~/fba-lab/lab/speedrun/journey/trace-attn-lab

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›Profiler deep-dive›Attention Lab
Act 1Model Training FundamentalsAct 2AI Systems OptimizationAct 3World-Record Training Optimization
Step 18 of 28Skill: AI Systems Optimization
← 05 · Sliding Window06 · Smear Gate →
TRAINING SIMULATION

Attention Lab

running
◷train_gpt.py▸bm_sizes — asymmetric sliding windows◎learner$no GPU
1/1
Blocks
Quick summary

11 layers, 3 window types: short (8 layers), long (L3 + L10 — wider context bridges), full (L6 — no mask).…

Full explanation below the code →

fba-lab — train_gpt.py · bm_sizes — asymmetric sliding windowsexecuting
// block: bm_sizes — asymmetric sliding windows · lines 1222–1232$ study train_gpt.py --block bm-sizes11 layers, 3 window types: short (8 layers), long (L3 + L10 — wider context bridges), full (L6 — no … ✓
Explanation

11 layers, 3 window types: short (8 layers), long (L3 + L10 — wider context bridges), full (L6 — no mask). ws_schedule=(3,7,11): windows grow during training. YaRN rescales RoPE when ws_long changes.

Think about

Why use full attention only at L6 rather than at L0 or L10?

// architecture

Live diagram

100%
05 · train_gpt.py line 1222 — bm_sizes, YaRN
Flash Attn 3 + Sliding Window

Two context windows per layer — and how they grow during training

Sliding-window attention limits each token to a fixed context window. The speedrun uses this for 9 of 11 layers, but asymmetrically: a short window for most layers and a longer window for layers 3 and 10 (wider context bridges). Layer 6 uses full attention.

The window sizes grow during training on a curriculum schedule — ws_schedule=(3,7,11). This is why YaRN is needed: when the window grows, the model encounters position indices further apart than anything it trained on. YaRN rescales RoPE angular frequencies smoothly.

L0short L1short L2short L3LONG ↑ws_long×128 L4short L5short L6FULLbm=None L7short L8short L9short L10LONG ↑ws_long×128 Short window (ws_short × 128 tokens) — 8 layers Long window (ws_long × 128 tokens) — L3, L10 Full attention (bm = None) — L6 only ws_schedule = (3, 7, 11) — window grows during training At ws_long=11: long_bm = 1 408 tokens, short_bm = 640 tokens
# train_gpt.py line 1222-1226
short_bm = ws_short * args.block_size
long_bm = ws_long * args.block_size
bm_sizes = [short_bm, short_bm, short_bm, long_bm, # L0, L1, L2, L3↑
short_bm, short_bm, None, short_bm, # L4, L5, L6∅ (full), L7
short_bm, short_bm, long_bm] # L8, L9, L10↑
# YaRN applied when ws_long changes:
if new_ws_long != ws_long:
self.model.yarn.apply(ws_long, new_ws_long)
Why two window sizes?

Most predictions are highly local — the last few hundred tokens contain the needed signal. Short-window layers handle this efficiently. Layers 3 and 10 act as wider context bridges. L6's full attention is the single fully-expressive layer in the stack middle.

YaRN — why RoPE needs rescaling

When the window grows, the model encounters token pairs at distances it was never trained on. YaRN rescales RoPE angular frequencies: long-period components are left unchanged; short-period ones are scaled down. Context length extension without catastrophic forgetting.