Shadow Mode and Safe Rollback: Shipping Model Updates to an Edge Fleet An engineer described a pipeline for shipping model updates to a fleet of 5,000 NAT-bound edge devices on cellular links, built around signed model bundles with verifiable manifests, shadow-mode evaluation, cohort canaries, guardrail metrics, and version-skew tracking. The shadow runner compares candidate and production scores on live data, logging corroborating signals and ring-buffer references on disagreements, and reports disagreement rate and direction. The engineer cautioned that shadow mode reduces the risk of a catastrophically wrong rollout but cannot validate accuracy without labelled incidents. Updating a model on 5,000 devices behind NAT, on cellular links, is a different discipline from updating a web service. You cannot roll back by redeploying. You cannot read the logs. Some devices are offline for days. And a bad update can make every device confidently wrong at once. This post describes the pipeline that makes that survivable: shadow mode, cohort canaries, guardrail metrics, and a manifest that keeps version skew visible. A model is not one file. Ship a signed bundle with everything inference needs, described by a manifest that the device can verify before it stops running the current model: { "model id": "vib-anomaly", "version": "3.2.0", "created at": "2026-11-20T04:12:00Z", "framework": "tflite-micro", "files": { "model.tflite": { "sha256": "9f2c...", "bytes": 98304 }, "normalizer.json": { "sha256": "41ab...", "bytes": 512 } }, "input": { "shape": 1, 512, 3 , "dtype": "int8", "scaler": "rolling zscore v2" }, "feature set hash": "7d19c0e2", "min firmware": "1.8.0", "target": { "ram kb max": 160, "latency ms p99 max": 25 }, "metrics": { "alarm rate expected": 0.0041, "alarm rate tolerance": 0.5 }, "signature": "MEUCIQ..." } Four fields carry disproportionate weight: feature set hash min firmware alarm rate expected signature Shadow mode is the highest-value step in the whole pipeline and the one teams skip most often. The new model runs on live data alongside the old one; only the old one's decisions are acted upon. class ShadowRunner: """Run a candidate model beside production; log divergence, act on nothing.""" def init self, prod model, shadow model, sink, warn ratio=1.5 : self.prod, self.shadow, self.sink = prod model, shadow model, sink self.warn ratio = warn ratio self.n = self.disagree = self.shadow only = self.prod only = 0 def step self, window, context : p = self.prod.score window s = self.shadow.score window p alarm, s alarm = p self.prod.threshold, s self.shadow.threshold self.n += 1 self.disagree += int p alarm = s alarm self.shadow only += int s alarm and not p alarm self.prod only += int p alarm and not s alarm sample aggressively on disagreement, sparsely otherwise if p alarm = s alarm or self.n % 500 == 0: self.sink.write { "ts": context "ts" , "device": context "device id" , "prod score": round float p , 4 , "shadow score": round float s , 4 , "corroboration": context.get "corroboration" , "window ref": context.get "ring buffer ref" , } return p alarm def report self - dict: return { "n": self.n, "disagreement rate": self.disagree / max self.n, 1 , "shadow only": self.shadow only, "prod only": self.prod only, } Two details make shadow mode actually usable: Log the corroborating signals, not just scores. When the shadow model disagrees, you need to know whether it did so with or without a second independent signal temperature rising, current anomaly . Divergence with corroboration is a potential catch; divergence without is probably a false positive. Sample the raw window reference. A ring-buffer reference lets you pull the actual waveform for a sample of disagreements, which is the difference between "the new model is worse" and "the new model is better and we can prove it". It can tell you: disagreement rate, which direction the disagreement goes, whether the new model fires on windows with corroborating evidence, and whether latency and memory fit in the real duty cycle. It cannot tell you: whether the new model is right . Shadow mode has no labels. It reduces the risk of shipping a catastrophically wrong model; it does not validate accuracy. For that you need the labelled incidents from a later post in this series. Randomly selecting 1% of devices is a bad idea when your fleet is heterogeneous. Select a cohort that is representative and low-stakes: cohort A: 12 devices, one site, mixed models, monitored by an engaged technician cohort B: 60 devices, three sites, all machine types cohort C: remainder Promotion gates, checked after a fixed observation period not a fixed event count : | Gate | Threshold | Action on breach | |---|---|---| | Alarm rate vs. expected | within ±50% | auto-rollback | | p99 latency | ≤ manifest budget | auto-rollback | | Crash / watchdog resets | ≤ baseline + 0 | auto-rollback | | Shadow disagreement on cohort | ≤ 20% | hold, investigate | | Operator disposition spot check | ≥ 70% actionable | hold | The alarm-rate gate is the one that catches the most real failures, because a broken model usually fails loudly — it fires constantly. Note that the tolerance is relative to alarm rate expected from the manifest, which is why that field must be computed from the validation set at training time, not guessed. Design rollback as "switch a pointer back", not "download and reinstall": php def activate bundle path: str, expected sha: str, pubkey: str, slot: str - None: verify signature bundle path, pubkey assert sha256 file bundle path == expected sha self test bundle path run one inference with a fixture, check output nvs write "active model slot", slot single atomic-ish write reboot If self test fails at boot, the bootloader falls back to the other slot. This is the same A/B slot pattern used by firmware update systems, and there is no reason models should be less careful than firmware. Real fleets are never uniformly up to date. A model rollout will stall at 85% and the rest will be a long tail of devices that are offline, behind a broken gateway, or have an old firmware. Make skew visible and bounded: python def fleet skew inventory : from collections import Counter c = Counter d "active model version" for d in inventory total = sum c.values return {v: {"count": n, "share": round n / total, 3 } for v, n in c.most common } alert when an old version persists beyond its support window def stale versions skew, supported: set str , max unsupported share=0.02 : unsupported = sum v "count" for ver, v in skew.items if ver not in supported return unsupported / sum v "count" for v in skew.values max unsupported share Two policies that keep this from becoming permanent debt: That last item matters more than it looks. A rollback path that has never been executed is a hypothesis, and the worst time to discover it does not work is during a bad rollout at 2 a.m. Next: LLM-Assisted Triage for IoT Alerts — Turning 10,000 Alarms into 10 Tickets.