Source-linked AI summary

ANTE: Anticipate, Then Execute -- Learning Internal World Models for Coding Agents from Verified Beliefs

Yi Ge, Kangrui Ruan, Jifan Chen, Manish Prajapat, Christian Bock, Xiaoyang Wang, Rein Houthooft, Aritra Sengupta, Varun Kumar

arXiv:2610.15368v1cs.LG

TL;DR

Outcome-based RL rewards only the final task result rather than directly training agents to predict action effects, while code world models do not combine verified forecasts with per-step policy credit. ANTE has the policy state an outcome forecast and trust-or-abstain decision before each action, verifies forecasts through execution, and uses them for BAPO credit and test-time candidate ranking. ANTE-32B reaches 57.2% on SWE-bench Verified and improves average performance by 6.2 percentage points over a matched RL baseline without the belief state across eleven out-of-distribution benchmarks.

  • Problem

    Outcome-based RL rewards only the final task result rather than directly training agents to predict action effects, while code world models do not combine verified forecasts with per-step policy credit.

    Source: §1 · p. 1
  • Method

    ANTE has the policy state an outcome forecast and trust-or-abstain decision before each action, verifies forecasts through execution, and uses them for BAPO credit and test-time candidate ranking.

    Source: §1 · p. 2
  • Results

    ANTE-32B reaches 57.2% on SWE-bench Verified and improves average performance by 6.2 percentage points over a matched RL baseline without the belief state across eleven out-of-distribution benchmarks.

    Source: §1 · p. 2
  • Takeaways & Limitations

    The learned internal belief tracks what has happened, what the code does now, and what the next command will change, with foresight reported to transfer across harnesses and domains.

    Source: §5 · p. 10

    Proposition 2 bounds one-step selection regret for candidates with execution outcome laws and belief forecasts, under a bounded utility score.

    Source: §3.3 · p. 5

Abstract

from arXiv · show

Rapid advances in large language models have made software engineering agents capable of tackling complex coding tasks. Within a containerized environment, a coding agent receives tool responses or execution results, and determines its later actions by those earlier results. However, most existing coding agents never look ahead: their policies do not anticipate the consequences of actions, and the terminal reward barely attributes a failure to certain earlier steps, so an ill-judged edit can corrupt the repository state irreversibly before any signal arrives. Recent code world models aim to address these challenges, but they are either trained and then frozen before reinforcement learning (RL), or reduced to an auxiliary next-token loss on the environment's outputs. We present ANTE (Anticipate, Then Execute), an agentic RL framework that verifies the policy's pre-action predictions by real execution and turns them into per-step credit for its actions and trust-or-abstain decisions. With an internal belief stated before each action, Belief-Anchored Policy Optimization (BAPO) turns the settled predictions into per-step advantages by anchoring credit on the policy's own forecasts. To turn the trained forecasts into better actions at inference, thereby facilitating effective test-time scaling, ANTE-TTO (test-time optimization) selects among candidate actions without an external scorer. ANTE raises Qwen3-32B from 25.0% to 57.2% pass@1 on SWE-bench Verified, 6.2% above a matched GRPO baseline trained without the belief state; its world model's accuracy climbs from 44% to 69% during RL, and the learned foresight capability transfers across harnesses and out-of-distribution domains. In summary, we aim to build a code world model that knows what has happened, what holds now, and what the next action will achieve.

1 Introduction

Coding agents often act on tool results without forecasting an edit’s consequences, while terminal-only rewards do not directly train action-level prediction. ANTE states and verifies forecasts before execution, uses them for per-step credit, and selects actions from their forecasts at inference.

