End-to-end Algorithm Synthesis with Recurrent Networks: Logical Extrapolation Without Overthinking

Arpit Bansal, Avi Schwarzschild, Eitan Borgnia, Zeyad Emam, Furong Huang, Micah Goldblum, Tom Goldstein

Abstract

Traditional neural networks excel at pattern recognition but often fail at algorithmic extrapolation—the ability to apply a strategy learned on simple problems to significantly more complex ones. This paper presents a "Deep Thinking" (DT) architecture that enables recurrent networks to learn scalable algorithms. By incorporating a "Recall" mechanism and a progressive training routine, the researchers mitigate the "overthinking" phenomenon where performance degrades with increased iterations. The resulting models demonstrate unprecedented scalability, solving 801x801 mazes after being trained only on 9x9 instances.

1. Introduction

A fundamental challenge in artificial intelligence is bridging the gap between pattern matching and algorithmic reasoning. While a human can generalize the logic of a small maze to a much larger one, standard neural networks typically fail when the problem size exceeds the training distribution. Recurrent Neural Networks (RNNs) offer a potential solution by iterating a shared set of weights to simulate "thinking time." However, these models often suffer from "overthinking": as the number of iterations increases beyond the training threshold, internal representations drift, leading to a total collapse in accuracy. This research aims to build models that can "think" indefinitely without losing their way.

2. Methodology

To address the instability of recurrent reasoning, the authors propose two key architectural and training innovations:

2.1 DT-Recall Architecture

In standard recurrent models, the input is provided only at the initial step. In the DT-Recall architecture, the original problem instance is concatenated to the feature stack at every iteration. This constant "re-reading" of the problem prevents the network from losing track of the goal during long chains of thought, effectively anchoring the reasoning process and allowing for self-correction if internal states become noisy.

2.2 Progressive Loss Training

To ensure the network learns iteration-agnostic behaviors, the authors employ an incremental training routine. Rather than training for a fixed number of steps, they take a partially processed state, detach it from the gradient graph, and train the model to make further progress over a randomized number of additional iterations. This forces the network to converge toward a stable fixed-point solution rather than a step-specific output.

3. Experimental Evaluation

The models were evaluated using the easy-to-hard-data benchmark suite, focusing on tasks where difficulty scales with input size:

  • 2D Mazes: Models were trained on 9x9 mazes and tested on sizes up to 801x801.
  • Prefix Sums: Computing modulo-2 sums of bit strings, training on 32-bit and testing on 512-bit strings.
  • Chess Puzzles: Predicting optimal moves on boards of increasing Elo difficulty.
Scaling from 9x9 training mazes to 801x801 test mazes.

4. Key Results and Insights

The DT-Recall model demonstrated remarkable extrapolation capabilities. On 59x59 mazes, it achieved 97.3% accuracy, whereas standard feed-forward and recurrent baselines failed completely. Most notably, the model successfully solved a "ridiculous" 801x801 maze—a task requiring 10,000 iterations, equivalent to the depth of a 100,000-layer convolutional network.

4.1 Convergence and Robustness

Analysis shows that DT-Recall models learn to reach stable fixed points where the change in internal features ($\Delta\phi$) approaches zero as iterations increase. Furthermore, the Recall mechanism provides significant robustness; the model can recover from internal state perturbations or noise by re-anchoring to the constant input. In chess puzzles, this stability provided a 4% accuracy boost on hard puzzles and maintained performance over hundreds of iterations, while baseline models began "overthinking" and losing accuracy after just 70 steps.

5. Conclusion

By stabilizing recurrent reasoning through input recall and progressive training, this research enables neural networks to synthesize scalable algorithms. While computationally intensive at inference time, this "Deep Thinking" approach provides a path toward AI systems that can solve complex logical problems by simply "thinking longer," mirroring human-like algorithmic generalization. Future work will explore halting mechanisms to optimize compute costs and the application of these principles to natural language processing.

Summary updated

BibTeX
@inproceedings{bansal2022end,
  author = {Arpit Bansal and Avi Schwarzschild and Eitan Borgnia and Zeyad Emam and Furong Huang and Micah Goldblum and Tom Goldstein},
  title = {{End-to-end Algorithm Synthesis with Recurrent Networks: Logical Extrapolation Without Overthinking}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2022},
  url = {https://openreview.net/forum?id=PPjSKy40XUB},
}
Figure