Programming by Backprop: An Instruction is Worth 100 Examples When Finetuning LLMs

Jonathan Cook, Silvia Sapora, Arash Ahmadian, Akbir Khan, Tim Rocktäschel, Jakob Nicolaus Foerster, Laura Ruis

TL;DR

Researchers have introduced Programming by Backprop (PBB), a novel training regime that allows Large Language Models (LLMs) to "compile" abstract instructions directly into their weights. The study demonstrates a massive leap in training sample efficiency: a single declarative instruction (like a piece of Python code) can be as effective as 100 execution examples for teaching a model a new behavior.

What Problem Does This Paper Address?

LLMs typically learn in two ways: following a prompt "in-context" during inference, or being fine-tuned on thousands of demonstrations via Supervised Fine-Tuning (SFT). However, there is a massive gap between these two paradigms. While a human can read a rulebook and immediately start playing a game, LLMs generally require extensive "practice" (data) to internalize a behavior into their parameters.

The authors point out that much of the data LLMs see during pretraining is declarative—it consists of rules, algorithms, and descriptions. Yet, we mostly train them on procedural demonstrations. The core challenge is: Can we force a model to internalize the procedure described in an instruction without needing to show it hundreds of examples of that instruction being executed?

Methods

To bridge this gap, the authors propose Programming by Backprop (PBB), which treats the gradient descent process as a "compiler" that turns text instructions into executable model weights. They introduce two primary curricula:

Diagram illustrating the Proactive-PBB training curriculum.
  1. Proactive PBB: The model first learns a general "meta-mapping" between instructions and behaviors using a training set of paired instructions and examples. In the second stage, it is shown new instructions without any accompanying examples. The gradient update from simply modeling the text of these new instructions "programs" the corresponding behavior into the model.
  2. Retroactive PBB: The model first reads all instructions, acquiring declarative knowledge. Then, it is shown execution examples for only a subset of those instructions. This "activates" the latent knowledge, allowing the model to execute the instructions it hasn't seen examples for yet.

The researchers tested these methods using both standard fine-tuning (SFT) and Reinforcement Learning (specifically the GRPO algorithm).

Datasets

The study utilizes four distinct domains to validate PBB:

  • Random Arithmetic: 1,000 synthetically generated Python functions involving loops and conditionals to test procedural complexity.
  • Leetcode: 702 real-world competitive programming problems to test PBB on naturalistic, complex code.
  • Ciphers: Custom variations of Caesar and Vigenère ciphers to test out-of-distribution generalization and bias correction.
  • Formal Grammars: 200 unique Context-Free Grammars (CFGs) where the model must generate text that follows specific symbolic production rules.

Key Insights and Ideas

Chart showing the sample efficiency of PBB compared to standard execution examples.
  • The "100x" Rule: In the Random Arithmetic domain, training on a single instruction was equivalent to training on roughly 100 input-output examples. This suggests instructions are a far more "dense" way to update model behavior than raw data.
  • Latent Activation: Retroactive PBB proves that models can "know" a rule without knowing how to "do" it. Providing examples for other rules can flip a switch that makes the model's latent knowledge functional.
  • Code as the Best Language: Algorithms are internalized more effectively when expressed in Python code rather than natural language. The authors suggest this is due to the unambiguous, structural nature of code and the strong inductive bias LLMs have toward it from pretraining.
  • Implicit Execution: Models trained via PBB can execute complex logic in a single forward pass without needing Chain-of-Thought (CoT) reasoning, though CoT still improves overall performance.

Key Results

  • High Efficiency: On the Random Arithmetic task, a Qwen3-14B model reached 37% accuracy on test behaviors using the Proactive curriculum—a task where zero-shot performance is 0%.
  • Bias Correction: PBB can fix "data skew." If a model is trained on examples that mostly use a specific cipher shift (like ROT13), it usually struggles with other shifts. PBB allows the model to learn the general function from the instruction, overcoming the bias of the demonstration data.
  • RL Superiority: For Retroactive PBB, Reinforcement Learning (RL) was significantly more effective than SFT at "activating" latent knowledge. SFT tended to cause the model to simply memorize specific examples rather than generalize the rule.

Limitations and Future Work

Despite the breakthrough in efficiency, PBB-trained models are still less reliable than models given the same instruction in-context (via a prompt). The "programming" is "noisy"—the model internalizes the gist of the behavior but lacks the precision of a literal interpreter.

The authors also raise a significant safety concern: if instructions in training data can be implicitly "programmed" into a model via backprop, it implies that LLMs might be picking up unintended or "hidden" behaviors from their massive pretraining corpora that researchers haven't explicitly supervised. Future work will likely focus on how to make this "internalized" execution as robust as prompted execution.

Summary updated

BibTeX
@inproceedings{cook2026programming,
  author = {Jonathan Cook and Silvia Sapora and Arash Ahmadian and Akbir Khan and Tim Rocktäschel and Jakob Nicolaus Foerster and Laura Ruis},
  title = {{Programming by Backprop: An Instruction is Worth 100 Examples When Finetuning LLMs}},
  booktitle = {International Conference on Learning Representations},
  year = {2026},
  url = {https://openreview.net/forum?id=y1OWj26FCo},
}
Figure