Counterfactually Gated Timing for Compact Physical-Intervention Policies

Many control tasks fail on when, not what. In I-PHYRE, a 2D physics benchmark where an agent removes blocks so that balls fall into a pit, learned agents often pick the right blocks in the right order and still miss the fraction of a second in which removal works. The benchmark also has a "Noisy" split that adds blocks with no physical role, and agent performance drops there. This proposal argues that the two failures are linked. When an agent's sense of timing is computed from an attention pass over every object in the scene, irrelevant objects nudge the predicted moment of action even when they leave the chosen action unchanged. Our fix is a small model trained only for this domain. One part of the model decides which block to act on. A separate timing part predicts a continuous timestamp, and it is allowed to see only the objects that a physics simulator has shown to matter causally.

In plain terms: we use the simulator during training to label which objects actually change the outcome when removed. We teach a compact policy to predict those labels, and we hard-wire the timing output to read only the objects predicted to matter. If this works, distractors should stop moving the timing estimate, especially distractors that look like real blocks. Showing distractors during training should not achieve the same effect, because appearance does not tell the model which objects are functional.

Core Claim

Our claim has two parts. The first part is diagnostic. Under contextual noise, the extra failures of timing-capable policies come mostly from shifts in the predicted action time, not from choosing the wrong object. The second part is about the fix. A compact policy that separates action choice from timing, and hard-gates the timing head to a causally supervised subset of objects, closes most of the gap between clean and noisy performance. A matched model trained on the same distractor-augmented data with ordinary soft attention does not close it.

What would be new is the source of the gate. In robotics, relevance is usually learned from task success, as in the Most Relevant Point locality loss of Evaluating Continual Learning on a Home Robot. In text retrieval, it comes from query-reconstruction scores or self-evaluation, as in Improving Zero-shot Reader by Reducing Distractions from Irrelevant Documents in Open-Domain Question Answering and CompAct: Compressing Retrieved Documents Actively for Question Answering. Here it comes from counterfactual intervention in the simulator. We also apply the gate to the temporal output specifically.

Positioning

The decoupling idea comes from Time and Action Co-Training in Reinforcement Learning Agents. That work separates a Q-network that chooses actions from a recurrent "population clock" that fires them within 100 ms windows. It never tests distractors, and its clock reads the full observation. We keep the separation and replace the recurrent clock with a timing head that regresses a timestamp. The point of the change is to restrict what the timing head can see.

I-PHYRE: Interactive Physical Reasoning supplies the testbed, the Noisy split, and the observation that motivates the work: correct order, missed window. It tests only from-scratch model-free RL and offers no mechanism for handling noise.

The text-noise literature constrains the design. Soft attention cannot drive irrelevant keys to exactly zero, so they still change the softmax normalization. Both Superposition Prompting: Improving and Accelerating Retrieval-Augmented Generation and CompAct gain by structurally excluding context rather than reweighting it. That evidence is why we use a hard gate instead of an auxiliary attention-weighting loss. We test this choice directly rather than assuming it.

Causal-PIK: Causality-based Physical Reasoning with a Physics-Informed Kernel shows that grouping actions by their causal outcome generalizes better than grouping by spatial proximity. It reports 65.0 AUCCESS on Virtual Tools versus 42.0 with a standard kernel. However, it handles only static, single-step placement. We borrow the causal-outcome principle and move it into multi-step, time-critical intervention.

Domain specialization sets the scale regime and a known risk. LLMLight: Large Language Models as Traffic Signal Control Agents shows a specialized 0.5B model outperforming Llama-2-70B on traffic control. Its inputs are clean text, and its timing is discrete phase selection. Specializing Smaller Language Models towards Multi-Step Reasoning documents the cost: specialized models lose ability outside their domain. We therefore treat transfer to I-PHYRE's Compositional and Multi-ball splits as a required check, not an optional one.

Research Program

Counterfactual labels. For each training game and each reference solution, we remove each object at time zero in the simulator and re-run the episode. Reference solutions are found offline by simulator search over block order and timestamps. An object is labeled functional if removing it changes the outcome, or moves any ball's trajectory by more than a set distance before the scheduled interventions. Because Pymunk is fast and I-PHYRE scenes contain few objects, labeling costs on the order of scenes × objects rollouts. This supervision exists only at training time. At test time the policy sees only the initial scene and the evolving scene.

Policy. The policy is a compact object-centric transformer, tens of millions of parameters, trained only on I-PHYRE. Each object token encodes shape, position, velocity, and whether the object can be removed. A shared encoder feeds three heads.

The relevance head predicts each object's functional label. The selection head chooses which removable block to act on next. The timing head regresses a continuous removal time $\tau$. Its attention is masked to the objects whose predicted relevance exceeds a threshold, plus the selected block. This mask removes keys entirely; it does not down-weight them.

The timing loss uses the width of the success window rather than a single target time. Let $[a, b]$ be the window of removal times, found by sweeping in the simulator, for which the reference continuation still succeeds. The loss is zero inside the window and quadratic outside:

$$\mathcal{L}_\tau = \max(0, a - \tau)^2 + \max(0, \tau - b)^2.$$

This prevents a narrow window from being treated as a point estimate.

Training proceeds in two stages. The first is imitation of the reference solutions, with distractor augmentation turned on for every model variant. The second is closed-loop fine-tuning with re-planning after each executed action, matching I-PHYRE's combined planning mode.