1 Introduction

  • Outcome-based RL rewards only the final task result, so it does not directly train agents to predict each action’s effects; an edit can pass its target test yet break another.The introduction contrasts reactive and retrospective agents that miss such side effects.Source: §1 · p. 1
  • ANTE writes a belief before each action, including an outcome forecast and a trust-or-abstain decision, then learns from execution feedback.Its internal belief tracks what has been established, what the code does, and what the next command will change.Source: §1 · p. 2
  • BAPO compares steps across rollouts that predict the same outcome and assigns per-step credit from verified forecasts and trust decisions.This adds step-level credit beyond the final task reward.Source: §1 · p. 2
  • At inference, ANTE-TTO samples alternatives when the policy abstains or predicts failure, ranks them by their own forecasts, and executes the highest-ranked candidate without an external scorer.The introduction reports improved task success at 7B with approximately 31% additional inference tokens over a single greedy attempt.Source: §1 · p. 2
  • The motivating example shows ANTE anticipating that an edit would break other tests, choosing an alternative fix, and confirming that the full test suite passes.The figure caption also reports that resolve rate and prediction hit rate rise together under RL.Source: §1 · p. 2, Figure 1 · p. 2
  • ANTE-32B reaches 57.2% on SWE-bench Verified, outperforming all compared open-weight agents above 30B; across eleven out-of-distribution benchmarks, it improves average performance by 6.2 percentage points over a matched RL baseline.The matched RL baseline was trained without the belief state.Source: §1 · p. 2

2 Related Work

Prior code world models either are not checked or rewarded during RL, model the environment outside the policy, or train on output losses without an explicit pre-action forecast. ANTE verifies forecasts through execution and uses them for policy credit and inference-time candidate ranking.

2 Related Work

  • Prior code world models include execution predictors trained before RL, external learned simulators or executable programs, and auxiliary losses on environment outputs.The cited approaches differ in whether prediction is checked or rewarded during RL.Source: §2 · pp. 2–3
  • Prior belief-reward approaches compare beliefs with true states using judges or embedding similarity, while T3 keeps beliefs implicit and leaves them unsupervised.The related-work discussion notes that judge-based rewards can be prone to reward hacking.Source: §2 · p. 3
  • BAPO groups steps across rollouts by shared forecasts, unlike methods that compare identical states or predefined belief predicates.The passage also contrasts BAPO with implicit process reward models and execution-grounded reasoning within individual programs.Source: §2 · p. 3

3 ANTE: Learning to Predict Before Acting

ANTE makes a coding agent state a belief before acting, then trains and uses those forecasts through execution feedback. Its pipeline combines belief-augmented SFT, execution-grounded RL with BAPO credit, and forecast-based test-time action selection.

3.1 Problem Formulation

  • A belief state records a summary of what is established and broken, a verifier-readable outcome forecast, and a trust-or-abstain decision before each action.The verifier reads the check result and whether the command exited cleanly from execution.Source: §3.1 · pp. 3–4

3.2 Stage I (ANTE-SFT): Supervised Fine-Tuning on BeliefTraj

  • Stage I uses SFT on BeliefTraj, execution-environment solving trajectories annotated at each step with a belief state and outcome forecast.The forecast label comes from the logged next observation; the decision label is assigned when the corpus is built.Source: §3.2 · p. 4
  • Stage I’s imitation bound includes a hindsight-induced remainder Λ that imitation cannot recover, which Stage II addresses.The passage says minimizing cross-entropy drives down the other term, bringing policy success toward demonstration success up to Λ.Source: §3.2 · p. 4

3.3 Stage II (ANTE-RL): Belief-Anchored Policy Optimization

  • Stage II trains on the policy’s own rollouts, using execution-derived prediction targets, decision rewards for trust or abstention, and episode-level task rewards.The prediction loss supervises forecasts; the policy-gradient update adds belief-anchored per-step credit on eligible steps.Source: §3.3 · p. 5
  • Proposition 2 bounds one-step selection regret for candidates with execution outcome laws and belief forecasts, with tighter bounds when candidate-specific forecast divergences are smaller.The proposition considers a bounded utility score over candidates.Source: §3.3 · p. 5
  • Trusting a correct forecast earns +α, trusting an incorrect one incurs −γ, and abstention incurs a fixed cost κ on conclusive steps.The trust reward is positive in expectation only above the target forecast accuracy q*; as forecasts improve, the policy drops corpus abstention before reaching that target.Source: §3.3 · p. 5
  • BAPO compares decision returns for steps sharing a forecast across rollouts, then anchors per-step credit on forecast and forecast–decision groups.This permits comparison regardless of trajectory position; its belief-relative and decision-relative advantages adjust episode-level credit.Source: §3.3 · p. 6, Figure 3 · p. 6

