# Interactive Program Induction with Language Model Priors

Robin Shing Moon Chan, Ryan Cotterell · arXiv · 2026-11-13

- **Problem** Finite input–output examples fit infinitely many programs that differ on unseen inputs, so recovering a program needs an inductive bias and further queries.
- **Method** Treats the target program as a Bayesian unknown, uses a language model as both prior and importance-sampling proposal, and chooses each query by expected information gain over a sampled evaluation set.
- **Results** Reached up to 22 percentage points higher accuracy than the CodeARC LM agent, with up to 10.5 fewer input–output examples.

![Figure 1: (a) Cumulative accuracy (top) and fraction of runs terminated (bottom) by round, for Alg. 1 under four query selection strategies, the CodeARC agent…](https://refivu.com/papers/92ea057b-2bf7-43ba-8d48-9e24e96e388c/figures/figure-4a4204d8d52eab7cb5e132db3ba0c13d.png?thumb=512)

**Figure 1** : (a) Cumulative accuracy (top) and fraction of runs terminated (bottom) by round, for Alg. 1 under four query selection strategies, the CodeARC agent (LM only), and the per-instance bound of Thm. 3.2 aggregated over the EIG runs. The termination panels use the runs whose initial particles contain the target’s class. A run is terminated once it reaches the total query budget. (b) The information the selected query is guaranteed to yield, γt, by round, averaged over the runs still querying and pooled across models. A dashed line marks the last round with at least 200 runs of that strategy still querying, which is where the strategy has typically terminated. 95% CIs over five seeds.

[Original paper](https://arxiv.org/abs/2611.18485v1) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Robin Shing Moon Chan, Ryan Cotterell · Interactive Program Induction with Language Model Priors · Original paper figure · Extracted the figure area from page 9 of the original PDF.

## Why finite examples leave the program open

A finite set of input–output examples fits infinitely many programs, and those programs can disagree on inputs the examples never show. Earlier systems avoid this by limiting the search to a hand-designed domain-specific language, which keeps the candidates enumerable but restricts what can be expressed. Language models trained on code describe a distribution over programs in a general-purpose language, yet used as one-shot inductors they give little control over which consistent program is chosen.

The study asks instead how a learner that picks its own inputs and asks an oracle for their outputs can recover a target program in such a language, and how many oracle queries that takes.

## Treating the target program as a Bayesian unknown

The learner starts from a prior \\(p\_0\\) over programs, which carries the inductive bias, and an input distribution \\(\\mu\\) that fixes where agreement with the target is measured.

Exact equivalence of computable functions is undecidable, so the paper relaxes it in two steps. The first step calls \\(f\\) equivalent to \\(f^\\star\\) at tolerance \\(\\epsilon\\) when the error under \\(\\mu\\), \\(\\Pr\_{x\\sim\\mu}\[f(x)\\neq f^\\star(x)\]\\), is at most \\(\\epsilon\\). The second step draws \\(N\\) inputs from \\(\\mu\\) and calls two programs equivalent when they agree on every sampled input, a condition that can be checked on observed data.

Proposition 2.1 bounds the error of each program in the target's class with high probability over the draw of the sample: \\\[ \\mathrm{err}\_\\mu(f)\\le\\frac{\\ln(1/p\_0(f))+\\ln(1/\\delta)}{N} \\\] holds for every such program with probability at least \\(1-\\delta\\). A program with more prior mass therefore gets a tighter bound from the same sample.

Because the classes are what the inference tracks, the target is identified through the mass each class collects: \\(p\_\\sim(\[f\]\_\\sim\\mid D\_t)\\) sums the posterior over the members of a class.

## Choosing each query by expected information gain

Queries come only from the evaluation set \\(S\\), since the classes are defined there: programs in one class agree on every input in \\(S\\), so an answer never splits a class. The input chosen at each round maximizes the expected drop in entropy of the class distribution: the entropy before the query minus the posterior-predictive-weighted entropy after each possible answer, \\\[ x^{(t)}=\\arg\\max\_{x\\in S}\\;H\[p\_\\sim(\\cdot\\mid D\_{t-1})\]-\\sum\_{y}p(y\\mid x,D\_{t-1})\\,H\[p\_\\sim(\\cdot\\mid D\_{t-1}\\cup\\{(x,y)\\})\] \\\]

After the oracle answers, the posterior is updated through its recursive form and the class masses are recomputed. The loop stops at the first round in which one class holds more than half of the pushforward mass, and the returned program is drawn from that class.

## Query counts and when the answer is right

Theorem 3.1 averages over targets drawn from the prior: the greedy rule's total guaranteed information over a run is at most the prior class entropy \\(H\[p\_\\sim(\\cdot\\mid D\_0)\]\\), measured in bits. If every query guarantees at least \\(\\gamma\>0\\) bits, the expected number of queries is at most \\(H\[p\_\\sim(\\cdot\\mid D\_0)\]/\\gamma\\).

Under those conditions the number of rounds is at most \\\[ \\left\\lfloor \\frac{1}{\\gamma}\\log\_2\\frac{1}{2\\,p\_\\sim(\[f^\\star\]\_\\sim\\mid D\_0)}\\right\\rfloor+1 \\\] Theorem 3.2 does not use the greedy rule, so the bound also covers other selection rules over \\(S\\), each with the guaranteed information of its own queries.

A wrong class is returned only when some class with prior mass strictly above \\(p\_\\sim(\[f^\\star\]\_\\sim\\mid D\_0)\\) stays consistent with every query. So when no class outweighs the target's class under the prior, the algorithm returns the target's class within that bound.

A non-adaptive strategy that labels random inputs needs on the order of \\(\\log(1/\\delta)/\\epsilon\\) labeled inputs, and that count grows as \\(\\epsilon\\) shrinks. The adaptive bound depends on how plausible the target is under the prior, not on \\(\\epsilon\\).

The paper checks this trade-off empirically in its evaluation set size ablation.

## Estimating the posterior with a language model

The posterior sits on a countably infinite support, so neither the posterior nor its entropy can be computed exactly. The method instead draws weighted programs from a language model and computes class masses from those weights. The model is prompted with the observed input–output examples, so the proposal \\(q\_t(x)=p\_{\\mathrm{LM}}(x\\mid\\mathrm{prompt}(D\_t))\\) is defined over implementations, and the program prior \\(p\_0\\) is the proposal before any query.

Distinct implementations can compute the same function, and the equivalence relation collapses those that agree on \\(S\\) into one class. Each particle gets an importance weight equal to its prior density times the consistency indicator, divided by its proposal density: \\\[ w\_m=\\frac{p\_0(f\_m)\\prod\_{(x,y)\\in D\_t}\\mathbf{1}\\{f\_m(x)=y\\}}{q\_t(f\_m)} \\\]

Class masses are estimated by self-normalized importance sampling as the weighted share of particles in each class, \\(\\hat p\_\\sim(c\\mid D\_t)=\\sum\_{m:f\_m\\in c}w\_m/\\sum\_m w\_m\\). Entropy and the posterior predictive are then plug-in estimates computed from the same weights, and the greedy step maximizes over \\(S\\) using these estimates. When the effective sample size falls below the threshold \\(\\tau\_{\\mathrm{ESS}}\\), the particles are redrawn from the current proposal.

## CodeARC setup and comparison conditions

The evaluation uses the CodeARC benchmark, whose 1114 Python functions come from HumanEval+, MBPP+ and APPS. The anonymized split replaces function names with a generic identifier, and each task is run with one or with ten seed invocations. Each task has a budget of 30 input–output pairs, and the seed invocations count toward that budget.

The CodeARC agent may also issue 2 equivalence queries, while the proposed algorithm issues none and submits its returned program once.

Six instruction-tuned models are compared: Llama3.2-3B, Llama3.1-8B, Qwen2.5-7B, Qwen2.5-32B, Olmo3-7B and Ministral-8B. Correctness is judged by the differential testing tool MOKAV, whose test-generating model is fixed to Qwen2.5-32B for every model and both methods. The input distribution is conditioned on all 10 seed invocations and kept fixed across settings, independent of which seed invocations are shown.

## Accuracy and oracle cost against the CodeARC agent

Table 1 compares the proposed algorithm with the CodeARC LM agent on average input–output examples observed and accuracy, under one and ten seed invocations.

The authors attribute the remaining gap to perfect accuracy to the models' general ceiling in proposing code that matches the shown pairs. Early termination is a recurring problem, which the authors tie to early concentration of the posterior; this is the case the per-instance bound does not cover. Table entries carry 95% confidence intervals over seeds, so differences should be read against those intervals.

## Query selection and evaluation set size

Within the proposed algorithm, expected information gain is compared with uncertainty, diversity and random selection.

Figure 1 tracks accuracy and termination by round for each strategy, and the guaranteed information of the selected queries by round. The bound of Theorem 3.2 is attained in .37 of the EIG runs.

The evaluation set size \\(N\\) was varied from 2 to 256 for three models. As \\(N\\) grows, convergence on the target's class becomes rarer, while accuracy given convergence rises. The authors read the rising conditional accuracy as the effect of agreeing on more sampled inputs, which leaves fewer disagreements on unseen ones.

## Prior majority class calibration

The calibration plot relates the accuracy of the prior majority class to the prior mass of the largest class, with an ECE per model in the legend. The authors also note that CodeARC targets may not match the programs humans would consider plausible, so calibration against human plausibility could differ.

## Limits of the guarantees and the evidence

The guarantees are stated for the exact posterior, while the implementation uses a finite particle budget, and with finite particles the set may miss the target's class entirely. A wrong class can also exceed the threshold before enough particles fall in the target's class, which the authors say the prior's miscalibration makes common. The importance weights use LM probabilities of the extracted code, not the completion probabilities of the sampled text, so they approximate the exact weights.

The PAC certificate holds for the returned program only conditional on the algorithm returning the target's class. Experiments use only the CodeARC benchmark and six instruction-tuned models. The CodeARC agent with 2 equivalence queries has strictly more oracle access than the proposed algorithm, so that setting is the stronger baseline. Noisy oracles are named as a direction the framework could extend to, and they were not tested.

## Paper info

- **Authors**: Robin Shing Moon Chan, Ryan Cotterell
- **Venue**: arXiv · Preprint
- **First published**: 2026-11-13
- **Added**: 2026-11-16
- **Updated**: 2026-11-13
- **Version**: v1
- **arXiv**: 2611.18485
- **Category**: cs.CL · cs.AI · cs.LG
- **Original paper terms**: [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)
- **What we show**: Paper info, commentary and permitted figures from the original paper

[Original paper ↗](https://arxiv.org/abs/2611.18485v1) · [PDF ↗](https://arxiv.org/pdf/2611.18485v1)

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

## Abstract

Program induction refers to the process in which a learner aims to recover a program from a few given input-output examples. This paradigm broadens programming access by letting users demonstrate the rule-based behavior they want to apply to unseen data, instead of having to implement it themselves. However, recovering a program from finite input-output examples is fundamentally ambiguous, as a finite set of input-output examples is theoretically consistent with infinitely many programs whose output diverges on unseen inputs. We view this problem from a Bayesian perspective, where, given a prior $p^0$ over programs, identifying the target program means concentrating posterior probability mass on it by observing additional input-output examples. In the interactive program induction setting, the learner chooses maximally informative inputs and queries an oracle, such as the user, for their outputs. We derive a greedy query-selection algorithm and show that it terminates after $\\mathcal{O}(\\frac{1}γ\\log 1/p^0(f^\\star))$ informative oracle queries, and returns the target program $f^\\star$ up to approximate equivalence when no other class outweighs it under the prior. The algorithm uses a language model as the prior under a PAC-style relaxation of program equivalence, where the query-selection objective is estimated using importance sampling. On the CodeARC benchmark, the algorithm improves accuracy over the LM only agent by up to 22 percentage points while observing up to 10.5 fewer input-output examples.

## Quote from the paper

Robin Shing Moon Chan, Ryan Cotterell (2026). Interactive Program Induction with Language Model Priors. arXiv:2611.18485v1. https://arxiv.org/abs/2611.18485v1

**BibTeX**

```
@misc{chan2026interactive,
  title = {{Interactive Program Induction with Language Model Priors}},
  author = {Robin Shing Moon Chan and Ryan Cotterell},
  year = {2026},
  eprint = {2611.18485},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.18485v1}
}
```

## Other paper commentary

- [JFinBench: A Continuously Refreshable Japanese Financial Benchmark from the Latest Certification Exams](https://refivu.com/en/papers/507f003d-f0bb-48de-a7b8-b4a9727995ee-jfinbench-a-continuously-refreshable-japanese-financial.md)
- [PerfArena: Ranking LLMs by Code Performance](https://refivu.com/en/papers/c040cebb-8cde-4fb3-b12d-79a3fe746bfa-perfarena-ranking-llms-by-code-performance.md)
- [Fuse-All MoE Inference Kernel with Load Balancing on TPUs](https://refivu.com/en/papers/9cb74dcd-e120-4e43-b2b0-37dad7ccf356-fuse-all-moe-inference-kernel-with-load-balancing.md)
- [Right Token, Right Time: From Per-Token Gating to Trajectory-Aware Activation Steering](https://refivu.com/en/papers/0f4151bb-65f7-42ff-9693-d1cea802586a-right-token-right-time-from-per-token-gating.md)
- [GraphScent: Calibrating Directional Relevance Signals for Bounded-Context Code Localization](https://refivu.com/en/papers/f485b130-6849-48e3-832f-e8d259afa756-graphscent-calibrating-directional-relevance-signals-for.md)
- [Superfluid: Local AI Server for Distributed LLM Inference](https://refivu.com/en/papers/8e6a37d1-98da-443c-a248-1340a46ef81c-superfluid-local-ai-server-for-distributed-llm-inference.md)
- [Explanations that Transfer: Interpreting Medical Retrieval with Sparse AutoEncoders](https://refivu.com/en/papers/fcc9b660-cb5e-4a36-99e8-e9d43824526d-explanations-that-transfer-interpreting-medical-retrieval.md)
- [Small Is Not Dead: Distance-Aware Cluster Revival for e-means](https://refivu.com/en/papers/f2b6f05d-7401-4871-be99-b749f117115c-small-is-not-dead-distance-aware-cluster-revival.md)
- [FEND: Far-End Detection in Outbound Voice AI Calls](https://refivu.com/en/papers/8f9be405-cbfb-49aa-8c22-204722d38a37-fend-far-end-detection-in-outbound-voice-ai.md)
- [Who Counts as Exposed? Measurement Choices in an Open, Re-estimable Index of Occupational AI Exposure](https://refivu.com/en/papers/bc2cfc93-d47d-40b5-b11c-31874b253264-who-counts-as-exposed-measurement-choices-in-an.md)
- [Cracks in Embeddings: Robustness and Stability of JEPA-Based Chest X-Ray Representations](https://refivu.com/en/papers/daee5a77-a7ae-4a85-aa91-3c0350658e14-cracks-in-embeddings-robustness-and-stability-of-jepa.md)
- [Tracing Uncertainties of Extreme El Niño Prediction to Mesoscale Ocean Currents](https://refivu.com/en/papers/e50737f2-d670-42f4-9b3c-5a4a5eaf3da4-tracing-uncertainties-of-extreme-el-nino-prediction-to.md)

## Terms in this paper

- [Accuracy](https://refivu.com/en/terms/1995c0cd6282-accuracy)
- [importance sampling](https://refivu.com/en/terms/f730041e2218-importance-sampling)
- [effective sample size](https://refivu.com/en/terms/e4b72ae2c498-effective-sample-size)
- [ECE](https://refivu.com/en/terms/ac26c4c348fc-ece)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/92ea057b-2bf7-43ba-8d48-9e24e96e388c-interactive-program-induction-with-language-model-priors)