Optional pretrained-backbone variant. A second version starts from a pretrained 0.5B language model, following LLMLight's scale, with serialized object tokens. This tests whether pretrained priors reduce the specialization cost. It is secondary to the main question.

Diagnostic analysis before the method. For every baseline we split each Noisy-split failure into two types. A selection error means the chosen block sequence differs from every successful sequence. A timing error means the sequence is valid but some $\tau$ falls outside its window. If noise mainly causes selection errors, the core hypothesis is weakened. In that case we would report the gate as a selection-robustness method and stop claiming that the problem is specifically temporal.

Baselines

Naive reference. The do-nothing point is I-PHYRE's own reported setup: PPO, SAC, and DQN in planning-on-the-fly mode, choosing act or no-op at each step, trained on Basic and evaluated on every split. The file reports that these agents degrade on Noisy, Compositional, and Multi-ball. We found no reported per-agent absolute number on Lacuna for I-PHYRE RL success rates, so we will re-run them under the benchmark protocol. The only reported reference is human success of roughly 80–90% across splits. We also include a planning-in-advance baseline that predicts all timestamps from the initial frame.

Strongest learned competitor. This is the same compact transformer with the same three-head structure, relevance labels removed, ordinary soft attention, and the same distractor-augmented data. It also receives the extra robustness data any reviewer would ask for: random distractors drawn from the full appearance distribution. It is matched on parameters, training steps, and a 20-configuration hyperparameter search. Beating it means a Noisy-split success gain beyond seed variance (five seeds, bootstrap intervals) and a smaller increase in timing error under noise.

Soft-relevance ablation. This variant keeps the counterfactual relevance loss but uses the predicted relevance as soft attention weights in the timing head instead of a hard mask. It isolates whether the hard exclusion matters, as the text-noise work suggests.

Model-based planning baseline. We train a learned forward model on the same rollouts and plan timestamps by sampling candidates and scoring them with that model, in the spirit of Causal-PIK. The file reports no I-PHYRE result for this method. We run it with a compute budget per decision equal to ten policy forward passes, and separately with an unlimited budget.

Upper bounds. The ground-truth simulator searched at test time gives an upper bound. A version of our model fed oracle relevance labels separates errors in predicting relevance from errors in using it.

Generalist model. A prompted frontier vision-language model is included for context. lmgame-Bench: How Good are LLMs at Playing Games? reports these models failing at duration control in Super Mario Bros. We found no reported I-PHYRE number on Lacuna for them.

Why not just…?

Why not just train with distractor augmentation and let attention learn to ignore them? This is the real threat, and the soft-attention matched baseline exists to settle it. The two methods should differ only on distractors whose appearance gives no clue to their function. Augmentation can teach "ignore things that look like typical distractors." It cannot teach which of two identical-looking blocks is load-bearing; the counterfactual labels can. We therefore build a hard-noise split from I-PHYRE generators. Its distractors match functional blocks in shape and material and sit near the balls' paths, and every one is verified non-functional by the same counterfactual test. Distractor types are held out from training. If augmentation matches us on this split, the counterfactual gate is unnecessary, and we will say so.

Why not just plan with the simulator, or a learned dynamics model, at test time? With the true simulator the benchmark becomes search, which is why we report it as an upper bound and not as a competitor. Real deployments, the setting Control of autonomous mobile robots with automated planning addresses, involve latency and dynamics mismatch that a perfect simulator hides. A learned forward model is a fair competitor. Its rollouts still pass through every object, so we expect distractor-induced error to compound over the prediction horizon. The equal-compute comparison will show whether a fast amortized policy or an explicit planner is more robust to noise.

Why not just use a frontier generalist model with a good harness? lmgame-Bench reports that o1/o3-class models reason correctly about intent but cannot set durations. It also reports that pruning dialogue history, not adding model scale, restores their deductive accuracy in Ace Attorney. Both findings point to the two failures we target. We include such a model for context but do not expect it to be the strongest competitor.

Why not just discretize time more finely for RL? Finer steps enlarge the no-op search space that I-PHYRE identifies as the on-the-fly mode's weakness. They also leave the noise pathway intact. We run PPO at two step resolutions to show whether finer time steps help on Noisy at all.

Proposed Experiments

All models train on I-PHYRE's Basic split with distractor augmentation. They are evaluated on Basic, Noisy, Compositional, Multi-ball, and the new hard-noise split. We report:

  • success rate;
  • the noise gap, defined as Basic minus Noisy success;
  • timing error, measured in milliseconds outside the success window;
  • the share of failures that are selection versus timing errors.

We also plot success against success-window width, binned across games. If the mechanism works, our model's advantage should be largest for the narrowest windows.

The decisive check has two conditions. On the hard-noise split, the gated model's noise gap must be at most half that of the soft-attention augmented baseline. The oracle-label variant must show that most of the remaining gap comes from relevance-prediction errors. Failing either condition falsifies the central claim.

A second check is transfer to Compositional and Multi-ball, where specialization cost would appear. If the gate overfits to Basic-split causal structure, transfer performance there will fall below the ungated baseline.

As an exploratory extension, we will test whether the same gating applies to duration control in lmgame-Bench's Super Mario Bros. There the continuous output is button-hold duration, and relevance labels come from emulator-state ablations of sprites. We treat this only as a test of how far the idea generalizes.