Relabel, Don't Discard: Recovering Mismatched Simulator Data for Offline RL

Robots are often trained from two piles of logged experience. One is large and cheap: transitions from a simulator, or from an older version of the robot. The other is small and trustworthy: a few thousand transitions from the real machine. The two piles disagree because the physics differ. A push that moves the simulated leg 10 cm moves the real leg 6 cm. Current offline methods (methods that learn only from logged data, with no new interaction) handle this disagreement in one of two ways. Some throw out or penalize simulator transitions wherever the physics disagree. Others train a generative model that imagines what would have happened in the real system. Throwing data out blinds the agent in exactly the regions where the simulator was wrong. Imagining new states adds model error that compounds over long rollouts.

We propose a third option that sits between them. Often the simulator visited a sequence of states that the real robot could also visit, just by applying a different force. In that case the simulator trajectory is not wrong. It carries the wrong action label. We keep the simulator's real state sequence, ask a target-side inverse dynamics model (a model that predicts which action moves the system from state $s$ to state $s'$) for the action the real robot would need, and verify that answer with a target-side forward model. Each source transition is then routed to one of three bins. It is kept as is if local dynamics agree, relabeled if it disagrees but the relabel is verifiably consistent, and discarded only when the transition is unreachable under real physics. This turns the open question "when should an agent filter versus bridge mismatched data?" into a per-transition test that can be measured.

Core Claim

