Learning to Add, Multiply, and Execute Algorithmic Instructions Exactly with Neural Networks
Artur Back de Luca, George Giapitzakis, Kimon Fountoulakis
Abstract
Neural networks are known for their ability to approximate smooth functions, yet they fail to generalize perfectly to unseen inputs when trained on discrete operations. Such operations lie at the heart of algorithmic tasks such as arithmetic, which is often used as a test bed for algorithmic execution in neural networks. In this work, we ask: can neural networks learn to execute binary-encoded algorithmic instructions exactly? We use the Neural Tangent Kernel (NTK) framework to study the training dynamics of two-layer fully connected networks in the infinite-width limit and show how a sufficiently large ensemble of such models can be trained to execute exactly, with high probability, four fundamental tasks: binary permutations, binary addition, binary multiplication, and Subtract and Branch if Negative (SBN) instructions. Since SBN is Turing-complete, our framework extends to computable functions. We show how this can be efficiently achieved using only logarithmically many training data. Our approach relies on two techniques: structuring the training data to isolate bit-level rules, and controlling correlations in the NTK regime to align model predictions with the target algorithmic executions.
Ask Lune
Know this paper in minutes, not an afternoon.
Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.
1 top-tier paper has cited it since. Know what they found before your reviewers do.
Lune can draw on
the full paper · the top-tier papers that cite it · related work
Free to start. No credit card required.
Lineage
- Looped Transformers as Programmable Computers cites Statistically Meaningful Approximation: a Case Study on Approximating Turing Machines with Transformers
- Looped Transformers as Programmable Computers cites Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
- Learning to Execute Graph Algorithms Exactly with Graph Neural Networks cites Looped Transformers as Programmable Computers
- Learning to Execute Graph Algorithms Exactly with Graph Neural Networks cites Statistically Meaningful Approximation: a Case Study on Approximating Turing Machines with Transformers
- Learning to Execute Graph Algorithms Exactly with Graph Neural Networks cites Transformers Can Do Arithmetic with the Right Embeddings
- Transformers Can Do Arithmetic with the Right Embeddings cites Looped Transformers as Programmable Computers
Cited by top-tier papers1
Builds on13
- Chain-of-Thought Prompting Elicits Reasoning in Large Language ModelsJason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma et al.NeurIPS 2022 · 22,562 citations
- Neural Tangents: Fast and Easy Infinite Neural Networks in PythonRoman Novak, Lechao Xiao, Jiri Hron, Jaehoon Lee et al.ICLR 2020 · 254 citations
- Looped Transformers as Programmable ComputersAngeliki Giannou, Shashank Rajput, Jy-yong Sohn, Kangwook Lee et al.ICML 2023 · 175 citations
- Statistically Meaningful Approximation: a Case Study on Approximating Turing Machines with TransformersColin Wei, Yining Chen, Tengyu MaNeurIPS 2022 · 117 citations
- Transformers Can Do Arithmetic with the Right EmbeddingsSean McLeish, Arpit Bansal, Alex Stein, Neel Jain et al.NeurIPS 2024 · 94 citations
Related papers
- Tensor Programs IIb: Architectural Universality Of Neural Tangent Kernel Training DynamicsGreg Yang, Etai LittwinICML 2021 · 81 citations
- Real-Valued Backpropagation is Unsuitable for Complex-Valued Neural NetworksZhi-Hao Tan, Yi Xie, Yuan Jiang, Zhi-Hua ZhouNeurIPS 2022 · 16 citations
- A generalized neural tangent kernel for surrogate gradient learningLuke Eilers, Raoul-Martin Memmesheimer, Sven GoedekeNeurIPS 2024 · 2 citations
- Deep Networks Provably Classify Data on CurvesTingran Wang, Sam Buchanan, Dar Gilboa, John WrightNeurIPS 2021 · 9 citations
- The Surprising Effectiveness of Infinite-Width NTKs for Characterizing and Improving Model TrainingJoshua DeOliveira, Walter Gerych, Elke A. RundensteinerAAAI 2025 · 1 citation
