Welcome to Braedyn Thompson's portfolio!
See the roles I'm targeting →

Now playing
Berkeley Lab SeismicSoCal BearLM
PROJECT 02 · DEEP LEARNING · MLOPS · LIVE

Seismic
SoCal

A live system that listens to 19 seismometers across Southern California. Two neural networks turn the first seconds of ground motion into a detection, a location and a magnitude, and phones that follow nearby sensors get a two-stage alert. QuakeOps keeps the models tracked, gated and watched for drift.

Deployed livePyTorchCNN → Transformer · GNNMLflow · Dagster · Evidently
PSsynthetic trace · 30 s window
SeismicSoCal live site
Live siteseismicsocal.duckdns.org: the Detect card, with the held-out AUC, its 95% CI and the STA/LTA baseline on one line, and the live SeedLink status in the corner.

Overview01

0.9998Detection ROC-AUCvs 0.816 STA/LTA
0.951Magnitude R²vs 0.886 amp + distance
145Replay pushes, all real quakes80 held-out days · chance 0%
83%Isolated M3+ caughtwith 3+ sensors online

The pipeline detects a quake, locates it, sizes it and sends an alert. Each result is reported with its classic-seismology baseline, a 95% confidence interval and a replay of real days the system never trained on.

SeismicSoCal trains on 26 years of Southern California data (USGS catalogue + SCEDC waveforms, 2000 → 2026): 6,243 quakes (M2.0–7.1) for sizing and 50,743 detection windows, including 2,062 hard negatives: real live-stream noise that once fooled a detector. Every split is chronological. A SeedLink daemon runs the same engine 24/7 on a free Oracle VM, and a monthly MLOps loop decides whether a retrained model is allowed to replace the live one.

  • 01

    Built the detector as a CNN → Transformer on the 19 stations that actually stream, with the P-wave anywhere in the window and real live-noise false triggers as hard negatives: ROC-AUC 0.9998 (95% CI 0.9997–0.9999) vs. 0.816 for STA/LTA on 7,303 held-out windows.

  • 02

    Sized quakes with a CNN → GNN → Transformer over the station graph: R² 0.951, MAE 0.10 on 937 held-out quakes vs. 0.886 for amplitude + distance; a 10-seed study separates seed variance from sampling variance.

  • 03

    Made a replay of 80 archived days the acceptance test: 145 push alerts and every one a real quake (time-shifted chance baseline 0%), pushed sizes within MAE 0.12 of the catalogue, median location error 3–4 km.

  • 04

    Estimated the shaking at each user's home (Modified Mercalli intensity) from magnitude, distance, ground type and a per-quake correction, validated on USGS "Did You Feel It?" reports: MAE 0.42 levels, 94% within one level on 28 held-out quakes, with the home location never leaving the phone.

  • 05

    Built QuakeOps: MLflow tracking and a champion/challenger registry, a Dagster retrain job, a six-rule statistical + replay promotion gate, Evidently drift checks and GitHub Actions deploys.

Scope: research demonstration, not an official warning system. It detects quakes after they begin and alerts within tens of seconds; it does not predict them.

Results vs. classical seismology02

Deep beats classical on both tasks, and the confidence intervals don't overlap.

Held-out chronological test set, 2022–2026 (higher is better)0.0000.2500.5000.7501.000Classical seismology baselineDeep model (5-seed ensemble)Detect · ROC-AUCDetect · ROC-AUC — Classical seismology baseline: 0.8160.816Detect · ROC-AUC — Deep model (5-seed ensemble): 0.99980.9998Size · R²Size · R² — Classical seismology baseline: 0.8860.886Size · R² — Deep model (5-seed ensemble): 0.9510.95195% CIs (event-clustered bootstrap): AUC 0.9997–0.9999 vs 0.805–0.828 · R² 0.943–0.959 vs 0.871–0.898
FigureBoth models beat the classical baseline on a strictly chronological held-out test (2022–2026). CIs are bootstrapped and clustered by event, so a quake's correlated station windows resample together.
TaskArchitectureDeep model (95% CI)Classical baseline
Detect: is it a quake?CNN → Transformer, single station, 30 sAUC 0.9998 (0.9997–0.9999), MCC 0.886STA/LTA 0.816 (0.805–0.828)
Size: how big?CNN → GNN → Transformer, multi-stationR² 0.951 (0.943–0.959), MAE 0.10amp + distance 0.886 (0.871–0.898)
Quick check: worth a first alert?median of a·log peak + b·log dist + c, first 4 s of PMAE 0.24; passes 93% of M3+, 1.1% of <M2.5n/a (it is the classic formula)

