NEWAI chat: ask your fleet anything, in plain language. Chat with your fleet Read more →

Shadow mode: how to test a new robot policy in production without letting it act

How to run a candidate robot policy on live inputs without letting it move anything: what to compare, how many samples you need, and the traps.

Illustration for "Shadow mode for robot policies": a humanoid robot, with the label "candidate · not acting"

Every team I talk to has the same gap. The new checkpoint looks better in the eval suite. It looks better in sim. It looks better on the bench robot in the lab. Then it goes to a cell on a factory floor, and nobody really knows how it will behave there until it is already moving parts.

That gap exists because these machines are not running programs anymore. A program does the same thing with the same input. A robot policy makes a decision many times a second from what its cameras see right now: the light at 6 a.m., the scratch on the fixture, the slightly different bin the customer bought last month. The model changes, the world around it changes, and the robot is far from the people who trained it. The only inputs that tell you how a model behaves in production are production inputs.

Shadow mode is how you get those inputs without letting a model you don't trust yet touch the motors. I think every team shipping learned policies should have it, and I think most teams who have it measure the wrong things. This post is about doing it properly.

The short answer: Run the new policy next to the current one on the same live inputs, in a background thread, and send its outputs to a log instead of the motors. Compare agreement, action distance and latency against a noise floor you measured by running the current model against itself. If it passes over enough real cycles, switch to it atomically and roll it out in phases.

What shadow mode is

The idea is simple. The current model (the primary) keeps driving the robot exactly as before. The new model (the candidate) gets a copy of the same live inputs, computes its own output, and that output goes into a log instead of to the actuators. Then you compare.

Three rules make it shadow mode and not something more dangerous:

  • The candidate has no path to the motors. Not "a flag that defaults to off". No path. Its output goes into a comparison function and a metric, nothing else. If your architecture makes it possible to accidentally route a shadow action to a controller, fix the architecture first.
  • The primary must not notice. The robot's behavior during a shadow test has to be the robot's normal behavior. If running the candidate slows down the primary, you are no longer testing in production. You are testing a slower robot.
  • Same inputs, same moment. The candidate sees exactly the observation the primary saw, at the time the primary saw it. Not a replay from yesterday, not a re-encoded frame.

How to wire it

