Language models can now write robot control scripts and fix them by running them in a simulator, reading the failures, and trying again. The simulator used for this repair loop is clean, though. Its LiDAR never loses beams near glass, and its camera never blurs at speed. Code that passes every simulated test therefore meets real sensor corruption for the first time on hardware. We propose to fit a fast, region-by-region statistical model of how real sensor readings differ from simulated ones, and to place that model inside the repair loop. The model is a localized Gaussian process: a collection of small Bayesian regressors, each responsible for one slice of sensing conditions such as range, incidence angle, surface type and robot speed. It supplies two things. First, it injects corruption that looks like real corruption, with the right structure in the right places. Second, it tells the language model which of its sensor reads fall in places where the noise is severe, or where the noise model itself does not know what to expect. The resulting feedback reads like this: "your grasp check reads depth at grazing angles on a reflective surface, where readings drop out 40% of the time and our estimate is uncertain."
The opportunity is that each ingredient already exists but has never been connected. Execution-grounded code repair works in noise-free simulators. Localized Gaussian processes now scale to millions of points on a laptop. Sim-to-real research documents that sensor noise is structured and heteroscedastic, meaning its size varies across conditions rather than following a single Gaussian. The central claim is testable and could fail. At a matched budget of real sensor data, code refined against a calibrated, localized noise model should transfer better than code refined in clean simulation or under blanket noise randomization. The uncertainty report, not just the injected noise, should account for a measurable part of that gain.
Why This Gap Is Real
Code-repair systems that act in the physical world ground their feedback only in simulation. RobotGPT uses decision, evaluation and corrector chatbots to repair PyBullet manipulation code over up to three attempts, reaching 91.5% simulated success against 38.5% for zero-shot ChatGPT. Its Franka hardware trials nonetheless failed often because of placement inaccuracy and open-loop execution. LearnAct shows that agents will rewrite their own Python functions in response to environment errors, updating code 90% of the time rather than writing notes, but it does so in AlfWorld and symbolic planning domains. These two papers motivate the proposal: the repair loop is capable, and what it lacks is realistic feedback. VeriGuard shows that generated policy code can be checked and monitored at runtime, but its checks are deterministic and target API-agent security rather than noisy physical sensing.
The sim-to-real literature supplies the evidence that sensor noise is structured and dangerous. Deep Drone Acrobatics reports 0% success for raw-image policies against 100% for policies fed abstracted visual-inertial feature tracks. Uncertainty Quantification with Statistical Guarantees in End-to-End Autonomous Driving Control finds that Monte Carlo Dropout's safety score collapses to 0.00 under CARLA rain. That result constrains our design: generic approximate Bayesian uncertainty over a whole policy can fail precisely under structured perceptual noise. This is why we model the noise itself, per region, rather than putting uncertainty on the controller. Provably Safe Sim-to-Real Transfer partitions a tabular world into a trusted region and a mismatch region, with sample cost scaling in the mismatch size. It assumes the simulator is either exactly right or wrong by a fixed margin, which continuous sensor degradation violates. Our localized model can be read as a continuous, soft version of its mismatch region.
The method comes from the scalable Gaussian process line. A single scan from a real LiDAR produces on the order of a hundred thousand returns, so a global Gaussian process, whose cost grows with the cube of the data size, is out of the question. GPnn fits hyperparameters on a subsample and predicts from each query's nearest neighbours, training on 1.6 million points in about 30 seconds. We reuse it as the base noise model. Its authors also flag two limits that matter here. Neighbour search degrades as the input dimension grows. Their cheap recalibration only makes the variance match the squared error ("weak calibration") and does not make the full distribution, and hence the tails, correct ("strong calibration"). Tails are exactly what an injected-noise simulator must get right, so we keep the conditioning inputs low-dimensional (a handful of physical sensing variables, not raw pixels) and add per-region recalibration of the quantiles. Treed models such as CTGP, which infers its tree with slow MCMC but handles sharp non-stationarity well, are our alternative partitioning scheme. They fit our setting because a model trained once, offline, can afford MCMC. Finally, Approximation-Aware Bayesian Optimization argues that a surrogate's limited modelling budget should go where decisions depend on it. We borrow that principle to decide where to collect scarce real data.
Core Claim
Let $x$ be the low-dimensional sensing condition of one reading, for example range, incidence angle, material tag and ego speed. Let $r(x)$ be the real-minus-simulated residual of that reading, together with a dropout indicator. The localized model gives, for each region, a posterior over the residual's mean, log-variance and dropout probability. Candidate code $c$ is scored not on one noisy rollout but across $S$ functions $f_s$ drawn from that posterior. Each draw is a plausible world for sensor corruption, so the score averages over what the noise model does not know as well as over the noise itself:
$$ J(c) = \mathrm{Quantile}_{\alpha}\big\{\, \mathrm{SuccessRate}(c \mid f_s) \,\big\}_{s=1}^{S}, $$
Here $\mathrm{SuccessRate}(c \mid f_s)$ is the simulated task success when readings are corrupted by $f_s$, and $\alpha$ (for example 0.1) sets how pessimistic the score is. The claim is that repairing code to raise $J$, while feeding the language model a per-read report of predicted corruption and model uncertainty, yields scripts that contain the right defensive structure: filtering, assertions, re-sensing and fallbacks placed where they are needed. Blanket noise tends instead to produce uniformly timid code.
Research Program
We build three components. The first is a sensor-residual pipeline. It collects paired readings of the same physical state from a "sim" sensor and a "real" sensor, and fits the localized noise model: a GPnn base, a treed variant, and per-leaf quantile recalibration. The second is a noise-injecting simulator wrapper that corrupts readings by drawing from the model's posterior. The third is a repair loop in the style of RobotGPT that receives, alongside tracebacks and task outcomes, a structured report. The report attributes each failure to the specific sensor reads the code consumed, tagged with their region's predicted corruption and epistemic uncertainty (how unsure the model is about the noise, as opposed to how noisy the sensor is). Following the plateau after three to five feedback rounds reported by Yan et al., we cap refinement at five iterations for every method.
A second strand tests the tension between GPnn's claim that rough parameter estimates are "good enough" for accuracy and the argument of Maus et al. that decision utility should steer modelling effort. Given a fixed budget of real paired readings, we compare uniform collection with collection targeted at regions where the posterior is uncertain and the current code's success is sensitive to the draw $f_s$. Targeted collection winning would indicate that decision-aware allocation matters even for a local model. A tie would support GPnn's view.
Because a real robot fleet is not assumed, each benchmark uses a "reality proxy": a richer corruption process hidden from every method, in the spirit of the CityFlow-to-SUMO split used by PromptGAT. CARLA gives a natural paired case. The same scene rendered in clear weather and in rain supplies real structured perceptual differences, not hand-designed ones.
Baselines
The naive reference is zero-shot language-model control code evaluated directly on the reality proxy. The second reference is clean-simulation repair in the RobotGPT style, with the same model, prompts, five-iteration cap and rollout count, and no noise at all. This is the current practice we aim to beat. RobotGPT reports 91.5% task success in clean PyBullet simulation. No reported result on Lacuna was found for its success under structured sensor noise; the paper reports only high hardware failure rates.
The strongest competitor is repair under tuned domain randomization, meaning noise injected uniformly regardless of sensing conditions. We fit a single heteroscedastic-free Gaussian noise level plus a global dropout rate to the same real paired readings our model sees. We then sweep its scale over the same tuning budget, taking the best setting on a held-out proxy split. This baseline gets identical data, compute and iterations. Beating it means higher target-proxy task success at equal or lower completion time, since otherwise we could be buying robustness with timidity. A second strong competitor replaces our localized model with a global sparse variational Gaussian process and with a heteroscedastic neural regressor, both trained on the same residuals. This isolates whether localized structure and calibrated uncertainty matter, rather than merely having some learned noise model.
For the navigation suite we also report the learned hybrid planner of Pokle et al. and the ROS Nav Stack. These are reference points, not code-repair competitors. In clean Gazebo, Pokle et al. report 98% versus 82% success on foyer scenario E6 and 84% versus 66% on unseen map E7. For CARLA rain, the reference is Michelmore et al.'s reported Monte Carlo Dropout safety of 0.00. The oracle upper bound repairs code directly in the hidden reality proxy.
Three ablations isolate the key ingredients. The first keeps noise injection but removes the uncertainty report. The second injects only the posterior mean noise model, dropping the averaging over draws $f_s$. The third keeps the report but removes per-leaf quantile recalibration, which tests whether strong calibration is needed.
Why not just…?
Why not just randomize sensor noise broadly and let the loop harden the code? This is the real threat, and it might work. If tuned randomization matches our method on target success at matched completion time, the localized model is not earning its cost, and we will report that. Our prediction that it will fall short rests on the structure documented in the sim-to-real work cited above. Dropout concentrated at grazing angles or on glass, and rain degrading depth unevenly with range, cannot be represented by one noise level. Tuning that level high enough to cover the worst region should produce code that is slow everywhere. The matched-completion-time comparison and a per-region failure breakdown will settle it.
Why not just learn the noise model with a neural network? A neural regressor can fit the residual mean and variance, and it is included as a baseline. The concern is its uncertainty about the noise model itself. The 0.00 rain safety of Monte Carlo Dropout in Michelmore et al. is direct evidence that cheap neural uncertainty can fail under structured perceptual shift. Our averaging over $f_s$ and our uncertainty report both depend on that epistemic signal. If the neural model's uncertainty proves as useful as ours in the ablation-matched comparison, the conclusion is that the choice of Gaussian process is a convenience, not a necessity.
Why not just repair the code against real data directly? With abundant real rollouts this would be best, and it is our oracle. The practical constraint is budget. Every repair iteration needs many rollouts, and Provably Safe Sim-to-Real Transfer shows unconstrained real exploration spending 68.5% of iterations in unsafe states. Our paired readings are passive sensor logs, which are far cheaper than closed-loop trials. The data-budget curve reports how much real closed-loop data the oracle needs before it overtakes us.
Why not just use one global sparse Gaussian process? At LiDAR scale a global model must compress the data into a few hundred inducing points. Maus et al. show that such compression spreads the modelling budget away from the regions that matter and smooths over sharp local features, which is exactly what dropout near reflective surfaces looks like. The global-model baseline measures this directly through both calibration and task transfer.
Proposed Experiments
We run three suites. The first is BulletArm/PyBullet pick-and-place with a depth sensor whose proxy corruption includes edge dropout, material-dependent bias and motion blur. The second is Gazebo navigation in scenarios E1–E7, with a LiDAR proxy featuring beam loss near glass and range-dependent scatter. The third is CARLA with clear-to-rain pairing, where the language model writes rule-based controllers that consume LiDAR and depth features. Metrics are target-proxy task success, safety violations, completion time as a conservatism check, noise-model negative log likelihood and quantile coverage at several levels, noise-model fit and query time as scan counts grow, and the amount of real paired data used.
Four checks are decisive. The first compares our method against tuned randomization at matched completion time on all three suites; failure here sinks the core claim. The second is the uncertainty-report ablation: if removing the report costs nothing, the contribution reduces to better noise injection. The third tests whether strong calibration (quantile coverage), rather than negative log likelihood, predicts transfer across all noise models tried; this tells us whether GPnn's weak calibration is sufficient for this use. The fourth compares targeted and uniform real-data collection at fixed budget, which answers whether decision-aware modelling matters for local Gaussian processes. If a physical rover or arm becomes available, a small hardware replication on the Gazebo task family would test whether proxy conclusions survive real sensors.
References
- RobotGPT: Robot Manipulation Learning From ChatGPT
- Empowering Large Language Model Agents through Action Learning
- VeriGuard: Enhancing LLM Agent Safety via Verified Code Generation
- Deep Drone Acrobatics (Extended Abstract)
- Uncertainty Quantification with Statistical Guarantees in End-to-End Autonomous Driving Control
- Provably Safe Sim-to-Real Transfer
- Leveraging Locality and Robustness to Achieve Massively Scalable Gaussian Process Regression
- Classification and Categorical Inputs with Treed Gaussian Process Models
- Approximation-Aware Bayesian Optimization
- CodeTransOcean: A Comprehensive Multilingual Benchmark for Code Translation
- LLM Powered Sim-to-real Transfer for Traffic Signal Control
- Deep Local Trajectory Replanning and Control for Robot Navigation