Compiling Known Rules into Compact Neural Agents: Weight-Space Programming on Unseen Games

Jens LehmannarXiv 2026 · arXiv

TL;DR

Can a language model "compile" its understanding of a task directly into the weights of a neural network? This paper explores Weight-Space Programming (WSP), finding that while frontier models can indeed write weights that solve unseen games, they essentially produce "programs in network form"—highly sparse, hand-tuned tensors that are far more fragile than trained networks and fail to benefit from standard reinforcement learning fine-tuning.

What Problem Does This Paper Address?

Training neural networks typically requires thousands or millions of examples. A more efficient alternative might be to have a reasoning agent (like a Large Language Model) analyze the rules of a task and directly "write" the parameters of a small, compact neural agent. This would create an agent that is fast to run, requires no training data, and—being a neural network—is theoretically differentiable and refinable via Reinforcement Learning (RL).

The authors investigate whether current frontier models can perform this "compilation" for complex, interactive tasks like games. They specifically look at whether these written weights generalize to unseen levels and whether the neural format offers any real advantage over simply writing a standard Python program.

Methods

The researchers established a rigorous protocol to test "WSP" across several conditions:

  1. The Writers: Nine frontier models (including GPT-6 and Claude 5.5 variants) acted as "writers." They were given the "mechanics-only" source code of a game—the simulator logic—but no information about specific levels or strategies.
  2. The Tasks: Writers had to produce an agent to play a game. They were tested in three output formats:
  3. Fixed Actor: Setting the weights for a predefined 57k-parameter recurrent convolutional network.
  4. Free Architecture (FreeArch): Designing a custom network topology and its weights using a restricted tensor language.
  5. Python Player: Writing a standard Python script (serving as a performance ceiling).
  6. The Comparison: Written agents were compared against "Learners"—the same fixed-actor architecture trained from scratch using standard methods like DAgger or PPO on a small set of "support levels."
Figure 1: Left: setup. A writer receives a game’s mechanics-only source and returns weights for the fixed actor, a network of its own design, or a Python player, one-shot (1) or with feedback (2). Learned baselines train the fixed actor on the support levels. Right: one state of the public game ls20 (ARC Prize Foundation, 2026) as published and under a template we constructed for this figure. The board and HUD are turned, player, collectibles, walls and the key frame are drawn in other styles, and colours are permuted, which changes 91% of the cells while the mechanics stay the same. The private templates vary geometry, object and HUD style and palette in this way.

Datasets

The study primarily used 20 privately authored game families designed in the style of ARC-AGI-3. Because these games were never published, the models could not rely on memorized solutions. Each family included multiple levels and various "renderer templates" that changed the visual appearance (colors, shapes) without altering the underlying mechanics. They also reported results on 25 public ARC-AGI-3 games as a secondary, potentially familiar tier.

Key Insights and Ideas

  • Programs in Network Form: On close inspection, the "neural networks" written by models weren't like the dense, noisy weight matrices produced by gradient descent. Instead, they were incredibly sparse: 93% of parameters were exactly zero, and the rest were mostly small integers or powers of two. The models were effectively writing code using tensors as their programming language.
  • Appearance Invariance: Unlike trained networks, which often overfit to specific pixel values, written weights generalized almost perfectly to new visual renderings. Because the models "understood" the rules, they built agents that looked for shapes and patterns rather than specific color IDs.
  • The "Neural Benefit" is a Myth (for now): One of the main hopes for WSP is that written weights provide a great starting point for RL. However, the authors found that standard PPO fine-tuning actually destroyed the performance of written agents. The written weights were so "brittle" that even the first small update from an RL algorithm removed most of their success.
  • Architecture Matters: Models performed significantly better when allowed to design their own network (FreeArch) rather than using a fixed one. This suggests that the difficulty in WSP isn't just calculating weights, but mapping logic onto a specific, rigid computational graph.

Key Results

  • Performance Gap: In the fixed-actor setting, the best writer (GPT-6 Astra) solved 56% of held-out episodes. In contrast, the same model's Python programs solved 100%.
  • Free Architecture Gain: When allowed to design the network, success jumped to 68–90% for the strongest models.
  • Writers vs. Learners: Learning the weights from examples transferred poorly, with a maximum success of only 11% on held-out levels. The writers' access to the source code provided a massive informational advantage.
  • Difficulty Scaling: As games got harder, the performance of written weights plummeted, while Python programs remained near-perfect.
Success rates by game difficulty. Written weights in the fixed actor (blue) degrade quickly, while Python programs (red) remain robust. Free architectures (yellow) bridge much of the gap.

Limitations and Future Work

The authors acknowledge several limitations:

  • Binary Success: The games used have a "win/loss" outcome per level, which provides a sparse reward signal that is notoriously difficult for RL fine-tuning.
  • Source Code Reliance: The writers were given the game's source code. Future work could explore if models can write weights after discovering rules through interaction, rather than reading them.
  • Program-like Tasks: The tasks were logical and grid-based. WSP might behave differently on "statistical" tasks (like image classification) where a symbolic, program-like solution is less obvious.

Ultimately, the paper concludes that while LMs can "compile" rules into networks, we are currently better off just letting them write Python. The dream of a "differentiable reasoning agent" that combines the best of symbolic logic and neural learning remains elusive.

Summary updated

Abstract

Weight-space programming (WSP) uses language models to construct neural network weights without training. We test whether known game mechanics can be compiled into compact agents that generalise to held-out levels, renderings and start states within a game family. Writers receive simulator source with held-out level data removed for 20 privately authored, unpublished ARC-AGI-3-style game families. With a fixed 57k-parameter recurrent architecture, the strongest writer reaches 56% held-out-level success with feedback, while the four main writers' Python players reach 97-100%. An exploratory free-architecture condition reaches 68-90%. Learning from support-level examples transfers much less well, but these learners lack the source information given to writers. Written networks have a program-like structure: 93% of parameters are zero, and 90% of the rest are small integers or powers of two. NumPy players under comparable computation caps reach 91%, versus the networks' 79%. Training the strongest writer's architectures from scratch yields about 1% success within our budget. Written fixed-network weights are fragile, and standard PPO removes most of their success. Prompts for noise robustness increase tolerance by about four orders of magnitude for two of three writers, but PPO makes larger updates and still removes most success. These results demonstrate rule-to-network compilation in this setting, while showing limited benefits over Python programs and no successful combination with the tested PPO fine-tuning.
BibTeX
@misc{lehmann2026compiling,
  author = {Jens Lehmann},
  title = {{Compiling Known Rules into Compact Neural Agents: Weight-Space Programming on Unseen Games}},
  year = {2026},
  eprint = {2611.16981},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.16981},
}
Figure