From I/O to Code with Discovery Agent

Yihong Dong, Jiaru Qian, Haoran Zhang, Peixu Wang, Binhua Li, Zhi Jin, Yongbin Li, Ge Li, Xiaokang Yang, Xue JiangarXiv 2026

TL;DR

While Large Language Models (LLMs) excel at generating code from natural language descriptions, synthesizing programs purely from input-output examples (IO2Code) remains a major bottleneck due to the lack of semantic guidance. This paper introduces DIO-Agent, an evolutionary search framework that guides LLMs using execution feedback and a structural complexity prior called the Transformation Priority Premise (TPP). Evaluated on a new benchmark, IO2CodeBench, DIO-Agent significantly outperforms state-of-the-art code evolution baselines and test-time scaling strategies while maintaining high token efficiency.

What Problem Does This Paper Address?

Most recent breakthroughs in AI code generation operate under the NL2Code paradigm, where an LLM translates a natural language prompt (e.g., "Write a function to sort a list...") into executable code. This relies heavily on the semantic alignment between language and code that the model learned during pretraining.

However, real-world software engineering often lacks clean textual specifications. Developers frequently need to reverse-engineer black-box APIs, migrate legacy systems with lost source code, or deduce algorithms from scientific observations. This is the IO2Code problem: synthesizing a generalized program strictly from a limited set of input-output (I/O) behaviors.

Without natural language clues, LLMs face two major pitfalls in this massive hypothesis space:

  1. The Overfitting Trap: The model creates a giant, hard-coded lookup table that perfectly matches the training examples but fails completely on unseen data.
  2. The Blind Mutation Trap: In an unconstrained evolutionary search, the model randomly mutates code into structurally complex but semantically incorrect dead ends.
Figure 1: Illustration of IO2Code, where the mainstream NL2Code task evaluates the composition and reuse ability of LLMs, while the IO2Code task evaluates the induction and discovery ability.

Methods

To keep the search from wandering into complex dead ends, the authors propose DIO-Agent, an evolutionary framework built on three core pillars:

  1. Transformation Priority Premise (TPP) Guided Mutation: Borrowed from Test-Driven Development (TDD) principles in software engineering, TPP enforces a strict structural prior. The LLM is explicitly instructed to prefer the simplest possible code transformations first—progressing from constants to variables, then conditionals, loops, and finally recursion—only escalating complexity when simpler structures fail to explain the data.
  2. Curriculum-wise Evolution (CE): Instead of forcing the agent to solve all examples at once, the visible inputs are sorted from easy to hard. The agent tackles them stage-by-stage, allowing it to establish a clean foundational logic before refining it against edge cases.
  3. Error-Grounded Feedback (EF): When a generated program fails, a sandbox evaluator extracts concrete failure cases (mismatched outputs or runtime errors) and feeds them back into the prompt, turning the mutation process into an explicit debugging loop rather than a blind guessing game.
Figure 2: Overview of DIO-Agent.

Datasets

The authors introduced IO2CodeBench, a benchmark programmatically generated from deterministic oracle functions to ensure zero data leakage. It comprises 125 tasks divided into four difficulty tiers:

  • Base (62 tasks): Standard scalar arithmetic, list operations, and map/filter/reduce patterns.
  • Algorithm (35 tasks): Complex algorithmic reasoning, dynamic programming, and combinatorial logic.
  • Geometry (18 tasks): Spatial reasoning, area calculations, and coordinate transformations.
  • Multimodal (10 tasks): Grid images as inputs where the model must count shapes or identify spatial relationships by calling an external multimodal LLM tool.

Each task provides exactly 8 visible training examples and 15 hidden test cases to evaluate true generalization.

Key Insights and Ideas

  • Simplicity Breeds Generalization: Forcing the model to exhaust simpler hypotheses (like returning a constant or a single variable) before introducing loops prevents it from writing convoluted code that overfits.
  • Tracking Complexity Trajectories: The authors found that successful runs are highly correlated with continuous simplification (the code gets cleaner over time). Conversely, monotonic complexity growth is a strong indicator of "patch-work programming," where the model is simply stacking messy if-else statements to pass tests.
  • Iterative Search Beats Parallel Sampling: Simply throwing more compute at the problem via parallel sampling (like Best-of-N) is highly inefficient for program discovery. The correct algorithmic rule is rarely the most frequent one generated by the model's prior distribution; it must be uncovered through structured, feedback-driven iteration.

Key Results

DIO-Agent achieved state-of-the-art performance across all difficulty levels on IO2CodeBench. Using DeepSeek-v3.2 as the base model, it achieved an average success rate of 58.63%, outperforming competitive baselines like CodeEvolve (49.60%) and AlphaEvolve (47.29%).

Table 1: Main results between DIO-Agent and seven baselines on the IO2CodeBench, where the best results are shown in bold.
  • Multimodal Superiority: On the challenging Multimodal tier, DIO-Agent achieved a 40.67% pass rate, nearly doubling AlphaEvolve's 22.00%.
  • Test-Time Scaling: When compared against parallel sampling strategies (Direct, Self-Consistency, Best-of-N) at an equivalent sampling budget ($N=40$), DIO-Agent outperformed the strongest baseline by nearly 24 percentage points.
Figure 3: Comparison of DIO-Agent with test-time scaling methods.
  • Code Quality: Statistical analysis showed that DIO-Agent produced significantly shorter correct programs (112.1 tokens vs 154.8 for AlphaEvolve) and copied fewer direct examples from the prompt, proving it was discovering rules rather than memorizing data.
Figure 4: Comparison between DIO-Agent and AlphaEvolve. (a) DIO-Agent produces shorter cor- rect programs. (b) DIO-Agent reduces incorrect early stopping during search. (c) DIO-Agent copies fewer prompt example cases into the generated programs.

Limitations and Future Work

The authors noted two primary limitations:

  1. Domain Coverage: While IO2CodeBench spans arithmetic, algorithms, geometry, and multimodal tasks, many highly specialized programming domains remain unexplored.
  2. Fixed Example Uniformity: The benchmark uniformly provides a fixed number of I/O examples per task. In real-world applications, the quality and informativeness of examples vary wildly. Future work will investigate how strategically chosen boundary cases impact search effectiveness compared to large sets of routine examples.

Summary updated

BibTeX
@misc{dong2026from,
  author = {Yihong Dong and Jiaru Qian and Haoran Zhang and Peixu Wang and Binhua Li and Zhi Jin and Yongbin Li and Ge Li and Xiaokang Yang and Xue Jiang},
  title = {{From I/O to Code with Discovery Agent}},
  year = {2026},
  eprint = {2605.15334},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2605.15334},
}
Figure