The Big Picture
Treating generated code as an editable reasoning trace and iteratively fixing it with execution feedback lets language models correct earlier mistakes and improves accuracy on hard math benchmarks.
ON THIS PAGE
Key Findings
IIPC creates programs that represent the model's reasoning, runs them, and then iteratively revises only the mistaken parts using deterministic execution feedback and a memory of past failures. A parallel text-only reasoning trace is kept separate and only merged at the end, which prevents over-reliance on possibly wrong program outputs. That combination of editable programs plus a safeguarded text trace leads to higher accuracy on difficult math datasets while keeping a verifiable record of the reasoning steps. execution feedback
Avoid common pitfallsLearn what failures to watch for
Data Highlights
1IIPC achieved the highest accuracy on the MATH and AIME benchmarks across 4 of the 5 large language models tested.
2Evaluation used 1,483 problems from a balanced MATH subset and 933 problems from the full AIME set.
3The refinement loop is constrained to at most 2 process validations and 2 error corrections per validation in the reported experiments.
What This Means
Engineers building AI agents that must explain and correct their reasoning will gain a practical approach for making model decisions auditable and fixable. ML researchers and technical leaders evaluating agent reliability can use the method and released traces to study failure modes, debugging strategies, and how execution feedback improves outcomes on hard reasoning tasks. Human-in-the-Loop Pattern
Key Figures

Fig 1: Figure 1: Overview of IIPC. f init f_{\text{init}} derives key propositions from the problem statement; f prog f_{\text{prog}} generates an initial candidate program; f val f_{\text{val}} evaluates program correctness and logical consistency; if errors are detected, the error correction component f err f_{\text{err}} revises the program accordingly; f cot f_{\text{cot}} produces a textual chain of thought; f comb f_{\text{comb}} combines program and token reasoning context for final output; M t M_{t} denotes the error descriptor memory at refinement step t t ; P t P_{t} represents the program store at step t t .

Fig 2: Figure 2: Accuracy of PoT, IIPC, CR, and MACM on the MATH dataset using Llama 4 Maverick. This bargraph is stratified by difficulty level

Fig 3: Figure 3: Heatmap of accuracy (%) by subject area on the MATH benchmark for Llama-4-Maverick. Columns correspond to reasoning agents (PoT, IIPC, CR, and MACM) and rows correspond to mathematical domains.

Fig 4: Figure 4: Accuracy by difficulty level for each LLM, comparing PoT, CR, MACM, and IIPC agents on the MATH dataset.
Ready to evaluate your AI agents?
Learn how ReputAgent helps teams build trustworthy AI through systematic evaluation.
Learn MoreConsiderations
The method is token- and compute-intensive because it runs and refines executable programs multiple times, which can be costly in production. Models with weaker coding or reasoning capacity may not benefit and in some cases perform better with simpler program-only approaches. Experiments focus on mathematical benchmarks and a fixed set of libraries, so generalization to other domains or toolsets needs further testing. state-inconsistency
Deep Dive
IIPC (Iteratively Improved Program Construction) treats generated code as an explicit, editable record of the model’s reasoning. The agent first extracts key propositions from the problem, then generates a candidate program (restricted to stable numeric and symbolic libraries, written without recursion and with verbose comments and print statements). The program is executed; the agent inspects outputs or errors, writes a concise reflection describing the flaw, stores that reflection in a memory of past mistakes, and revises just the offending code segments. A separate branch generates a purely textual chain of thought that remains independent of program outputs until the final integration step, which reduces over-dependence on potentially misleading execution results. memory Planning Pattern
Need expert guidance?We can help implement this
Credibility Assessment:
All authors have very low h-indices and no affiliations listed; arXiv preprint and zero citations.