Compute how many gradient accumulation steps you need to reach a target effective batch size when a single device batch is limited by memory.
累积步数越多显存占用越低。
| Item | Formula / Note | Source / Standard |
|---|---|---|
| Equivalent batch | accumulation steps times micro batch size gives the effective batch size | PyTorch gradient accumulation docs |
| Gradient normalisation | dividing each micro-step gradient by the accumulation count keeps the expectation matched | PyTorch gradient accumulation docs |
| Memory trade-off | peak memory drops according to activation storage rather than parameter count | PyTorch memory management docs |