Detect, in plain English

Every 2 seconds each sensor hands the model its last 30 seconds of ground motion, and the model decides whether an earthquake is in it or just traffic, wind or sensor noise. It works wherever the quake starts in the window (AUC 0.9997 / 0.9999 / 0.9997 with the P-wave at 2 / 12 / 22 s), and train, validation and test AUC match, so it isn't memorising.

Detection evidence: ROC vs STA/LTA and robustness to onset position
FigureFrom the live site's Evidence panel: held-out ROC vs. STA/LTA on 7,303 windows (2022–2026), and AUC by where the P-wave falls in the 30 s window.

Near-perfect wherever the quake starts in the window.

False triggers at the live threshold

The live trigger is 0.6, not the checkpoint's MCC-optimal 0.9987, so both are reported. A per-window trigger still isn't an alert: it also needs a clean pick and two more stations that locate the same source.

ThresholdTest noise (n = 2,339)Held-out live noise, Oct 2–5 (n = 397)Event windows caught
0.6 (live trigger)1.41%0.25%99.6%
0.9987 (checkpoint MCC)0.00%0.25%91.9%

Size, technically

Each station's 3-component window is normalised to unit peak, so the CNN reads shape; its log peak velocity and log distance from the located epicentre are graph-node features, so the graph reads size. Two graph-convolution layers over the 19-station network (Gaussian distance weights, σ = 50 km) and a Transformer across stations feed the head. Training jitters the epicentre by ~8 km and the picks by ±0.5 s and drops stations at random, so it learns under live conditions.

Size evidence: scatter, error by size, ablation, replayed live sizing
FigureFrom the live site. Top: predicted vs. catalogue magnitude on 937 held-out quakes (MAE 0.10 vs. 0.16), and error by size. Bottom: what the network fusion buys, and the live pipeline replayed on 20 days (quakes below M2 are outside training and read high, but stay under the M3.0 push floor).
Magnitude R² on 937 held-out quakes: what the graph network earns0.0000.5001.000Deep ensembleAblation / baselineAll stationsAll stations — Deep ensemble: 0.9510.951Live-like (10 km loc error, 3–6 stations)Live-like (10 km loc error, 3–6 stations) — Deep ensemble: 0.9390.939Amplitude + distance baselineAmplitude + distance baseline — Ablation / baseline: 0.8860.886Nearest single station onlyNearest single station only — Ablation / baseline: 0.8080.808
FigureOnly the nearest station: R² 0.808, worse than the classic formula. The gain comes from the graph fusion. Live-like conditions (10 km location error, 3–6 stations) cost just 0.012.

Take away the graph and it loses to the classic formula.

Seed variance vs. sampling variance

Magnitude model (937 held-out quakes)R²95% CI
Single model, mean over 10 seeds0.9490.948–0.951 (t-interval over seeds)
10-seed ensemble0.9520.944–0.959 (event bootstrap)
Live 5-seed ensemble0.9510.943–0.959
Amplitude + distance baseline0.8860.871–0.898
Ensemble − baseline (paired)+0.067+0.056 … +0.079

The deep model's lead over the baseline is about 6× the width of either uncertainty. Ensembling adds only +0.003, well inside the sampling CI, so the live system keeps 5 seeds rather than 10.

The live pipeline & alerts03

The models run continuously on a live SeedLink stream with USGS out of the loop, and everything runs on waveform (data) time, never wall-clock time. The same module, pipeline.py, runs live and in the replay harness.

01SeedLink19 stations, 300 s rolling 3-component buffers
02Quality gatereject gap-fill zeros, stuck runs, clipping, lone spikes
03DetectCNN→Transformer every 2 s per station; trigger at 0.6
04PickSTA/LTA + AIC onset, SNR ≥ 3; the picker that aligned training
05Locategrid search; ≥ 3 picks, RMS ≤ 1.5 s, no silent nearer station
06Quick checkfirst 2 or 4 s of P → provisional push
07SizeGNN ensemble on [P−5 s, P+25 s] from every station ≤ 200 km
08DecideM ≥ 3.0 confirms, otherwise retracts

Every first notice is followed by a confirmation or a retraction that replaces it.

When each message arrives (median seconds after the quake begins, 80 replayed days)0 s10 s20 s30 s40 s50 s60 sOriginquake beginsFastfirst notice, 2 s of PStandardfirst notice, 4 s of PConfirmedfull size, or retractionLive adds ~2–5 s of SeedLink delay
TimelineMedians over the 80 replayed days. The first notice waits for the third station's pick; the confirmation waits for 25 s of P-wave at the nearest stations.

