GitHub - davedx/cosmicgpt: A GPT-in-space simulator to research SpaceX AI satellite viability · GitHub
/" data-turbo-transient="true" />
Skip to content
Search or jump to...
Search code, repositories, users, issues, pull requests...
-->
Search
Clear
Search syntax tips
Provide feedback
--><br>We read every piece of feedback, and take your input very seriously.
Include my email address so I can be contacted
Cancel
Submit feedback
Saved searches
Use saved searches to filter your results more quickly
-->
Name
Query
To see all available qualifiers, see our documentation.
Cancel
Create saved search
Sign in
/;ref_cta:Sign up;ref_loc:header logged out"}"<br>Sign up
Appearance settings
Resetting focus
You signed in with another tab or window. Reload to refresh your session.<br>You signed out in another tab or window. Reload to refresh your session.<br>You switched accounts on another tab or window. Reload to refresh your session.
Dismiss alert
{{ message }}
davedx
cosmicgpt
Public
Notifications<br>You must be signed in to change notification settings
Fork
Star
main
BranchesTags
Go to file
CodeOpen more actions menu
Folders and files<br>NameNameLast commit message<br>Last commit date<br>Latest commit
History<br>5 Commits<br>5 Commits
docs
docs
scenarios
scenarios
scripts
scripts
src/cosmicgpt
src/cosmicgpt
tests
tests
.gitignore
.gitignore
ARCHITECTURE.md
ARCHITECTURE.md
DESIGN.md
DESIGN.md
README.md
README.md
pyproject.toml
pyproject.toml
View all files
Repository files navigation
CosmicGPT
Simulate what happens to GPT inference under space conditions — cosmic-ray bit<br>flips and other radiation-induced faults corrupting a model's weights, activations,<br>KV cache, and output.
📊 View the live reports → davedx.github.io/cosmicgpt
See what radiation does to an AI model's output: a single-run report<br>and an environment comparison.
See DESIGN.md for goals and the conditions we model, and<br>ARCHITECTURE.md for the technical design.
Status: visualizations + HTML reports (step 5)
The end-to-end loop covers the full Single-Event-Effect taxonomy across three<br>corruptible regions , with faults either hand-specified or derived from a physical<br>radiation environment : build a seeded nanoGPT<br>(with a real KV cache), generate a clean baseline, get faults (manual or from the<br>flux scheduler), inject them (weight mutations,<br>activation forward-hooks, KV-cache mutations), regenerate with the same sampling seed,<br>and diff.
Fault kinds (--kind): SEU (single bit flip), MBU (multi-bit upset),<br>STUCK_AT (cell pinned 0/1), SEL (latch-up — a whole tensor zeroed),<br>SET (transient activation glitch), SEFI (NaN/garbage cascade).<br>Regions (--region): weight , activation (incl. lm_head → logits), kv_cache .<br>Environments (--orbit): LEO, SAA, POLAR, GEO, INTERPLANETARY, SOLAR_STORM , with an<br>optional solar-flare burst window raising λ(t) mid-inference.
Every run also reports a failure mode (silent_correct / subtle_wrong / repetition /<br>garbage / nan_garbage / crash), time-to-failure , and mean KL divergence of the<br>output distribution, and can emit a per-step RunTrace<br>JSON (the data the upcoming visualizations consume).
# physically-derived faults from an orbit (flux scaled so a short run shows effects)<br>cosmicgpt run --orbit SAA --flux-mult 1e4 --tokens 120<br># a mission with a mid-inference solar flare<br>cosmicgpt run scenarios/mission_solar_storm.yaml<br># write a self-contained HTML report (token diff + degradation timeline + raster)<br>cosmicgpt run --orbit SOLAR_STORM --flux-mult 1e4 --report report.html<br># regenerate a report from a saved trace — no re-inference<br>cosmicgpt report runs/storm/trace.json -o report.html<br># compare conditions side by side (View C)<br>cosmicgpt compare --orbits LEO,SAA,SOLAR_STORM -o comparison.html
Reports are fully self-contained (inline CSS + inline SVG, no external assets, no<br>matplotlib) so they're emailable and archivable.
Quickstart
python -m venv .venv && source .venv/bin/activate<br>pip install -e ".[dev]"
# run the smallest scenario (SEU)<br>cosmicgpt run scenarios/walking_skeleton.yaml
# drive the taxonomy directly<br>cosmicgpt run --kind SEFI --n-flips 1 --tokens 120 --fault-seed 3<br>cosmicgpt run --kind SEL --n-flips 8 --tokens 100
# verify the bit-flip foundation + injection mechanisms<br>pytest
Early findings
Single faults on low-impact sites (biases, low mantissa bits) are routinely<br>masked — realistic: most cosmic-ray hits do nothing visible.
Exponent/sign flips and SEL are far more destructive than mantissa flips.
SET (transient activation glitch) is gentle: without persistence it affects one<br>step, and only if it lands on the emitted position.
The model now has a real KV cache (--region kv_cache): a strike there is mutated<br>once but persists, because every later token re-reads the corrupted entry through<br>attention. Region is independent of fault kind — --region weight|activation|kv_cache.
A single short inference in LEO is essentially fault-free at realistic upset rates;<br>meaningful...