A large share of the source data that filtering methods discard is action-explainable. Its state transition $(s, s')$ is reachable in the target system under some feasible action, and only the action label is wrong. Recovering those transitions by relabeling should help most on shifts that rescale the effect of actions, such as friction, actuator gain or damping, and moderate gravity changes. It should give roughly nothing on shifts that make source state transitions physically unreachable, such as extreme gravity, where the method should fall back to filtering. The fraction of high-divergence transitions that pass the consistency test should predict how much a given shift benefits. If that prediction fails, the claim is wrong.

The test itself is simple. We train an inverse model $g$ and an ensemble of forward models $f_1,\dots,f_K$ on the small target dataset. For a source transition $(s,a,s')$ that falls in a high-divergence region, we form the relabeled action $a^* = g(s,s')$ and compute the consistency error

$$e(s,s') = \max_k \lVert f_k(s,a^*) - s' \rVert ,$$

where taking the maximum over ensemble members makes the check conservative. The transition is accepted with action $a^*$ when $e$ falls below the forward models' own held-out error quantile on target data, and $a^*$ lies inside the actuator limits. Otherwise it is discarded. Rewards are recomputed from $(s,a^*,s')$ using the known reward function. This matters because locomotion rewards include an action cost.

Relation to Prior Work

The motivating tension is spelled out by two recent off-dynamics offline RL papers. LoDADA clusters transitions by next state, estimates a local KL divergence between source and target dynamics in each cluster, and discards high-divergence clusters before training with Implicit Q-Learning (IQL, a method that avoids querying values of unseen actions). DARA instead turns a classifier-estimated dynamics ratio into a reward penalty. Both avoid regions of mismatch rather than recovering them. MOBODY names this blind spot and responds generatively. It learns a shared latent transition model with separate source and target action encoders, then imagines target-domain rollouts.

Our proposal shares MOBODY's key insight: the same next state can require different actions in different domains. We implement that insight without generating states. Every state we train on was actually visited in the source logs, so there is no compounding rollout error. Our explicit discard bin also covers the case MOBODY's shared latent model cannot represent, namely transitions that are unreachable in the target system.

The method itself comes from HIDIL. HIDIL uses expert-trained inverse dynamics across an imperfect simulator and reaches 78.1% of expert return from 10 demonstrations. HIDIL is imitation from expert data with an interactive simulator. We use inverse dynamics as a data-repair step for offline RL on suboptimal logs, with no simulator queries.

The hybrid offline-and-online line constrains the design. H2O, H2O+ and SR² all require live simulator interaction, and SR² further requires resetting the simulator to arbitrary states. We target the purely offline setting where none of that is available. H2O+ also reports that discriminator-based gap estimation is fragile, which is one reason our acceptance test uses forward-model consistency instead of a domain classifier for the relabel decision.

B4MRL supplies a warning. It finds that mixing imperfect source data with biased offline data can do worse than either source alone, and it lists action discrepancy as a distinct error type. Our method is specifically aimed at that type. Its confounding settings are where we expect the method to fail, and we will report them.

Research Program

The work has three parts. First, we build the relabeling pipeline on top of an IQL backbone. The pipeline has three stages: LoDADA-style local divergence scoring to find candidate mismatched regions, inverse-model relabeling, and the ensemble consistency gate. We then train on target data plus kept and relabeled source data. We will also try a horizon-$H$ variant in the spirit of HIDIL. In that variant, relabeling targets $s_{t+H}$ rather than $s_{t+1}$, which may help when single steps are unreachable but short sequences are not.

Second, we measure relabel accuracy directly. MuJoCo lets us set the target simulator's state for evaluation only. So for every relabeled transition we can execute $a^*$ from $s$ under the true target physics and measure the distance to $s'$. This gives a ground-truth check on the gate's precision and recall that no prior off-dynamics paper reports.

Third, we characterize which shifts are action-explainable. For each perturbation type and severity, we report the fraction of high-divergence transitions accepted by the gate. We then correlate that fraction with the method's gain over pure filtering.

Baselines

The naive reference points are IQL and behavior cloning trained on the 5,000 target transitions alone, and IQL on naively pooled source and target data. The first pair tells us whether source data helps at all. The pooled run reproduces the B4MRL warning that mixing can hurt.

The strongest filtering competitor is LoDADA. On ODRL it reports a 19.9% improvement over the second-best method on gravity and friction shifts and 32.7% on morphology shifts. It is the closest ancestor of our method, since our keep and discard bins reuse its local divergence idea. Beating it isolates the value of the relabel bin.

The strongest generative competitor is MOBODY. On ODRL gravity and friction tasks it reports a 44% average improvement over the best prior baseline (REAG), and it ranks best or second-best in 28 of 32 such scenarios. No reported absolute normalized score for either method was found on Lacuna. We will therefore rerun both from their descriptions rather than copy numbers. Each will receive the same 1,000,000 source and 5,000 target transitions, the same IQL backbone where applicable, the same number of gradient steps, and the same hyperparameter search budget of 20 configurations per method. Tuning will use the same held-out target-data criterion, never online returns. We will also include DARA as a plug-in penalty on IQL.

Beating these baselines means a higher mean D4RL-normalized target return than both LoDADA and MOBODY, averaged over the ODRL gravity, friction and kinematic suites, with non-overlapping 95% bootstrap intervals over 5 seeds. It also means not losing to LoDADA on any severity level by more than seed noise.

Three ablations isolate the key ingredient. The first relabels everything without the consistency gate, which tests whether verification matters. The second removes the relabel bin, which reduces the method to LoDADA. The third relabels with an inverse model trained on source data. That model should return roughly the original actions, so this ablation controls for any effect of simply refitting actions.

Why not just…?

Why not just keep filtering, as LoDADA does? Filtering is safe, but it learns nothing in exactly the regions where the simulator was wrong, and MOBODY's gains suggest those regions matter. Our decisive test speaks to this directly. If the gate accepts few high-divergence transitions, or relabeled data does not raise return over LoDADA, then filtering is the right answer for these shifts and our claim fails. The relabel-free ablation measures exactly this.

Why not just learn a target world model and imagine, as MOBODY does? This is the real threat, because MOBODY already captures domain-specific actions. Our bet is that real source state sequences are worth more than imagined ones on long horizons and under structural shifts like broken joints, where a shared latent transition model is least plausible. If MOBODY matches us on kinematic and morphology shifts and on long-horizon AntMaze, relabeling offers only simplicity, and we will say so. A hybrid that uses relabeled data as the start of MOBODY rollouts is the natural follow-up in that case.

Why not just pretrain on source data and fine-tune on target data? Pretraining on source data and fine-tuning on 5,000 target transitions is the obvious transfer recipe. But fine-tuning a value function on a few thousand transitions brings back the out-of-distribution overestimation that D4RL documents for small datasets. We include it as an extra baseline under the same budget instead of arguing it away.

Why not just fit the simulator's parameters from the real data, as DROPO does? DROPO fits a distribution over simulator parameters to real trajectories, cutting box-pushing error from about 10 cm under uniform randomization to about 2 cm. When a parametric simulator is available and well specified, that is the better tool. Our setting assumes only logged source data. Statistical Guarantees for Offline Domain Randomization also notes that this approach only reaches the best parametric approximation when the simulator is structurally misspecified. Relabeling makes no parametric assumption.

Proposed Experiments

The main evaluation uses the ODRL benchmark used by MOBODY and LoDADA. It covers HalfCheetah, Ant, Walker2d and Hopper under gravity and friction scaling from 0.1x to 5.0x across four severity levels, plus broken-joint and limb-size shifts. AntMaze is added for long horizons and Adroit Pen and Door for manipulation. The metric is D4RL-normalized return in the target environment over 5 seeds.

A secondary evaluation uses the B4MRL action-discrepancy and confounding settings. Action discrepancy is where relabeling should shine. Confounding is where we predict it should not, because a confounded behavior policy corrupts the target inverse model.

There are three decisive checks. The first is gate precision, measured with the ground-truth target-simulator replay. Relabeled transitions must land within the target forward model's own held-out error on at least most accepted samples, or the gate is not doing its job. The second is the predictive relationship. Across all shift types and severities, the gate's acceptance rate on high-divergence data should correlate positively with the gain over LoDADA. In particular, gains should be largest on friction shifts, which we expect to be mostly action-explainable, and should vanish at 5.0x gravity, where many source transitions are unreachable. The third is the head-to-head against MOBODY on morphology shifts and AntMaze. This settles whether keeping real state sequences beats imagining them.