Why three stations

With 3 picks, latitude, longitude and origin time are exactly determined, so a low misfit proves nothing on its own. The locator also uses negative evidence: a real quake reaches nearer stations first, so a solution whose closer stations stayed quiet is coincident noise. One or two stations become a tentative event: logged, never pushed. Requiring four stations was tested on validation days: it confirmed 31 events instead of 86 and missed a real out-of-network M3.6 that three stations caught.

Two-stage alerts, with a speed the user picks

Five variants of the first message were replayed over 20 days, and the speed trade-off is now a setting the user picks:

First-message variantTest days: sent / real M2.5+ / retracted / no quakeMedian after originQuick-size MAE
Standard (4 s of P, full response removal)6 / 6 / 1 / 033.4 s0.21
4 s, sensitivity-scaled (not offered)6 / 6 / 1 / 027.7 s0.20
Fast (2 s of P, sensitivity-scaled)7 / 6 / 2 / 025.9 s0.26
Push on location alone (rejected)72 / 8 / 67 / 525.6 s–

Pushing on location alone would mean about 7 first messages a day, nearly all retracted. Both stages carry the same notification tag, so the confirmation ("Mx.x earthquake confirmed", with the distance and expected shaking) or the retraction ("Update: smaller quake… you can disregard the earlier alert") replaces the first message in the tray.

Where it can see, and who gets alerted

Interactive coverage map of the 19 stations
Live siteThe live coverage map, drawn from Census outlines: dark areas have 3+ stations within 100 km, so a quake there is located, sized and can alert; light areas reach 2 and are logged only. Zoom reveals more cities and boundaries.
Alert me near me with regions and alert speed
Live siteAlert me near me: follow a region, switch single sensors off, and choose Standard or Fast. Coordinates never leave the device; only station codes and a push token are stored.

Users follow stations, not a location. A device is alerted when a confirmed quake is within 150 km of a station it follows, with the distance measured from the located epicentre to that station.

Shaking at your home (MMI)04

A magnitude and a distance don't tell someone what they felt. For every quake, the current one in a push and every past one in the quake list, the app estimates the shaking at the user's home as a Modified Mercalli Intensity level (I–X, e.g. "Light: felt indoors; dishes and windows rattle"). It's an estimate from the physics and our own sensors, not a measurement at the house.

01Ground motionpeak velocity from magnitude and distance, fitted on 25k of our own station records
02Ground typeUSGS Vs30 site term: soft ground shakes harder
03This quakecorrection from how hard it actually shook our sensors (live quakes)
04Intensityvelocity → MMI (Worden et al. 2012), offset calibrated on Did You Feel It?
05On the phonecomputed on the device; the home never leaves it
log10 PGV = a + b·M + c·log10 R + d·R + e·log10(Vs30 / 631) + event_term // fitted on the training events only (chronological split); event_term = how this quake shook our sensors, clipped to ±0.5

Validated against people's reports

USGS "Did You Feel It?" collects what people report feeling. The DYFI offset was fitted on the older 29 Southern California M3.5+ quakes and the result scored once on the newer 28 quakes (1,892 report cells):

Held out: 28 quakes, 1,892 cellsMAE (MMI levels)Within one level
This model0.4294%
Without the DYFI offset0.68–
Without the ground-type term0.40–

Reported honestly: the ground-type term gave no measurable gain on these reports (a 10 km report cell averages many kinds of ground). It stays because it's physically right and fitted from our own records, but it isn't what makes the estimate work. Error is flat with distance.

One set of equations, three implementations

ServerPython, for the push wording every app version gets: shaking at the subscriber's nearest followed station.
Web appTypeScript: the line under each quake and the quake page, from coefficients served by /api/shaking-model.
Native AndroidJava: a data-only push lets the app write "Light shaking likely at Pasadena" itself, with the server's text as fallback.
PrivacyThe home is saved only on the device; the server only ever sees station codes.
Biggest Southern California quakes with caught and seen marks
Live siteThe quake list on the live site: every catalogued Southern California quake the network could catch, marked caught by our model (with our size and station count), seen but not confirmed, or not caught. With a home saved, each row also shows the estimated shaking there.

Every quake is checked against what the live system actually caught.

Acceptance test: a replay of 80 held-out days05

A test AUC alone doesn't say whether a live system can be trusted, so the acceptance test is a replay: the exact live engine runs over archived continuous data. Thresholds were calibrated on separate validation days, then frozen and scored once on 80 held-out days (Apr 2022 – Aug 2026): 60 days with an M3+ quake in coverage and 20 random days. Every precision is reported next to a chance baseline: the same declarations shifted by an hour.

