Source-linked AI summary
Twin: Playing an Unknown Game with a Test-Time Digital Twin
Alexy Skoutnev, Kirill Acharya, Gaston Longhitano, Madeleine Udell, Kevin Ellis, Iddo Drori
TL;DR
Agents struggle to play unfamiliar grid-world games because both their dynamics and win conditions are hidden. Twin writes and validates an executable world model at test time, raising benchmark performance to 93.3% and clearing 23 of 25 games.
Problem
ARC-AGI-3 games hide their controls and win conditions, while frontier models fail at most games that humans completely clear.
Method
Twin has a coding agent construct, validate, repair, and plan through an executable game model before submitting actions.
Results
93.3% benchmark action-efficiency score, clearing 23 of 25 games and 179 of 183 levels.
Takeaways & Limitations
World-model construction is tractable for unknown games, whereas inferring the hidden goal remains the harder problem.
Takeaways & Limitations
Twin assumes deterministic, representable dynamics and leaves truly latent state and probabilistic twins out of scope.
Abstract
from arXiv · showhide
We present a Test-time World-model Inference (Twin) system, in which a frontier coding agent writes an executable world model for completing continual learning tasks, such as ARC-AGI-3 games. Traditional approaches hand-engineer such models, one custom design per task. Each game hides its rules and goal, and our system constructs them from simulation and interaction alone. Its inductive prior over grid games is strong enough to recover the true transitions of the game and the goal on nearly all levels. Replay validation happens in a twin world model. The harness enforces that an action is not made until the program reproduces every previous observed game transition. Each mismatch between a world model prediction and the actual action result becomes a counterexample that is used to repair the world model. Twin clears 179 out of 183 levels (97.8%), and does so more efficiently than humans in 158 out of 179 levels (88.3%). The system infers the goal before any reward on 156 of the levels it clears (87.2%), and in the remaining levels automatically discovers the goal by search. The benchmark scores completion and action efficiency, between 0 and 100, against humans playing each game for the first time. Played directly, the base model scores only 7.8%; an off-the-shelf harness increases it to 61.1%, whereas our twin world model increases the same base model to 93.3%, clearing 23 out of 25 games. Building a usable world model is simpler than anticipated, whereas the harder problem is inferring the right goal.
Introduction
Twin addresses unfamiliar ARC-AGI-3 games by writing and validating an executable world model at test time, then planning within it. Its main remaining challenge is inferring unstated win conditions, while the system substantially improves frontier-model performance and reaches human-level action efficiency.
- Motivation: ARC-AGI-3 games hide their controls and win conditions, requiring agents to discover them through interaction on 64 × 64 colored-cell grids.Humans completely clear these games, whereas frontier models fail at most games.
- Baseline: 7.8% is the direct-play score for a strong frontier model, rising to 61.1% with the same model in an off-the-shelf coding harness.ARC-AGI-3’s action-efficiency score ranges from 0 to 100 and rewards clearing each game in as few actions as a first-time human.
- Method: Twin has a coding agent write a Python world model at test time and repairs it until its predictions reproduce every observed game transition.Planning and action submission occur only after the twin validates the logged transitions, turning the unknown environment into an executable hypothesis to inspect, falsify, and repair.
- Goal inference: Inferring the hidden goal is harder than recovering game rules, so Twin tests rival goal predicates against promising states and confirms or eliminates candidates through outcomes.The system can infer the goal before reward, and an exactly reached non-goal eliminates a candidate.
- Results: 179 of 183 levels are cleared, including 158 where Twin uses fewer actions than first-time humans, while 23 of 25 games are cleared overall.92.9% of chosen actions execute a route already tried in the twin.
Related Work
Twin builds on neural, object-centric, program-induction, and program-synthesized world-model research while applying test-time executable environment induction to interaction. It differs from concurrent ARC-AGI-3 approaches through harness-enforced full-history replay validation before scored actions and explicit goal hypothesis before reward.
- Neural and object-centric world models: Twin induces symbolic source code from tens of transitions at test time, unlike latent dynamics learned by gradient descent over many episodes.It uses a pretrained code model and provides exact replay tests, deterministic long-horizon rollouts, and a legible artifact, assuming program-compressible, roughly deterministic dynamics.
- Program induction and LLM agents: Twin transfers program induction and test-time adaptation from ARC-AGI-1/2 to interaction by inducing the environment rather than a static input-output transformation.Its experiments choose the training data.
- Related methods tackling ARC-AGI-3: Twin requires its harness to reproduce every observed transition before each scored action, unlike concurrent world-model systems that do not require matching the entire history.The harness enforces this check rather than leaving it to the agent.
- Related methods tackling ARC-AGI-3: Twin hypothesizes the goal before any reward arrives, distinguishing it from approaches that trade explicit world modeling for more search or greater reliance on the base model.Direct-play GPT 5.6 Sol xhigh, Twin’s base model, scores 7.8%.
- Program-synthesized world models: Twin retains executable models, replay repair, and counterexample-driven correction from program-synthesized world-model methods.WorldCoder introduced this pattern; CWM synthesizes Python dynamics under execution feedback, while PoE-World scales it by composing multiple programmatic experts.
The Twin Method
Twin builds and continually repairs an executable world model from interaction, validating every observed transition before planning or acting. When the goal is unknown, it searches reachable states and tests candidate goals, updating the goal predicate only when level completion confirms them.
- Core method: Twin repeatedly fits an executable world model to the interaction log, explores needed repairs or destinations, plans within the model, and executes checked actions.Its four parts are a problem statement, validate/explore/plan routines, a checked executor, and goal discovery.
- Validate: Validation replays every logged transition and blocks scored actions until the twin reproduces the observed past.Failures identify mismatched transitions and cells that become repair feedback; validation certifies observed consistency rather than unseen-state correctness.
- Plan: Plan uses breadth-first search over the validated twin, with 8-depth and 20,000-node budgets, widened to 14 depth and 30,000 nodes for goal discovery.With unit-cost actions, the first found goal route is shortest within the action set, depth limit, and node budget.
- Goal discovery: Twin handles missing rewards by treating reachable states as tentative goals and testing them until a level boundary confirms one or its absence rejects it.A confirmed candidate updates the goal predicate, while reaching the candidate without a boundary permanently excludes it.
Experimental Results
Twin achieves 93.3/100 on the 25-game benchmark, clearing 23 of 25 games and outperforming comparison systems and direct use of the same base model. Its validated world-model planning improves action efficiency, while residual errors concentrate on novel dynamics and goal discovery.
- Compute: 2.60 billion processed tokens and 91.4 hours of inference were used across 25 runs, averaging roughly 224,000 tokens per scored action.Compute follows difficult goal discovery rather than level count; per-game usage ranges from 5.1 million to 625 million tokens.
- Aggregate performance: 93.3/100 mean score: Twin clears 23 of 25 games and reaches the 100.0 ceiling on 18.The same base model played directly scores 7.8 and clears one game; OPINE-World scores 78.4, Prime Agent 78.3, and EWM 63.8.
- Hard games: Twin is the only system to clear bp35, lf52, and sk48, while on dc22 it clears all six levels in 1,219 actions versus EWM’s 1,842.The largest gains occur on the hardest, longer multilevel games; all four systems score 100.0 on easy games ar25 and cn04.
- Action efficiency: 0.61× as many actions as humans on average: Twin matches or beats the human action count on 21 of its 23 cleared games.Across 13 games cleared by Twin, EWM, and OPINE-World, Twin uses 3,357 actions versus 5,367, 5,381, and 7,485 for the comparison systems and human reference.
- Validated execution: 92.9% of scored actions execute plans tested in simulation, while 7.1% are deliberate probes; 20.1% of outcomes disagree with the twin and trigger repair.Every scored action starts from a replay-validated twin, and repairs persist when previously mispredicted situations recur.
- Generalization and errors: 79.0% of first-seen state–action pairs are predicted exactly, versus 94.8% of recurring pairs, showing that novelty costs 15.8 percentage points.The paper identifies goal proposal and temporal state modeling as the main improvement targets.
Conclusion
Twin frames unknown-game interaction as constructing and validating an executable world model, using observed transitions to plan, act, and repair its theory. It reaches 93.3/100 action efficiency while clearing 23 of 25 public games and predicts reusable rules beyond transition replay.
- Executable world-model inference: Twin represents its current game theory as a Python program, validates every observed transition, plans inside the model, and halts on mismatches.Each action becomes planned progress, a model-repair counterexample, or a deliberate probe.
- Benchmark results: 93.3 of 100 on the benchmark’s action-efficiency metric, Twin clears 23 of 25 public games and 179 of 183 levels.The same off-the-shelf Codex without the validate-explore-plan loop scores 61.1.
- Benchmark results: 79% of first-seen state–action pairs are predicted exactly, indicating reusable rules rather than transition replay.The result supports Twin’s model-based generalization across observed interactions.
- Goal inference: 87.2% of completed levels have a correct first goal hypothesis before any reward, covering 156 of 179 completed levels.This result concerns goal inference before reward, distinct from the system’s broader world-model validation process.
Appendix A: World-Model Accuracy on Unseen Transitions · Appendix B: Planning inside the Twin versus the Real Engine
Final twins generalize beyond replay, predicting complete next frames exactly for 70.1% of previously unobserved state–action pairs, though accuracy varies widely across games and remains local to experienced states and actions. Appendix B compares bounded BFS planning inside each twin and the real engine from the same restored state.
- Appendix A: World-Model Accuracy on Unseen Transitions: Replay validation alone cannot establish generalization because memorizing recorded transitions would also pass.The unseen-pair evaluation uses states visited during the run with actions never taken from those states.
- Appendix A: World-Model Accuracy on Unseen Transitions: 22 of 25 games replay exactly for evaluation, while sc25, dc22, and tn36 require truncating trajectories at their last matching frames.From each verified trajectory or prefix, the experiment samples up to 100 visited states.
- Appendix A: World-Model Accuracy on Unseen Transitions: 70.1% of previously unobserved state–action pairs receive an exact next-frame prediction from final twins.Exact-frame accuracy requires all cells in the predicted frame to match; the test evaluates generalization beyond replayed transitions.
- Appendix A: World-Model Accuracy on Unseen Transitions: 9.9%–98.8% is the cross-game range for exact prediction on previously unobserved pairs.tu93, sp80, bp35, and ar25 exceed 91%, while wa30 reaches only 9.9% despite reproducing its recorded history.
- Appendix A: World-Model Accuracy on Unseen Transitions: The unseen-transition test measures generalization near the agent’s experience, not arbitrary states or actions.Each test starts from a visited state and uses an action type or click coordinate observed during the run.
- Appendix A: World-Model Accuracy on Unseen Transitions: Exact-frame accuracy is preferred over cell-match fraction because unchanged background cells can mask important object errors.A prediction counts as exact only when the complete next frame matches.
- Appendix B: Planning inside the Twin versus the Real Engine: Appendix B compares the same bounded breadth-first search inside the final twin and the real engine from the same restored state.The comparison tests how far twin forward dynamics carry beyond the recorded interaction history.
The race over every completed level
The race compares bounded search in the twin with search in the ARC-AGI-3 engine from identical restored states. The engine finishes more levels overall, but the twin can prevail when hidden state makes identical-frame merging unsound and often certifies shortest plans.
- Experimental setup: 174 of 179 completed levels are compared only from boards proven identical by replaying recordings and checking every frame.Replay mismatches in dc22 and tn36 are attributed to timing during mid-change frames, not version or seed differences.
- Failure modes: The twin is the only search returning a plan on five light-blue levels, but every such plan fails in the engine.Other disagreements include engine searches exhausting a 20,000-node budget on cn04 and merging identical frames despite hidden state on tn36.
- Search results: 61 engine searches finish levels from their starts versus 47 twin searches, while 31 of the twin’s 32 wins are certified shortest.Two levels favor the twin outright because it executes exact plans while the engine finds nothing after merging identical frames.
Appendix C: Token and Cost Accounting · Appendix D: Inside Explore
Appendix C shows that Twin trades substantially more test-time computation for higher benchmark performance and fewer scored actions, while Appendix D details Explore’s diagnostic, goal-discovery, validation, and submission-control mechanisms. Together, these appendices characterize both the cost of Twin’s reasoning and the safeguards governing its actions.
- Appendix C: Token and Cost Accounting: 224k processed tokens per scored action yields a 93.3 score for Twin, versus 48k for no-twin and 715k for EWM.Twin puts nearly five times the thought behind each action while halving harness actions; Table 4 reports 93.3 on 2.60B tokens versus EWM’s 63.8 on 20.0B.
- Appendix C: Token and Cost Accounting: 80 to 1,219 scored actions and 5.1M to 625.3M processed tokens span Twin’s 25 game runs.The diagonal in Figure 8 marks a median rate of about 0.2M tokens per scored action; sb26 and ka59 are the labeled endpoints.
- Appendix C: Token and Cost Accounting: 29.5 percentage points higher score than EWM comes with 7.7× fewer processed tokens, while Twin uses 4.7× more tokens per action than no-twin for a 32-point gain.Cached-context reads account for over 98% of processed tokens, and ka59 contributes 24% of the total.
- Appendix C: Token and Cost Accounting: 2.60B processed tokens and 91.4 hours cover all 25 Twin runs, with non-cached tokens under 2% of total computation.Wall-clock time ranges from 0.7 hours on sb26 to 17.8 on ka59, while thinking per action ranges from 34k to 549k tokens.
- Appendix D: Inside Explore: Explore branches on replay counterexamples: nonempty c triggers repair of the worst-mispredicted action–object context, while empty c with no plan triggers goal-candidate discovery.The dynamics branch groups changed cells by action and before/after colors, excludes background cells, and ranks contexts primarily by misprediction rate.
- Appendix D: Inside Explore: Goal discovery ranks reachable states by color_gone, color_new, local_burst, big_change, and frontier, then retains the cheapest strong example for each signal.The search expands from depth 8 and 20,000 states to depth 14 and 30,000; these are visual-change heuristics, not game-specific rules, and the agent must infer and validate the predicate.
- Appendix D: Inside Explore: Every candidate goal predicate must return false on every recorded frame, because recorded frames are certified negatives after the winning frame is replaced.Candidates firing on any recorded frame are rejected before planning, instantiating WorldCoder’s consistency check.
- Appendix D: Inside Explore: Only submit.py may issue a scored action, requiring a rationale tag, complete-history twin validation, and a committed next-frame prediction before the outcome.MODEL denotes executing the twin’s plan, PROBE denotes testing an uncertain rule, and the submission log makes actions auditable as exploitation or evidence-buying.
Appendix E: Every Scored Action
Across 25 runs, Twin’s scored actions are dominated by validated plans, with exploration concentrated early and probes mainly resolving competing dynamics. Its halt-on-mismatch guard repairs models incrementally, while learning regimes vary across games.
- Action composition: 7.1% of 11,562 chosen actions were deliberate probes, while validated plan steps dominated the 25 game runs.Figure 11 marks correct validated steps blue, probes amber, and failed predictions producing counterexamples red.
- Exploration: 19 in 20 probes distinguished between competing dynamics hypotheses, while only 1 in 20 searched directly for the goal.Exploration was frontloaded at 19.1% of first-level actions and 5.3% of second-level actions, with probes reappearing when deeper levels introduced new mechanics.
- Learning regimes: 223 of ar25’s remaining 235 actions became validated plan steps after it learned its mirror rule.By contrast, ka59 and sk48 never settled, interleaving successful plans with counterexamples through the end.
- Incremental repair: Twin halts each plan at its first wrong prediction and uses that prediction as the next model repair, without waiting for global model accuracy.This guard allows planning to continue despite locally incomplete world models.
Appendix F: One Base Model, From Direct Play to Twin
On the fixed GPT 5.6 Sol base model, persistent memory and self-modifying interaction state substantially improve direct play, but Twin takes this progression toward an externalized world model. Prime Agent reaches 78.3, ahead of the off-the-shelf Codex harness at 61.1.
- 7.8 is GPT 5.6 Sol’s leaderboard score when played directly.
- 38.3 is the score reached by combining retained reasoning and history compaction, from a direct-play starting score of 13.3, using roughly six times fewer output tokens.Both memory settings keep the model’s working state alive across moves.
- 78.3 is Prime Agent’s score, exceeding the off-the-shelf Codex harness at 61.1 without a world model.Prime Agent stores interaction history in a persistent interpreter and allows the agent to rewrite its prompt, skills, and sub-agents midrun.
- Twin externalizes the same persistent working-state principle into a world model.
Appendix G: The Learned Twins
The learned twins retain their rules and repair reasoning as executable, readable code, using counterexamples to refine predictions and goals. In partially observed games, they combine one-time probes with memorized visual strips while preserving mostly rule-based dynamics.
- Interpretable learning: Each twin leaves behind executable model.py code whose rules and counterexample repairs are readable in source and docstrings.The learned discipline keeps effects as no-ops until observed and requires new rules to preserve reproduced transitions.
- Goal learning: In ft09, the first scored action exposed two unmodeled cells, after which the agent rewrote a memorized finished-board picture as a constraint.Three actions later, the goal predicate fired on the unsolved level-1 board, then failed after the rewrite exposed the overfit goal condition.
- Prediction and repair: The twin predicts the full next frame before each action, and every mismatch becomes a counterexample for repair.A prediction is exact only when the predicted and returned frames agree across all 4,096 cells.
- Partial observability: bp35 clears 9 of 9 levels in 529 actions versus the 651-action human baseline despite seeing only about a third of its map at a time.The screen shows 10.7 rows of a 28-row map, while the exit lies 16 rows above the opening frame.
- Partial observability: bp35 pays one scored probe per new place, storing 56 revealed strips by run’s end; deleting them breaks only 54 of 407 recorded transitions.The twin predicts everything except the strip about to scroll into view, then files that strip under a hash of the frame from which it was observed.
Appendix H: Action Counts by Level
Appendix H provides the raw action-count ledger underlying the paper’s scores, covering human references and three systems across every game level. Tables 8 and 9 preserve level order, identify efficiency ties, and record unfinished-run actions under explicit conventions.
- Ledger scope: The ledger reports per-level actions for human, EWM, OPINE-World, and Twin across all games.Columns L1 through L10 follow each game’s level order; blank cells indicate unavailable levels or levels never reached.
- Table organization: Tables 8 and 9 split the action-count ledger between the first thirteen games and the remaining twelve.Table 9 continues Table 8 with the same columns and cell conventions.
- Efficiency convention: Bold marks the fewest actions among EWM, OPINE-World, and Twin, including ties, while human counts serve only as a reference.The human row does not compete for bold formatting.
- Unfinished runs: 647 actions on sc25 L4 and 928 on sp80 L6 were recorded for Twin before those runs ended.These are the first uncleared levels reported for the unfinished runs.
Appendix I: Reproducibility Details
Reproducibility is based on deterministic environments and a public audit trail rather than exact model token-sequence replay. Evaluation settings were fixed across all 25 games, with each observation and action transition recorded as replayable artifacts.
- Evaluation reproducibility: The environments and harness are deterministic, but gpt-5.6-sol token sequences cannot be exactly reproduced because its hosted service exposes no random seed.Reproducibility instead relies on one scored run per game, hash-committed predictions before every submitted action, and complete action histories.
- Evaluation reproducibility: The public project site replays all 25 runs, making the recorded evaluation artifacts available for inspection.The audit trail includes complete action histories and committed predictions before each submitted action.
- Evaluation reproducibility: Every evaluation setting was fixed before the first run and held constant across the 25 games.This configuration is summarized in Table 10.
- Evaluation artifacts: Each observation is written as a 64 × 64 integer board with values from 0 to 15, alongside rendered and turn-state files.The harness writes frames/latest.json, frames/latest.png, and state/turn.json containing the step, level, and legal actions; the agent reads the integers as text without a vision channel.
Appendix J: What the Twins Believe Winning Looks Like · Appendix K: The Learned Twins in Code
Appendix J shows that Twin models game dynamics more reliably than winning conditions: goal predicates recall many wins but accept numerous nonterminal states, causing premature plans. Appendix K provides executable learned code and illustrates how counterexamples repair both dynamics and goal predicates.
- Appendix J: What the Twins Believe Winning Looks Like: 87.2% of completed levels received a correct first committed goal hypothesis, with the harness stopping search at the first predicate-accepted state.A wrong predicate acceptance spends the plan’s scored actions without completing the level.
- Appendix J: What the Twins Believe Winning Looks Like: 0.214 precision accompanied 0.771 recall across accepted states, showing that twins identify many wins while accepting many states that complete nothing.The counts were 138 accepted wins, 179 completed levels, and 646 accepted states.
- Appendix J: What the Twins Believe Winning Looks Like: False goal claims are spread almost evenly across levels rather than concentrated near their finishes, indicating that accepted features recur throughout levels.Correct claims land at the finish by construction, whereas Figure 16 maps false-claim locations.
- Appendix J: What the Twins Believe Winning Looks Like: Precision, not recall, separates games: 13 of 25 twins claim every level they complete, while precision ranges from 0.00 to 1.00.Recall asks whether wins were announced; precision asks how often a claim was right.
- Appendix J: What the Twins Believe Winning Looks Like: 79.4% online dynamics accuracy versus 0.214 goal precision reflects 11,557 dynamics examples compared with 179 goal examples, a 65-to-1 label ratio.Every scored action labels dynamics, whereas completion labels arrive once per level.
- Appendix J: What the Twins Believe Winning Looks Like: Low per-game goal precision predicts failed endgame plans because the planner stops searching at the first state its predicate accepts.False claims themselves carry no penalty; the cost arises when premature acceptance ends the plan short of the level.
- Appendix K: The Learned Twins in Code: 305 lines of the complete executable ft09 twin encode visual parsing, action dynamics, goal recognition, and planning, including the learned exclusion of an animated timer row.The listing is the agent’s verbatim planning model rather than a post-run reconstruction.
- Appendix K: The Learned Twins in Code: A corner-pocket counterexample repaired the ka59 rim threshold from four to three, while ft09 repairs corrected dynamics after scored action 0 and the goal predicate after a level-0 boundary.The ft09 goal rewrite rejected an unsolved level-1 board that the original predicate accepted.