3.4 ANTE-TTO: Action Selection by the World-Model Prediction

  • ANTE-TTO resamples when the policy abstains or predicts failure, ranks alternatives alongside the original by their forecasts, and executes the highest-ranked candidate without changing weights.It uses no external scorer or extra best-of-n executions.Source: §3.4 · p. 7

4 Experiments

Across repository and terminal tasks, ANTE outperforms its matched baselines, and its gains extend to out-of-distribution reasoning benchmarks. Test-time candidate selection improves success with lower inference-token cost than TTS-4, while analyses show forecasts sharpen during RL and guide more robust fixes.

4.1 Experimental Setup

  • The experiments use repository issues with R2E-Gym at 7B, 14B, and 32B, and terminal tasks with the Tmax agent at 9B, with matched baselines and evaluation settings.ANTE-TTO runs one trajectory per task and samples three alternatives at trigger steps; other entries use single greedy attempts.Source: §4.1 · pp. 7–8

4.2 Main Results

  • 57.2% pass@1 on SWE-bench Verified at 32B; ANTE leads both baselines at every scale and on every terminal benchmark.Without BAPO, the belief state improves over Reactive by 1.0–3.2 points on SWE-bench Verified and 4.0–5.5 on terminal tasks; BAPO adds 1.8, 2.6, and 3.0 points at 7B, 14B, and 32B. Above 30B, ANTE leads SWE-World, FrogBoss, CWM, and every 72B method; ANTE-9B leads compared terminal agents below 20B, including ECHO.Source: Table 1 · p. 8, Table 2 · p. 8, §4.2 · p. 8

4.3 Out-of-Domain Generalization

  • ANTE-32B leads Reactive-RL on all eleven out-of-distribution benchmarks by 6.2 points on average, with the largest gains on AIME’25 and MMLU-Pro.The matched methods share the backbone, trajectories, and training procedure and differ only in the belief and its signals.Source: §4.3 · p. 9, Table 3 · p. 9

4.4 ANTE-TTO: Gains and Overhead of Test-Time Foresight

  • ANTE-TTO improves task success at every scale by resampling only trigger steps, ranking candidates by their beliefs, and executing one candidate.Its inference-token cost is 1.31× versus 4.42× for TTS-4 at 7B, and 1.6× versus 4.1× averaged over four settings.Source: §4.4 · p. 9, Figure 4 · p. 9

4.5 Why ANTE Works

  • 44% to 69%: at 32B, conclusive-prediction hit rate rises during RL as the trust rate doubles and abstention concentrates on uncertain steps.In the case study, ANTE scopes a UnicodeDecodeError fix to Python 2 and uses the native-string helper rather than forcing bytes everywhere.Source: §4.5 · pp. 9–10, Figure 5 · p. 10, Figure 6 · p. 10

5 Conclusion

ANTE’s conclusion envisions coding agents that form beliefs about the past, present, and likely effects of their next actions, with execution correcting those beliefs. The accompanying analysis formalizes the setting and examines how belief-anchored credit and belief-augmented imitation behave.

5 Conclusion

  • ANTE’s internal belief represents what the agent has established, what the code currently does, and what the next command will change; the authors envision execution correcting those beliefs.They report that this foresight ability improves performance across harnesses and model scales and generalizes to tasks in other domains.Source: §5 · p. 10

A Preliminaries

  • The coding agent is modeled as a POMDP whose latent state is the repository and container, whose actions are tool calls, and whose terminal reward records task success.A learned belief representation predicts features of the latent state from history because the exact posterior belief is not computable or checkable for a repository.Source: A Preliminaries · p. 16

B Notation

  • Hats mark estimates, while ỹ denotes a predicted-value group key and à a standardized advantage.These are the notation conventions listed in Table 4.Source: Table 4 · p. 17

C Theoretical analysis of the ANTE objective

  • Theoretical results bound imitation’s performance gap, characterize BAPO’s credit decomposition, and relate forecast loss and divergence to uncertainty and selection regret.The analysis also states that an idealized policy term lower-bounds task performance and that prediction weight λ indexes a monotone family of accuracy budgets.Source: C Theoretical analysis of the ANTE… · pp. 17–18

