atlas

Research map / Learning theory and algorithms / Prediction and decision losses

Making Hard Problems Easier with Custom Data Distributions and Loss Regularization: A Case Study in Modular Arithmetic

ICML 2025 · Learning theory and algorithms › Prediction and decision losses · approach: Loss landscape analysis · 0 citations (OpenAlex)

Read the paperCheck your idea against 108,967 papers

AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.

Proposes a sparsity-based training data distribution and a regularized angular MSE loss that let encoder-only transformers learn modular addition of up to 128 terms and recover binary LWE secrets with Hamming weight up to 6.

Problem

ML models struggle to learn modular arithmetic (summing many elements mod q), which limits ML-based attacks on Learning with Errors (LWE) to few nonzero secret entries.

Approach

Augment training data with sparse vectors sampled from a number-of-zeros distribution f (inv_sqrt) instead of uniform sampling, and add a regularization term penalizing predictions near the origin to the angular MSE loss, so the model avoids collapse and learns easier-to-harder structure without a curriculum.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Add sparse training examples using f_inv_sqrt instead of default sampling (ablation)Encoder-only transformer modular addition · Modular addition N=16, q=257τ=0.5% accuracy: 1.2% -> 99.8%Helped
Use f_inv_sqrt rather than uniform sparsity sampling (ablation)Encoder-only transformer modular addition · Modular addition N=16, 32, 64, 128; q=257τ=0.5% accuracy: 99.7% vs 99.8%; 98.9% vs 99.5%; 95.3% vs 98.9%; 92.7% vs 96.1%Helped
Add sparse examples to the training dataEncoder-only transformer modular addition · Modular addition N=16, q=257τ=0.5% accuracy: 1.3% -> 99.8%Helped
Add custom loss regularization (ablation)Encoder-only LWE model · LWE without errors, N=64, secret weight=6, q=257Secret recovery: 0% -> 15%Helped
Add custom loss regularization (ablation)Encoder-only transformer modular addition · Modular addition N=16, q=257τ=0.5% accuracy: 99.9% vs 99.8%No clear effect
Increase training repeats from 10 to 1000 (ablation)Encoder-only transformer modular addition · Modular addition N=128, q=257τ=0.5% accuracy: 96.1% -> 86.1%Hurt
Increase training duration by 4× (ablation)Encoder-only transformer modular addition · Modular addition N=256, q=257τ=1% accuracy: 90.4% -> 94.8%Helped
Increase model size by 4× (ablation)Encoder-only transformer modular addition · Modular addition N=256, q=257τ=1% accuracy: 90.4% -> 96.2%Helped
Replace fixed-length training with diverse problem lengths using f_inv_sqrtDecoder-only transformer associative recall · Associative recall, max length 64Accuracy: 1.8% -> 100.0%Helped
Replace fixed-length training with diverse problem lengths using f_inv_sqrtDecoder-only transformer parity · Parity, max length 256Accuracy: 50.2% -> 99.4%Helped
Replace f_default with f_inv_sqrt samplingTransformer modular multiplication · Modular multiplication N=16, q=3329τ=1% accuracy: 2% -> 3%Helped
Replace f_default with f_inv_sqrt samplingTransformer scalar product · Scalar product N=8, q=257τ=1% accuracy: 2% vs 2%No clear effect

Surprising findings

Limitations

Experimental setup

Datasets: synthetic modular addition data with sparse vectors (f_inv_sqrt) synthetic LWE (A, b) pairs synthetic copy, associative recall, parity, selective copy data

Benchmarks: held-out modular addition test set (100,000 examples) LWE binary secret recovery copy associative recall parity selective copy

Metrics: MSE tau-accuracy (0.5%, 1%) exact accuracy secret recovery %

Baselines: default uniform training distribution curriculum learning standard MSE loss cross-entropy loss

Builds on: angular embedding for modular arithmetic ML attacks on LWE (Wenger et al.) curriculum learning grokking studies

Closest papers by meaning

Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.

Open scime draft

Get the next scime Dispatch and a monthly field update

Free. We send a confirmation link first; every email has a one-click unsubscribe. Privacy