Fault-tolerant inference runtime for compute in harsh environments. ECC for your model.
Project description
radshield
Fault-tolerant inference runtime for compute in harsh environments. ECC for your model.
When a cosmic ray flips a bit in the memory holding your model's weights — a
single-event upset (SEU) — the value 0.01 can become ~1e30 or NaN, and
your model starts emitting garbage. Commodity GPUs (the kind now being flown in
orbit) do not have hardware ECC on every memory path, and bit flips accumulate
between memory scrubs. radshield detects and repairs corrupted weights and
contains corrupted activations, in software, on any chip — so inference stays
correct under radiation.
This matters today for orbital data centers and satellite edge compute, and right now for safety-critical terrestrial AI (automotive, defense, avionics) where the same failure mode appears at sea level.
Left: flipping the top float32 exponent bit alone costs ~17 accuracy points;
every other bit is near-harmless — radshield exploits exactly this asymmetry.
Right: as upsets accumulate between scrubs, unprotected models fail
catastrophically up to ~73% of the time; radshield holds failures at 0%.
(Reproduce with python experiments/fault_campaign.py.)
Install
pip install -e .
Use
import radshield as rs
# 1. Protect weights: checksums + a verified golden copy.
guard = rs.WeightGuard(params)
# 2. Calibrate an output range once on clean data.
sanitize = rs.OutputSanitizer.from_calibration(clean_logits, margin=4.0)
# ---- during operation, per inference (or on a timer) ----
guard.verify_and_repair(params) # detect drifted tensors, restore them
logits = sanitize(model_forward(x)) # clamp range + scrub NaN/Inf
# Validate your own protection by simulating radiation:
corrupted = rs.inject.inject_bit_flips(params["W1"], n_flips=5, region="exponent")
That's the whole v0 surface. Three primitives, near-zero overhead: a checksum is a few MB/ms; sanitizing is one elementwise clip.
Use it on a real PyTorch model
One call protects an nn.Module: it checksums the weights and calibrates output
ranges on a clean batch, then auto-repairs and sanitizes on every forward.
import radshield.torch as rst
handle = rst.protect(model, clean_batch=x) # checksum weights + calibrate
# ... model runs in orbit; bit flips strike its parameters ...
y = model(x) # weights auto-repaired, output sane
print(handle.guard.repairs, "upsets repaired")
Validated on a real CNN: as upsets accumulate in the model's parameters, an unprotected model fails catastrophically up to ~91% of the time; the protected model holds at 0%.
Reproduce with python experiments/torch_campaign.py.
How it works
A float32 is [sign | 8 exponent bits | 23 mantissa bits]. Flips in the high
exponent bits cause value explosions (the catastrophic case); mantissa flips are
nearly harmless. radshield combines two cheap, composable defenses:
- WeightGuard — per-tensor CRC checksums plus a verified golden reference. On mismatch, the tensor is restored. This is software ECC for your weights.
- OutputSanitizer — a last line of defense between checksum passes: clamps activations/outputs to a calibrated plausible range and removes NaN/Inf, so a flip occurring mid-inference cannot propagate an explosion to the user.
Redundant recompute (DMR/TMR) is intentionally not the default — it doubles compute. radshield's bet is that detect-and-repair plus containment buys you most of the reliability at a fraction of the cost.
Roadmap
v0 (this repo) is the numpy reference implementation and the measurement harness. Open-core direction:
- Framework adapters — PyTorch hooks so
protect()wraps annn.Modulewith one call (done, seeradshield.torch); JAX next. - Selective protection — spend the checksum/redundancy budget only on the most sensitive layers and the most sensitive bits, guided by a profiler.
- Quantization-aware guards — int8/fp8 fault models for the chips that actually fly.
- Telemetry — structured logs of detected/repaired upsets, the dataset every operator and silicon team currently lacks.
The free core stays permissive (Apache-2.0). A later hardened/certified tier with support targets operators and chipmakers who need it production-qualified.
Status
Experimental. v0.0.1. Built to be torn apart — issues and PRs welcome.
License
Apache-2.0.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file radshield-0.0.1.tar.gz.
File metadata
- Download URL: radshield-0.0.1.tar.gz
- Upload date:
- Size: 14.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
53c7076e92dc696e650f5183bdabe7ede0c2f009d5166f0ab658592dc03948f2
|
|
| MD5 |
cb07c763ee14cf558b54b8e85c715db7
|
|
| BLAKE2b-256 |
38406f979205c296eb4285d1c90fc20f261601b7bdadc82c1c860ed6a7073791
|
Provenance
The following attestation bundles were made for radshield-0.0.1.tar.gz:
Publisher:
release.yml on captainawesome78/radshield
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
radshield-0.0.1.tar.gz -
Subject digest:
53c7076e92dc696e650f5183bdabe7ede0c2f009d5166f0ab658592dc03948f2 - Sigstore transparency entry: 2168146787
- Sigstore integration time:
-
Permalink:
captainawesome78/radshield@6da4f4c694405ff25d730a4fa5cff2b9a4b13903 -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/captainawesome78
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@6da4f4c694405ff25d730a4fa5cff2b9a4b13903 -
Trigger Event:
release
-
Statement type:
File details
Details for the file radshield-0.0.1-py3-none-any.whl.
File metadata
- Download URL: radshield-0.0.1-py3-none-any.whl
- Upload date:
- Size: 14.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4f53c3fa4c74bbba5a085336a4177846e9587b659d6d0450d63971a58dfbd0ae
|
|
| MD5 |
cf708056b1d0cc94be549a84ef33e79b
|
|
| BLAKE2b-256 |
4b2e691fe983fa01ab170bc053bd2978102f7af57d74ac6f908d60a5fa0c6a3e
|
Provenance
The following attestation bundles were made for radshield-0.0.1-py3-none-any.whl:
Publisher:
release.yml on captainawesome78/radshield
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
radshield-0.0.1-py3-none-any.whl -
Subject digest:
4f53c3fa4c74bbba5a085336a4177846e9587b659d6d0450d63971a58dfbd0ae - Sigstore transparency entry: 2168146809
- Sigstore integration time:
-
Permalink:
captainawesome78/radshield@6da4f4c694405ff25d730a4fa5cff2b9a4b13903 -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/captainawesome78
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@6da4f4c694405ff25d730a4fa5cff2b9a4b13903 -
Trigger Event:
release
-
Statement type: