NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

NeuralSolver: Learning Algorithms For Consistent and Efficient Extrapolation Across General Tasks

Bernardo Esteves, Miguel Vasco, Francisco S. Melo

TL;DR

NeuralSolver is a novel recurrent neural network architecture designed to learn general algorithms on small-scale problems and successfully execute them on much larger, unseen scales. By combining a convolutional LSTM with a flexible aggregation module and curriculum training, it achieves state-of-the-art extrapolation performance while using 90% fewer parameters than previous methods.

The Extrapolation Challenge

Standard machine learning models are excellent at pattern recognition but notoriously poor at extrapolation—the ability to apply learned logic to a harder or larger version of the same task. For example, a model trained to solve $7 \times 7$ mazes often fails completely when presented with a $128 \times 128$ maze.

Extrapolation across different maze sizes

Recent research has explored "recurrent solvers," which use iterative processing (looping through the same layers) to simulate the "thinking time" needed for complex reasoning. However, these existing solvers have a major limitation: they generally only work for "same-size" tasks where the input and output dimensions are identical (like image-to-image mapping). They struggle with "different-size" tasks, such as classification or decision-making, where a large input must be distilled into a single action or label.

The NeuralSolver Architecture

The authors introduce NeuralSolver, which breaks the problem down into three core components to handle both same-size and different-size tasks effectively:

  1. Recurrent Module (The "Thinker"): Instead of standard residual blocks, NeuralSolver uses a Layer-Normalized Convolutional LSTM. This allows the model to iteratively process spatial information at different scales. Crucially, it constantly "recalls" the original input at every step, preventing the network from forgetting the problem details as it iterates.
  2. Processing Module (The "Aggregator"): To handle tasks where the output size differs from the input, the authors added a processing block with an optional Global Max-Pooling layer. This allows the model to compress a variable-sized internal representation into a fixed-size output (like a 4-way action vector for a maze).
NeuralSolver architecture for different-size tasks
  1. Curriculum-Based Training: The model is trained using a curriculum that starts with very small problems and gradually increases the dimensionality. This helps the model learn the underlying algorithm rather than just memorizing specific spatial patterns.

Key Insights and Performance

NeuralSolver treats recurrence as algorithmic execution. The core insight is that recurrence isn't just for sequences; it's a way to give a model "computational depth." By iterating more times at test time than during training, the model can "think longer" to solve larger problems.

Previous recurrent solvers often suffered from performance degradation if they ran for too many iterations. NeuralSolver’s use of LSTMs and constant input recall makes it remarkably stable, maintaining perfect accuracy even when the number of iterations is increased ten-fold.

Remarkable Results

  • Perfect Extrapolation: NeuralSolver achieved 100% accuracy on several tasks (Prefix-Sum, Maze, GoTo, Pong) even when the test problems were 5 to 16 times larger than the training examples.
  • Massive Parameter Reduction: It outperformed previous state-of-the-art models while requiring 90% fewer parameters and roughly 30% of the computational cost.
  • Zero-Shot Scaling: In a simplified one-step maze task (1S-Maze), the model was trained on sizes up to $13 \times 13$ and successfully solved $512 \times 512$ mazes—a massive leap in scale that previous models could not handle.

Limitations and Future Work

While NeuralSolver is highly efficient, training efficiency remains a challenge for very complex tasks like Chess, where it still requires significant time to converge.

Additionally, while the model excels at "one-shot" decision-making, future work should explore integrating this architecture into Reinforcement Learning (RL) frameworks. This would allow agents to learn complex, sequential policies on small environments and deploy them in massive, open-world simulations without further training. Finally, while the internal states show clear "propagation" of information, more work is needed to fully interpret the "algorithms" the network is actually inventing.

Summary updated

BibTeX
@inproceedings{esteves2024neuralsolver,
  author = {Bernardo Esteves and Miguel Vasco and Francisco S. Melo},
  title = {{NeuralSolver: Learning Algorithms For Consistent and Efficient Extrapolation Across General Tasks}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=IxRf7Q3s5e},
}
Figure