Part I: Foundations
Project Overview (README)
502M-param pure-PyTorch GPT-OSS reproduction: sliding-window/full attention alternation, learned attention-sink bias, YaRN RoPE 128K, and top-2-of-8 MoE with one sanctioned Triton kernel.
Foundations & 12-Layer Architecture
The alternating 6 SWA + 6 full-attention stack, GQA, RMSNorm, and the full wiring.
Attention Sinks & Sliding-Window Stabilization
Why learned per-head sink bias stabilizes SWA — the rolling-buffer ↔ softmax cliff problem and the clamp.
Attention Geometry & YaRN RoPE
Pruned RoPE on global layers, YaRN NTK-by-parts ramp at θ=100K, and the 128K extrapolation math.
Sliding-Window / Full Alternation
One-topic primer: which layers slide, the banded mask, and the 2.00× KV-cache cut.
Learned Attention Sinks
One-topic primer: softmax mass under eviction, the zero-value sink key, and the clamp.
YaRN Scaling to 128K
One-topic primer: the frequency ramp, mscale temperature, and per-layer RoPE pruning.
Mixture of Experts — Top-2 of 8 + 1 Shared
Top-2 of 8 routed + 1 shared, standard aux loss, grouped dispatch, expert-load balance.
Part II: The data
Part III: The training run
Getting Started — From Zero to a Running Loop
From zero to a running training loop — install, verify the math, full run, resume.
Training, Memory Stack & Data Pipeline
Mixed-precision stack, the gradient checkpointing contract, and the long-context data path end to end.
Triton MoE Kernels & Memory Checkpointing
Sanctioned fused W1/W3+silu grouped-GEMM, gradient checkpointing per 3rd layer, NaN guard.
Optimizers & Numerical Stability
BF16 + FP32 AdamW master, TF32, manual FP32 attention, sink-bias clamp, chunked CE.
Operations Guide — Launch, Monitor, Resume
Launch, monitor, NaN recovery, and resume for a production pre-training run.
Inference & 128K Long Context
MixedKVCache (ring buffer + exponential growth), 128K passkey retrieval, and O(1) decode per step.