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

맞춤형 데이터 분포와 손실 정규화로 어려운 문제를 더 쉽게 만들기: 모듈러 산술 사례 연구

Eshika Saxena, Alberto Alfarano, François Charton, Zeyuan Allen-Zhu, Emily Wenger, Kristin Lauter · arXiv · 2024년 10월 4일

- **연구 문제** 많은 원소를 mod q로 더하는 모듈러 덧셈은 기존 ML 모델이 잘 학습하지 못하는 과제이며, 이 문제는 LWE 기반 ML 공격의 확장성을 제한합니다.
- **연구 방법** 학습 데이터에 쉬운 희소 예시를 섞는 고정 샘플링 분포와, 원점 예측을 억제하는 정규화 손실을 각도 임베딩 위에서 함께 사용합니다.
- **주요 결과** 제안 방법은 N = 128까지 모듈러 덧셈을 학습하고 LWE 개념 증명에서 Hamming weight 6의 비밀 복구를 보고합니다. 기준선과 커리큘럼 학습보다 높은 정확도 또는 안정성을 보였으나 결과의 적용 범위는 설정에 따라 다릅니다.

## 모듈러 덧셈이 ML 공격의 병목이 되는 이유

LWE(Learning with Errors)는 후양자 암호에 쓰이는 어려운 문제이며, 비밀 벡터 s를 행렬 A와 b = A·s + e로부터 추정하는 것이 핵심입니다. 비밀이 이진이고 희소할 때 b를 A로부터 계산하는 과정은 mod q 부분합, 즉 모듈러 덧셈 문제가 됩니다. 기존 ML 공격은 b를 A로부터 예측하도록 모델을 학습하며, 비밀의 0이 아닌 원소 수가 늘어날수록 더 많은 원소를 mod q로 더해야 하므로 성능이 떨어진다고 보고됩니다. 따라서 이 논문은 많은 원소의 모듈러 덧셈을 ML 모델이 학습하도록 만드는 방법을 문제로 설정합니다. 기존 연구에서는 N ≤ 6, q ≤ 1000 수준까지만 보고되었습니다.

