Exploring Only Where the Simulator Is Wrong

A robot trained in simulation usually reaches the real world knowing most of what it needs. Its simulator is wrong only in some places: a slippery patch of floor, a motor that saturates at high speed, a contact the physics engine smooths over. Real-world data collection, however, is still typically either blind or uniform. The robot is either deployed zero-shot and hopes for the best, or it re-explores the whole state space in reality, spending scarce and risky real samples on regions the simulator already models well. We propose a reward-free real-world exploration method for continuous control that spreads its real visits as widely as possible, but only across the region where the simulator and reality disagree or where their agreement has not yet been checked. It does this while keeping cumulative real-world safety cost under a hard budget.

The ingredients come from four lines of work. The first is state entropy maximization: driving an agent to make the distribution of states it visits as uniform as possible, which amounts to a systematic breadth-first sweep of reachable states. The second is safe exploration under constrained Markov decision processes (CMDPs), which are RL problems with a separate cost signal whose total must stay under a budget. The third is the cold-start cost of learning from scratch. The fourth is the sim-to-real gap. The core claim is that entropy should not be used to avoid simulator-reality mismatch. It should be used to cover that mismatch efficiently, so the agent can learn a corrected model with a number of real samples that scales with the size of the mismatch region rather than the size of the whole state space. A tabular version of this sample-complexity result exists. We aim to make it work for continuous robots.

What Exists and What Is Missing

The closest prior work is Provably Safe Sim-to-Real Transfer, and it motivates the proposal. That paper estimates the set $B$ of state-action pairs where the simulator's transitions diverge from reality, builds a hybrid model that uses real transition counts only inside $B$, and explores through a mixture of a known safe policy and an exploratory one, with the mixing weight set by linear programming. It proves real-world sample complexity scales with $|B|$ rather than $|\mathcal{S}|$. On a 5×5 gridworld it reports 0% unsafe iterations and 77,958 real samples, against 296,910 without a simulator. It is strictly tabular: it relies on discrete transition counting and a separability assumption on the shift, and it has no mechanism for spreading exploration in continuous spaces.

CEM supplies the exploration machinery. It maximizes a $k$-nearest-neighbor particle estimate of state entropy, a density estimate in which a state far from its neighbors in the buffer is treated as rarely visited. It respects an undiscounted safety budget by updating the policy with discounted cost gradients while updating the Lagrange multiplier with undiscounted real costs. CEM, however, runs in a single stationary environment and treats every unvisited state as equally worth visiting.

SPiDR points the opposite way from us. It adds ensemble next-state disagreement across randomized simulators to the safety cost, so the agent avoids regions where simulators disagree. It reports 100% constraint satisfaction on a Unitree Go1 and an RC car, and 26.1× and 6.2× fewer violations than plain domain randomization. SPiDR is reward-driven, and it assumes reality lies inside the randomization range. Avoidance also means the mismatch is never learned, which caps performance wherever the task needs those regions.

Sim-to-Lab-to-Real shields real training with a reachability-based safety critic, a learned estimate of how close each state is to becoming unrecoverable. It pays for its PAC-Bayes guarantees with thousands of intermediate "lab" rollouts. We borrow its idea of a backup policy that intercepts unsafe actions, but not its lab stage.

Two results constrain the design. First, State Entropy Regularization for Robust Reinforcement Learning proves that no entropy regularizer computed on the nominal environment can guarantee robustness to arbitrary transition shifts. This could look like a contradiction, but our proposal agrees with it. We do not ask entropy to make a sim-trained policy robust to the gap. We use entropy to collect the real data that closes the gap, and the robustness comes from the corrected model. The same paper notes that entropy conflicts with risk-averse, concentrated behavior. We handle that tension with an explicit budget and a safe fallback policy, not by hoping entropy stays benign.

Second, particle entropy estimates are noisy with few samples, which is exactly the real-world regime. That fact shapes how we estimate density, described below.

Core Claim

Mismatch-weighted, constrained state entropy maximization in reality, initialized from a simulator-trained safe policy, will reach a given accuracy of the corrected dynamics model inside the mismatch region with substantially fewer real samples than uniform constrained entropy. It will do so with no more safety violations than a policy that simply avoids simulator disagreement. A corrected model built this way will also support better downstream performance on several unseen tasks than either zero-shot transfer or disagreement avoidance.

Research Program

We learn a residual dynamics model: an ensemble that predicts the difference between the real next state and the simulator's predicted next state. From it we define a mismatch score $m(s)$, equal to the magnitude of the predicted residual plus the ensemble's spread. Early in training almost nothing has been checked, so $m$ is high everywhere and the agent explores broadly. As real data confirms that the simulator is accurate in some regions, $m$ falls there and exploration concentrates on the true mismatch region. This is the continuous analogue of shrinking the tabular method's confidence set around $B$.

The exploration objective is

$$\max_{\pi} \; \mathbb{E}_{s \sim d^{\pi}_{\text{real}}}\big[\, m(s)\,\log \lVert z(s) - z^{(k)}(s)\rVert \,\big] \quad \text{s.t.} \quad \mathbb{E}\Big[\textstyle\sum_{t=0}^{T} c(s_t,a_t)\Big] \le \epsilon .$$

Here $d^{\pi}_{\text{real}}$ is the real-world state distribution, $z(\cdot)$ is a learned state embedding, $z^{(k)}(s)$ is the embedding of the $k$-th nearest real state already in the buffer, $c$ is the safety cost, $T$ is the episode length, and $\epsilon$ is the undiscounted budget. The constraint is enforced CEM-style: discounted cost gradients drive the policy, and the undiscounted real cost updates the multiplier.

