Where the Simulator Lies: Calibrated Mismatch Flags for Safe Real-World World-Model Fine-Tuning

A robot trained in simulation with a learned world model plans by imagining the future inside that model. A world model is a neural network that predicts what the robot will see next and what reward and safety cost it will incur. When the robot moves to the real world, the model is confidently wrong wherever the simulator was wrong: a patch of floor with more friction, a gust zone next to an obstacle, a motor that responds late. The planner then does what optimizers always do and steers toward those errors. The result is hallucinated safety: imagined trajectories look collision-free because the model has never seen the real collision. The usual guard against this, pessimism wherever an ensemble of models disagrees, does not help here. The ensemble was trained on abundant simulator data from exactly those states, so its members agree with each other, and they agree on the wrong answer.

We propose to find the simulator's lies directly and to be cautious only there. The camera only partially reveals the world, so some surprise between the model's prediction and the next real observation is normal. We measure that normal level in simulation, where we know the model is correct, and turn it into a calibrated per-region threshold. During real fine-tuning, a region of latent state space is flagged as a mismatch region only when real prediction errors there exceed what simulation says partial observability alone would produce. Imagined rollouts that enter flagged regions receive worst-case cost. Real exploration inside them is routed through a conservative fallback policy. Everywhere else, the agent trusts its simulator-trained model and keeps its full sample efficiency.

Core Claim

Under partial observability, the gap between a world model's prior prediction and its observation-corrected posterior mixes two things: irreducible ambiguity from the sensors, and actual simulator-to-reality dynamics error. Only the second should trigger pessimism. A simulator gives a free null distribution for the first. So a conformal-style test against that null localizes sim-to-real mismatch in a continuous, vision-based latent world model. Pessimism and safe exploration scoped to the flagged regions should then cut real-world constraint violations during fine-tuning without the blanket conservatism of uncertainty penalties or domain randomization.

Concretely, let $z_t$ be the world model's latent belief state and $e_t$ its surprise on the next real step, defined as the divergence between the model's one-step prior and its posterior after seeing $o_{t+1}$. Let $q_{1-\alpha}(z)$ be the $(1-\alpha)$ quantile of $e$ measured on held-out simulator data near $z$. A real latent state is flagged when, among its $k$ nearest real-visited neighbours, the fraction with $e > q_{1-\alpha}$ exceeds $\alpha$ by a binomial-test margin:

$$ \text{flag}(z) = \mathbb{1}\Big[\tfrac{1}{k}\textstyle\sum_{j \in N_k(z)} \mathbb{1}[e_j > q_{1-\alpha}(z_j)] > \alpha + \delta_k\Big], $$

where $\delta_k$ is the confidence margin for $k$ samples. Without a dynamics mismatch, the exceedance rate is at most $\alpha$ by construction, which is where the form of the test comes from. Inside imagination, the cost model is replaced by its maximum in flagged states, and rollouts are truncated there.

The method rests on one assumption, which we state openly. It is the continuous analogue of the separability assumption in Provably Safe Sim-to-Real Transfer: mismatch regions are spatially coherent, so evidence from visited real states extends to their latent neighbours.

Relation to Prior Work

The motivating evidence comes from three places. PIGDreamer shows that agents under partial observability systematically underestimate risk. It fixes this in simulation by aligning a camera-only world model with a privileged-state model, but it explicitly leaves sim-to-real transfer unstudied. SafeDreamer adds cost models and constrained planning to DreamerV3 and reaches near-zero cost in vision-only Safety-Gymnasium, again entirely in stationary simulation. The safety paradox identified in Breaking Safety Paradox with Feasible Dual Policy Iteration and observed in Blind Spot Detection explains why fine-tuning on real data alone will not fix these models: safe policies rarely visit boundaries, so real cost labels are scarce exactly where they matter. Blind Spot Detection reports an AUC of 0.60 from optimal-oracle data versus 0.96 from suboptimal data.

