🌍 nanoGPT-Seis
English | 中文
Train a small GPT for earthquake science — the entire LLM lifecycle, from a blank folder to a talking model, explained block by block.
Crawl → Clean → Tokenize → Model → Train → Infer, on 2× NVIDIA A30 (48 GB).
Six free data sources → crawl → clean/dedup → 16k BPE →
113M GQA+RoPE decoder → 2-GPU DDP training → streaming inference. Each stage is a
section below.
nanoGPT-Seis is a teaching repository. It is not trying to be a great earthquake
model — it is trying to make every stage of pretraining a language model legible:
where the data comes from, how it is cleaned and deduplicated, how a tokenizer is
built, why the Transformer looks the way it does, how it is trained across two GPUs,
and how it is served. Every design decision is explained, and every number
(perplexity, VRAM, tokens) is one we actually measured on this hardware.
The corpus mixes earthquake / seismology text (open-access papers via
Crossref+Unpaywall, arXiv/EarthArXiv preprints, the "Earthquake Insights" Substack)
with general text (Wikipedia + FineWeb-Edu) for plain-language fluency — about
24% domain / 76% general. A focused corpus lets a ~100M-param model become
genuinely fluent on a single node, so you can see the whole loop close in a day, not
a month. (Why the general mix? See §1.)
Status: the pretraining lifecycle is complete — crawl through inference.
Table of contents
- Results at a glance
- Quick start
- Stage 1 — Data crawling
- Stage 2 — Processing & dedup
- Stage 3 — The BPE tokenizer
- Stage 4 — The model (RoPE, GQA, …)
- Stage 5 — Training (DDP, VRAM, LR)
- Stage 6 — Inference
- Repository layout
- Scaling-law experiments
1. Results at a glance
| value |
|---|
| Corpus | 533,248 docs · 485.7M words · 822.7M training tokens (≈2.4:1 general:domain) |
| Model | 113M params — decoder-only, GQA + RoPE + RMSNorm + SwiGLU |
| Hardware | 2× NVIDIA A30 (24 GB each), bf16, DDP — also runs on a single RTX 3090/4090, or 12–16 GB with a smaller batch ([§7.5](#75-running-on-on |