Results
The training results from the Tensorlock manuscript: what each transformation does to accuracy, and what the complete encryption costs in accuracy and training time across datasets. What an attacker can and cannot recover is set out on the Security page.
- Drop in validation accuracy, encrypted vs plaintext, across five datasets
- 0.0002–0.0227
- Training time on encrypted MNIST (18.27 s vs 18.57 s)
- +1.6%
- Attacker's reconstruction error (MAE) vs guessing a blank image
- 0.241 vs 0.173
How the experiments were run
Every training comparison used the same fully connected network and hyperparameters, trained from scratch for each run. Nothing was tuned for encrypted data: the only difference between models was the larger input that padding creates. Each condition was run 15 times with a new random transformation each time, against control models trained in the same session on the same GPU, in random order.
- Network
-
- Input layer matching the example shape (which padding may enlarge)
- Fully connected layer, 512 neurons, ReLU, dropout 0.2
- Fully connected layer, 256 neurons, ReLU, dropout 0.2
- Output layer matching the dataset’s labels
Each step alone, then the full sequence
Applied one at a time to MNIST, perturbation, shuffle, and orthogonal transformation make no difference to validation accuracy. Padding alone costs a very small 0.0015 reduction in validation accuracy. The full sequence costs 0.0012 in validation accuracy compared to control. Where the padding goes makes no difference: external 0.9821, interlaced 0.9820 (P = 0.72).
| Transformation | Transformed | Control | P |
|---|---|---|---|
| Random padding A different random (2, 28) pad for each example. | 0.9818 ± 0.0009 | 0.9833 ± 0.0010 | < 0.001 |
| Random perturbation A different array of random perturbations per example, −5% to +5%. | 0.9827 ± 0.0009 | 0.9829 ± 0.0008 | 0.66 |
| Fixed index shuffle One secret permutation applied to every example. | 0.9827 ± 0.0009 | 0.9830 ± 0.0012 | 0.49 |
| Orthogonal transformation One random orthogonal matrix applied to every example. | 0.9835 ± 0.0011 | 0.9835 ± 0.0013 | 0.93 |
| Full encryption Padding (2, 28), perturbation ±5%, fixed shuffle, orthogonal transformation. | 0.9819 ± 0.0011 | 0.9831 ± 0.0009 | < 0.001 |
Manuscript, Figures 3 and 4A. Each experiment had its own controls; 15 runs per group.
Training time
Training on encrypted data took slightly longer: 18.567 ± 0.166 s against 18.271 ± 0.162 s for controls, a difference of 0.296 s per training run, or 1.62% (P < 0.001; NVIDIA A100, 15 runs per group).
Numerical precision
Storing the encrypted data at a lower floating point precision did not reduce accuracy (repeated-measures ANOVA, P = 0.68, 15 matched runs). The network computed in 32-bit floating point throughout, so only the precision of the stored ciphertext differed. Half precision needs a quarter of the memory of the 64-bit result.
| Stored as | Training tensor | Validation accuracy |
|---|---|---|
| float64 | 384.52 MB | 0.9819 ± 0.0010 |
| float32 | 192.26 MB | 0.9819 ± 0.0010 |
| float16 | 96.13 MB | 0.9821 ± 0.0011 |
How far padding and perturbation can be pushed
More padding and wider perturbation both lower validation accuracy slightly across the range tested, applied alone and within the full encryption: from 0 to 10 rows of padding (0 to 280 coordinates), and from no perturbation to ±30%. Each point is a single trained model, so the lines also carry run-to-run variation.
Manuscript, Figure 5.
Across datasets
The same encryption (two rows of padding, ±5% perturbation, shuffle, orthogonal transformation) applied to four further public benchmarks, with the network unchanged. The last column repeats the comparison with advanced padding and perturbation, which make the padding harder for an attacker to identify.
| Dataset | Control | Encrypted | P | Decrease | Decrease, advanced |
|---|---|---|---|---|---|
| MNIST | 0.9831 ± 0.0009 | 0.9819 ± 0.0011 | < 0.001 | 0.0012 | 0.0010 |
| Fashion-MNIST | 0.8855 ± 0.0031 | 0.8823 ± 0.0033 | 0.009 | 0.0032 | 0.0017 |
| CIFAR-10 | 0.5305 ± 0.0035 | 0.5078 ± 0.0045 | < 0.001 | 0.0227 | 0.0257 |
| EMNIST Digits | 0.9913 ± 0.0004 | 0.9911 ± 0.0004 | 0.16 | 0.0002 | 0.0005 |
| EMNIST Letters | 0.9241 ± 0.0012 | 0.9213 ± 0.0016 | < 0.001 | 0.0028 | 0.0011 |
Manuscript, Table 1 and §Testing on other data sources. Advanced: padding generated from the data's own principal components (PCA-score bootstrap) and a spectrally optimized nonlinear perturbation with a utility-preserving penalty. CIFAR-10 accuracies are low for both groups because fully connected networks were used throughout; convolutional networks need the adaptations described in the white papers (see Convolutional networks).
Encrypted and control models also get the same examples right. For MNIST with advanced padding and perturbation, the two models agreed on whether each validation example was classified correctly 98.73% of the time. The Jaccard similarity of their sets of correctly classified examples was 0.9872, and the Q statistic 0.9923.