Searching Latent Program Spaces

Clément Bonnet, Matthew V. MacfarlanearXiv 2024 · DOI

Abstract

The Latent Program Network (LPN) addresses the generalization gap in AI by bridging symbolic program synthesis and neural learning. LPN learns a continuous latent space of implicit programs and employs gradient-based search at test time to adapt to new tasks. This approach significantly improves performance on out-of-distribution challenges like the Abstraction and Reasoning Corpus (ARC-AGI), doubling accuracy compared to standard in-context learning methods.

Introduction

Artificial Intelligence currently faces a significant "generalization gap." Existing approaches typically fall into two categories: inductive symbolic methods and transductive neural methods. Symbolic methods search for explicit code in a Domain-Specific Language (DSL), offering strong generalization but suffering from combinatorial explosion. Neural methods, such as Large Language Models (LLMs), utilize in-context learning to map inputs to outputs; while they scale well, they often lack consistency and fail to apply learned logic to the very examples they were just shown.

This research focuses on the Abstraction and Reasoning Corpus (ARC-AGI), a benchmark designed to measure "fluid intelligence"—the ability to learn new rules from minimal examples. Current models struggle with ARC-AGI because they either overfit to training data or fail to adapt efficiently to novel rules at test time.

The Latent Program Network (LPN)

The authors propose the Latent Program Network (LPN), which represents programs as points in a continuous, high-dimensional latent space. The LPN architecture operates in three stages:

  1. The Encoder (System 1): Acting as an initial "gut instinct," the encoder processes a few input-output pairs to generate an initial latent program vector.
  2. Latent Optimization (System 2): This is the core innovation. Instead of relying solely on the encoder's first guess, the model performs gradient ascent in the latent space. It iteratively refines the latent vector to maximize the likelihood that the decoder will produce the correct outputs for the provided examples.
  3. The Decoder: The decoder "executes" the refined latent program. Given a new input and the optimized latent vector, it generates the predicted output.
The LPN architecture combines an encoder for initial guesses with a gradient-based latent optimization loop to refine programs before decoding.

LPN is trained using a Leave-One-Out (LOO) objective. During training, the model must reconstruct one output using a latent program derived only from the other examples in the set. This forces the model to learn generalizable abstractions rather than simple data memorization.

Experimental Setup and Datasets

The model was evaluated on several benchmarks:

  • ARC-AGI: Visual logic puzzles requiring human-like reasoning.
  • Pattern Task: A synthetic 2D grid task designed to test spatial patterns and out-of-distribution (OOD) shifts.
  • String Manipulation: A sequence-based task demonstrating that LPN's benefits are not limited to grid-based data.

Key Insights

A major finding is that the "likelihood landscape" of the latent space is surprisingly smooth, allowing simple gradient ascent to effectively "search" for programs. Furthermore, LPN scales gracefully with the number of examples. Unlike standard Transformers, which may overfit or fail when given more examples than seen during training, LPN's use of mean-pooling to aggregate information into the latent space allows it to improve as more evidence is provided.

Compared to standard Test-Time Training (TTT), which updates all model weights, LPN only updates a compact latent vector. This makes the adaptation process significantly more computationally efficient and robust against overfitting.

Results

The inclusion of latent search led to dramatic performance improvements. On out-of-distribution ARC-AGI tasks, LPN doubled its accuracy, reaching approximately 15.5% at higher compute budgets. In the "Pattern" task, LPN maintained 88% accuracy via latent search when faced with novel colors and shapes, whereas standard in-context learning models dropped to 0%.

Accuracy comparison across different training and inference methods. Gradient-based latent optimization (Grad 100) consistently outperforms zero-gradient inference.

Conclusion and Future Work

While LPN shows great promise, it is currently limited by the diversity of programs in its training set; it can only search within the "neighborhoods" of logic it has encountered. Future work will explore more sophisticated search algorithms, such as evolutionary strategies, and aim to scale the model to handle more complex, compositional programs. Integrating LPN with large-scale pre-trained models could combine broad "Core Knowledge" with the efficiency of latent program search.

Summary updated

BibTeX
@misc{bonnet2024searching,
  author = {Clément Bonnet and Matthew V. Macfarlane},
  title = {{Searching Latent Program Spaces}},
  year = {2024},
  eprint = {2411.08706},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2411.08706},
}
Figure