Micro batch vs effective batch in fine-tuning: give the relationship
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
Micro batch is what fits in one GPU in one pass. Effective batch is what the optimizer sees per step: micro batch times gradient accumulation steps times data-parallel GPU count.
Imagine cooking a stew that serves 64 people, but your largest pot only holds 4 servings. Two options. You can cook 16 small pots one after another and pour them all into one big stockpot before serving (accumulating small pots over time), or you can have 16 cooks each making one small pot in parallel and pooling them (cooking on many stoves at once). Either way the diners receive the same 64-serving stew. The size of one pot is the micro batch: hardware constraint. The size of what reaches the dinner table is the effective batch: what the recipe actually cared about. The recipe was tuned for 64 servings, and as long as you reach 64 by any combination of more pots over time or more cooks in parallel, the dish tastes right.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
4 min: define micro batch versus effective batch + three-factor product formula + why accumulation is equivalent for transformers + data-parallel multiplier + recipe portability via effective batch + LR scaling caveats.
| Aspect | Micro batch | Effective batch |
|---|---|---|
| What it is | Examples per GPU per forward-backward pass | Examples whose gradients are averaged before optimizer step |
| Bound by | Activation memory on one GPU | Recipe choice; product of micro, accumulation, world size |
| What the LR is tuned against | No (hardware artifact) | Yes (statistical quantity) |
| Effect of doubling it | Doubles activation memory | Roughly doubles per-step gradient signal to noise |
| Common typical value | 1 to 8 per H100 on 7B model | 32 to 256 for LoRA fine-tunes |
Real products, models, and research that use this idea.
What an interviewer would ask next. Try answering before peeking at the approach.
Red flags and common mistakes that signal junior thinking. Click to expand.
Treating micro batch as the value the LR schedule was tuned against. Recipes are written for effective batch; using the wrong one quietly mis-scales the learning rate.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.