The method borrows from two lines of work. From Provably Safe Sim-to-Real Transfer we take the core logic: estimate the region $B$ where the simulator is wrong, trust the simulator elsewhere, and explore $B$ through a mixture of a safe baseline and an exploratory policy. That work is tabular and fully observed. Our contribution is making $B$ estimable from pixels in a learned latent space, with sensor ambiguity calibrated away. From the model-exploitation literature we keep the practice of truncating imagination where the model is untrustworthy, as in MBPO and Masked Model-based Actor-Critic. We change the trigger from ensemble variance to calibrated real-versus-sim surprise.

One line of work constrains the design. Mismatched No More uses a real-versus-model transition classifier, and its penalties are known to become over-conservative. That is a reason not to apply a global discriminator-style penalty.

Three nearby methods attack related but different problems. Rejecting Hallucinated State Targets during Planning rejects infeasible imagined goals, but only in fully observed discrete grids. Blind Spot Detection needs a human oracle. Sim-to-Lab-to-Real shields a model-free policy with reachability analysis and has no world model to protect from exploitation.

Research Program

The system starts from a SafeDreamer-style agent trained in a source simulator with moderate domain randomization. Where available, it uses the PIGDreamer privileged alignment. After source training, we freeze a copy of the world model and compute its surprise distribution on held-out simulator rollouts. We store latent codes and their surprises in a nearest-neighbour index that gives region-local quantiles $q_{1-\alpha}(z)$.

The fallback policy is a constrained model-free policy (CPPO-PID) trained in the same simulator with a tight cost budget and broad randomization. It is deliberately conservative. Like Provably Safe Sim-to-Real, we assume it is safe in the target domain, and we test that assumption rather than presuming it.

During target-domain fine-tuning, every real transition contributes a surprise value to the index, and the flag is recomputed. The acting policy is a state-dependent mixture. In unflagged states, the world-model policy acts. In flagged states, the fallback acts, except for a small probing budget. The probing budget is spent only on flagged regions that the world-model policy's own imagined trajectories pass through, following the task-oriented exploration argument of Learning Active Task-Oriented Exploration Policies: mismatch the task never touches is not worth exploring. Real data from flagged regions fine-tunes the world model. A region is unflagged once its exceedance rate falls back under $\alpha + \delta_k$, which returns it to optimistic planning.

The analysis component asks three questions. Does surprise exceedance track ground-truth mismatch better than ensemble disagreement does? Does calibrating against the simulator's own surprise distribution remove false alarms caused purely by partial observability? How much does each source of safety (imagination pessimism versus fallback routing) contribute?

Baselines

The naive reference point is zero-shot deployment of the simulator-trained SafeDreamer agent, followed by unguarded fine-tuning on target data. This shows how much hallucinated safety costs when nobody intervenes.

The strongest existing method in the vision-based safe world-model setting is SafeDreamer, together with PIGDreamer where privileged state exists. The reported reference numbers are a 94.3% cost reduction versus prior model-based methods on vision-only Safety-Gymnasium, and a 100% arrival rate with average episode cost 2.2 on MetaDrive (versus 14.1 for PPO reward shaping), both from SafeDreamer. PIGDreamer reports near-zero deployment cost and a 136% reward improvement on Guard. All of these are in-simulator figures. We found no reported result on Lacuna for SafeDreamer or PIGDreamer under a sim-to-real dynamics shift, so we establish that number ourselves. We will run these agents with conservative fine-tuning, meaning the cost budget is tightened during target adaptation, using the same pretraining checkpoint, the same real-step budget, and the same hyperparameter search budget as our method.

The uncertainty-pessimism baseline is the same agent with an ensemble of five latent dynamics heads. Imagined rollouts are truncated, and cost is inflated, wherever ensemble disagreement passes a threshold tuned on target data, in the spirit of MBPO and masked model-based actor-critic.

The model-free baseline is CPPO-PID from Safety Gymnasium with broad domain randomization, both deployed zero-shot and fine-tuned. Safety Gymnasium reports that PPO-Lag reduces velocity-task violations by 98% relative to PPO at a 45% reward drop. That gives a sense of the cost-reward tradeoff of this family.

