TAPAS: Datasets for Learning the Learning with Errors Problem

Eshika Saxena, Alberto Alfarano, Francois Charton, Emily Wenger, Kristin E. Lauter

TL;DR

The TAPAS datasets offer the first large-scale, preprocessed benchmark suite (up to 400 million samples per configuration) designed to help machine learning researchers attack the Learning with Errors (LWE) problem—the mathematical backbone of modern post-quantum cryptography. By removing the steep computational and domain barriers required to preprocess lattice data, TAPAS provides an off-the-shelf sandbox to study how neural networks learn modular arithmetic, recover cryptographic secrets, and scale against quantum-resistant systems.

What Problem Does This Paper Address?

Post-quantum cryptography standards (such as NIST's standardized CRYSTALS-Kyber) and homomorphic encryption rely heavily on the hardness of the Learning with Errors (LWE) problem. In LWE, an attacker tries to recover a secret vector $\mathbf{s} \in \mathbb{Z}_q^n$ given noisy linear equations $\mathbf{b} = \mathbf{A}\mathbf{s} + \mathbf{e} \pmod q$.

Recent works demonstrated that AI-driven attacks (such as SALSA and Cool & Cruel) can match or outperform classical lattice reduction algorithms in certain weakened regimes (e.g., sparse secrets). However, AI researchers face a massive roadblock: models cannot learn directly from raw LWE samples. The data requires extensive preprocessing using complex lattice reduction techniques (like BKZ and flatter). This step demands deep domain expertise and millions of CPU hours. Prior public datasets capped out at around 4 million samples—insufficient for training large models or establishing empirical scaling laws.

Methods

The authors provide a standardized pipeline to generate and reduce massive LWE datasets:

  1. Subsampling Trick: Starting from $4n$ eavesdropped samples $(\mathbf{A}, \mathbf{b})$, the authors subsample random batches of size $m$ to generate millions of candidate systems $(\mathbf{A}_i, \mathbf{b}_i)$.
  2. Lattice Reduction: Each subsampled matrix is embedded into a $(m+n)$-dimensional $q$-ary lattice $\Lambda_i$: $$\Lambda_i = \begin{pmatrix} 0 & q \cdot \mathbf{I}_n \\ \omega \cdot \mathbf{I}_m & \mathbf{A}_i \end{pmatrix}$$
  3. Interleaved Reduction Algorithm: The authors interleave BKZ 2.0 and flatter reduction passes, followed by integer lattice polishing. If progress stalls (reduction metric $\rho$ drops below a progress threshold $\gamma$ over $s$ steps), the pipeline switches algorithms until a target threshold $\tau$ is reached.
  4. Baseline AI Attacks:
  5. SALSA: A 4-layer Transformer with angular embeddings (mapping modular elements to unit circle coordinates) trained to predict reduced labels $\mathbf{R}\mathbf{b}$ from reduced matrices $\mathbf{R}\mathbf{A}$. If prediction accuracy beats random chance, model queries extract secret bits.
  6. Cool & Cruel (CC): Exploits reduction asymmetry: unreduced ("cruel") columns are brute-forced, while reduced ("cool") columns are recovered via linear regression.

Datasets

The authors released five open-source datasets via Hugging Face (facebook/TAPAS), totaling over 560 million reduced samples:

  • $n = 256, \log_2 q = 20$: 400M samples ($\rho = 0.4284$, 37 cruel bits).
  • $n = 512, \log_2 q = 12$: 40M samples ($\rho = 0.9036$, 411 cruel bits).
  • $n = 512, \log_2 q = 28$: 40M samples ($\rho = 0.6740$, 225 cruel bits).
  • $n = 512, \log_2 q = 41$: 40M samples ($\rho = 0.3992$, 69 cruel bits).
  • $n = 1024, \log_2 q = 26$: 40M samples ($\rho = 0.8600$, 750 cruel bits).

Generating these datasets required over 42 million CPU hours on 2.1 GHz Intel Xeon Gold processors (over 40 million hours spent on the $n=256$ dataset alone).

Key Insights and Ideas

  • Lattice Reduction Asymmetry as an AI Attack Surface: Standard reduction algorithms do not shorten basis vectors uniformly; early columns form a high-variance "cliff" (cruel bits), while later columns are heavily compressed (cool bits). This structure makes hybrid brute-force and linear regression attacks feasible.
  • Dual Nature Benchmark: Unlike generic math reasoning datasets (e.g., GSM8K or FrontierMath), TAPAS serves as an operational benchmark for specific mathematical operations—modular addition and noisy multiplication—while simultaneously providing a real-world cryptanalysis benchmark.
  • Data Scale as a Substitute for Lattice Reduction: Prior work established that stronger lattice reduction enables recovering secrets with higher Hamming weights ($h$). TAPAS enables the community to test whether massive dataset scaling (10x to 100x prior sizes) can compensate for lower reduction quality.

Key Results

The authors benchmarked SALSA and Cool & Cruel across binary and ternary secrets, recording the maximum recoverable Hamming weight ($h$):

Dimension $n$ $\log_2 q$ Max $h$ Recovered (Binary) <br> (SALSA / CC) Max $h$ Recovered (Ternary) <br> (SALSA / CC)
256 20 33 / 22 20 / 22
512 12 6 / 6 4 / 7
512 28 9 / 12 11 / 13
512 41 63 / 60 45 / 37
1024 26 5 / 6 4 / 5

Under high-modulus settings ($n=512, \log_2 q = 41$), SALSA recovered sparse binary secrets up to $h = 63$. Under lower modulus settings or higher dimensions ($n=1024$), both attacks struggle past very low Hamming weights ($h \le 6$).

Limitations and Future Work

  • Standard LWE Only: The datasets focus on plain LWE, omitting Ring-LWE (RLWE) and Module-LWE (MLWE), which are used in deployed systems like Kyber to save memory.
  • High Generation Overhead: Generating preprocessed lattices remains computationally staggering, necessitating future work in synthetic data generation and data augmentation.
  • Reduction Quality Floor: TAPAS expands dataset size, but reduction quality ($\rho$) remains constrained by the current limits of classical reduction algorithms.
  • Exploration Vectors: Promising directions include investigating alternative architectures (e.g., non-Transformers, reinforcement learning), studying grokking in modular arithmetic, and reformulating the learning task from search-LWE to decision-LWE or multi-secret pre-training.

Summary updated

BibTeX
@inproceedings{saxena2025tapas,
  author = {Eshika Saxena and Alberto Alfarano and Francois Charton and Emily Wenger and Kristin E. Lauter},
  title = {{TAPAS: Datasets for Learning the Learning with Errors Problem}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=91scW3DywW},
}
Figure