The shape that works:

  1. Wrap the primary model call. Every time the app calls the primary, the wrapper returns the primary's output immediately, unchanged.
  2. On a sample of those calls, the wrapper pushes the inputs (and the primary's output) into a small bounded queue.
  3. A background thread pulls from the queue, runs the candidate, and computes the comparison.
  4. If the queue is full, drop the sample. Never block the control loop to wait for the candidate.

The bounded queue with drop-on-full is the most important design choice here. A candidate that is slower than the primary will fall behind. If the queue grows without limit, you leak memory. If the wrapper waits, you have just added the candidate's latency to the control loop. Dropping samples costs you some data. Waiting costs you the robot's behavior.

Sample, don't mirror every call. At 30 Hz, consecutive observations are nearly identical. Running the candidate on every fifth or tenth call loses almost no information and frees a lot of compute.

Keep the candidate's files out of the path the app loads from. We put candidates in their own versioned folder with a separate shadow link, and never touch the current link that the primary loads, until the decision is made. More on that in how to update a VLA model on robots remotely.

What to compare

This is where most shadow setups go wrong. Teams log "agreement" as one number and stop there.

Classifiers and discrete decisions

For a vision classifier (good part / bad part, which bin, grasp or skip), agreement is clean: did both models pick the same top class? Track it as a rate.

But also keep the disagreements themselves. A confusion table of "primary said X, candidate said Y" tells you much more than 96%. If all the disagreements are "primary said good, candidate said defect", you have a candidate that is stricter. That might be exactly what you wanted, or it might stop the line.

Save the frames where they disagree. Those images are the most useful thing a shadow test produces. Someone should look at fifty of them before anyone promotes anything.

Continuous actions

For a policy that outputs joint targets, end-effector deltas or action chunks, there is no "same class". You need a distance.

  • Normalize per dimension. A 0.05 difference means one thing on a joint with a 6 rad range and something very different on a gripper with a 0 to 1 range. Divide each dimension by its range (or by the spread you saw in training data) before you compute a distance. Otherwise the biggest joint dominates the metric and the gripper, which is often where the action is, disappears.
  • Compare what would actually execute. If the policy outputs a chunk of 50 actions but the robot executes the first 10 before asking again, compare the first 10. The tail of a chunk is a guess that never runs.
  • Turn distance into agreement with a tolerance. "Agree" means normalized distance below a threshold you choose. Pick it from data, not taste (see the noise floor below).
  • Look at the distribution, not the mean. A candidate that agrees closely 99% of the time and is wildly different 1% of the time has a fine mean. The 1% is where the robot hits something. Track the p95 and the max distance too.

Latency

Measure the candidate's inference time next to the primary's, on the same device, at the same time. Report it as a ratio. A candidate that is 1.4x slower might be fine on a robot with headroom and a disaster on a robot whose loop already runs at the edge. In robotics, slower is a behavior change. If you don't know how much headroom your loop has, read why your robot is slow first.

Measure the noise floor first

Here is the step almost everyone skips.

Many modern policies are not deterministic. Diffusion policies sample noise. Some VLAs sample tokens. GPU kernels are not always bit-exact run to run. So run the primary against itself in shadow before you test any candidate. Same model in both slots, same inputs.

If the current model agrees with itself 93% of the time at your tolerance, a candidate at 91% is close to identical, and a candidate at 99% is suspicious (did you load the same weights twice?). Without this baseline, the agreement number has no meaning.

Do this once per model family and per robot type. Keep the number. Set your pass threshold relative to it.

How many samples you need

Shadow tests produce huge sample counts that mean very little. A robot at 30 Hz, sampled every fifth call, produces thousands of comparisons in an hour. Most of them are the same moment seen twice.

Think in independent decisions, not samples:

  • Count episodes, cycles or picks. Ten thousand comparisons from 40 assembly cycles is roughly 40 data points about how the model behaves on a cycle. Not ten thousand.
  • Cover the conditions that change. Run through at least one full shift, ideally a full day, so you see morning light, evening light, the busy hour and the quiet one. If the cell runs three part variants, make sure all three came through.
  • Use more than one robot. One robot has one camera mount, one calibration, one set of quirks. Two or three robots in different spots tell you whether a result is about the model or about the robot.
  • Do the basic math. With a few hundred truly independent decisions, an agreement rate is accurate to roughly plus or minus two percentage points. If you want to tell 97% from 95%, you need more than that. If you only have 40 cycles, accept that you can catch a bad candidate but you can't rank two good ones.

Set a minimum sample count in the test itself, and make "not enough samples" its own result, separate from pass and fail. A test that ran during a stopped line should not pass by default.

What agreement can't tell you

I want to be clear about the limit, because it matters for safety.

Shadow mode compares the candidate's decisions on states the primary created. It never sees what happens after the candidate's action, because the candidate's action never runs. For a classifier, that is fine: the decision is the whole story. For closed-loop control it is not. A policy that is 2% off at every step can drift into states it was never trained on within a few seconds. Shadow mode can't see that, because the primary keeps pulling the robot back to familiar states.

And agreement is not correctness. A new model that is supposed to be better has to disagree with the old one somewhere. If it agrees 100%, you trained the same model. What you want is high agreement on the routine moments and disagreement concentrated where the old model was weak. That is why you read the disagreement frames.

So treat shadow mode as a gate that catches obvious problems cheaply and safely: broken preprocessing, a wrong camera order, a checkpoint exported with the wrong normalization stats, a model that is twice as slow on this hardware. It does not replace a phased rollout. It earns the candidate the right to enter one.

Pitfalls

  • Compute contention. Two models on one GPU compete for memory and time. Check that both fit in GPU memory with room to spare before starting. Watch the primary's latency during the test and compare it with the hour before. If it went up, the shadow is changing the robot. Sample less often, or run the candidate at lower priority.
  • Stateful models. If the policy keeps a history of observations or past actions, the candidate needs its own history built from the same observations. Don't feed it the primary's past actions as if they were its own, and don't let it share state objects with the primary.
  • Preprocessing drift. The candidate may need different image sizes or normalization. Do that inside the candidate's path, not by changing the shared input. Changing the shared input changes the primary.
  • The world changes mid-test. A camera gets bumped during the test, and both models get worse together. Agreement may even go up. Look at the primary's own health during the test window. If the primary had a bad hour, the test window is suspect.
  • Testing on an idle robot. A shadow test on a robot that isn't working produces comparisons of an empty table. Tie the test to real activity, or count only samples taken during cycles.
  • Forgetting the app holds the old model. Most apps load weights once at startup. Switching a file on disk does nothing until the app reloads. Plan the restart as part of the switch.

Pass or fail: a concrete starting point

Every team should tune these, but here is where I would start:

  • Agreement: at least the primary's self-agreement minus a small margin (a couple of points), at the tolerance you chose from the noise floor.
  • Tail distance: p95 normalized distance no worse than the primary against itself.
  • Latency ratio: 1.2x the primary or less on loops with little headroom, looser where you have measured headroom.
  • Samples: a minimum count, plus coverage of at least one full shift.
  • Primary health: no regression in the primary's latency or loop rate during the window.

Write those down in the release itself, not in someone's head. If the test fails, the candidate files and the shadow configuration should be removed automatically, and the robot should be exactly as it was.

Promote atomically, then roll out

Passing shadow on one robot or a small first group means one thing: the candidate is ready to act on a few robots. The promotion should be boring:

  1. Point the current link at the tested version in one atomic step. No copying weights into place.
  2. Restart the app (or trigger its reload) so it actually loads the new weights.
  3. Keep the previous version on disk so undo is a link switch back.
  4. Roll the promotion out in phases, comparing updated robots with not-yet-updated ones on inference latency, loop rate, errors and cycle yield, and halt automatically if they get worse.

That last part is a topic of its own: phased rollouts and automatic rollback for robot fleets. Shadow mode tells you the candidate is sane. A phased rollout tells you it is better. And once it acts, you need to monitor the policy in production like any other.

How we do it at PhysicalFleet

In PhysicalFleet, shadow mode is a release step. model.shadow puts the candidate in its own versioned slot next to the current model, runs it for the duration you set, and passes or fails it on agreement, latency ratio and a minimum sample count. On the robot, one line (pf.shadow(model, ...)) wraps the primary so the candidate runs on sampled live inputs in a background thread with a bounded queue, and never acts. If it passes, model.promote switches current atomically and you roll it out in phases behind the health gate. More on the OTA updates page.

If you're testing new policies on real robots, I'd love to hear how you decide a model is ready to act.

Common questions

What is shadow mode in robotics?

Shadow mode runs a new model next to the current one on the same live inputs, while only the current model controls the robot. The new model's outputs go to a log and a comparison, never to the motors. It shows you how a candidate behaves on real production inputs before you trust it to act.

How do I compare two robot policies that output continuous actions?

Normalize each action dimension by its range, compute a distance, and count it as agreement when it's under a tolerance you picked from data. Compare only the part of an action chunk that would actually execute. Track the p95 and the max distance as well as the mean, because the rare large disagreements are where a robot hits something.

Can shadow testing slow down my robot?

It can, if it's built wrong. Two models on one GPU compete for memory and time, and a wrapper that waits for the candidate adds its latency to the control loop. Run the candidate in a background thread on sampled inputs, with a bounded queue that drops samples when it's full, and watch the current model's latency during the test.

Why does my robot policy disagree with itself in a shadow test?

Many policies aren't deterministic. Diffusion policies sample noise, some VLAs sample tokens, and GPU kernels aren't always bit-exact from run to run. Run the current model against itself first to measure this noise floor, then set the candidate's pass threshold relative to it.

Is shadow mode enough to prove a new robot policy is safe?

No. Shadow mode only sees states the current model created, never what happens after the candidate's own actions, so it can't catch a closed-loop policy drifting into states it never trained on. It's a cheap and safe gate for obvious problems, like broken preprocessing or a model that's too slow on this hardware. After it passes, the candidate still needs a phased rollout.

#shadow mode#robot policy#model testing#VLA#MLOps#model rollout
Amit EzerCo-founder, PhysicalFleet

From the lab bench. To the entire fleet.

Connect your first machine in minutes, develop it in the lab and run your whole fleet in production from one place.

Free for up to 3 machines · Then pay as you go