In the tabular windy gridworld, the reference is Provably Safe Sim-to-Real itself. It reports 0% unsafe iterations and 77,958 real samples, against 68.5% unsafe iterations for unconstrained sim-to-real and 296,910 samples for simulator-free safe exploration.

Two ablations isolate the key ingredient. The first replaces the simulator-calibrated threshold with a single global surprise threshold tuned on target data. The second replaces the surprise test with a learned real-versus-sim transition discriminator.

Our method beats the baselines if it achieves lower cumulative real-world cost during fine-tuning than conservatively fine-tuned SafeDreamer and the ensemble baseline at matched final return. It must also reach higher final return than CPPO-PID with randomization at matched cost. In the gridworld, it should match the 0% unsafe rate while staying within a small factor of 77,958 samples, despite working from images rather than tabular states.

Why not just…?

Why not just use ensemble disagreement, which already prevents model exploitation? Ensembles measure how little training data a region had, not whether that data came from the right physics. In a mismatch region the simulator supplied plenty of confident, consistent, wrong data, so the members agree. This is the central empirical bet of the proposal, and the experiments test it directly. We will report the correlation between ensemble disagreement and ground-truth mismatch on the shifted tasks against the same correlation for our flag. If ensembles track mismatch about as well, our contribution reduces to the scoping and fallback machinery, and we will say so.

Why not just randomize the simulator broadly and train a constrained model-free policy? Broad randomization is the standard recipe, and with a wide enough range it may avoid the specific shifts we inject. The file's evidence is that it costs agility and sample efficiency: MBPO reports roughly 3 million SAC steps on Ant versus 300,000 model-based steps, and SafeDreamer reports that Lagrangian model-free methods struggle to reach near-zero cost from vision. This is a real threat in the zero-shot regime. We settle it by including randomization ranges that cover the injected shift and comparing final return at matched real cost.

Why not just fine-tune SafeDreamer on real data with a tighter cost budget? The safety paradox predicts this fails in a specific way. A tighter budget keeps the agent away from boundaries, so the cost model never sees the real failure, and it stays wrong exactly where the planner pushes. The decisive measurement is the number of real violations accumulated before the fine-tuned model's cost predictions in the mismatch region become accurate.

Why not just train a real-versus-sim discriminator, as Mismatched No More does? This is the closest threat, because a discriminator also localizes difference. Its weakness is that it fires on any difference, including harmless visual differences such as lighting, and it is uncalibrated. That pushes it toward the over-conservatism reported for that approach. It is included as an ablation. A visual-only-shift control, with identical dynamics and changed rendering, shows whether it over-flags relative to our test. We acknowledge that a poor encoder could inflate our surprise under pure visual shift too, and we will report that outcome honestly.

Proposed Experiments

The main testbed is vision-only Safety-Gymnasium (PointGoal, CarGoal, PointButton) and Guard. Each task is split into a source simulator and a held-out target simulator that stands in for reality. The target adds shifts the source lacks: localized wind fields near hazards (a continuous version of the windy gridworld), changed friction on floor patches, and actuator latency. Ground-truth mismatch regions are therefore known, which lets us score the flag's precision and recall. A second testbed is MetaDrive, with procedurally generated maps as source and real-trajectory-imported scenarios as target; MetaDrive itself reports that purely synthetic training transfers poorly to real maps. The tabular windy gridworld provides a sanity check against provable guarantees. We will consider hardware only if the simulated target results are decisive.

The metrics are cumulative target-domain cost during fine-tuning, final return and cost, real steps to reach the cost budget, flag precision and recall against true mismatch regions, and the false-flag rate.

Three checks would decide the idea. First, in wind and friction regions, surprise exceedance must identify mismatch substantially better than ensemble disagreement. Second, an aleatoric control adds identical observation noise and occlusion to source and target. A global-threshold surprise detector should then flag widely, while the simulator-calibrated test should not; if both flag equally, the calibration story is wrong. Third, on the full shifted tasks, the method must reduce cumulative fine-tuning cost relative to conservatively fine-tuned SafeDreamer at matched return. The scoped-pessimism ablation, which applies pessimism to all states once any flag fires, must lose return relative to the full method. That would show that localization, not caution alone, carries the benefit.