cs.LGNov 6, 2026

Semiprime Factorization with Discrete Diffusion and Beam Search: Scaling Laws

Authors: Brendan O Donoghue, Nenad Tomasev, Volodymyr Mnih, Timothy Nguyen, Dalin Guo, Arun Nair, Kenneth Yang, Alexandre Frechette, 

Organizations: Google DeepMind

Abstract

We demonstrate that transformer architectures trained with discrete denoising diffusion and decoded via guided test-time beam search can learn to recover the prime factors of semiprime integers directly from data. Our approach establishes a new frontier for learning-based semiprime factorization, successfully factoring 68-bit integers-a substantial advance over the prior 56-bit state of the art. While computationally less efficient than classical factoring algorithms, our model requires no domain-specific number-theoretic priors and learns purely from training examples. In practice, the diffusion model acts as a generative prior, identifying promising factor candidates where exact verification or lattice-based post-processing can complete the factorization. Furthermore, we derive empirical scaling laws relating approximation quality to training data volume, model size, and test-time computation. In contrast to language, problem size is the key driver of scaling behavior. Achieving a fixed accuracy on a held-out test set requires compute that scales exponentially with bit length. Consequently, our findings pose no threat to security, as the projected compute cost required to factorize cryptographically relevant integers remains prohibitive.

Figures & tables

Appendix figures & tables11 assets

Supplementary material from the paper’s appendix.

Appendix

Explore similar work

CardsList
  1. Testing Transformer Learnability on the Arithmetic Sequence of Rooted Trees

    Dec 1, 2025Alessandro Breccia, Federica Gerace, Marco Lippi +2TransformerAutoregressive Language Modeling

  2. Prime Fourier Embeddings: A Principled Basis for Modular Arithmetic

    Jun 22, 2026Hyunsang Hwang, Suhyun Bae, Donghun LeeFourier Feature EmbeddingsRepresentation Learning