![Table 1: Summary of prior work on ML-enabled modular addition. Best N and q are bold](https://refivu.com/papers/3f87239f-196c-4cf7-ad33-c79663a9d9c4/figures/figure-54e33edc2057ccee0bc1b15f864467dd.png?thumb=512)

**Table 1** Summary of prior work on ML-enabled modular addition. Best N and q are bold.

[원문](https://arxiv.org/abs/2410.03569v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Eshika Saxena, Alberto Alfarano, François Charton, Zeyuan Allen-Zhu, Emily Wenger, Kristin Lauter · Making Hard Problems Easier with Custom Data Distributions and Loss Regularization: A Case Study in Modular Arithmetic · 원문 그림 인용 · 원본 PDF 3쪽에서 그림 영역을 추출했습니다.

## 희소 벡터를 섞은 학습 데이터 분포

제안 방법의 첫 번째 변경은 학습 데이터의 분포입니다. 기존 연구는 a를 Zq^N에서 균등하게 뽑는 fdefault 분포를 사용하지만, 이 논문은 0의 개수 z에 대해 확률을 1/√(N−z+1)에 비례하도록 정한 finv\_sqrt 분포를 사용합니다. 이 분포는 0이 많아 쉬운 원소와 0이 적어 어려운 원소를 함께 생성합니다. 이는 커리큘럼 학습처럼 학습 중 분포를 바꾸는 것이 아니라 생성 분포를 고정한 채 쉬운 예시를 섞는 방식입니다. 저자들은 모델이 희소한 예시를 먼저 익힌 뒤 더 복잡한 합을 학습한다는 관찰로 이 설계를 뒷받침합니다.

## 각도 임베딩과 원점 억제 손실

제안 방법의 두 번째 변경은 입출력 표현과 손실 함수입니다. 정수 t ∈ Zq는 각도 2πt/q로 바뀌고 단위원 위의 점 (cos ϕ, sin ϕ)로 표현되며, 이로써 0과 q가 같은 점으로 취급됩니다. 저자들은 MSE만 사용하면 어려운 설정에서 모델이 원점 근처의 나쁜 국소 최솟값으로 수렴하는 문제를 관찰했습니다. 이를 막기 위해 예측이 원점에 가까울수록 손실이 커지는 항을 MSE에 더합니다. 이 항은 예측이 단위원 위에 있을 때 최소가 되며, 원문은 α = 10^-4를 사용한다고 보고합니다.

![Table 7: Model performance with custom and MSE loss are comparable when trained on modular addition. We train the models with q = 257and with the best training…](https://refivu.com/papers/3f87239f-196c-4cf7-ad33-c79663a9d9c4/figures/figure-0112cbd73bae787a2af8bb03fd210cbe.png?thumb=512)

**Table 7** Model performance with custom and MSE loss are comparable when trained on modular addition. We train the models with q = 257and with the best training data parameters identified in §4 with angular embeddings and evaluate on the same test set for all.τ = 0.5% Accuracy is percentage of predictions within0.005q of right answer (see §3).

[원문](https://arxiv.org/abs/2410.03569v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Eshika Saxena, Alberto Alfarano, François Charton, Zeyuan Allen-Zhu, Emily Wenger, Kristin Lauter · Making Hard Problems Easier with Custom Data Distributions and Loss Regularization: A Case Study in Modular Arithmetic · 원문 그림 인용 · 원본 PDF 9쪽에서 그림 영역을 추출했습니다.

## 모듈러 덧셈의 주요 결과와 기준선 비교

주요 결과에서 인코더 전용 트랜스포머는 N = 16부터 128까지, q = 257부터 974269까지 모듈러 덧셈을 학습합니다. N = 16, q = 257의 τ = 0.5% 정확도는 99.8%로 보고되며, N = 128, q = 257에서는 τ = 0.5% 정확도 96.1%와 MSE 0.04가 보고됩니다. 같은 학습 샘플 수에서 기준선은 1.3%를 보였다고 본문에 쓰여 있으며, Table 3의 fdefault 값은 1.2%로 표시되어 두 값이 함께 존재합니다. 이 비교는 기준선의 분포와 손실이 제안 방법과 다른 조건에서 측정된 결과입니다.

![Table 2: Our methods perform consistently well adding N ∈ \[16, 32, 64, 128\] elements mod q ∈ \[257, 3329, 42899, 974269\]. All metrics are computed on a held out…](https://refivu.com/papers/3f87239f-196c-4cf7-ad33-c79663a9d9c4/figures/figure-c9c9aa0afb5d522dd10fe848f7fd17fc.png?thumb=512)

**Table 2** Our methods perform consistently well adding N ∈ \[16, 32, 64, 128\] elements mod q ∈ \[257, 3329, 42899, 974269\]. All metrics are computed on a held out test set. MSE is mean squared error,τ = 0.5% Accuracy is percentage of predictions within 0.005q of right answer andτ = 1%Accuracy is percentage of predictions within0.01q of right answer (see §3). The models perform with consistently low MSE and very highτ-accuracy.

[원문](https://arxiv.org/abs/2410.03569v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Eshika Saxena, Alberto Alfarano, François Charton, Zeyuan Allen-Zhu, Emily Wenger, Kristin Lauter · Making Hard Problems Easier with Custom Data Distributions and Loss Regularization: A Case Study in Modular Arithmetic · 원문 그림 인용 · 원본 PDF 6쪽에서 그림 영역을 추출했습니다.

## 커리큘럼 학습과의 안정성 비교

저자들은 고정 분포가 커리큘럼 학습보다 안정적이라고 주장합니다. 커리큘럼 학습은 쉬운 샘플로 먼저 학습한 뒤 전체 데이터로 학습하는 방식이며, 8회 시행에서 N = 128, q = 257일 때 제안 방법은 95.8% ± 0.5%, 커리큘럼 학습은 85.1% ± 10.3%를 보고합니다. 이 결과는 해당 설정에서 분산이 줄어든 것을 보여주지만, 커리큘럼 설정 탐색의 전 범위를 대표하지는 않습니다. 원문은 여러 대안 설계가 비슷한 결과를 냈다고도 기록합니다.

![Table 4: Our approach is more consistent and stable than CL, especially for larger N . We chose the best performing curriculum to compare to our approach. We r…](https://refivu.com/papers/3f87239f-196c-4cf7-ad33-c79663a9d9c4/figures/figure-1c6604b49f45f48d2642b4e090e801ea.png?thumb=512)

**Table 4** Our approach is more consistent and stable than CL, especially for larger N . We chose the best performing curriculum to compare to our approach. We report theaverage τ = 0.5% accuracy (see §3) and the variance across 8 trials.

[원문](https://arxiv.org/abs/2410.03569v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Eshika Saxena, Alberto Alfarano, François Charton, Zeyuan Allen-Zhu, Emily Wenger, Kristin Lauter · Making Hard Problems Easier with Custom Data Distributions and Loss Regularization: A Case Study in Modular Arithmetic · 원문 그림 인용 · 원본 PDF 8쪽에서 그림 영역을 추출했습니다.

## KL 발산과 희소 데이터의 역할

데이터 분포의 효과를 설명하기 위해 저자들은 학습 분포와 테스트 분포 사이의 KL 발산을 계산합니다. fdefault는 KL 발산이 0.0이고 정확도가 0%로 보고되며, 학습 분포가 테스트 분포와 거의 같을 때 모델이 학습하지 못했다고 해석됩니다. 반면 funi는 쉬운 샘플이 지나치게 많아 KL 발산이 크고 정확도가 낮아집니다. 저자들은 중간 범위의 KL 발산을 갖는 finv\_sqrt가 가장 잘 작동한다고 해석합니다. 이는 여러 설정에서 관찰된 상관적 해석이며 인과 증명으로 제시되지 않습니다.

![Table 3: Sampling the training data from finv\_sqrt produces the best accuracy results across N and q. τ = 0.5% Accuracy is percentage of predictions within0.00…](https://refivu.com/papers/3f87239f-196c-4cf7-ad33-c79663a9d9c4/figures/figure-0dbc81f6f49165a9ea60a9c9f43888aa.png?thumb=512)

**Table 3** Sampling the training data from finv\_sqrt produces the best accuracy results across N and q. τ = 0.5% Accuracy is percentage of predictions within0.005q of right answer (see §3), KL divergence is the level of similarity between the training and testing datasets. With default samplingfdefault, the model does not learn at all. Distributions with a KL divergence that is not too high or too low enable the model to perform best.

[원문](https://arxiv.org/abs/2410.03569v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Eshika Saxena, Alberto Alfarano, François Charton, Zeyuan Allen-Zhu, Emily Wenger, Kristin Lauter · Making Hard Problems Easier with Custom Data Distributions and Loss Regularization: A Case Study in Modular Arithmetic · 원문 그림 인용 · 원본 PDF 7쪽에서 그림 영역을 추출했습니다.

## LWE 비밀 복구 개념 증명

LWE 적용은 개념 증명입니다. 실험에서는 오차 벡터 e를 무시하고, 비밀 s를 이진 희소 벡터로 가정합니다. 모델은 30M개의 서로 다른 예시와 총 1B 예시의 학습 예산으로 b를 A로부터 예측하도록 학습합니다. 원문은 N = 64에서 Hamming weight 6의 비밀을 복구한 결과를 보고하며, 사용자 정의 손실은 20번의 초기화 중 10%에서 20%를 복구했고 MSE 손실은 0%를 보고합니다. 저자들은 이를 기존 ML 공격이 대략 3개 원소의 합까지 다룬다는 보고와 비교해 성능을 높였다고 해석합니다. 이 결과는 제한된 설정의 개념 증명이며 실제 암호 체계 전체의 안전성 판정이 아닙니다.

![Table 8: Model performs better when trained with our custom loss on the L W(ithout)E problem. We train the models with the best data parameters from §4 and eva…](https://refivu.com/papers/3f87239f-196c-4cf7-ad33-c79663a9d9c4/figures/figure-1a2c9e62b3161a1dd715b8b1a7d44a7d.png?thumb=512)

**Table 8** Model performs better when trained with our custom loss on the L W(ithout)E problem. We train the models with the best data parameters from §4 and evaluate if the model successfully recovers the secret. Recovery % is the percent of secrets recovered out of 20 different model initialization.

[원문](https://arxiv.org/abs/2410.03569v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Eshika Saxena, Alberto Alfarano, François Charton, Zeyuan Allen-Zhu, Emily Wenger, Kristin Lauter · Making Hard Problems Easier with Custom Data Distributions and Loss Regularization: A Case Study in Modular Arithmetic · 원문 그림 인용 · 원본 PDF 10쪽에서 그림 영역을 추출했습니다.

## 다른 과제로의 적용과 한계

저자들은 모듈러 덧셈 이외의 과제에도 같은 데이터 분포를 적용합니다. Parity 과제의 N = 32에서 finv\_sqrt는 100.0%, fdefault는 50.3%를 보고하며, 이 실험은 디코더 전용 모델과 회전 위치 임베딩을 사용하고 사용자 정의 손실은 사용하지 않습니다. 또한 큰 N에서는 MSE가 약간 높고 정확도가 낮아진다고 명시하며, 부록에서 더 긴 학습이나 더 큰 모델이 큰 N의 성능을 개선한다는 추가 실험을 보고합니다. 따라서 큰 N에서의 완전한 견고성은 이 논문에서 확인되지 않았습니다.

![Table 16: With our approach, performance declines with higher N . All metrics are computed on a held out test set. MSE is mean squared error and τ = 1% Accurac…](https://refivu.com/papers/3f87239f-196c-4cf7-ad33-c79663a9d9c4/figures/figure-e3fff6e9f01660e8a3e518deb2a8a5a0.png?thumb=512)

**Table 16** With our approach, performance declines with higher N . All metrics are computed on a held out test set. MSE is mean squared error and τ = 1% Accuracy is percentage of predictions within0.01q of right answer (see §3 for details).

[원문](https://arxiv.org/abs/2410.03569v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Eshika Saxena, Alberto Alfarano, François Charton, Zeyuan Allen-Zhu, Emily Wenger, Kristin Lauter · Making Hard Problems Easier with Custom Data Distributions and Loss Regularization: A Case Study in Modular Arithmetic · 원문 그림 인용 · 원본 PDF 17쪽에서 그림 영역을 추출했습니다.

![Table 17: Training 4x longer improves performance on high N . All metrics are computed on a held out test set. MSE is mean squared error andτ = 1%Accuracy is p…](https://refivu.com/papers/3f87239f-196c-4cf7-ad33-c79663a9d9c4/figures/figure-d7234c74497aba2adedc53b1f18cd80c.png?thumb=512)

**Table 17** Training 4x longer improves performance on high N . All metrics are computed on a held out test set. MSE is mean squared error andτ = 1%Accuracy is percentage of predictions within0.01q of right answer (see §3 for details).

[원문](https://arxiv.org/abs/2410.03569v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Eshika Saxena, Alberto Alfarano, François Charton, Zeyuan Allen-Zhu, Emily Wenger, Kristin Lauter · Making Hard Problems Easier with Custom Data Distributions and Loss Regularization: A Case Study in Modular Arithmetic · 원문 그림 인용 · 원본 PDF 17쪽에서 그림 영역을 추출했습니다.

![Table 18: A 4x larger model also improves performance on high N . All metrics are computed on a held out test set. MSE is mean squared error and τ = 1% Accurac…](https://refivu.com/papers/3f87239f-196c-4cf7-ad33-c79663a9d9c4/figures/figure-9b0b7299db2cf591fa154f3fb054d490.png?thumb=512)

**Table 18** A 4x larger model also improves performance on high N . All metrics are computed on a held out test set. MSE is mean squared error and τ = 1% Accuracy is percentage of predictions within0.01q of right answer (see §3 for details).

[원문](https://arxiv.org/abs/2410.03569v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Eshika Saxena, Alberto Alfarano, François Charton, Zeyuan Allen-Zhu, Emily Wenger, Kristin Lauter · Making Hard Problems Easier with Custom Data Distributions and Loss Regularization: A Case Study in Modular Arithmetic · 원문 그림 인용 · 원본 PDF 17쪽에서 그림 영역을 추출했습니다.

## 논문 정보

- **저자**: Eshika Saxena, Alberto Alfarano, François Charton, Zeyuan Allen-Zhu, Emily Wenger, Kristin Lauter
- **학회·저널**: arXiv · 프리프린트
- **최초 공개일**: 2024년 10월 4일
- **등록일**: 2026년 10월 30일
- **수정일**: 2025년 8월 25일
- **버전**: v2
- **arXiv**: 2410.03569
- **분류**: cs.LG
- **원문 이용 조건**: [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)
- **제공 범위**: 논문 정보, 해설, 허용된 원문 그림

[논문 원문 ↗](https://arxiv.org/abs/2410.03569v2) · [원문 PDF ↗](https://arxiv.org/pdf/2410.03569v2)

AI 해설은 논문 원문과 별개의 설명이며 오류가 있을 수 있습니다. 원문과 그림은 각 출처의 이용 조건과 따로 표시된 권리를 따릅니다.

## 초록

Recent work showed that ML-based attacks on Learning with Errors (LWE), a hard problem used in post-quantum cryptography, outperform classical algebraic attacks in certain settings. Although promising, ML attacks struggle to scale to more complex LWE settings. Prior work connected this issue to the difficulty of training ML models to do modular arithmetic, a core feature of the LWE problem. To address this, we develop techniques that significantly boost the performance of ML models on modular arithmetic tasks, enabling the models to sum up to $N=128$ elements modulo $q \\le 974269$. Our core innovation is the use of custom training data distributions and a carefully designed loss function that better represents the problem structure. We apply an initial proof of concept of our techniques to LWE specifically and find that they allow recovery of 2x harder secrets than prior work. Our techniques also help ML models learn other well-studied problems better, including copy, associative recall, and parity, motivating further study.

## 원문 인용

Eshika Saxena, Alberto Alfarano, François Charton, Zeyuan Allen-Zhu, Emily Wenger, Kristin Lauter (2024). Making Hard Problems Easier with Custom Data Distributions and Loss Regularization: A Case Study in Modular Arithmetic. arXiv:2410.03569v2. https://arxiv.org/abs/2410.03569v2

**BibTeX**

```
@misc{saxena2024making,
  title = {{Making Hard Problems Easier with Custom Data Distributions and Loss Regularization: A Case Study in Modular Arithmetic}},
  author = {Eshika Saxena and Alberto Alfarano and François Charton and Zeyuan Allen-Zhu and Emily Wenger and Kristin Lauter},
  year = {2024},
  eprint = {2410.03569},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2410.03569v2}
}
```

## 이 논문의 용어

- [KL divergence](https://refivu.com/terms/5f1dbea73907-kl-divergence)
- [mean squared error (MSE)](https://refivu.com/terms/285676885a86-mean-squared-error-mse)
- [Curriculum Learning](https://refivu.com/terms/b6ef6666624f-curriculum-learning)
- [grokking](https://refivu.com/terms/53ded075674f-grokking)
- [custom loss function](https://refivu.com/terms/9ba15e6a41cb-custom-loss-function)
- [Encoder-only transformer](https://refivu.com/terms/7ae5f62ffade-encoder-only-transformer)
- [modular addition](https://refivu.com/terms/314b54ab1639-modular-addition)

## 다른 논문 해설

- [Understanding and Improving Length Generalization in Recurrent Models](https://refivu.com/papers/f9cd6a9a-de1d-4e94-a91d-e03ad7e1036c-understanding-and-improving-length-generalization-in.md)
- [Improving Multi-Class Calibration through Normalization-Aware Isotonic Techniques](https://refivu.com/papers/b6c283c7-33a6-4837-bc33-2a99b929d4c9-improving-multi-class-calibration-through-normalization.md)
- [Dichotomy of Feature Learning and Unlearning: Fast-Slow Analysis on Neural Networks with Stochastic Gradient Descent](https://refivu.com/papers/d22616f1-d062-41c9-96ea-b861b94b978c-dichotomy-of-feature-learning-and-unlearning-fast-slow.md)
- [All ERMs Can Fail in Stochastic Convex Optimization Lower Bounds in Linear Dimension](https://refivu.com/papers/611959d0-945b-4f84-8df3-5f73eeb4b0d9-all-erms-can-fail-in-stochastic-convex-optimization.md)
- [Armijo Line-search Can Make (Stochastic) Gradient Descent Provably Faster](https://refivu.com/papers/2d604ce5-f2ec-49fe-88c5-5d0fd711c821-armijo-line-search-can-make-stochastic-gradient-descent.md)
- [Dimension-Independent Convergence of Underdamped Langevin Monte Carlo in KL Divergence](https://refivu.com/papers/206df735-cc15-48eb-9820-3e1c893270c1-dimension-independent-convergence-of-underdamped-langevin.md)
- [Energy-Based Flow Matching for Generating 3D Molecular Structure](https://refivu.com/papers/0c5ea30e-e1dd-4afa-b058-77baea5ad8b4-energy-based-flow-matching-for-generating-3d-molecular.md)
- [Diagonal Symmetrization of Neural Network Solvers for the Many-Electron Schrödinger Equation](https://refivu.com/papers/dc323c3a-1543-4d1b-af35-f33e841e1b65-diagonal-symmetrization-of-neural-network-solvers-for-the.md)
- [Learning to (Learn at Test Time): RNNs with Expressive Hidden States](https://refivu.com/papers/6a02f8bd-d757-4f00-9d97-6829bf6db29f-learning-to-learn-at-test-time-rnns-with.md)
- [Pareto-frontier Entropy Search with Variational Lower Bound Maximization](https://refivu.com/papers/4a68478a-a524-4679-9764-cc925c4b9ca0-pareto-frontier-entropy-search-with-variational-lower-bound.md)
- [PAK-UCB Contextual Bandit: An Online Learning Approach to Prompt-Aware Selection of Generative Models and LLMs](https://refivu.com/papers/513a246a-acb4-4fe6-a126-225b5f22a8c9-pak-ucb-contextual-bandit-an-online-learning-approach.md)
- [Towards a General Time Series Forecasting Model with Unified Representation and Adaptive Transfer](https://refivu.com/papers/7876f6d2-a5fe-4260-be88-ef1b85fea412-towards-a-general-time-series-forecasting-model-with.md)

---

AI 해설에는 오류가 있을 수 있습니다. [Refivu](https://refivu.com/papers/3f87239f-196c-4cf7-ad33-c79663a9d9c4-making-hard-problems-easier-with-custom-data-distributions)
