Product-Level World Models for Coding Agents
Anticipate what the code will do. Put that foresight inside the agent’s reasoning.
Paper · Demo · Overview · Results · Examples · ProWM-Bench · Installation · Pipeline · Citation
Will the official tests pass? Will the rendered product behave correctly? PreVision teaches a coding agent to anticipate these outcomes and use them in its own reasoning.
Animation · Static overview · Case record · Editable visual source
The Chart.js scene uses the released prediction and ground truth: the render probe’s startCallCount changes from 2 to 1, and PreVision correctly predicts that the official issue test passes. The product interface is a schematic reconstruction. The following training scenes illustrate the method, separately from this evaluation example.
Agent world models usually predict the next observation: what a tool will return after an action. For a coding agent this target says little about the task. An edit returns the same file edited. whether it fixes the bug or not, and local tests often disagree with the hidden official result. What decides success is the product, the code as judged by the project's official tests and, for user-facing software, by what a user sees.
We therefore propose product-level world models, which predict the state of the product after an action: the outcome of the official tests and the rendered behavior of the program. PreVision internalizes such a world model into a coding agent at training time:
- Verified product forecasts. At key decision points of successful agent trajectories (after edits, after new feedback, before finishing), a teacher model forecasts the product state from what the agent can see; a forecast is kept only if it matches the official tests and a render probe run on the current code.
- Internalized judgments. Each verified forecast is written as a short first-person judgment (evidence → forecast → decision) at the start of the agent's reasoning; the original action is kept.
- Joint training. The agent is fine-tuned on these trajectories plus a small share (30% of supervised tokens) of auxiliary world-model examples. At inference it runs its standard loop with no extra module.
ProWM-Bench measures agent ability and product-level world-model ability on the same real repository tasks. It traces agent rollouts, freezes the exact code state before every action, and records the official test outcomes and the output of a per-issue render probe for every intermediate state. The frozen benchmark prompts, ground-truth targets, render probes, and zero-dependency scorer are hosted on Hugging Face.
Higher task completion from the same 545 teacher trajectories. Trial-level success improves on both evaluation sets:
| Evaluation | Agent-SFT | PreVision | Gain |
|---|---|---|---|
| SWE-MM | 54.7% | 65.1% | +10.4 pp |
| Held-out repositories | 56.9% | 64.6% | +7.7 pp |
Full comparison: agent success and product-level world-model metrics
Agent ability is the resolved rate over two attempts per task (trial) and the share of tasks solved in at least one attempt (task). World-model ability uses the cumulative protocol: given the initial state and the public trajectory, predict the state after an action. All trained models start from Qwen3.6-27B and use the same 545 teacher trajectories; they differ only in the world-model data.
| Model | SWE-MM trial | SWE-MM task | Held-out trial | Held-out task | Obs EM (SWE / HO) | Test Resolved | Test All-EM | Render Field-EM | Render DOM-ΔF1 |
|---|---|---|---|---|---|---|---|---|---|
| Qwen3.8-27B (teacher, untrained) | 42.2 | 62.5 | 58.9 | 69.8 | 8.1 / 8.5 | 79.4 / 75.5 | 77.2 / 57.5 | 66.6 / 71.5 | 47.2 / 44.1 |
| Qwen3.6-27B (base, untrained) | 18.2 | 22.9 | 31.7 | 37.1 | 6.5 / 5.5 | 63.7 / 59.5 | 61.5 / 49.0 | 55.2 / 53.0 | 30.7 / 23.8 |
| Agent-SFT | 54.7 | 71.9 | 56.9 | 67.8 | 6.2 / 6.5 | 75.1 / 69.5 | 72.9 / 57.5 | 68.8 / 64.5 | 27.6 / 35.6 |
| Obs-Think (observation forecasts) | 51.0 | 67.7 | 55.4 | 67.8 | 5.2 / 4.5 | 57.2 / 59.5 | 55.3 / 47.5 | 34.5 / 27.0 | 26.5 / 16.5 |
| Struct-Forecast | 55.7 | 69.8 | 50.5 | 62.9 | 6.0 / 4.5 | 46.6 / 45.5 | 45.0 / 35.5 | 40.1 / 28.5 | 14.5 / 14.3 |
| WM-Mix (WM examples only) | 52.1 | 74.0 | 57.7 | 66.8 | 7.6 / 7.5 | 78.0 / 75.0 | 75.9 / 59.0 | 64.4 / 68.5 | 32.8 / 42.3 |
| PreVision (ours) | 65.1 | 79.2 | 64.6 | 74.8 | 7.9 / 7.5 | 77.5 / 77.0 | 75.6 / 59.0 | 70.2 / 71.0 | 35.0 / 45.9 |
Key findings:
- Observations are a poor proxy for the product. At 56% of the decision points that follow a local test run, the local result contradicts the hidden official result; at most other points no test was run at all.
- World-model ability alone does not make a strong agent. WM-Mix and the untrained teacher predict the product well but are not better agents; an external world model consulted at inference makes the agent worse.
- Internalized forecasts are used. PreVision forecasts the official outcome far more often than Agent-SFT, edits again after forecasting "still fails", and uses 22–24% fewer reasoning tokens per episode.
A ProWM-Bench item (examples/prowm_bench_item.json). SWE-bench Multimodal, chartjs__Chart.js-8162 ("legend and title are rendered twice"). After 62 public steps the agent adds a regression test; the source fix happened earlier in the trajectory. From the initial state and the public trajectory alone, PreVision predicts the render probe's decision field and the official test outcome:
Render probe: startCallCount |
Issue condition | Official tests | |
|---|---|---|---|
| Initial state s0 | 2 | not satisfied | unresolved |
| PreVision prediction | 1 | satisfied | resolved, fail-to-pass test passes |
| Ground truth | 1 | satisfied | resolved, fail-to-pass test passes |
A PreVision judgment passage (examples/prevision_judgment.json). Inserted at the start of the agent's reasoning after a local test run whose failures are unrelated to the issue:
The closer look pins the cause: all three failing class-based-view tests die with the same
TypeErrorabout_handle_swagger_method_callmissing therouteargument — a handler-binding incompatibility with the installed aiohttp 3.13, unrelated to spec serialization, so I'll treat that file as a pre-existing failure and leave it alone. Against the current unmodified code, the official issue tests requesting/docs/swagger.jsonwith a date example should still fail:routes.pystill hands the spec toweb.json_responsewith the default encoder, so the endpoint keeps serving the 500 error page my repro saw … To confirm that, I'll run the full suite with just that one file deselected and look at the tail of the summary.
The agent's original reasoning and its action (running the suite with that file deselected) follow unchanged.
| Path | Contents |
|---|---|
prevision/tasks/ |
Task sources: SWE-rebench V2, ScaleSWE, selection funnel, trusted pool (vendored SWE-rebench V2 log parsers) |
prevision/swemm/ |
SWE-bench Multimodal tasks, Docker wrapper, official harness grading, browser capture |
prevision/render_probes/ |
Render probe authoring (LLM author with repository tools), contract, gates, harness |
prevision/harbor/ |
Harbor + OpenHands agent, in-container runner and state observer, task adapters, exporter, SWE-MM browser verifier |
prevision/product/ |
Product-state capture on frozen code states: official tests and render probes (online coordinator) |
prevision/rollouts.py |
One-run Harbor/OpenHands rollout orchestration (collection and agent evaluation) |
prevision/prowm/ |
ProWM-Bench: item construction, read-only sandbox, strict scoring (13 metrics) |
prevision/wm/ |
One-shot CoT world-model prompts, evidence, runtime, evaluation and example collection |
prevision/data/ |
PreVision data construction: decision points, product truth, teacher forecasts, passages, audits, assembly, training mixes |
prevision/training/ |
Native Qwen serialization with token parity, SFT exports, LLaMA-Factory recipe and worker, divergence guard |
prevision/analysis/ |
Paper analyses: local vs. official, online forecast judge, behavior and cost |
prevision/external_wm.py |
External-WM baseline proxy |
scripts/ |
Numbered pipeline entry points (below), analysis/, figures/ |
configs/ |
Task lists, rollout/evaluation protocols, PreVision data constants, SFT recipe |
docker/Dockerfile.capture |
Headless-Chrome capture sidecar for render probes |
examples/, assets/ |
Examples above, README figures, aggregated data behind the paper figures |
tests/ |
Offline tests; equivalence tests against the original artifacts run when PREVISION_DEV_ROOT is set |
Run the commands below from the repository root. Complete both setup panels before starting step 1. Collection and evaluation use Docker, Node.js and a model endpoint; training uses a separate Python environment. The two environments share the files produced by the pipeline.
| Environment | Used for |
|---|---|
prevision |
Task preparation, render probes, agent rollouts, benchmark construction and evaluation |
prevision-train |
Native training-data export, PreVision assembly, training and weight merging |
| Your vLLM environment | Serving the teacher or the trained agent; runs as a separate process |
Install the two environments and capture tools
conda env create -f environment.yml
conda activate prevision
pip install -e ".[data,test]"
playwright install chromium
bash scripts/00_fetch_third_party.sh
python scripts/00_fetch_browser_runtime.py
docker build -f docker/Dockerfile.capture \
--build-arg CAPTURE_UID="$(id -u)" -t wmmb-capture:latest docker
conda create -n prevision-train python=3.12 pip -y
conda activate prevision-train
pip install -e ".[train,data]"
conda activate prevision
cp .env.example .env
# Edit .env: use an endpoint address reachable from the task containers.
set -a; source .env; set +aThe capture image runs the browser shared by all render probes. Docker access is required; when your installation uses sudo, set PREVISION_DOCKER="sudo -n docker" and use that prefix for the build above. Product capture also needs permission to read Docker's overlay layers, directly or through passwordless sudo. Node.js must be on PATH (node --version).
The browser-runtime download supplies the pinned Firefox and Yarn versions used by SWE-MM verification. Keep third_party/ available for later runs.
Models, endpoints and shared paths
Place the student checkpoint and teacher tokenizer at the paths below, or change the variables to their locations. The teacher's full weights are needed locally only when you serve it here. The repository contains task identities and example records; the commands below build the trajectory, training and benchmark data.
export STUDENT_MODEL="$PWD/models/Qwen3.6-27B"
export TEACHER_MODEL="$PWD/models/Qwen3.8-27B"
export TEACHER_NAME="Qwen/Qwen3.8-27B"
export EVAL_BASE_URL="http://YOUR_INFERENCE_HOST:8001/v1"
export POOL="$PWD/data/processed/pools/trusted_render_pool.json"
export TRAIN_TASKS="$PWD/data/processed/splits/train_tasks.json"
export HELDOUT_TASKS="$PWD/data/processed/splits/heldout_tasks.json"
export SWEMM_TASKS="$PWD/data/processed/splits/swemm_eval_tasks.json"PREVISION_LLM_BASE_URL / PREVISION_LLM_API_KEY from .env address the teacher and judges. EVAL_BASE_URL addresses the trained model, served as prevision. Set both URLs to addresses reachable from the task containers. Harbor requires an API-key string of at least 24 characters; the example placeholder works for an unauthenticated local server.
In a separate terminal with vLLM installed, serve the teacher with native reasoning and tool-call parsing:
vllm serve "$TEACHER_MODEL" --served-model-name "$TEACHER_NAME" \
--host 0.0.0.0 --port 8000 --tensor-parallel-size 4 \
--dtype bfloat16 --max-model-len 131072 \
--reasoning-parser qwen3 --enable-auto-tool-choice --tool-call-parser qwen3_coderSet the model/path variables in that terminal too. Adjust the tensor-parallel size to the inference hardware. The endpoint must support /v1/chat/completions and /tokenize; token counting enforces the context budget. After merging the trained model in step 5, serve it with the same flags, replacing the path with models/prevision, the served name with prevision, and the port with 8001.
If you only want to evaluate a model on the paper's frozen ProWM-Bench world-model benchmark (569 items / 1,707 branch prompts across SWE-MM and held-out R+S) without rebuilding reference traces or running Docker, download the standalone release from Hugging Face. Its loader and deterministic scorer use only the Python 3.9+ standard library:
hf download simonlqy/ProWM-Bench --repo-type dataset --local-dir ProWM-Bench
cd ProWM-Bench
python3 -B -m prowm_bench verify
python3 -B -m prowm_bench selfcheck
python3 -B examples/run_model.py --subset swemm --base-url http://localhost:8000/v1 --model YOUR_MODEL --output predictions_swemm.jsonl
python3 -B -m prowm_bench score --subset swemm --predictions predictions_swemm.jsonl --output scores_swemm.jsonReplace swemm with rs for SWE-rebench V2 + ScaleSWE. See the ProWM-Bench dataset card for the full evaluation protocol.
Follow one set of generated files through the stages. Every command below passes the new task lists explicitly; configs/tasks/ retains the paper's fixed task identities. R+S means SWE-rebench V2 + ScaleSWE, with evaluation repositories held out from training.
| Step | Input → output | Main entry points |
|---|---|---|
| 1. Prepare tasks | Public issues → screened tasks and per-issue render probes | 01, 02, 03 |
| 2. Publish task pools | Audited probes → training / R+S held-out / SWE-MM manifests | 02, 01 |
| 3. Collect agent data | Teacher rollouts → filtered Agent-SFT trajectories | 04, 04b |
| 4. Build training data | Traces → WM examples + trajectories with verified forecasts → one training mixture | 05, 06, 07, 08 |
| 5. Train | Training mixture + student checkpoint → merged PreVision weights | 09, 09b |
| 6. Evaluate the agent | Model + tasks → patches, verifier results and resolved rates | 10 |
| 7. Evaluate forecasts | Fixed reference traces → benchmark → predictions and scored reports | 10, 05, 11 |
Steps 6 and 7 measure different abilities: can the agent solve the issue, and can the model predict the product state. Build the reference benchmark once and reuse it for every model being compared.
A fresh collection may produce different numbers of accepted probes, successful trajectories and training rows. The paper used 545 agent trajectories and a 2,344-row PreVision mixture; these are recorded outcomes, not quotas enforced on new data. Keep the generated manifests to identify your population.
1 · Prepare tasks and construct render probes — environment: prevision
A render probe is a small program that exercises the issue through the product's public interface. It supplies the same test of rendered behavior at every recorded code state.
conda activate prevision
python scripts/01_prepare_tasks.py download
for source in rebench scaleswe; do
python scripts/01_prepare_tasks.py select --source "$source" \
--output "data/candidates/$source.json"
python scripts/01_prepare_tasks.py screen --source "$source" \
--candidates "data/candidates/$source.json" \
--output-dir "runs/screen/$source" --model "$TEACHER_NAME"
python scripts/03_prebuild_env_images.py task-images \
--tasks "runs/screen/$source/selected_tasks.json"
python scripts/02_build_render_probes.py build \
--tasks "runs/screen/$source/selected_tasks.json" \
--surface-manifest "runs/screen/$source/selected_tasks.json" \
--all --model "$TEACHER_NAME" --output-root "runs/render/$source"
done
python scripts/01_prepare_tasks.py screen --source swemm \
--candidates configs/tasks/swemm_eval_tasks.json \
--output-dir runs/screen/swemm --model "$TEACHER_NAME"
python scripts/02_build_render_probes.py build --task-source swe_mm \
--tasks runs/screen/swemm/selected_tasks.json \
--surface-manifest runs/screen/swemm/selected_tasks.json \
--all --model "$TEACHER_NAME" --output-root runs/render/swemmSWE-MM uses its pinned upstream task images. The 03 task-images command builds the task images for SWE-rebench V2 and ScaleSWE.
Each 02 build prints a run directory under the supplied output root. Copy those three exact paths into the variables below; do not use a wildcard when several runs exist:
export REBENCH_RENDER="/absolute/path/to/the/rebench/render-run"
export SCALE_RENDER="/absolute/path/to/the/scaleswe/render-run"
export SWEMM_RENDER="/absolute/path/to/the/swemm/render-run"Output: each run contains segments/results/, segments/accepted_probes/ and accepted base/fixed-code captures. To resume construction, pass that same directory as 02 build --run-dir ... with the same task and surface manifests.
2 · Audit probes and publish the task manifests — environment: prevision
Two audit reports check that each probe captures the issue's natural product behavior. Publication keeps probes accepted by both reports; the pool builder verifies their saved hashes before installing them.
for source in rebench scaleswe swemm; do
case "$source" in
rebench) render_run="$REBENCH_RENDER" ;;
scaleswe) render_run="$SCALE_RENDER" ;;
swemm) render_run="$SWEMM_RENDER" ;;
esac
for repeat in 1 2; do
python scripts/02_build_render_probes.py audit --run-dir "$render_run" \
--selection "runs/screen/$source/selected_tasks.json" \
--output-name "natural_surface_reaudit.$repeat.json" --model "$TEACHER_NAME"
done
python scripts/02_build_render_probes.py publish --run-dir "$render_run" \
--selection "runs/screen/$source/selected_tasks.json"
done
python scripts/01_prepare_tasks.py licenses \
--tasks runs/screen/scaleswe/selected_tasks.json
python scripts/01_prepare_tasks.py pool \
--trusted "rebench=$REBENCH_RENDER" --trusted "scaleswe=$SCALE_RENDER" \
--promote-probes --output "$POOL"
python scripts/01_prepare_tasks.py split --pool "$POOL" \
--output-dir data/processed/splits
python scripts/01_prepare_tasks.py swemm --trusted "$SWEMM_RENDER" \
--promote-probes --output "$SWEMM_TASKS"Output: $POOL identifies each R+S task and its verified probe; $TRAIN_TASKS and $HELDOUT_TASKS split it by repository. $SWEMM_TASKS contains both task IDs and verified probe paths, so the same file works for agent evaluation and ProWM-Bench construction. Probe programs are installed under data/processed/render_probes{,_rebench}/.
The SWE-MM manifest contains only the trusted probes from the selected run. An empty probe population is reported as an error before downstream work starts.
3 · Collect teacher trajectories and export the Agent-SFT view — environments: prevision → prevision-train
The teacher acts through Harbor/OpenHands. Product capture separately runs official tests and render probes on frozen code states; those hidden results are kept out of the agent's observations.
python scripts/04_collect_rollouts.py --model "$TEACHER_NAME" \
--tasks "$TRAIN_TASKS" --pool "$POOL"Copy the printed run directory into ROLLOUT_RUN. It contains the agent's native conversation records, state transitions, product-state records and verification results.
export ROLLOUT_RUN="/absolute/path/to/the/completed/teacher-rollout-run"
conda activate prevision-train
python scripts/04b_export_agent_sft.py --runs "$ROLLOUT_RUN" \
--tasks "$TRAIN_TASKS" --pool "$POOL" --exclude-tasks "$SWEMM_TASKS" \
--student-model "$STUDENT_MODEL" --out data/agent_sftOutput: data/agent_sft/segments/views/agent_shared.json holds native training rows; segments/raw/agent_shared.jsonl holds aligned logical rows and provenance; segments/media/ holds their images. segments/stats.json reports accepted rows and filter exclusions.
The export checks successful trajectories, reasoning quality, the token-length limit and repository balance. The supplied paper configuration also records the original 464-task collection list; the commands here instead collect from your newly accepted training split. Keep the chosen task population consistent across model variants.
4 · Build auxiliary WM examples, insert verified forecasts, and mix — environments: prevision → prevision-train
There are two data branches. Auxiliary WM examples train explicit prediction from a traced code state. PreVision trajectories insert a verified forecast at selected points in the agent's reasoning. The final mixture combines both.
First build prediction examples from training traces, then collect and grade the teacher's answers:
conda activate prevision
python scripts/05_build_prowm_bench.py build --rollout-run "$ROLLOUT_RUN" \
--task-pool "$POOL" --context-mode pre_action_state --out runs/prowm/train-pre
python scripts/05_build_prowm_bench.py build --rollout-run "$ROLLOUT_RUN" \
--task-pool "$POOL" --context-mode initial_state_with_trajectory --out runs/prowm/train-s0
python scripts/06_collect_wm_examples.py select --run runs/wm-collection \
--benchmark runs/prowm/train-pre --benchmark runs/prowm/train-s0 \
--train-tasks "$TRAIN_TASKS" --exclude-tasks "$HELDOUT_TASKS" --exclude-tasks "$SWEMM_TASKS"
python scripts/06_collect_wm_examples.py prepare --run runs/wm-collection
python scripts/06_collect_wm_examples.py collect --run runs/wm-collection --model "$TEACHER_NAME"Export the accepted WM answers, construct the PreVision trajectories, then combine them:
conda activate prevision-train
python scripts/06_collect_wm_examples.py export --run runs/wm-collection \
--student-model "$STUDENT_MODEL" --out data/wm
python scripts/07_build_prevision_data.py all \
--views data/agent_sft/segments/views/agent_shared.json \
--raw data/agent_sft/segments/raw/agent_shared.jsonl --rollout-runs "$ROLLOUT_RUN" \
--model "$TEACHER_NAME" --teacher-tokenizer "$TEACHER_MODEL" \
--student-model "$STUDENT_MODEL" --out runs/prevision-data
python scripts/08_build_training_mix.py prevision \
--agent runs/prevision-data/dataset/train.json \
--agent-meta runs/prevision-data/dataset/row_audit.json --agent-media-root data/agent_sft \
--wm data/wm/lf/train.json data/wm/lf/train.meta.jsonl --wm-media-root data/wm/lf \
--out runs/prevision-mixOutput: runs/prevision-mix/train.json and dataset_info.json are the training input. stats.json reports the achieved WM token share; wm_selection.json and row_order.json identify every selected source row. Keep the referenced image directories alongside the generated data.
The target is 30% WM supervised tokens, using whole samples. 07 also saves decision points, teacher attempts, passage audits and removal reasons. A rerun with the same inputs resumes those caches; use a new output directory when changing inputs or the recipe.
5 · Train, continue, and merge PreVision — environment: prevision-train
The default recipe uses LoRA rank 64, learning rate 2.5e-4, a 100k-token cutoff and a global batch of 12 on four GPUs. Start with the 10-epoch run:
python scripts/09_train_sft.py --model "$STUDENT_MODEL" \
--dataset-dir runs/prevision-mix --dataset prevision_train \
--output-dir runs/sft/prevision --dry-run
python scripts/09_train_sft.py --model "$STUDENT_MODEL" \
--dataset-dir runs/prevision-mix --dataset prevision_train \
--output-dir runs/sft/prevision --divergence-guardThe main paper model continues from epoch 10 with a global cosine schedule extended to 20 epochs, and selects the saved epoch-12 checkpoint. Compute checkpoint numbers from your actual row count:
STEPS_PER_EPOCH=$(python -c 'from pathlib import Path; from prevision.training.recipe import dataset_rows, planned_steps; print(planned_steps(dataset_rows(Path("runs/prevision-mix"), "prevision_train"), 1))')
python scripts/09_train_sft.py --model "$STUDENT_MODEL" \
--dataset-dir runs/prevision-mix --dataset prevision_train \
--output-dir runs/sft/prevision-continued \
--resume-from-checkpoint "runs/sft/prevision/output/checkpoint-$((10 * STEPS_PER_EPOCH))" \
--epochs 20 --rebind-cosine --divergence-guard
python scripts/09b_merge_lora.py --model "$STUDENT_MODEL" \
--adapter "runs/sft/prevision-continued/output/checkpoint-$((12 * STEPS_PER_EPOCH))" \
--out models/previsionFor the paper's 2,344 rows, these are steps 1,960 and 2,352. Keep optimizer, scheduler and RNG files in the epoch-10 checkpoint: the continuation restores the complete training state. The command has a 20-epoch horizon and saves each epoch; the merge selects epoch 12. If the divergence guard stops training, see python scripts/09_train_sft.py --help for the --recover-from resume option.
Output: models/prevision/ contains the merged model, tokenizer, native chat template and merge-audit.json. Serve it as prevision at $EVAL_BASE_URL before the evaluation steps.
6 · Evaluate the coding agent — environment: prevision
Use the same task lists for launching trials and reporting rates, so missing or failed trials remain in the denominator.
conda activate prevision
python scripts/10_eval_agent.py run --suite swemm --tasks "$SWEMM_TASKS" \
--model prevision --base-url "$EVAL_BASE_URL"
python scripts/10_eval_agent.py run --suite heldout --tasks "$HELDOUT_TASKS" --pool "$POOL" \
--model prevision --base-url "$EVAL_BASE_URL"Copy the two printed run directories, then reverify the browser-dependent SWE-MM tasks and summarize:
export EVAL_SWEMM_RUN="/absolute/path/to/the/prevision/swemm-run"
export EVAL_RS_RUN="/absolute/path/to/the/prevision/heldout-run"
python scripts/10_eval_agent.py reverify --run "$EVAL_SWEMM_RUN" --stage --publish
python scripts/10_eval_agent.py summarize --suite swemm --tasks "$SWEMM_TASKS" "$EVAL_SWEMM_RUN"
python scripts/10_eval_agent.py summarize --suite heldout --tasks "$HELDOUT_TASKS" "$EVAL_RS_RUN"Output: each run retains native trials and verifier evidence. summarize prints trial-level and task-level resolved rates; add --json for machine-readable output. The default is two attempts per task.
7 · Build a reference benchmark and evaluate world-model predictions — environment: prevision
First collect reference traces with product capture enabled. This flag records the official tests and renders needed by the benchmark builder; ordinary agent evaluation leaves capture off.
python scripts/10_eval_agent.py run --suite swemm --tasks "$SWEMM_TASKS" \
--model "$TEACHER_NAME" --base-url "$PREVISION_LLM_BASE_URL" --capture-product
python scripts/10_eval_agent.py run --suite heldout --tasks "$HELDOUT_TASKS" --pool "$POOL" \
--model "$TEACHER_NAME" --base-url "$PREVISION_LLM_BASE_URL" --capture-productCopy the reference run directories. The following builds cumulative prediction tasks from each new population, freezes a manifest, prepares model inputs, predicts and scores:
export REFERENCE_SWEMM_RUN="/absolute/path/to/the/reference/swemm-run"
export REFERENCE_RS_RUN="/absolute/path/to/the/reference/heldout-run"
for suite in swemm heldout; do
case "$suite" in
swemm) reference_run="$REFERENCE_SWEMM_RUN"; task_pool="$SWEMM_TASKS" ;;
heldout) reference_run="$REFERENCE_RS_RUN"; task_pool="$POOL" ;;
esac
python scripts/05_build_prowm_bench.py build --rollout-run "$reference_run" \
--task-pool "$task_pool" --context-mode initial_state_with_trajectory \
--online-balanced-transitions --out "runs/prowm/$suite-s0"
python scripts/05_build_prowm_bench.py lane --lane "wm-$suite-s0" \
--benchmark "runs/prowm/$suite-s0" --view task_balanced_v1 \
--context-mode initial_state_with_trajectory \
--branch observation_repository --branch official_tests --branch render_product \
--out "runs/prowm/lanes/wm-$suite-s0.json"
python scripts/11_eval_world_model.py prepare --lane "runs/prowm/lanes/wm-$suite-s0.json" \
--inputs "runs/wm_eval/inputs/wm-$suite-s0"
python scripts/11_eval_world_model.py predict --inputs "runs/wm_eval/inputs/wm-$suite-s0" \
--run "runs/wm_eval/prevision/wm-$suite-s0" --model prevision --base-url "$EVAL_BASE_URL"
python scripts/11_eval_world_model.py score --lane "runs/prowm/lanes/wm-$suite-s0.json" \
--run "runs/wm_eval/prevision/wm-$suite-s0"
done
python scripts/11_eval_world_model.py table --model PreVision=runs/wm_eval/previsionOutput: each model/benchmark directory contains requests, responses and grades under cases/, plus evaluation/report.json. The report includes all 13 metrics; table prints the five paper columns. Reuse the same benchmark manifests and prepared inputs when evaluating another model.
For the paper's fixed population sizes, use 05 paper instead of the generic build / lane pair above. It reads the recorded selection recipe and requires enough eligible reference states for its task/item counts:
python scripts/05_build_prowm_bench.py paper --source swemm \
--rollout-run "$REFERENCE_SWEMM_RUN" --task-pool "$SWEMM_TASKS" --out runs/prowm-paper
python scripts/05_build_prowm_bench.py paper --source heldout \
--rollout-run "$REFERENCE_RS_RUN" --task-pool "$POOL" --out runs/prowm-paperPass the resulting runs/prowm-paper/lanes/*.json to 11 prepare and 11 score, with separate input and prediction directories for each lane. Recollection creates new trajectories even when task identities and item budgets are fixed.
Checking the installation: in prevision, run python -m pytest -q tests. Portable checks exercise stage connections and contracts without GPUs or Docker. Comparisons against unpublished historical experiments are optional and run only when PREVISION_DEV_ROOT is supplied. These checks do not execute model training or task containers.
| Script | Paper |
|---|---|
scripts/analysis/local_vs_official.py |
Local test vs. official result at the 3,554 decision points (Fig. 3a) |
scripts/analysis/forecast_judge.py |
Blind LLM judge of online forecasts and their effect on the next action (Fig. 8, Sec. 4.5) |
scripts/analysis/behavior_metrics.py |
Turns, reasoning tokens, runaway episodes, voluntary stops (Table 2) |
scripts/figures/make_all.py |
Redraws the paper figures from assets/figure_data/*.json |
@article{li2026prevision,
title = {Predict the Product, Not the Observation: Product-Level World Models for Coding Agents},
author = {Li, Qingyao and Dai, Xinyi and Yin, Di and Sun, Xing and Liu, Weiwen and Zhang, Weinan and Yu, Yong},
journal = {arXiv preprint arXiv:2612.04946},
year = {2026}
}First-party code is released under the Apache-2.0 license. Vendored and third-party components keep their own licenses; see THIRD_PARTY.md. Datasets are subject to the licenses of their original sources.



