Agentic AI
AI Agent Learns to Reverse-Engineer Code by Analyzing Input-Output Patterns
Researchers introduce DIO-Agent, a method that reconstructs program logic from computational behavior rather than natural language specifications.
Synthesizing working code directly from input-output examples has long resisted automation, even as language models have made rapid progress translating natural language into programs. A new approach tackles this harder problem by treating code recovery as an evolutionary search guided by an LLM and execution feedback.
The Challenge of IO2Code#
Natural language-to-code (NL2Code) systems benefit from the semantic overlap between how humans describe tasks and how code is written—both were part of the LLM's training data. By contrast, inferring program logic from bare input-output pairs (IO2Code) requires discovering underlying computational principles from limited examples, with vastly more possible solutions than actual correct answers. This makes the problem fundamentally more constrained and ambiguous.
How DIO-Agent Works#
Researchers at Carnegie Mellon University and Snap Research developed DIO-Agent, a discovery agent that performs iterative program synthesis through mutation and refinement. The method frames code recovery as an evolutionary search over program space, where the LLM proposes mutations and test execution provides concrete feedback on which paths to pursue. Rather than exploring all possibilities equally, the system embeds a Transformation Priority Premise—a built-in bias toward simplicity that starts with the simplest constructs (constants, arithmetic) and only escalates to conditionals or loops when simpler hypotheses fail against observed behavior.
Benchmarking and Results#
To enable systematic evaluation, the team introduced IO2CodeBench, a benchmark spanning multiple difficulty tiers. Across these tests, DIO-Agent outperformed both classical program-synthesis baselines and recent evolution-agent competitors, while demonstrating stronger performance gains per sample budget than standard test-time scaling approaches.
The work suggests that explicit search guidance combined with a prior favoring structural simplicity can substantially improve the sample efficiency of code synthesis from behavior alone.
Why It Matters#
Successful IO2Code could enable automated program recovery for reverse engineering, legacy system modernization, and repair of buggy or incomplete implementations—tasks where natural language documentation may be unavailable or unreliable.

