~/fba-lab/lab/speedrun/journey/keller-46-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›Speedrun milestones›#46 · Batch Schedule
Act 1Model Training FundamentalsAct 2AI Systems OptimizationAct 3World-Record Training Optimization
Step 24 of 28Skill: World-Record Training Optimization
← #38 · Polar Express#53 · Multi-Token Prediction →
TRAINING SIMULATION

#46 · Batch Schedule

running
◷train_gpt.py▸train_bs_schedule tuple◎learner$no GPU
1/2
Blocks
Quick summary

Batch size starts small (8×2048×8 tokens = 134M tokens/step) then grows in two steps up to 24×2048×8 (402M). Small…

Full explanation below the code →

fba-lab — train_gpt.py · train_bs_schedule tupleexecuting
// block: train_bs_schedule tuple · lines 1230–1231$ study train_gpt.py --block bs-configBatch size starts small (8×2048×8 tokens = 134M tokens/step) then grows in two steps up to 24×2048×8… ✓
Explanation

Batch size starts small (8×2048×8 tokens = 134M tokens/step) then grows in two steps up to 24×2048×8 (402M). Small batches early → high gradient noise → more exploration. Large batches late → low noise → convergent fine-tuning.

Think about

Why does growing the batch size during training improve convergence compared to keeping it constant?

// architecture

Live diagram

100%
Record #46 · PR #163 · Batch size schedule
Training schedule

Start noisy, finish clean — batch size as a training dial

A large batch averages many gradient signals before each update. That is efficient late in training when you want smooth, stable convergence. But early in training, a large batch can be wasteful — the model changes so fast that samples from the same large batch are nearly correlated. Small batches inject noise that pushes the model to explore.

PR #163 schedules the batch size in three stages: small early for high-variance exploration, then growing twice as training progresses. The batch size triples from start to finish. This saves compute where noise is free and buys stability where precision counts.

24× 16× 8× bs=8 explore bs=16 bs=24 converge 0 – 33% 33 – 66% 66 – 100% training
# lines 1230–1231 — batch size triples across training
train_bs_schedule = (8, 16, 24) # ×2048 tokens per GPU

# lines 1359–1364 — piecewise lookup by training fraction
def get_bs(step, total):
    x = step / total
    return train_bs_schedule[int(x * len(train_bs_schedule))]
Why does noise help early training?

Early in training, the loss landscape is rough and full of poor local structure. Small batch noise acts like random perturbations that help escape bad regions. A large batch early computes an expensive, accurate gradient — accurate about the wrong region. The noise is not a bug; it is a feature.

Why does a larger batch help late?

Late in training, the model is close to a good minimum and needs precise gradient estimates to squeeze the final loss. Small batch noise at this stage causes loss oscillation that prevents the last few tenths of a nat of improvement. The critical batch size grows as the model converges.

What changed vs #38

Select a change to view diff hunks.