Sim-to-Real Deployment and Continual Correction › The Reality Gap, Stated Precisely
World Models HandbookAll chapters Sim-to-Real Deployment and Continual Correction › The Reality Gap, Stated PreciselyOne section · Sections in this chapter2 / 13 ↓
Reading tools Definitions & inline links
Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.
Article links
Make inline references clickable
This section defines the reality gap precisely. We sort the sources of mismatch by how they behave under different remedies, and we distinguish two kinds of model error that organize the rest of the chapter.
Where the gap comes from
Jakobi, Husbands, and Harvey's 1995 work used the term in its title, Noise and the Reality Gap: The Use of Simulation in Evolutionary Robotics. This is an attribution of that published use, not a claim of priority for inventing the term. For deployment, the practical question is task-specific: which distinctions must this simulator preserve for the controller and evaluation conditions? A simulator can support one task yet fail on another using the same physical system.
That reframing matters because it tells you where to look. A simulator can be extremely accurate about contact dynamics and completely silent about motor heating. It can model the arm perfectly and forget that the camera exports frames on a different clock than the controller. The gap is not a scalar error bar; it is a structured mismatch, and different parts of it have different fixes. A scalar error bar suggests a single knob to turn, whereas a structured mismatch tells you to go find the specific component of the system whose behavior is missing from the model and decide whether to model it, randomize over it, or monitor for it.
It helps to sort the sources by the part of the system they affect. Residual patterns can suggest tests, but do not uniquely identify these categories:
- Parameter mismatch. Wrong values in a chosen model family: masses, inertias, friction coefficients, damping, gains, gear ratios, battery-voltage curves or motor constants. Estimation can correct these when the experiment identifies them. They need not produce signed bias: a damping error gives a velocity-dependent residual whose mean can be zero over symmetric motion.
- Unmodeled structure. Missing or incorrectly represented mechanisms, such as deadband, backlash, stiction, hysteresis, cable stretch or contact stick-slip, relative to the chosen class. Correction can require a different functional form, state or input. Its residual need not depend on state: an omitted constant force is a structural discrepancy in a class that lacks a constant term.
- Timing and latency. Sensor delay, actuator delay, jitter, unsynchronized clocks, overruns or dropped frames. Sensor delay can leave the physical transition valid while making an observation-only prediction insufficient. Actuator delay changes which command reaches the plant and may require action history or additional state.
- Saturation and rate limits. Delivered commands differ from requested commands when limits bind. Limits may depend on speed or temperature for a particular actuator and operating range; that dependence is not universal. Gentle tests may never activate the limit. Once it does activate, the resulting state error can persist after the actuator leaves saturation.
- Observation channel differences. Noise statistics, quantization, offsets, occlusion or modality dropout. These affect what the controller knows even when the modeled plant dynamics are accurate.
- Distribution and task mismatch. Deployment reference trajectories, initial conditions or loads can differ from those used in model fitting and evaluation. Good fit on the simulated population does not establish performance under that new population. This can coexist with omitted physical mechanisms; the categories are a guide to designing checks, not mutually exclusive diagnoses.
One note on terminology before the formal distinction. Throughout this chapter the plant is the physical system being controlled, the model is the mathematical object used to predict its behavior, and the controller is the rule that maps observations into commands. These three words appear constantly, and keeping them separate is what makes the rest of the argument readable. A great deal of confusion in practice comes from sliding between them, for instance by saying "the model is wrong" when the model is right and the observation feeding the controller is stale, or by saying "the controller is unstable" when the controller is fine and the model it plans against is systematically biased.
Parametric error and structural error
Let us be precise, because this distinction organizes the whole chapter.
Suppose the true plant is a damped oscillator whose state consists of position and velocity . The continuous-time dynamics are:
where:
- : position in metres, the first component of the state
- : velocity in metres per second, the second component of the state
- : the time derivative of position, which equals by definition
- : acceleration, or equivalently the time derivative of velocity
- : mass-normalized stiffness, in ; for , the term produces restoring acceleration
- : mass-normalized viscous damping, in ; for , its contribution dissipates mechanical energy
- : dimensionless control gain, since the applied command already has acceleration units
- : the scalar command issued by the controller at time , in metres per second squared (the units of acceleration), which plays the role of the book's action . We write the raw issued command as and the post-clip applied command as . The distinction between and matters because the model may predict a command the actuator cannot deliver. The physical acceleration is always written as to avoid collision with the control symbol.
The oscillator has linear second-order dynamics in the applied input. Clipping from issued to applied command makes the overall commanded system nonlinear. A damped mechanical mode is a useful teaching example for inertia, restoring behavior and dissipation; it is not a claim that every controlled plant has such a mode. The parametric-versus-structural distinction does not depend on the simplicity of the plant; it depends on whether the discrepancy between the true plant and the model is confined to the constants or spills into the functional form.
A mismatch confined to the numerical values of quantities that appear in the model, while the model's functional form is correct. If the true parameters are and your model uses , the parametric error is the vector .
A mismatch in the model's functional form: the true map is not in the hypothesis class your model or simulator draws from. Additive parameter drift cannot represent it, and neither can adding more parameters of the wrong kind.
A plant with when the model uses has parametric mismatch if the remaining modeled structure is correct. Sensor delay is a different layer: leaves the physical transition valid, but changes the controller's information. A predictor receiving only may lack enough history to determine the next state. Residual fitting can improve that conditional prediction, but exact current-state reconstruction needs additional assumptions and information, such as a known deterministic transition and the intervening applied actions. The delay sweep below tests a controller without that reconstruction, not the best possible time-aware estimator.
When a monitor fires, first test candidate explanations. If the discrepancy is identifiable parameter mismatch, an informative episode can support an update within the current class. If the class is misspecified, consider a different functional form, state or input. Neither category determines how difficult the correction is: an unexcited parameter can be unidentifiable, while an omitted constant term can be straightforward to estimate. The monitor alone does not make that distinction.
A rollout bound makes the distinction between local defects and propagated error explicit. Compare the true recursion with under the same issued action sequence. Fix one norm and an operating region containing both trajectories. Suppose throughout that region and is -Lipschitz in state with action held fixed. The triangle inequality gives
where:
- is endpoint error, not a sum of errors over time.
- is the initial-state discrepancy.
- is a uniform one-step defect bound in the same norm.
- bounds the true map's change with state while holding the action fixed.
- counts transitions; at the sum is empty.
For the example below, both rollouts start from the same state, so . Define the resulting upper bound as . It is a conditional guarantee for each trajectory satisfying the premises, not a prediction that a trajectory attains the bound. If either rollout leaves the operating region, this argument no longer supplies the stated guarantee.
The unamplified final term comes from the newest defect. A defect introduced one transition earlier can be multiplied once by ; an older one can be multiplied twice, and so on. These factors permit contraction when as well as expansion when . The inequalities need not be jointly tight.
For , approaches . At , it is . For fixed and , grows asymptotically as . Actual error may remain much smaller, including zero for identical maps. These open-loop bounds hold actions fixed; independently replanning controllers produce different action sequences and need a separate closed-loop analysis.
Use a dimensionless state norm for the oscillator: . The plot is a generic illustration with in this norm, not an estimated Lipschitz constant or defect bound for the fitted models below.
We plot the same bound for three values of at a fixed defect bound. Only the assumed amplification factor changes; the figure does not classify the fitted plant as contractive or expansive.
import numpy as np
from book_plot_style import use_book_style
use_book_style()
# Upper bound B_H = eps * (1 + L + ... + L^(H-1)), with matched initial states.
# Evaluation settings, declared explicitly:
# fixed dimensionless one-step defect bound eps = 0.01,
# horizons 0..30 recursive steps,
# Lipschitz constants chosen to bracket the marginal case L = 1.
EPS_BOUND = 0.01
HORIZONS = np.arange(0, 31)
LIPSCHITZ = [0.8, 1.0, 1.2]
def rollout_error_bound(eps, L, H):
"""Worst-case bound under the stated smoothness and one-step-error assumptions.
H counts the number of recursive steps, so H = 0 gives an empty sum of 0.
The marginal case L = 1 is handled separately to avoid a 0/0 form; there the
series grows linearly in H rather than geometrically.
"""
h = np.arange(H + 1)
if L == 1.0:
return eps * h
return eps * (1.0 - L**h) / (1.0 - L)
# One curve per Lipschitz constant; index order is fixed so the assignment is stable.
bound_curves = {
L: rollout_error_bound(EPS_BOUND, L, int(HORIZONS[-1])) for L in LIPSCHITZ
}