C.1 Setting and the quantities the analysis controls

  • The analysis treats task performance as expected terminal reward in the real environment and evaluates prediction loss on verifiable steps under the specified rollout distributions.It excludes candidates with outcome ⊥ from selection statements and omits the bounded format term from the task-outcome analysis.Source: §C.1 · p. 18

C.2 Decomposition of the anchored advantage

  • Within a group sharing a forecast, BAPO’s step advantage separates into mean-zero, orthogonal between-decision and within-decision components, with the decision signal carried by the decision advantage.The step baseline averages belief and belief-decision values, stabilizing comparisons when belief-decision groups contain few conclusive steps.Source: §C.2 · p. 19

C.3 Belief-augmented imitation

  • The belief-augmented imitation bound separates the Stage I likelihood term from a corpus-and-environment term that Stage I cannot reduce.For BeliefTraj, hindsight labels can make the corpus observation kernel differ from the real environment kernel; Stage II uses policy-generated environment data to address that gap.Source: §C.3 · p. 20

C.4 Task reward under a world-model accuracy budget

This section bounds how prediction loss relates to task reward, decision quality, and candidate selection, then describes the execution-verified corpora used to train and evaluate ANTE. It also specifies how corpus labels and paired control variants are constructed.

C.4 Task reward under a world-model accuracy budget

  • Up to the distribution-shift term, the step-level surrogate lower-bounds updated-policy performance under the stated support assumptions.The bound compares step policies using advantages and histories drawn under the updated policy.Source: §C.4 · pp. 20–21
  • A fixed prediction-loss multiplier selects a monotone accuracy budget: increasing it lowers both expected prediction loss and task reward under the stated global-optimum assumption.The budget is the expected prediction loss attained by the scalarized objective’s optimizer.Source: §C.4 · p. 21

C.5 Information-theoretic guarantees of the prediction loss

  • Decision-reward error is controlled by forecast divergence and belief information, while trajectory-level cost depends on average divergence over consumed predictions rather than the worst step.The trajectory bound is averaged over supervised steps at which predictions are consumed.Source: §C.5 · pp. 21–23
  • Expected prediction loss upper-bounds residual uncertainty about the checkable outcome and, after conditioning on the action, lower-bounds information the writing context carries about that outcome.The context is formed before the next observation, and the bound concerns the policy’s emitted reasoning and summary as well as its history.Source: §C.5 · p. 22
  • Forecast-based candidate selection has regret bounded by forecast divergence, but point forecasts retain an uncertainty penalty that need not vanish even with perfect predictive distributions.The penalty is zero when each candidate’s predictive distribution puts all mass on one score level.Source: §C.5 · pp. 23–24

D Corpus curation

  • BeliefTraj pairs execution-collected solving trajectories with forecasts derived from execution, while the Reactive and Retrospective corpora reuse those trajectories with belief blocks removed or reduced to summaries.The corpus-curation pipeline and its stage counts are mapped in Figure 8 and Table 5.Source: D Corpus curation · p. 24, Figure 8 · p. 24, Table 5 · p. 24

D.1 Task screening and trajectory collection

  • After container preflight and benchmark decontamination, the collector retains 12,500 repository and 30,161 terminal verified trajectories; the RL pool contains 6,566 unique instances.The repository trajectories cover 6,729 tasks and the terminal trajectories 10,823 tasks.Source: §D.1 · p. 24, Table 6 · p. 25

D.2 Execution-derived labels and checks; D.3 Paired corpus construction and protocol-leakage filtering

  • The verifier re-derives labels from logged observations, and paired controls are filtered to remove belief-protocol leakage while sharing the recorded tool calls and reasoning apart from cleaning.Decision labels use fixed rules, and the monitored test-file screen does not enter the reward.Source: §D.2 · p. 25, §D.3 · pp. 25–26

D.4 Corpus statistics and evaluation task lists

The repository training corpus contains 12,500 trajectories with parsed belief states at every assistant step. The evaluation task list includes 73 development-tooling and related tasks selected to avoid name or near-duplicate overlap with Terminal-Bench 2.0 and TB-Lite.

