SALSA: Attacking Lattice Cryptography with Transformers
Abstract
Currently deployed public-key cryptosystems will be vulnerable to attacks by full-scale quantum computers.
Consequently, “quantum resistant” cryptosystems are in high demand, and lattice-based cryptosystems, based on a hard problem known as Learning With Errors (LWE), have emerged as strong contenders for standardization.
In this work, we train transformers to perform modular arithmetic and mix half-trained models with statistical cryptanalysis techniques to propose
SALSA: a machine learning attack on LWE-based cryptographic schemes.
SALSA can fully recover secrets for small-to-mid size LWE instances with sparse binary secrets, and may scale to attack real-world LWE-based cryptosystems.
Introduction
The looming threat of quantum computers has upended the field of cryptography.
Public-key cryptographic systems have at their heart a difficult-to-solve math problem that guarantees their security.
The security of most current systems (e g. [58, 28, 50]) relies on problems such as integer factorization or the discrete logarithm problem in an abelian group.
Unfortunately, these problems are vulnerable to polynomial time quantum attacks on large-scale quantum computers due to Shor’s
Algorithm [62].
Therefore, the race is on to find new post-quantum cryptosystems (PQC) built upon alternative hard math problems.
Several leading candidates in the final round of the 5-year NIST PQC competition are lattice-based cryptosystems , based on the hardness of the Shortest Vector Problem (SVP) [2], which involves finding short vectors in high dimensional lattices.
Many cryptosystems have been proposed based on hard problems which reduce to some version of the SVP and known attacks are largely based on lattice-basis reduction algorithms which aim to find short vectors via algebraic techniques.
The LLL algorithm [43] was the original template for lattice reduction and although it runs in polynomial time (in the dimension of the lattice), it returns an exponentially bad approximation to the shortest vector.
It is an active area of research [22, 48, 5] to fully understand the behavior and running time of a wide range of lattice-basis reduction algorithms, but the best known classical attacks on the PQC candidates run in time exponential in the dimension of the lattice.
In this paper, we focus on one of the most widely used lattice-based hardness assumptions: Learning
With Errors (LWE) [56].
Given a dimension n , an integer modulus q , and a secret vector s ∈
Z nq , the learning with errors problem is to find the secret given noisy inner products with random vectors.
LWE-based encryption schemes encrypt a message by blinding it with a noisy inner product.
Given a random vector a ∈ Z n q , the noisy inner product is b := a · s + e mod q , where e is an “error” vector sampled from a narrow Gaussian distribution (so its entries are small, thus the reference to noise).
Interestingly, the assumption for cryptographic applications is that the Learning With Errors problem is hard: given a lot of noisy inner products of random vectors with a secret vector, it should be hard to learn the secret vector.
However, in Machine Learning we make the opposite assumption: given a lot of noisy data, we can still learn patterns from it.
So in this paper we investigate the possibility to train ML models to learn from LWE samples.
To that end, we propose SALSA , a technique for performing S ecret-recovery
A ttacks on L WE via
S equence to sequence models with A ttention.
SALSA trains a language model to predict b from a , and we develop two algorithms to recover the secret vector s using this trained model.
Our paper has three main contributions .
We demonstrate that transformers can perform modular arithmetic on integers and vectors.
We show that transformers trained on LWE samples can be used to distinguish LWE instances from random.
This can be further turned into two algorithms that recover binary secrets .
We show how these techniques yield a practical attack on LWE based cryptosystems and demonstrate its efficacy in the cryptanalysis of small and mid-size LWE instances with sparse binary secrets .
Our code is available at https://github.com/facebookresearch/SALSA .
Lattice Cryptography and LWE 2.1 Lattices and Hard Lattice Problems
[Figure]
An integer lattice of dimension n over Z is the set of all integer linear combinations of n linearly independent vectors in Z n .
In other words, given n such vectors v i ∈ Z n , i ∈ N n , we define the lattice Λ( v 1 , .. v n ) :
= { (cid:80) ni
=
a i v i | a i ∈ Z } .
Given a lattice Λ , the Shortest Vector Problem (SVP) asks for a nonzero vector v ∈ Λ with minimal norm.
Figure 1 depicts a solution to this problem in the trivial case of a 2-dimensional lattice, where b 1 and b 2 generate a lattice Λ and the green vector is the shortest vector in Λ .
The best known algorithms to find exact solutions to SVP take exponential time and space with respect to n , the dimension of the lattice [49].
There exist lattice reduction algorithms to find approximate shortest vectors, such as LLL [43] (polynomial time, but exponentially bad approximation), or BKZ [22].
The shortest vector problem and its approximate variants are the hard mathematical problems that serve as the core of lattice-based cryptography.
2.2 LWE
The Learning With Errors (LWE) problem, introduced in [56], is parameterized by a dimension n , the number of samples m , a modulus q and an error distribution χ
(e.g., the discrete Gaussian distribution) over Z q = { 0 , 1 , . .
. , q − 1 } .
Regev showed that LWE is at least as hard as quantumly solving certain hard lattice problems.
Later [53, 46, 14], showed LWE to be classically as hard as standard worst-case lattice problems, therefore establishing a solid foundation for building cryptographic schemes on it.
LWE and RLWE.
The LWE distribution A s ,χ consists of pairs ( A , b ) ∈
Z m × n q × Z nq , where A is a uniformly random matrix in Z m × n q , b
=
As + e mod q , where s ∈
Z nq is the secret vector sampled uniformly at random and e ∈
Z mq is the error vector sampled from the error distribution χ .
We call the pair ( A , b ) an LWE sample, yielding n LWE instances: one row of A together with the corresponding entry in b is one LWE instance .
There is also a ring version of LWE, known as the
Ring Learning with Errors (RLWE) problem (described further in Appendix A.1).
Search-LWE and Decision-LWE.
We now state the LWE hard problems.
The search-LWE problem is to find the secret vector s given ( A , b ) from A s ,χ .
The decision-LWE problem is to distinguish
A s ,χ from the uniform distribution { ( A , b ) ∈
Z m × n q × Z nq : A and b are chosen uniformly at random) } .
[56] provided a reduction from search-LWE to decision-LWE .
We give a detailed proof of this reduction in Appendix A.2 for the case when the secret vector s is binary (i.e. entries areand 1).
In Section 4.3, our Distinguisher Secret Recovery method is built on this reduction proof.
(Sparse) Binary secrets.
In LWE based schemes, the secret key vector s can be sampled from various distributions.
For efficiency reasons, binary distributions (sampling in { 0 , 1 } n ) and ternary distributions (sampling in {− 1 , 0 , 1 } n ) are commonly used, especially in homomorphic encryption [4].
In fact, many implementations use a sparse secret with Hamming weight h (the number of 1’s
[Figure]
[Table]
in the binary secret).
For instance
[Table]
HEAAN uses n = 2 15 , q = 2 628 , ternary secret and Hamming weight 64 [23].
For more on the use of sparse binary secrets in LWE, see [6, 25].
Modular Arithmetic with Transformers
Two key factors make breaking LWE difficult: the presence of error and the use of modular arithmetic.
Machine learning (ML) models tend to be robust to noise in their training data.
In the absence of a modulus, recovering s from observations of a and b = a · s + e merely requires linear regression, an easy task for ML.
Once a modulus is introduced, attacking LWE requires performing linear regression on an n-dimensional torus, a much harder problem.
Modular arithmetic therefore appears to be a significant challenge for an ML-based attack on LWE.
Previous research has concluded that modular arithmetic is difficult for ML models [52], and that transformers struggle with basic arithmetic [51].
However, [17] showed that transformers can compute matrix-vector products, the basic operation in LWE, with high accuracy.
As a first step towards attacking LWE, we investigate whether these results can be extended to the modular case.
We begin with the one-dimensional case, training models to predict b =
as mod q from a for some fixed unknown value of s when as ∈ Z q .
This is a form of modular inversion since the model must implicitly learn the secret s in order to predict the correct output b .
We then investigate the n -dimensional case, with a ∈ Z nq and s either in Z nq or in { 0 , 1 } n (binary secret).
In the binary case, this becomes a (modular) subset sum problem.
3.1 Methods
Data Generation.
We generate training data by fixing the modulus q (a prime with 15 ≤ ⌈ log 2 ( q ) ⌉ ≤ 30 , see the Appendix B), the dimension n , and the secret s ∈ Z nq (or { 0 , 1 } n in the binary case).
We then sample a uniformly in Z n q and compute b = a · s mod q , to create data pair ( a, b ) .
Encoding.
Integers are encoded in base B (usually, B=81), as a sequence of digits in { 0 , . . .
B − 1 } .
For instance, ( a, b ) = (16 , 3) is represented as the sequences [1,0,0,0,0] and [1,1] in base 2 , or [2,2] and [3] in base 7 .
In the multi-dimensional case, a special token separates the a coordinates.
Model Training.
The model is trained to predict b from a , for an unknown but fixed value of s .
We use sequence-to-sequence transformers [67] with one layer in the encoder and decoder,dimensions and 8 attention heads.
We minimize a cross-entropy loss, and use the Adam optimizer [39] with a learning rate of 5 × 10 − 5 .
At epoch end ( 300000 examples), model accuracy is evaluated over a test set of 10000 examples.
We train until test accuracy is 95% or loss plateaus for 60 epochs.
3.2 Results
One-Dimensional.
For a fixed secret s , modular multiplication is a function from Z q into itself, that can be learned by memorizing q values.
Our models learn modular multiplication with high accuracy for values of q such that ⌈ log 2 ( q ) ⌉ ≤ 22 .
Figure 2 presents learning curves for different values of log 2 ( q ) .
The loss and accuracy curves have a characteristic step shape, observed in many of our experiments, which suggests that “easier cases” (small values of ⌊ as/q ⌋ ) are learned first.
The speed of learning and the training set size needed to reach high accuracy depend on the problem difficulty, i.e. the value of q .
Table 1 presents the ⌈ log 2 ⌉ of the number of examples needed to reach 95% accuracy for different values of ⌈ log 2 ( q ) ⌉ and base B .
Since transformers learn from scratch, without prior knowledge of numbers and moduli, this procedure is not data-efficient.
The number of examples needed to learn modular multiplication is between 10 q and 50 q .
Yet, these experiments prove that transformers can solve the modular inversion problem in prime fields.
Table 1 illustrates an interesting point: learning difficulty depends on the base used to represent integers.
For instance, base 2 and 5 allow the model to learn up to ⌈ log 2 ( q ) ⌉
= 17 and 18 , whereas base 3 and 7 can reach ⌈ log 2 ( q ) ⌉ = 21 .
Larger bases, especially powers of small primes, enable faster learning.
The relation between representation base and learning difficulty is difficult to explain from a number theoretic standpoint.
Additional experiments are in Appendix B.
Multidimensional integer secrets.
In the n -dimensional case, the model must learn the modular dot product between vectors a and s in Z n .
The proves to be a much harder problem.
For n = 2 , with the same settings, small values of q ( 251 , 367 and 967 ) can be learned with over 90% accuracy, and q = 1471 with 30% .
In larger dimension, all models fail to learn.
Increasing model depth to 2 orlayers, or dimension to 1024 or 2048 and attention heads to 12 and 16, improves data efficiency (less training samples are needed), but does not scale to larger values of q or n > 2 .
Multidimensional binary secrets.
Binary secrets make n -dimensional problems easier to learn.
For n = 4 , our models solve problems with ⌈ log 2 ( q ) ⌉ ≤ 29 with more than 99 . 5% accuracy.
For n =and 8 , we solve cases ⌈ log 2 ( q ) ⌉ ≤ 22 with more than 85% accuracy.
But we did not achieve high accuracy for larger values of n .
So in the next section, we introduce techniques for recovering secrets from a partially trained transformer.
We then show that these additional techniques allow recovery of sparse binary secrets for LWE instances with 30 ≤ n ≤ 128 (so far).
Introducing SALSA: LWE Cryptanalysis with Transformers
Having established that transformers can perform integer modular arithmetic, we leverage this result to propose SALSA, a method for S ecret-recovery
A ttacks on L WE via S eq2Seq models with A ttention.
4.1 SALSA Ingredients
SALSA has three modules: a transformer model M , a secret recovery algorithm , and a secret verification procedure .
We assume that SALSA has access to a number of LWE instances in dimension n that use the same secret, i.e. pairs ( a , b ) such that b = a · s + e mod q , with e an error from a centered distribution with small standard deviation.
SALSA runs in three steps.
First, it uses
LWE data to train M to predict b given a .
Next SALSA runs a secret recovery algorithm.
It feeds M special values of a , and uses the output ˜ b =
M ( a ) to predict the secret.
Finally, SALSA evaluates the guesses ˜ s by verifying that residuals r
=
b − a · ˜ s mod q computed from LWE samples have small standard deviation.
If so, s has been recovered and SALSA stops.
If not, SALSA returns to step 1 and iterates.
4.2 Model Training
SALSA uses LWE instances to train a model that predicts b from a by minimizing the cross-entropy between the model prediction b ′ and b .
The model architecture is a universal transformer [27], in which a shared transformer layer is iterated several times (the output from one iteration is the input to the next).
Our base model has two encoder layers, with 1024 dimensions and 32 attention heads, the second layer iterated 2 times, and two decoder layers with 512 dimensions and 8 heads, the second layer iterated 8 times.
To limit computation in the shared layer, we use the copy-gate mechanism from [24].
Models are trained using the Adam optimizer with lr = 10 − 5 and 8000 warmup steps.
For inference, we use a beam search with depth 1 (greedy decoding) [40, 65].
At the end of each epoch, we compute model accuracy over a test set of LWE samples.
Because of the error added when computing b = a · s + e , exact prediction of b is not possible.
Therefore, we calculate accuracy within tolerance τ ( acc τ ) : the proportion of predictions ˜ b
=
M ( a ) that fall within τq of b , i.e. such that ∥ b − ˜ b ∥ ≤ τq .
In practice we set τ = 0 .
4.3 Secret Recovery
We propose two algorithms for recovering s : direct recovery from special values of a , and distinguisher recovery using the binary search to decision reduction (Appendix A.2).
For theoretical justification of these, see Appendix C.
Direct Secret Recovery.
The first technique, based on the LWE search problem, is analogous to a chosen plaintext attack.
For each i ∈ N n , a guess of the i -th coordinate of s is made by feeding model
Algorithm
1: Input: M , K, n 2: Output: secret s 3: p = 0 n 4: for i = 1 , . . .
, n do 5: a = 0 n ; a i = K 6: p i =
M ( a ) 7: s = binarize ( p ) 8:
Return: s
M the special value a i =
K e i (all coordinates 0 except the i -th), with K a large integer.
If s i = 0 , and the model M correctly approximates b i = a i · s + e from a i , then we expect ˜ b i :=
M ( a i ) to be a small integer; likewise if s i
=
we expect a large integer.
This technique is formalized in Algorithm 1.
The binarize function in line 7 is explained in Appendix C. In
SALSA, we run direct recovery with 10 different K values in order to yield 10 s guesses.
Distinguisher Secret Recovery.
The second algorithm for secret recovery is based on the decisionLWE problem.
It uses the output of M to determine if LWE data ( a , b ) can be distinguished from randomly generated pairs ( a r , b r ) .
The algorithm for distinguisher-based secret recovery is shown in
Algorithm 2.
At a high level, the algorithm works as follows.
Suppose we have t LWE instances ( a , b ) and t random instances ( a r , b r ) .
For each secret coordinate s i , we transform the a into a ′ i
= a i + c , with c ∈ Z q random integers.
We then use model M to compute M ( a ′ ) and M ( a r ) .
If the model has learned s and the i th bit of s is 0 , then M ( a ′ ) should be significantly closer to b than M ( a r ) is to b r .
Iterating on i allows us to recover the secret bit by bit.
SALSA runs the distinguisher recovery algorithm when model acc τ =0 .
1 is above 30% .
This is the theoretical limit for this approach to work.
Secret
1: Input: M , n, q, acc τ , τ 2: Output: secret s 3: s = 0 n 4: advantage, bound =
acc τ − 2 · τ, τ · q 5: t = min { 50 , 2 advantage 2 } 6: A LWE , B LWE = LWESamples ( t, n, q ) 7: for i = 1 , . . .
n do 8:
A unif ∼ U{ 0 , q − 1 } n × t 9:
B unif ∼ U{ 0 , q − 1 } t 10: c ∼ U{ 0 , q − 1 } t 11:
A ′ LWE =
A LWE 12:
A ′ LWE [: , i ] =
( A LWE [: , i ] + c ) mod q 13: (cid:94) B LWE =
M ( A ′ LWE ) 14: (cid:94) B unif =
M ( A unif ) 15: dl = | (cid:94) B LWE − B LWE | 16: du = | (cid:94) B unif − B unif | 17: c LWE =
# { j | dl j < bound, j ∈ N t } 18: c unif =
# { j | du j < bound, j ∈ N t } 19: if ( c LWE − c unif ) ≤ advantage · t/ 2 then 20: s i =
Return: s
At the end of the recovery step, we have 10 or 11 guesses ˜ s
(depending on whether the distinguisher recovery algorithm was run).
To verify them, we compute the residuals r = a · ˜ s − b mod q for a set of LWE samples ( a , b ) .
If s is correctly guessed, we have ˜ s
= s , so r = a · s − b
=
e mod q will be distributed as the error e with small standard deviation σ .
If ˜ s ̸ = s , r will be (approximately) uniformly distributed over Z q (because a · ˜ s and b are uniformly distributed over Z q ), and will have standard deviation σ ( r )
≈ q/ (cid:112) (12) .
Therefore, we can verify if ˜ s is correct by calculating the standard deviation of the residuals: if it is close to σ , the standard deviation of error, the secret was recovered.
In this paper, σ = 3 and q = 251 , so the standard deviation of r will be around
if ˜ s = s , and 72 .
5 if not.
SALSA Evaluation
In this section, we present our experiments with
SALSA.
We generate datasets for LWE problems of different sizes, defined by the dimension and the density of ones in the binary secret.
We use gated universal transformers, with two layers in the encoder and decoder.
Default dimensions and attention heads in the encoder and decoder are 1024/512 and 16/4, but we vary them as we scale the problems.
Models are trained on two NVIDIA
Volta 32GB GPUs on an internal cluster.
5.1 Data generation
We generate LWE data for SALSA training/evaluation is randomly given the following parameters: dimension n , secret density d , modulus q , encoding base B , binary secret s , and error distribution χ .
For all experiments, we use q = 251 and B = 81 (see §3.1), fix the error distribution χ as a discrete
Gaussian with µ = 0 , σ = 3 [4], and generate a random s .
We vary the problem size n (the LWE dimension) and the density d (the proportion of ones in the secret) to test attack success and to observe how it scales.
For problem size, we experiment with
[Figure]
[Table]
n = 30 to n = 128 .
For density, we experiment with 0 .
002 ≤ d ≤ 0 .
For a given n , we select d so that the Hamming weight of the binary secret ( h = dn ), is larger than 2 .
Appendix D.2 contains an ablation study of data parameters.
We generate data using the RLWE variant of LWE, described in
Appendix A. For RLWE problems, each a is a line of a circulant matrix generated from an initial vector ∈ Z nq . RLWE problems exhibit more structure than LWE due to the use of the circulant matrix, which may help our models learn.
5.2 Results
Table 2 presents problem sizes n and densities d for which secrets can be fully recovered, together with the time and the logarithm of number of training samples needed.
SALSA can recover binary secrets with Hamming weight 3 for dimensions up to 128 .
Hamming weight 4 secrets can be recovered for n < 70 .
For context, we include a column “ log 2 secrets” listing the number of possible secrets for the corresponding Hamming weight.
Exhaustive search for the secret may run faster than our current experiments for low Hamming weight.
However, an exhaustive search requires knowing the exact hamming weight in advance, or iterating through all possible Hamming weights.
Although we have only succeeded unconditionally with low Hamming weight so far, SALSA does not a priori know the secret Hamming weight h .
It remains to be seen how SALSA will scale to larger n and h .
Interestingly, the number of samples required for SALSA to succeed for a fixed Hamming weight is relatively flat as the dimension n increases.
However the time needed to recover the secret for a fixed Hamming weight increases with n , partly because the length of the input sequence fed into the model is proportional to n even though the number of samples needed remains stable as n grows.
This is an important result, because all the data used for training the model must be collected (e.g. via eavesdropping), making sample size an important metric.
For a given n , scaling to higher densities requires more time and data, and could not be achieved with the architecture we use for n > 50 .
As n grows, larger models are needed: our standard architecture, with 1024 / 512 dimensions and 16 / 4 attention heads (encoder/decoder) was sufficient for n ≤ 90 .
For n > 90 , we needed 1536 / 512 dimensions and 32 / 4 attention heads.
Figure 3 illustrates model behavior during training.
After an initial burn-in period, the loss curve (top graph) plateaus until the model begins learning the secret.
Once loss starts decreasing, model accuracy with 0 .
1 q tolerance (bottom graph) increases sharply.
Full secret recovery (vertical lines in the bottom graph) happens shortly after, often within one or two epochs.
Direct secret recovery accounts for 55% of recoveries, while the distinguisher only accounts for 18% of recoveries (see
Appendix C.3).
27% of the time, both methods succeed simultaneously.
One key conclusion from these experiments is that the secret recovery algorithms enable secret recovery long before the transformer has been trained to high accuracy (even before training loss settles at a low level).
Frequently, the model only needs to begin to learn for the attack to succeed.
[Table]
5.3 Experiments with model architecture
SALSA’s base model architecture is a Universal Transformer (UT) with a copy-gate mechanism.
Table 3 demonstrates the importance of these choices.
For problem dimension n = 50 , replacing the
UT by a regular transformer with 8 encoder/decoder layers, or removing the copy-gate mechanism increases the data requirement by a factor of 14 .
Reducing the number of iterations in the shared layers from 8 to 4 has a similar effect.
Reducing the number of iterations in either the encoder or decoder (i
[Table]
e. from 8/8 to 8/2 or 2/8) may further speed up training.
Asymmetric transformers (e
[Table]
g. large encoder and small decoder) have proved efficient for other math problems, e
[Table]
g. [37], [17]
[Table]
and asymmetry helps SALSA as well.
Table 3 demonstrates that increasing the encoder dimension from 1024 to 3040, while keeping the decoder dimension at 512 , results in a 7 -fold reduction in sample size.
Additional architecture experiments are presented in Appendix D.
[Table]
5.4 Increasing dimension and density
To attack real-world LWE problems
[Table]
SALSA must handle larger dimension n and density d .
Our experiments with architecture suggest that increasing model size, and especially encoder dimension, is the key factor to scaling n .
Empirical observations indicate that scaling d is a much harder problem.
We hypothesize that this is due to the subset sum modular addition at the core of LWE with binary secrets.
For a secret with Hamming weight h , the base operation a · s + e mod q is a sum of h integers, followed by a modulus.
For small values of h , the modulus operation is not always necessary, as the sum might not exceed q .
As density increases, so does the number of times the sum “wraps around” the modulus, perhaps making larger Hamming weights more difficult to learn.
To test this hypothesis, we limited the range of the coordinates in a , so that a i < r , with r = αq and 0 .
3 < α < 0 .
For n = 50 , we recovered secrets with density up to 0 .
3 , compared to 0 .
08 with the full range of coordinates (see Table 4).
Density larger than 0 .
3 is no longer considered a sparse secret.
5.5 Increasing error size
[Table]
Theoretically for lattice problems to be hard, σ should scale with √ n , although this is often ignored in practice, e.g. [4].
Consequently, we run most SALSA experiments with σ = 3 , a common choice in existing RLWE-based systems.
Here, we investigate how SALSA performs as σ increases.
First, to match the theory, we run experiments where σ = ⌊ √ n ⌋ , h = 3 and found that
SALSA recovers secrets even as σ scales with n (see Table 5, same model architecture as Table 2).
Second, we evaluate SALSA’s performance for fixed n / h values as σ increases.
We fix n = 50 and h = 3 and evaluate for σ values up to σ = 24 .
Secret recovery succeeds for all tests, although the number of samples required for recovery linearly increases (see Figure 7 in Appendix).
For both sets of experiments, we reuse samples up to 10 times.
SALSA in the Wild
Problem Size.
Currently, SALSA can recover secrets from LWE samples with n up to 128 and density d = 0 .
It can recover higher density secrets for smaller n ( d = 0 .
08 when n = 50 ).
As mentioned in Section 2.2, sparse binary secrets are used in real world LWE homomorphic encryption, and attacking these implementations is a future goal for SALSA.
Admittedly, SALSA must scale to attack larger n before it can break full-strength homomorphic encryption implementations.
However, other parameters of full-strength homomorphic encryption such as secret density (the secret vector in
HEAAN has d < 0 .
and error size ( [4] recommends σ = 3 . 2 ) are within SALSA’s reach.
[Table]
[Figure]
[Table] [Table]
[Figure] [Figure]
Other LWE-based schemes use secret dimensions that seem achievable given our current results.
For example, in the LWE-based public key encryption scheme Crystal-Kyber [9], the secret dimension is k × 256 for k = { 2 , 3 , 4 } , an approachable range for SALSA based on initial results.
The LWE-based signature scheme Crystal-Dilithium has similar n sizes [29].
However, these schemes don’t use sparse binary secrets, and adapting SALSA nonbinary secrets is an avenue for future work.
Sample Efficiency.
A key requirement of real-world LWE attacks is sample efficiency.
In practice, an attacker will only have access to a small set of LWE instances ( a , b ) for a given secret s .
For instance, in Crystal-Kyber, there are only ( k + 1) n LWE instances available with k = 2 , 3 or 4 and n = 256 .
The experiments in [20, 11] use less than 500 LWE instances.
The TU Darmstadt challenge provides n 2 LWE instances to attackers.
The log 2 samples column of Table 2 lists the number of LWE instances needed for model training.
This number is much larger than what is likely available in practice, so it is important to reduce sample requirements.
Classical algebraic attacks on LWE require LWE instances to be linearly independent, but SALSA does not have this limitation.
Thus, we can reduce SALSA’s sample use in several ways.
First, we can reuse samples during training.
Figure 4 confirms that this allows secret recovery with fewer samples.
Second, we can use integer linear combinations of given LWE samples to make new samples which have the same secret but a larger error σ .
Appendix E contains the formula for the number of new samples we can generate with this method (up to 2 42 new samples from 100 samples).
Comparison to Baselines.
Most existing attacks on LWE such as uSVP and dual attack use an algebraic approach that involves building a lattice from LWE instances such that this lattice contains an exceptionally short vector which encodes the secret vector information.
Attacking LWE then involves finding the short vector via lattice reduction algorithms like BKZ [22].
For LWE with sparse binary secrets, the main focus of this paper, various techniques can be adapted to make algebraic attacks more efficient.
[20, 11] and [23] provide helpful overviews of algebraic attacks on sparse binary secrets.
More information about attacks on LWE is in Appendix A.3.
Compared to existing attacks, SALSA’s most notable feature is its novelty.
We do not claim that to have better runtime, neither do we claim the ability to attack real-world LWE problems (yet).
Rather, we introduce a new attack and demonstrate with non-toy successes that transformers can be used to attack LWE.
Given our goal, no serious SALSA speedup attempts have been made so far, but a few simple improvements could reduce runtime.
First, the slowest step in SALSA is model training, which can be greatly accelerated by distributing it across many GPUs.
Second, our transformers are trained from scratch, so pre-training them on such basic tasks as modular arithmetic could save time and data.
Finally, the amount of training needed before the secret is recovered depends in large part on the secret guessing algorithms.
New algorithms might allow SALSA to recover secrets faster.
Since SALSA does not involve finding the shortest vector in a lattice, it has an advantage over the algebraic attacks – with all LWE parameters fixed and in the range of SALSA, SALSA can attack the
LWE problem for a smaller modulus q compared to the algebraic attacks.
This is because the target vector is relatively large in the lattice when q is smaller and is harder to find.
For instance, in [20], their Table 2 shows that when the block size is 45 , for n = 90 , their attack does not work for q less than 10 bits, but we can handle q as small as 8 bits (Table 20).
Related Work
Use of ML for cryptanalysis.
The fields of cryptanalysis and machine learning are closely related [57].
Both seek to approximate an unknown function F using data, although the context and techniques for doing so vary significantly between the fields.
Because of the similarity between the domains, numerous proposals have tried to leverage ML for cryptanalysis.
MLbased attacks have been proposed against a number of cryptographic schemes, including block ciphers [3, 63, 38, 10, 30, 12, 21], hash functions [31], and substitution ciphers [1, 64, 8].
Although our work is the first to use recurrent neural networks for lattice cryptanalysis, prior work has used them for other cryptographic tasks.
For example, [32] showed that LSTMs can learn the decryption function for polyalphabetic ciphers like Enigma.
Follow-up works used variants of LSTMs, including transformers, to successfully attack other substitution ciphers [1, 64, 8].
Use of transformers for mathematics.
The use of language models to solve problems of mathematics has received much attention in recent years.
A first line of research explores math problems set up in natural language.
[59] investigated their relative difficulty, using LSTM [34] and transformers, while [33] showed large transformers could achieve high accuracy on elementary/high school problems.
A second line explores various applications of transformers on formalized symbolic problems.
[42] showed that symbolic math problem could be solved to state-of-the-art accuracy with transformers.
[68] discussed their limits when generalizing out of their training distribution.
Transformers have been applied to dynamical systems [18], transport graphs [19], theorem proving [54], SAT solving [61], and symbolic regression [13, 26].
A third line of research focuses on arithmetic/numerical computations and has had slower progress.
[52] and [51] discussed the difficulty of performing arithmetic operations with language models.
Bespoke network architectures have been proposed for arithmetic operations [35, 66], and transformers were used for addition and similar operations [55].
[17] showed that transformers can learn numerical computations, such as linear algebra, and introduced the shallow models with shared layers used in this paper.
Learnability of LWE.
Shalev-Shwartz, Shamir and Shammah [60] showed that some problems of modular arithmetic cannot be solved by gradient descent.
Because it uses a transformer to learn the secret, by predicting b from a , SALSA’s scalability hinges on the solvability of LWE by gradient descent.
Here, we provide our perspective on this question.
The LWE problem amounts to (discrete) linear regression on an n -dimensional torus with radius q .
When q is infinite, LWE is pure linear regression, and gradient methods will succeed.
For finite q , gradients are informative unless the model’s prediction lies on the opposite side of the torus from the true solution (e.g. q = 100 , true value is 0 , prediction is 50 ).
At this point, the projection of the gradient along the coordinate axis is uninformative, since either direction on the torus points towards the true solution.
For large q , this situation is uncommon, so gradient methods should work.
For very small q , this will happen more often, and gradient methods will be perturbed.
In the degenerate case q = 2 , featured in [60], gradient methods will always fail.
For the value q = 251 used in SALSA, gradient methods can recover secrets (i.e. solve the modular linear regression problem) for n up to 128 so far.
Except for the case of very small q , it is unlikely that LWE belongs to the “failing gradient” class of problems described in [60].
Any learnability problems should disappear altogether as q increases.
Interestingly, this intuition about the size of q also appears in the classical lattice reduction approach to solving LWE.
Laine and Lauter [41] use LLL to demonstrate concrete polynomial-time attacks against lattice problems for large q .
They also explore the boundary of where these attacks start to fail for smaller q .
The intuition is that when q is large, LLL directly finds a vector which is “small enough” compared to q to break the system.
When q is small, LLL does not find a short enough vector.
This is further explored in [20], which gives concrete running times for generalizations of
LLL and quantifies the size of q where these attacks start to fail.
Conclusion
Discussion.
In this paper, we demonstrate that transformers can be trained to perform modular arithmetic.
Building on this capability, we design SALSA, a method for attacking the LWE problem with binary secrets, a hardness assumption at the foundation of many lattice-based cryptosystems.
We show that SALSA can break LWE problems of medium dimension (up to n = 128 ), which is in the same range as problems in the Darmstadt challenge [15], although we restrict to the easier case of sparse binary secrets.
This is the first paper to use transformers to solve hard problems in lattice-based cryptography.
Future work will attempt to scale up SALSA to attack higher dimensional lattices with more general secret distributions.
The key to scaling up to larger lattice dimensions seems to be to increase the model size, especially the dimensions, the number of attention heads, and possibly the depth.
Large architectures should scale to higher dimensional lattices such as n = 256 which is used in practice.
Density, on the other hand, is constrained by the performance of transformers on modular arithmetic.
Better representations of finite fields could improve transformer performance on these tasks.
Finally, our secret guessing algorithms enable SALSA to recover secrets from low-accuracy transformers, therefore reducing the data and time needed for the attack.
Extending these algorithms to take advantage of partial learning should result in better performance.
Ethics and Broader Impact.
The primary value of this work is in alerting the cryptographic and
ML communities to the risk of ML-based attacks on PQC.
Even if current attacks do not succeed, we believe that providing early warning of potential threats is critical.
However, we emphasize that
SALSA represents a proof of concept that cannot be used against real-world implementations (i.e. the PQC schemes which NIST standardized on July 5, 2022).
Additional scaling work would be necessary before these techniques would be relevant to attacking real-world cryptosystems.
Supplementary Materials A Further Details of LWE A.1 Ring Learning with Errors (§2)
We now define RLWE samples and explain how to get LWE instances from them.
Let n be a power of 2, and let R q
=
Z q [ x ] / ( x n + 1) be the set of polynomials whose degrees are at most n − 1 and coefficients are from Z q .
The set R q forms a ring with additions and multiplications defined as the usual polynomial additions and multiplications in Z p [ x ] modulo x n + 1 .
One RLWE sample refers to the pair ( a ( x ) , b ( x ) :
= a ( x ) · s ( x ) + e ( x )) , where s ( x ) ∈
R
q is the secret and e ( x ) ∈
R
q is the error with coefficients subject to the error distribution.
Let a , s and e ∈
Z nq be the coefficient vectors of a ( x ) , s ( x ) and e ( x ) .
Then the coefficient vector b of b ( x ) can be obtained via the formula b =
[Equation]
( x )
[Equation]
s + e , here A circ a ( x ) represents the n × n generalized circulant matrix of a ( x ) .
Precisely, let a ( x ) =
a 0 + a 1 x + . . .
+ a n − 2 x n − 2 + a n − 1 x n − 1 , then a = ( a 0 , a 1 , . .
. , a n − 2 , a n − 1 ) and
A circ a ( x ) =   a− a n −− a n −. . .
− aaa− a n −. . .
− aaaa.
− a...
a n −a n −a n −. . .
a  .
Therefore, one RLWE sample gives rise to n LWE instances by taking the rows of A circ a ( x ) and the corresponding entries in b .
A.2 Search to Decision Reduction for Binary Secrets (
We give a proof of the search binary-LWE to decisional binary-LWE reduction.
This is a simple adaption of the reduction in [56] to the binary secrets case.
We call an algorithm a ( T, γ ) -distinguisher for two probability distributions D 0 , D 1 if it runs in time T and has a distinguishing advantage γ .
We use LWE n,m,q,χ to denote the LWE problem which has secret dimension n , m LWE instances, modulus q and the secret distribution χ .
Theorem A.1.
If there is a ( T, γ ) -distinguisher for decisional binary- LWE n,m,q,χ , then there is a
T ′ =
(cid:101) O
( Tn/γ 2 ) -time algorithm that solves
search binary- LWE n,m ′ ,q,χ with probability 1 − o (1) , where m ′ =
(cid:101)
O
( m/γ 2 ) .
Proof.
Let s =
( s 1 , . . .
, s n ) with s i ∈ { 0 , 1 } .
We demonstrate the strategy of recovering s 1 , and the rest of the secret coordinates can be recovered in the same way.
Let m ′
= (cid:101) O
(1 /γ 2 ) m , given an LWE sample ( A , b ) where A ∈ Z m ′ × n q , b ∈ Z m ′ q , we compute a pair ( A ′ , b ′ ) as follows:
[Equation]
Here c ∈
Z m ′ q is sampled uniformly and the symbol “ + ′ ” means that we are adding c to the first column of A .
One verifies by the definition of LWE that if s 1 = 0 , then the pair ( A ′ , b ′ ) would be LWE samples with the same error distribution.
Otherwise, the pair ( A ′ , b ′ ) would be uniformly random in Z m ′ × n q × Z m ′
q .
We then feed the pair ( A ′ , b ′ ) to the ( T, γ ) -distinguisher for LWE n,m,q,χ , and we need to running the distinguisher m ′ /m
= (cid:101) O
(1 /γ 2 ) times given the number of instances.
Since the advantage of this distinguisher is γ with m LWE instances, and we are feeding it m ′
LWE instances, it follows from the Chernoff bound that if the majority of the outputs are “LWE”, then the pair ( A ′ , b ′ ) is an LWE sample and therefore s 1 = 0 .
If not, s 1 = 1 .
Guessing one coordinate requires running the distinguisher (cid:101) O
(1 /γ 2 ) times, therefore, this search to reduction algorithm takes time T ′ =
(cid:101) O
( Tn/γ 2 ) .
Note that we can use the same m ′
LWE instances for each coordinate, therefore it requires m ′
= (cid:101) O ( m/
γ 2 ) samples to recover all the secret coordinates.
A.3 Overview of Attacks on LWE
Typically, attacks on the LWE problem use an algebraic approach and involve lattice reduction algorithms such as BKZ [22].
The LWE problem can be turned into a BDD problem (Bounded
Distance Decoding) by considering the lattice generated by LWE instances, and BDD can be solved by Babai’s Nearest Plane algorithm [44] or the pruned enumeration [45], this is known as the primal
BDD attack.
The primal uSVP attack constructs a lattice via Kannan’s embedding technique [36] whose unique shortest vector encodes the secret information.
The Dual attack [48] finds a short vector in the dual lattice which can be used to distinguish the LWE samples from random samples.
Moreover, there are also attacks that do not use lattice reduction.
For instance, the BKW style attack [5] uses combinatorial methods; however, this assumes access to an unbounded number of LWE samples.
Binary and ternary secret distributions are widely used in homomorphic encryption schemes.
In fact, many implementations even use a sparse secret with Hamming weight h .
In [14] and [47], both papers give reductions of binary-LWE to hard lattice problems, implying the hardness of binaryLWE.
Specifically, the ( n, q ) -binary-LWE problem is related to a ( n/t, q ) -LWE problem where t =
O (log( q )) .
For example, if n = 256 is a hard case for uniform secret, we can be confident that binary-LWE is hard for n = 256 log(256) = 2048 .
But [11] refines this analysis and gives an attack against binary-LWE.
Their experimental results suggest that increasing the secret dimension by a log(log( n )) factor might be already enough to achieve the same security level for the corresponding
LWE problem with uniform secrets.
Let us now turn to the attacks on (sparse) binary/ternary secrets.
The uSVP attack is adapted to binary/ternary secrets in [11], where a balanced version of Kannan’s embedding is considered.
This new embedding increases the volume of the lattice and hence the chance that lattice reduction algorithms will return the shortest vector.
The Dual attack for small secret is considered in [6] where the BKW-style techniques are combined.
The BKW algorithm itself also has a binary/ternary-LWE variant [7].
Moreover, several additional attacks are known which can exploit the sparsity of an LWE secret, such as [16, 23] .
All of these techniques use a combinatorial search in some dimension d , and then follow by solving a lattice problem in dimension n − d .
For sparse secrets, this is usually more efficient than solving the original lattice problem in dimension n .
B Additional Modular Arithmetic Results (§3)
[Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
Here, we provide additional information on our single and multidimensional modular arithmetic experiments from §3.1.
Before presenting experimental results, we first highlight two useful tables.
Table 6 shows the q values used in our integer and multi-dimension modular arithmetic problems.
Table 7 is an expanded version of Table 1 in the main paper body.
It shows how the log 2 samples required for success changes with the base representation for the input/output, but includes additional values of base B (secret is fixed at 728) .
[Table]
Base vs. Secret.
We empirically observe that the base B used for integer representation in our experiments may provide side-channel information about the secret s in the 1D case.
For example, in
Table 8, when the secret value is 729 , bases 3 , 9 , 27 , 729 and 3332 all enable solutions with much higher q (8 times higher than the next highest result).
Nearly all these are powers of 3 3 as is the secret 729 = 3 6 .
In the table, one can see that these same bases provide similar (though not as significant) “boosts” in q for secrets on either side of 729 (e.g. 728 , 730 ), as well as for 720 = 3 6 − 3 2 .
Based on these results, we speculate that when training on ( a, b ) pairs with an unknown secret s , testing on different bases and observing model performance may allow some insight into s ’s prime factors.
More theoretical and empirical work is needed to verify this connection.
Ablation over transformer parameter choices.
We provide additional experiments on model architecture, specifically examining the effect of model layers, optimizer, embedding dimension and batch size on integer modular inversion performance.
Tables 9-12 show ablation studies for the 1D modular arithmetic task, where entries are of the form (best log 2 ( q ) / log 2 ( samples ) ), e.g. the highest modulus achieved and the number of training samples needed to achieve this.
The best results, meaning the highest q with the lowest log 2 ( samples ) , are in bold .
For all experiments, we use the base architecture of 2 encoder/decoder layers, 512 encoder/decoder embedding dimension, and 8/ attention heads (as in Section 3.1) and note what architecture element changes in the table heading.
We find that shallower transformers (e.g 2 layers, see Table 9) work best, allowing problem solutions with a much higher q especially when the base B is large.
The AdamCosine optimizer (Table 10) generally worked best, but required a smaller batch size for success with larger base.
For smaller bases, a smaller embedding dimension of 128 performed better (Table 11), but increasing base size and dimension simultaneously yielded good performance.
Results on batch size (Table 12) do not show a strong trend.
C Additional information on SALSA Secret Recovery (§4.3)
Here, we provide additional information about SALSA’s two secret recovery algorithms.
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table]
C.1 Direct Secret Recovery
Recovering Secrets from Predictions.
During the direct secret recovery phase, we must transform model predictions from sequences on integers in base B into binary secrets.
This transformation is denoted by the binarize function on line 7 of Algorithm 1.
We first decode the n (one for each special a input) predictions into integers and concatenate the predictions into one n -long vector ˜ s .
Then, we use each of the following methods to binarize this vector: mean comparison, softmax mean comparison, and mode comparison.
The mean
comparison
method takes the mean of ˜ s and computes
two
potential secrets
from it
via the following function: f 01 (˜ s ) sets all elements above the mean to be 0 and below it to be 1 , and f 10 (
˜ s ) sets all elements above the mean to be 1 and below it to be 0 .
• To use the softmax mean comparison, we first take the softmax of ˜ s .
We then take the mean of ˜ s and use the same binarization method as before to get two secret predictions.
• The mode comparison method is similar but instead of taking the mean, it uses the mode of ˜ s as the divider between 0 and 1 methods.
Altogether, these binarization methods produce six secret guesses.
In our SALSA evaluation, all of these are compared against the true secret s , and the number of matching bits is reported.
If ˜ s fully matches s , model training is stopped.
When s is not available for comparison, the methods in §4.
can be used to verify ˜ s ’s correctness.
K values.
At the end of each epoch, we use 10 K values for direct secret guessing, 5 of which are fixed and 5 of which are randomly generated.
The fixed K values are K =
[239145 , 42899 , q − 1 , 3 q + 7 , 42900] , while the random K values are chosen from the range ( q, 10 q ) .
C.2 Distinguisher-Based Secret Recovery
Here, we provide more details on the parameters and subroutines used in Algorithm 2.
• τ : This parameter sets the bound on q that will be used for the distinguisher computation.
In our experiments, we set τ = 0 .
• acc τ : This denotes the distinguisher advantage.
Let acc τ denote the proportion of model predictions which fall within the chosen tolerance (e
g. accuracy within tolerance as described in §4.2), then advantage =
acc τ − 2 ∗ τ .
• LWESamples ( t, n, q ) is a subroutine that returns LWE samples ( A , b ) ∈
Z n × t q × Z tq , note that now columns of A corresponds to LWE instances.
C.3 Secret Recovery in Practice
Empirically, we observe that direct secret recovery recovers the secret more quickly than the distinguisher-based method.
Figure 5 plots counts of which technique provided the successful secret guess for 120 SALSA runs with varying n and d .
The direct secret guessing method success > 90% of the time, but occasionally the distinguisher is able to get the secret first.
Occasionally, both methods simultaneously recover the secret.
Which secret recovery method finds secret first?
[Figure]
D Additional SALSA Results (§5.2) D.1 Effect of Architecture for (R)LWE Attacks
Several key architecture choices determine SALSA’s ability to recover secrets with higher n and d , namely the encoder and decoder dimension as well as the number of attention heads.
Other architecture choices determine the time to solution but not the complexity of problems SALSA could solve.
For example, universal transformers (UT) are more sample efficient than regular transformers.
Using gated loops in the UT with more loops on the decoder than the encoder reduced both model training time and the number of samples needed.
Here, we present ablation results for all these architectural choices.
Universal Transformers vs. Regular Transformers.
First, we see if universal transformers improve experimental efficiency or success.
We run dueling experiments on medium size problems ( N = 50 , d = 0 .
06 , q = 251 , B in /B out = 81 ).
For one experiment, we use regular transformers with between
[Table] [Table]
[Table] [Table]
[Table] [Table]
2 and 8 encoder/decoder layers.
For the other, we use gated universal transformers with betweenand 8 loops.
We then compare the relative number of training samples needed to achieve success for both methods.
As Table 13 shows, when model size increases, universal transformers prove more sample efficient, so we use them exclusively.
Gated vs Ungated UTs.
To understand the effect of gating on sample efficiency, we run two experiments with medium-size problems ( N = 50 , d = 0 .
06 , q = 251 , B in /B out = 81 ).
For both experiments, we use universal transformers with between 2 and 8 loops on the encoder/decoder.
We use gates for one experiment but not for the other.
As Table 14 shows, gated UTs are much more sample-efficient.
Number of Loops.
Table 15 shows the average number of samples needed to recover the secret for
N = 50 , h = 3 with different numbers of encoder/decoder loops (dimension=1025/512, heads=16/4).
There is a tradeoff between adding loops and increasing computation time, particularly for encoder loops as n increases.
In our experiments, we elect to use 2 encoder loops and 8 decoder loops due to the significant training time needed for high n values with more encoder loops.
Encoder/Decoder Dimension.
Table 3 in §5.2 demonstrates how increasing the encoder size and decreasing the decoder sizes enables secret recovery with fewer samples.
Here, we explore the effect of encoder and decoder dimension on the n and hamming weight of secrets SALSA can recover.
Our results, shown in Tables 16 and 17, follow the same pattern as before: higher encoder dimension and lower decoder dimension allow us to recover secrets with higher n .
Furthermore, for n = 30 , higher encoder dimension and/or smaller decoder dimension allows recovery of hamming weight 4 secrets.
[Table] [Table]
[Table] [Table]
[Table] [Table]
Attention Heads.
We run experiments for varying n with 2 encoder/decoder layers, 1024/ embedding dimension, 2/8 encoder/decoder loops, and varying attention heads to observe the impact of attention heads on SALSA’s success.
Increasing the number of encoder attention heads while keeping decoder heads at 4 allows SALSA to recover secrets for n > 70 (Table 18), although it slightly increases the number of samples needed for recovery (Table 19).
Increasing the number of decoder heads increases the number of samples needed but does not provide the same scale-up for n .
[Table]
[Table]
D.2 Effect of data parameters for (R)LWE Attacks
Complex relationships between N q , B , and d affect SALSA’s ability to fully recover secrets.
Here, we explore these relationships, with success measured by the proportion of secret bits recovered.
Table 20 shows SALSA’s performance as n and q vary with fixed hamming weight 3 .
SALSA performs better for smaller and larger values of q , but struggles on mid-size ones across all N values (when hamming weight is held constant).
This stands in contrast to traditional attacks on LWE, which only work well when q is large [20].
Table 21 shows the interactions between q and d with fixed n = 50 .
Here, we find that varying q does not increase the density of secrets recovered by SALSA.
Finally, Table 22 shows the log 2 samples needed for secret recovery with different input/output bases with n = 50 and hamming weight 3 .
The secret is recovered for all input/output base pairs except for
B in = 17 , B out = 3 , and using a higher input base reduces the log 2 samples needed for recovery.
D.3 Effect of training parameters on (R)LWE Attacks
We experiment with numerous training parameters to optimize SALSA’s performance (e.g. optimizer, learning rate, floating point precision).
While most of these settings do not substantively change
SALSA’s overall performance, we find that batch size has a significant impact on SALSA’s sample efficiency.
In experiments with n = 50 and Hamming weight 3 , small batch sizes, e.g. < 50 , allow recovery of secrets with much fewer samples, as shown in Figure 6.
The same model architecture is used as for n = 50 in Table 2.
E Improving SALSA’s Sample Efficiency
Here, we provide both theoretical and empirical results highlighting ways to improve SALSA’s sample efficiency.
Generating New Samples.
We explain how to generate new LWE samples from existing ones via linear combinations.
Assume we have access to m LWE samples.
Suppose a SALSA model can still learn from samples following a family of Gaussian distributions with standard deviations less than Nσ , where σ is the standard deviation of the original LWE error distribution.
The number of new samples we could make is equal to the number of vectors v = ( v 1 , . .
. , v m ) T ∈
Z m such that
[Table] [Table]
[Equation]
mi
[Equation]
| v i | ≤ N 2 .
For simplicity, assume that v ′
i s are nonnegative.
Then, there are
[Equation]
such vectors, and therefore this many new LWE samples one can generate.
Results on Generated Samples.
Next, we show how SALSA performs when we combine different numbers of existing samples to create new ones for model training.
We use the above method but do not allow the same sample to appear more than once in a given combination.
We fix K , which is the number of samples used in each linear combination of reused samples.
Then, we generate K coefficients for the combined samples, where each k i is randomly chosen from {− 1 , 0 , 1 } .
Finally, we randomly select K samples from a pregenerated set of samples, and produce a new sample from their linear combination with the k i coefficients.
These new samples follow error distribution with the standard deviation less than or equal to √ Kσ .
We experiment with different values of K , as well as different numbers of times we reuse a sample in linear combinations before discarding it.
The log 2 samples required for secret recovery for each ( K , times reused) setting are reported in Table 8.
The first key result is that the secret is recovered in
all experiments, confirming that the additional error introduced via sample combination does not disrupt model learning.
Second, as expected, sample requirements decrease significantly as we increase both K and times reused.
Samples vs. Sigma.
We observe that the number of samples needed for secret recovery increases linearly with σ , see Figure 7.
[Table]
[Table] [Table]
[Figure]
[Table]
[Figure]
[Table] [Table]
[Table] [Table]
[Table]