Overview
This paper explores how neural networks can learn to solve new algorithmic tasks when they lack access to step-by-step execution traces. The authors demonstrate that while traditional transfer learning techniques (like fine-tuning) fail in this domain, multi-task learning—training on a known algorithm with traces alongside the new one—effectively transfers "reasoning logic" and enables systematic generalization to larger, unseen graphs.
The Bottleneck in Neural Execution
In the field of "Neural Execution," researchers train Graph Neural Networks (GNNs) to mimic the behavior of classic algorithms, such as Dijkstra's or Breadth-First Search. Previous research established a "golden rule": to generalize well to larger problems than those seen during training, the model needs access to execution traces—the intermediate steps the algorithm takes.
However, in many real-world reasoning tasks (e.g., predicting links in a knowledge graph), we only have the input and the final output; the intermediate steps are unknown. This creates a significant bottleneck. The authors ask: Can we use an algorithm we already know well (for which we have traces) to help a model learn a similar new algorithm (for which we only have inputs and outputs)?
Methods and Architecture
The core of the approach relies on an Encoder-Processor-Decoder architecture. The "Processor" is a GNN that performs the core reasoning by passing messages between nodes.
Key Innovations
- NeuralExecutor++ (NE++): The authors found that previous models were too simple to handle complex logic. NE++ introduces a more expressive "latent encoder" that processes node and edge features together, allowing the model to learn non-linear operations (like the multiplication needed for probability-based paths).
- Transfer Strategies: They tested several ways to move knowledge from a "Base" algorithm (with traces) to a "Target" algorithm (without traces):
- Standard Transfer: Freezing the GNN weights of the Base and training only the encoders/decoders for the Target, or fine-tuning the whole network.
- 2-Processors: Running a frozen "expert" GNN and a trainable "student" GNN in parallel.
- Multi-task Learning (MTL): Training the model on both algorithms simultaneously. The Base algorithm provides the "supervision" (traces) that forces the GNN to learn valid algorithmic logic, which the Target algorithm then leverages.
- Trajectory Sampling: To stabilize training when no traces are available, they used Gumbel-softmax to sample multiple possible execution paths, backpropagating only through the most successful one.
Datasets and Evaluation
To evaluate these strategies, the authors established a new benchmark for algorithmic transfer featuring 9 algorithms and 3 graph types (Erdos-Renyi, Barabasi-Albert, and 2D-Grids).
Crucially, to test for true algorithmic reasoning rather than mere data memorization, models were trained on small graphs (20 nodes) and tested on much larger ones (50 and 100 nodes).
Key Insights and Results
- Reasoning is not Feature Extraction: In Computer Vision, transfer learning works because low-level features (like edges and shapes) are consistent across datasets. In algorithms, the features (like distances or weights) change drastically between tasks, even if the underlying logic (like picking the minimum value) is the same. Consequently, standard transfer fails. Techniques like freezing weights or fine-tuning often performed worse than training from scratch.
- The Expressivity Trap: Adding more power to a model (like NE++) helps it learn complex tasks (e.g., "Most Reliable Path"), but it increases the risk of overfitting. On simpler tasks, the more expressive model actually generalized worse than a simpler one because it found "shortcuts" in the training data that failed on larger graphs.
- MTL Wins: Multi-task learning acts as a powerful inductive bias and significantly improved performance. By forcing the GNN to satisfy the step-by-step requirements of a known algorithm, the model is "locked" into a reasoning manifold that helps it solve the trace-less target task correctly. For example, using Prim’s algorithm as a base helped the model learn Dijkstra’s much more effectively than learning Dijkstra’s in isolation.
- Size Generalization: Models trained with MTL were far more successful at solving problems on 100-node graphs after only seeing 20-node graphs, proving they had captured the underlying algorithmic structure.
Limitations and Future Work
The study is currently limited to static graphs and does not address graphs that change over time. Additionally, as the number of execution steps increases on larger graphs, small errors in the GNN's predictions can compound, eventually leading to failure. Finding ways to "self-correct" during execution remains a major open challenge. Finally, the algorithms studied are all linear-time; future work will need to explore if these techniques scale to NP-hard problems where reasoning is significantly deeper.
Summary updated