D.4 Corpus statistics and evaluation task lists

  • 18.5% of repository assistant steps have definite predicted check outcomes, and 13.1% are conclusive test steps whose decisions are scored.The corpus contains 42,676 definite-outcome steps and 30,178 conclusive test steps.Source: §D.4 · p. 26, Figure 10 · p. 26
  • 20.8% of repository assistant steps are marked epistemic, and the 12,500 trajectories average 11,962 tokens under the training tokenizer.Each assistant step carries exactly one parsed belief state.Source: §D.4 · p. 26, Figure 10 · p. 26
  • TB-Dev comprises 73 data-processing, systems-operations, and development-tooling tasks screened against Terminal-Bench 2.0 and TB-Lite for name and near-duplicate overlap.The collection follows the Internal-dev recipe of ECHO.Source: §D.4 · p. 26

E Belief state specification and outcome evaluation

ANTE emits a structured belief immediately before each tool call, and a verifier maps execution observations to outcomes used to assess forecasts and decisions. The appendix also records the supervised fine-tuning runs and the policy objective’s step-level additions.

E.1 Fields of the belief state

  • The belief block is a tagged JSON message before the tool call, carrying a state summary, predicted outcome, and trust-or-abstain decision.The predicted-value tokens receive prediction loss, while the decision token receives the policy gradient.Source: §E.1 · p. 26, Figure 11 · p. 27

E.2 Outcome channels, parsing rules, and decision reward per harness

  • The verifier and action-type map determine which outcomes can be supervised, with repository checks evaluated per step and terminal outcomes read from the hidden task verifier.Pragmatic repository steps have no supervised check target; terminal steps use the expect_success target, and unsupported target_test steps are dropped from the terminal corpus.Source: §E.2 · p. 27, Table 7 · p. 27
  • The expanded ANTE pipeline collects execution-verified trajectories, fine-tunes on them, then uses BAPO during RL with verifier-derived outcomes and step-level rewards.The pipeline applies decision rewards on conclusive steps and anchored advantages on eligible steps.Source: §E.2 · p. 28

F.1 Supervised fine-tuning records

  • Figure 12 reports supervised fine-tuning loss for repository runs at 7B, 14B, and 32B and a terminal run at 9B.The figure caption identifies the runs but supplies no loss values.Source: §F.1 · p. 28, Figure 12 · p. 28

F.2 The optimization objective

  • ANTE retains token-mean aggregation but adds prediction loss, decision reward, and anchored step advantages to the clipped group-relative objective.Unlike the rollout-wide advantage used by the compared objective family, BAPO changes the assignment of credit across steps.Source: §F.2 · pp. 28–29, Figure 13 · p. 29, Table 8 · p. 29

F.3 Break-even derivation of the reward coefficients

The reward coefficients set distinct break-even thresholds for trusting and abstaining, and the paper reports the compute and software stack used for training and inference.

F.3 Break-even derivation of the reward coefficients

  • The reward coefficients make trusting positive in expectation only above target accuracy q*, while the trust-versus-abstain break-even point q° is lower because abstention has a fixed cost.This permits a policy with improving reliability to stop blanket abstention before reaching q*.Source: §F.3 · pp. 29–30
  • The task reward adds a bounded training-time format term that credits well-formed belief blocks and penalizes unsolved rollouts near the response budget.The format term supplements the binary resolve outcome.Source: §F.3 · p. 30

F.4 Compute and software stack

  • Training used 64 A100 40GB GPUs for 7B, 14B, and 9B runs and 128 for 32B, with verl or the open-instruct GRPO trainer and vLLM-based inference workers.Repository runs used the official R2E-Gym tool interface.Source: §F.4 · p. 30

G.1 Scoring rule and inference algorithm

ANTE-TTO resamples actions when the belief signals abstention or predicted failure, then selects using the candidates’ predicted outcomes and execution status. Examples show this rule selecting alternatives on repository and terminal harnesses.

G.1 Scoring rule and inference algorithm

  • The score ranks predicted pass above indeterminate above failure, favors clean execution, and uses only belief value tokens without an extra model or execution.Ties favor the first, policy-generated action.Source: §G.1 · p. 30
  • At uncertainty triggers—abstention or predicted failure—ANTE-TTO samples alternatives, scores their beliefs, and executes only the selected action.The draft action is greedy; alternatives are sampled at temperature 1.0 under the same token cap and context.Source: §G.1 · p. 30
  • Token budgets include prompts, generated tokens, and discarded candidates; Figure 4 reports each setting’s marginal cost and averaged Btok and nMTC.The reported counts come from recorded call counts in the same evaluation runs.Source: §G.1 · p. 31

