-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The test accuracy is not changed with different training settings #1
Comments
I notice a few issues which I'll point to shortly: First, might be because you don't have the datasets (they're not on Github). You'll have to download the MNIST dataset from here or some source and then parse it to be compatible with SecureNN (you can use the code inside Secondly, in the current version of code, you'll have to run the training and the testing in the same run (otherwise there is no trained model for inference). Alternatively, you can train the model in standalone but will have to export the trained model to file and then import it for the testing (this importing and exporting is not currently implemented but shouldn't be too difficult). Finally, I also believe in the current version you should run |
Hi snwagh, I tried to parse the whole dataset using the tools in |
You're right, the parser is meant for the |
Hi snwagh, After I load the whole data set, I did the same modification as mentioned at very beginning, and train the network with
in the BTW, I also copy the parsed mnist data in the claimed folder |
For ML reasons, I think a batch size of 1 doesn't train well (FYI, I have not tried training it with batch size 1). It is also the reason why you need stochastic gradient descent (averaging out the gradients in a mini-batch gives a smoother convergence). You might have to spend some more time tuning the parameters if you use a batch size of 1. Also, for the simplistic network, all the hyper parameters (number of iterations, learning rate, initial weights and bias range) make a difference. A 10% accuracy network implies that your trained weights are essentially random or fixed classification (in my experience the latter). If you need deeper probing into the code, try printing out the outputs and use that as a starting point for debugging. |
@ChiaoThon Did you ever get results with good accuracies from the standalone run? If so can you share your hyperparameters? Thanks a lot. |
In the MnistSA setting, the accuracy is always around 10%. And in the 4PC setting, the predictions are totally wrong. |
The 4PC certainly is more legacy and needs a lot more testing and bug fixing. SA should also need testing/debugging but should be considerably easier to debug. Accuracy 10% usually in my experience playing with the underlying number is when the NN effectively predicts randomly (MNIST has 10 classes to about 9-11% accuracy is generally seen in practice). The training does not work out of the box in practice. You need to tweak the hyperparameters (initial range of weights, learning rate etc.) but hopefully with a few hours of tweaking (and even with just a few forward-backward passes) you should see non-trivial learning (60-80% accuracy). Initialize the weights to around two or three orders below 1 as the simple networks have not way to protect against value sticking to either extremes. For 4PC issues, try to refer to the correspionding 3PC code, it is better tested. For issues with the 3PC code, see if the corresponding functions in the Falcon codebase are useful for reference. I do believe the Mat-Mul, ReLU are well tested (and that's all you need for some of the networks). But if you suspect specific issues raise a git-issue. |
Hi Snwagh,
In
globals.h
at/src
file, after I change the#define MNIST false
into#define MNIST true
,NUM_LAYERS
to 4,LOG_MINI_BATCH
to 0 in#if MNIST
frame,NO_OF_EPOCHS
to 1,NUM_ITERATIONS
to 1, then atsecondary.cpp
, I changefor (int i = 0; i < NUM_ITERATIONS; ++i)
invoid test(NeuralNetwork* net)
function tofor (int i = 0; i < 10000; ++i)
. Finally, I change the network to be secureml inmain.cpp
and train the network withmake standalone
and do the test by changinginto
it gives me 99% accuracy which seems not correct as I just use 1 iteration (which means one piece of training data) to train the network, I changed the number of iteration but always get the same accuracy, can you give some tips for it or did I test it in wrong way?
Thanks very much!
The text was updated successfully, but these errors were encountered: