~/fba-lab/lab/speedrun/journey/tyler-05

FBALab

Code · architecture · study mode

AboutRoadmapSpeedrun
FBALab

Study mode — no GPU required.

Interactive LLM training & inference lab.

Qwen CAboutContactTermsPrivacyCookiesCommunity

© 2026 FBA Lab

Contact · contact@bubblspace.com · +91 75061 55016

Speedrun›Teaching arc›#2.4 Logit Soft-capping
Act 1Model Training FundamentalsAct 2AI Systems OptimizationAct 3World-Record Training Optimization
Step 6 of 28Skill: Model Training Fundamentals
← #2.3 Dataloading Tweaks#3 Longer Context →
TRAINING SIMULATION

Speedrun — #2.4 Logit Soft-capping

running
◷train_gpt2.py▸softcap()◎learner⌁05-softcap$no GPU
baseline
GPT-2 d12
Starting architecture and training loop.
step 01
train
active
optimize
Speedrun step
Architecture diffs and optimizer changes.
steps 02–05
loss
target
val loss 3.28
Cumulative loss timeline and finale.
step 06
1/3
Blocks
Quick summary

softcap(x, cap=30) = tanh(x/30) * 30 — bounds extreme logits smoothly.

Full explanation below the code →

fba-lab — train_gpt2.py · softcap()executing
// block: softcap() · lines 30–35$ study train_gpt2.py --block softcap_fnsoftcap(x, cap=30) = tanh(x/30) * 30 — bounds extreme logits smoothly. ✓
Explanation

softcap(x, cap=30) = tanh(x/30) * 30 — bounds extreme logits smoothly.

Think about

What happens to a logit of 100 after softcap?

// architecture

Live diagram

100%
speedrun journey013.28→023.28→033.28→043.28→053.27→063.27Softcap in GPT forwardReduces loss variance from logit outlier…s during training.val loss10.97 → 3.27 (-7.69)◉ before/afterlogits before → after softcap(logits, 30)before: unbounded logitscap=30-5822354828154012tanh(x / 30) × 30 — compresses extreme logits before cross-entropy
← #2.3 Dataloading Tweaks#3 Longer Context →

What changed vs 04-data-loading

Select a change to view diff hunks.

What it bought

Learn this step, your way

WatchReadDeep Dive

🎬 Video lesson coming soon

This step's video hasn't been recorded yet. The text lesson and Rune's deep-dives cover the same ground in the meantime.