G.2 Examples on different harnesses

  • On the terminal scaffold, a predicted crash triggers resampling; the read-both-keys fix scores 4, while the log-deleting shortcut scores 0.On the repository scaffold, a step-7 abstention triggers resampling, and the winning candidate replaces the drafted command.Source: §G.2 · p. 31, Figure 14 · p. 31

H A worked example of BAPO

The worked example illustrates how BAPO combines trajectory-level episode advantages with belief-relative and decision-relative credit. The decomposition distinguishes forecasts and decisions while leaving final advantage signs anchored by episode advantages.

H A worked example of BAPO

  • Episode rewards [1, 0, 0] yield advantages [+0.667, −0.333, −0.333], copied unchanged to every pragmatic step in each trajectory.Belief groups ignore step positions, and a rollout can contribute multiple members to a group.Source: Figure 15 · p. 32
  • Belief-relative advantage is decision return minus the belief-group mean: τ1tb receives +0.049, while τ2ta receives −0.084.A correct trust within a failed trajectory can retain positive belief-relative advantage (+0.006) while its total advantage remains negative.Source: H A worked example of BAPO · p. 32
  • Under predicted pass, abstaining has decision advantage +0.0263 and trusting −0.0263; under predicted fail, trusting has advantage +0.0275.In this batch, fail forecasts proved correct, so trusting them was rewarded; the advantage is scored per belief.Source: H A worked example of BAPO · p. 32
  • The final BAPO step term is highest for the abstained fail forecast opening the winning rollout (+0.043) and lowest for the corresponding step in τ2 (−0.07).The example uses one task, three rollouts, coefficients (α, γ, κ) = (0.05, 0.0625, 0.02), and combines standardized components at weight ω = 1/2.Source: H A worked example of BAPO · pp. 31–32

I Terminal instantiation and configuration differences

The terminal instantiation separates per-command exit predictions from the episode-level hidden-check prediction. It adapts BAPO’s targets, anchoring, and inference trigger to the signals available in the Harbor task format.

I Terminal instantiation and configuration differences

  • In Harbor, the exit field predicts each command’s zero exit status, while the check field predicts the episode outcome settled once by the hidden verifier.Exit predictions are settled by the next observation; the episode outcome is settled after the episode.Source: I Terminal instantiation and… · pp. 32–33
  • Exit predictions are supervised at every step, but check-field credit enters through the decision reward, with the verifier outcome scored after the final step.Steps share the episode return but are anchored and grouped by their own predicted exit field; an unparseable block is not anchored.Source: I Terminal instantiation and… · p. 33
  • At inference, ANTE-TTO triggers on the predicted exit field instead of the check field.The variants use a 48K-token episode budget, a 120-step cap, and 256 rollouts per training step.Source: I Terminal instantiation and… · pp. 33–34

J Evaluation against concurrent methods on SWE-bench Verified

On SWE-bench Verified, Table 9 compares open-weight methods across three model scales, with ANTE ahead of the cited task-trained methods at the two smaller scales. External entries use each method’s own scaffold.

J Evaluation against concurrent methods on SWE-bench Verified

K Terminal evaluation protocol

The section reports ANTE-9B’s terminal-agent comparison, examines forecast stability and outcome judging under RL, and illustrates failure modes without foresight and a case where ANTE-TTO guides action selection.

K Terminal evaluation protocol

  • External terminal-agent rows use their methods’ own protocols and scaffolds, with reported run counts ranging from four or five to unspecified.The published ECHO rows report pass@1 over five sampled attempts; the ECHO reproduction uses the authors’ evaluation setup.Source: K Terminal evaluation protocol · p. 35
  • Table 10 reports ANTE-9B resolving 24.7% of Terminal-Bench 2.0, ahead of every task-trained agent below 20B in the table, including the ECHO reproduction on the same backbone at 21.4%.Source: K Terminal evaluation protocol · p. 35