To address the small-sample weakness of particle estimators, we compute neighbor distances against the real buffer. The query states, however, come from cheap imagined rollouts of the hybrid model, which uses the simulator plus the learned residual. The policy is therefore rewarded for reaching places the real data has not yet covered, and it does not need many real trajectories to get a usable gradient.

Real-world execution goes through a mixture of the exploration policy and a safe policy $\pi_{\text{safe}}$ pretrained in simulation with SPiDR-style pessimism. At each episode, the mixing weight is the largest value whose pessimistic cost estimate under the hybrid model, evaluated at the upper edge of the ensemble, stays within budget. This replaces the tabular method's linear program. It also retires the fixed hand-tuned attenuation schedule used by α-RPO, which fades a classical controller out on a manual timetable. Here the prior fades as fast as the model's certified accuracy allows.

The simulator also helps with the problem described in Breaking Safety Paradox with Feasible Dual Policy Iteration: as a policy gets safer it stops seeing violations, and its safety critic degrades. We keep simulated constraint-violating transitions in the critic's training set, so the critic keeps learning where the danger is even when the real agent never goes there.

We will analyze two questions: whether sample counts track the measure of the mismatch region as its size is varied, and which properties of the residual model (for example, how smoothly it generalizes) the scaling depends on. We do not promise a full continuous proof.

Baselines

The naive reference point is zero-shot deployment of a domain-randomized policy trained on the downstream task, with no real exploration at all. It fixes the floor for downstream return and cost.

The strongest competitor on safety is SPiDR. We run it with the same simulator ensemble, the same randomization ranges, and the same hyperparameter search budget for its penalty weight as we give our budget and mixing parameters. SPiDR reports 100% constraint satisfaction in real deployments and 26.1× fewer Go1 violations than domain randomization. Beating it means matching its violation rate during real exploration while exceeding its downstream return, especially on tasks whose optimum passes through mismatch regions.

The strongest competitor on sample efficiency is CEM run directly in reality, warm-started from the same simulator-trained safe policy, with identical real sample budgets. Beating it means reaching a target residual-model error inside the mismatch region with clearly fewer real samples at equal or lower violations. For CEM on Safety Gym PointGoal and CarButton, no numerical entropy or cost value was found on Lacuna; only qualitative constraint satisfaction is reported.

On the 5×5 gridworld, the tabular method's reported 0% unsafe iterations and 77,958 samples is the reference. We should roughly match it, since our method is designed as a continuous generalization.

Three ablations isolate the key ingredients. The first sets $m\equiv 1$, which removes mismatch weighting. The second replaces the particle entropy term with a plain ensemble-variance bonus. The third drops the adaptive mixture in favor of α-RPO's fixed schedule.

Why not just…?

Why not just run CEM with SPiDR's disagreement-augmented cost? This is the obvious combination and it is easy to build. It turns disagreement into something to avoid. The agent never collects real data where the simulator is wrong, so any task needing those states stays unsolved or overly cautious, a failure the literature already attributes to pessimistic randomization. It also has no way to handle real dynamics outside the randomized ensemble's range, where the ensembles agree but are all wrong. Our shifted-reality experiments include exactly such out-of-range perturbations, and downstream return on mismatch-dependent tasks will settle the question.

Why not just maximize uniform state entropy in reality, as CEM does? Uniform coverage spends real samples confirming what the simulator already gets right. The tabular result, where exploiting the simulator cut real samples roughly 3.8×, suggests the waste is large. The $m\equiv 1$ ablation measures this directly. If it matches the full method, mismatch weighting is not pulling its weight and we will report that.

Why not just seek maximum model uncertainty with a variance bonus? This is the real threat, because it is simpler and targets the same region. Our concern is that a variance bonus drives the agent to the single most uncertain spot and oscillates there, leaving the rest of the mismatch region uncovered, whereas the entropy term rewards spreading out within it. We have no cited evidence settling this. The variance-bonus ablation, measured as residual-model error across the whole mismatch region rather than at its peak, decides it. If variance-seeking matches entropy, the contribution narrows to the safe mixture and hybrid-model density estimation, and we would say so.

Why not just fine-tune on the real task with a shield, as in Sim-to-Lab-to-Real? Task fine-tuning must be repeated per task and needs many domain-specific rollouts. A corrected model built reward-free serves every downstream task. Our multi-task downstream evaluation compares total real samples across tasks.

Proposed Experiments

The main testbed is sim-to-sim. The "simulator" is nominal Safety-Gymnasium navigation, using the PointGoal and CarButton families, and the "reality" is the same task with physics disruptions from Robust Gymnasium and the RRLS suite. Some disruptions are localized, such as friction patches or actuator saturation zones. Others are global, and some deliberately lie outside the randomization range. Varying the fraction of the space that is disrupted lets us test whether real sample counts scale with mismatch size. The gridworld replicates the tabular setting as a sanity check. If the sim-to-sim results hold, a hardware trial on the 1:10 F1TENTH car, the platform used by both α-RPO and SPiDR, would test a low-friction track section.

Metrics are real samples to reach a target residual error inside the true mismatch region, real constraint violations and cumulative undiscounted cost during exploration, and downstream return and cost on three to five tasks. Downstream tasks are planned or fine-tuned in the corrected hybrid model and then evaluated in "reality."

Two checks are decisive. The first is whether the full method beats the $m\equiv 1$ and variance-bonus ablations on samples-to-accuracy at matched violations. The second is whether it beats SPiDR on downstream return in the out-of-range disruptions while staying within the same violation rate. Failing the first means the entropy weighting is unnecessary. Failing the second means the added real-world exploration does not pay for its risk.