145Push alertsevery one a real quake
92%Placed within 60 kmthe rest: off-network quakes
0.12Pushed size MAEbias +0.05 vs catalogue
3–4kmMedian location errorconfirmed events
80 held-out daysResult
Push alerts145; 133 matched a catalogued M2.5+ within 60 km. The other 12 were also real quakes, outside the network and placed 63–145 km off. None was for a quake that didn't happen (chance baseline 0%).
Confirmed events that were real86% on busy days, 79% on random days (chance 4% / 0%); about 7 false confirmations a week, logged and never pushed
First message → confirmationStandard ~31 s, Fast ~25 s, confirmation ~50 s after the quake begins
First messages later retractedStandard 28%, Fast 36%: the faster setting retracts more, and the confirmation replaces the first message either way

How do you know an alert from this thing is real?

It replayed 80 archived days it never trained on. 145 pushes, and every one was a real quake.

And how many quakes did it miss?

About a third of M3+ overall, mostly inside aftershock swarms. Isolated M3+ with sensors up: 83% caught.

Catch rate, and where the misses are

Catalogued quakes in coverageM1–1.5M1.5–2M2–2.5M2.5–3M3+M2+
Caught9%29%41%60%68% (CI 60–74%)52%
  • By situation: with at least 3 stations online, 83% of isolated M3+ quakes were caught (86% in good coverage, 80% where it's thin), against 60% inside rapid sequences. For most missed sequence quakes a neighbour within 10 minutes and 50 km was caught, so the area was still alerted.
  • All 58 missed M3+, classified: 27 came back-to-back with another quake nearby, 16 happened while fewer than 3 stations had data in the archive, 7 were seen but not confirmed, and 8 weren't seen; most of those last ones sit where coverage is thinnest (Imperial Valley and the Salton Sea).
  • Below M2 is outside the magnitude training range; those sizes read slightly high but stay under the M3 push floor.

Catching more quakes in swarms

Most misses were a second quake absorbed into the first: an echo window (a new event this close to a declared one counts as its coda) and a station rest period (no new pick this soon after the last) hid it. I swept 32 configurations on validation days only (12 swarm days, including Ridgecrest 2019, plus 10 quiet days), with an adoption rule fixed in advance: raise the catch rate with no more duplicates and no more quiet-day false detections.

Validation swarm daysBefore (120 s / 60 s)Adopted (30 s / 45 s)
M3+ caught40.0%59.1%
M2+ caught32.4%45.4%
Confirmed events that were real76.5%75.2%
Duplicates / quiet-day false detections per week0 / 13.30 / 13.3

Configurations that caught more (up to 84% of M3+) were rejected because every one added false detections or duplicates. Scored once on the 80 held-out days, the adopted setting raised M3+ catch from 71% to 78% (detection-only scoring) with no duplicates and precision 85% → 84%. It went live on Oct 7, 2026.

Shadow mode before alerts

After going live the system runs in shadow mode: it detects, locates, sizes and logs everything but sends no pushes. A nightly job scores the live log against USGS in three tiers (confirmed, pushed, tentative), each with its own chance baseline. Pushes are switched on only once confirmed precision on live data clearly beats chance and pushed magnitudes match the catalogue.

QuakeOps: retraining, promotion gate and drift06

QuakeOps handles retraining, promotion and drift monitoring. A retrained model can only replace the live one by proving, statistically and on replayed days, that it's at least as good.

01Datamonthly append; older months never change
02Trainchallenger logged to MLflow with commit, data hash, seeds
03Comparechampion re-scored on the challenger's unseen test split
04Replay10 held-out days, champion vs challenger
05Gatesix rules, every result logged
06Promote@champion alias moves; VM pulls, verifies sha256
RuleDetectSize
G1 beats the classic baselinepaired ΔAUC vs STA/LTA, CI low > 0paired ΔR² vs amp + dist, CI low > 0
G2 non-inferior to the championΔAUC ≥ −0.001; ΔMCC ≥ −0.02; false triggers at the live 0.6 ≤ champion + 0.5 ppΔR² ≥ −0.01 and CI high ≥ 0; ΔMAE ≤ +0.01
G3 replay acceptanceprecision ≥ 0.85 and ≥ chance + 0.5; no false pushes; M3 recall ≥ championsame push checks; event-centric MAE ≤ champion + 0.02
G4 testspytest + daemon selftestsame
G5 lineageclean tree; commit, dataset version, seeds recordedsame
G6 reason to switchnewer data, or a superiority CI > 0same

A rule that can't be evaluated is logged as SKIPPED, never a silent pass. The gate never edits the live operating thresholds: a detector that needs a new trigger fails G3, and recalibrating is a deliberate, manual step.

Every live model traces back to its commit, dataset and seeds.

SeismicSoCal model health page
Live siteThe live /health page: the serving version of each model, its held-out metrics with 95% CIs, the data version and commit it came from, per-station drift status and the promotion history.

Watching the live stream for drift

The daemon logs three scale-free features per station every 30 s (detector score, crest factor, high-frequency share), computed on the model's own input so they're comparable with training. A daily Evidently job compares each station with its training noise: ok, watch (1 feature drifted) or drifting (2+), with an email after two drifting days in a row.

Drift features started logging on Oct 6, 2026, which is why the station pills still read "no data": the first statuses arrive with the next daily run.

Status: the registry, daily pull, drift logging, /health page and CI/CD deploys are live. The gate has been checked on a dry run (champion vs. itself); the first end-to-end monthly retrain hasn't run yet.

Deployment & architecture07

The whole service runs on an Oracle Cloud Always-Free Ampere A1 (ARM64) VM for $0. Caddy provides HTTPS and serves the site, systemd runs the API server, which supervises the SeedLink daemon and respawns it if the stream drops, and separate timers run the nightly crosscheck and the daily QuakeOps pull + drift check. The Android app is a Capacitor build of the same web app with FCM push, native code that writes the home-shaking line into notifications, and an update gate for breaking releases.

OFFLINE · PC (RTX 4060)ONLINE · Oracle A1 VM (systemd + Caddy)DataUSGS catalogue M1+SCEDC waveforms,response removedbuild_dataset.py6,243 events50,743 detect windowschronological 70/15/15Train (GPU)Detect: CNN→TransformerSize: CNN→GNN→Transformer5 seeds, MLflow-trackedReplay harnesssame engine, archived dayscalibrate on validationscore test days onceSeedLink19 stations, real timeper-station buffersdata-quality gatepipeline.pydetect → pick → locate→ quick check → size→ decide (data time)server.py (API)supervises the daemon/api/status /ca /healthpush registrationFCM pushtwo-stage alerts+ home shaking (MMI)shadow mode switchWeb + AndroidReact, Capacitor, nativeMMI computed on deviceNightly crosschecklive log vs USGS,+1 h chance baselineQUAKEOPS · MLOps loopDagster monthlytrain challengergate G1–G6MLflow @championVM pull (sha256)drift check
ArchitectureOffline, the PC builds datasets, trains on the GPU and replays archived days. Online, the VM runs the same engine on the live stream. QuakeOps connects them through the MLflow registry.
One station listnetwork.py is imported by the builder, daemon, API, scorer and replay; every station must stream on the public relay.
Self-checking checkpointsModels carry their normalizers and station list; the daemon refuses a model trained on a different network.
What the server storesSubscriptions store station codes, a push token and an alert speed, and no location. The home used for shaking estimates stays on the phone.
CI/CDGitHub Actions: ruff, the pytest suite, the daemon selftest and the site build on every change; tar deploy to the VM on main.
SeismicSoCal code-level architecture diagram
ArchitectureCode-level view: the web and mobile app (coverage map, push registration, native notifications, and the on-device shaking estimate, which fetches its coefficients from the API); the HTTP API, which spawns the live stream daemon; detection and alerts, where one event pipeline scores windows with the detection model, picks and locates, sizes events with the magnitude model and estimates shaking before push dispatch through Firebase; models and evaluation (detector and magnitude training, the dataset builder, and the archive replay that re-runs the same engine); and the data layer over the SeedLink stream, the USGS catalogue and the SCEDC waveform service.

Known limits

  • Coverage: strongest where 3+ stations sit within ~100 km (LA basin, Inland Empire, Mojave, Ridgecrest, Kern). Quakes outside the network are located from a one-sided set of stations and can be tens of km off.
  • Latency: 25–60 s after origin. This is rapid detection, not pre-arrival warning (ShakeAlert's job).
  • Locator: fixed 8 km depth and a 1-D travel-time model, with an empirical correction fitted on 31,427 picks.
  • Small quakes: below M2 (outside the magnitude training range) sizes read slightly high; harmless for the M3 floor.
  • Swarms: a quake right after another nearby can still be absorbed into it; about 60% are caught inside sequences.
  • Shaking estimates: depth is ignored, an off-network mislocation shifts the estimate, and a single house can differ more than the 0.42-level average, which is measured over 10 km report cells.