L Additional analyses of the belief under RL

  • At 32B under RL, the settled share of predictions, steps, and response tokens per trajectory hold; ANTE’s forecast judges trajectory outcomes better than SW-RM and comparably to SW-RM with the gold patch.Figure 18 tracks the protocol measures; Table 11 compares outcome judgments using covered accuracy, MCC, and overall accuracy.Source: L Additional analyses of the belief… · p. 36, Figure 18 · p. 36, Table 11 · p. 36

M Failure modes without foresight

  • Without a scored forecast, agents can corrupt repository state with irreversible actions, miss silent regressions, and receive the same task reward for breaking and later fixing tests.The examples include a corrupted index after git checkout, an authentication regression, and a printer override that breaks tests before being removed.Source: M Failure modes without foresight · p. 36

N.1 Foresight guides test-time optimization

  • On django__django-14349, ANTE-TTO sampled three alternatives after an abstention, ranked four actions by their beliefs, and executed the top candidate; the run resolved the task with previously passing tests intact.The executed check refuted the abstained forecast and exposed the issue.Source: §N.1 · p. 37

N.2 Memory extends context but not foresight

This section contrasts retrospective memory of established facts with explicit pre-action forecasts and trust-or-abstain decisions, describing the prompt templates and illustrating how ANTE’s beliefs guide verification, improve through RL, and transfer beyond coding.

N.2 Memory extends context but not foresight

  • ANTE’s forecast-guided native-string fix resolved psf__requests-1724 in 27 steps (6/6 target, 56/56 suite), while Retrospective and Reactive remained unresolved.Retrospective encoded the method to bytes, and Reactive submitted after deciding its tracing was flawed.Source: §N.2 · p. 39

N.3 The belief sharpens as the world model trains

  • After RL, the forecast matched the executed check and the sphinx-doc__sphinx-8721 task resolved in 26 steps; before RL, it remained unresolved after 41 steps.Before RL, the forecast missed the check twice; after RL, the predicted failure and unclean exit matched execution.Source: §N.3 · pp. 39–40

N.4 A confident forecast of failure is still a commitment

  • A trusted forecast of FAIL earns +α when the check fails with a clean exit, because trust scores forecast accuracy rather than step success.The rollout example predicts target_test FAIL and exit_ok true, and execution returns exit code 0 with VERDICT: FAIL.Source: §N.4 · p. 40

N.5 Foresight transfers beyond agentic coding

  • On CruxEval-I sample_423, ANTE traced and checked branches to produce a correct answer, while Reactive mis-simulated once and answered incorrectly.ANTE’s reasoning included rechecking the trace with additional inputs; Reactive did not rerun its mistaken trace.Source: §N.5 · p. 40

O Instruction templates

  • The paper’s prompts span corpus construction, fine-tuning, RL, and evaluation, with Table 12 summarizing their categories.The table distinguishes prompts carrying the belief protocol from those showing the shared scaffold.Source: O Instruction templates · p. 40, Table 12 · p. 41

O.1 Repository templates

  • Repository templates require a pre-action belief state with a persistent summary, predicted check and exit outcomes, and a trust-or-abstain decision, followed by one function call.The protocol distinguishes epistemic checks from pragmatic actions, requires verification before finishing, and scores trust only when predictions carry a machine-checkable verdict.Source: §O.1 · pp. 42–43
  • The retrospective repository template preserves a running summary of established past and present facts while removing every forward-looking field.Its rules prohibit recording an action's expected outcome as accomplished before execution; verification is mandatory before finishing a change.Source: §O.1 · pp. 43–44

O.2 Terminal and collection templates

  • The terminal-harness template carries a belief block through the (χ, ψ) interface, predicting per-step exit_ok and episode-level expect_success, plus a trust-or-abstain decision.The block is required on every step, including final submission, and expect_success expresses the agent’s self-assessment of whether the hidden verifier will pass.Source: §O.2 · p. 44
  • For collection, beliefs include target_test alongside exit_ok, and curation re-derives predictions from logged observations with verifier ψ and replaces decisions using a fixed rule.The collection protocol places the belief block at the start of each response; target_test predicts the current action’s machine-readable checking outcome or NA.Source: §O.2 · pp. 44–45
Loading 2610.15368v1…