Why is there no activation formula?
Activation memory depends on architecture, sequence length, batch and checkpointing. A single multiplier would look precise and be fiction. Leave it out rather than invent it.
This planner adds the terms we are willing to defend: stored weights, and optimiser state on the parameters you actually train. It leaves out activations, kernels and fragmentation. Those dominate some runs. They are not a constant we will pretend to know.
Weight memory (bytes) = parameters × bytes per parameter. The bytes we use are fp32 = 4, fp16 or bf16 = 2, int8 = 1, and 4-bit storage = 0.5. Four-bit is a storage width for a quantised weight, not a claim about numerical error.
Full fine-tune, Adam planning assumption: add 8 bytes per trained parameter for the first and second moment estimates in fp32, plus 4 bytes per parameter for an fp32 master copy of the weights. That is 12 extra bytes per parameter. Adam’s two moments are from Kingma and Ba. The choice to store them in fp32, and to keep a master copy, is our planner’s assumption, not a figure from the paper and not a reading off your GPU.
LoRA or QLoRA: base memory uses the base precision. Adapter memory = trainable parameters × 2 (fp16 adapter weights) + trainable parameters × 8 (Adam moments in fp32 on the adapter only). QLoRA sets the base precision to 0.5 bytes because the frozen base is 4-bit, which is the storage idea in Dettmers et al. Gradients and activations are not in either sum.
Overhead percent, if you type one, multiplies the total. It is your buffer. A blank overhead means we did not invent one.
If the weight term alone exceeds the card, no batch trick saves you. If the weight term fits and the run still dies, you are in the part this page refused to fake: activations. Shorten the sequence or the batch, or move to a method with a smaller base. The QLoRA definition and the LoRA-versus-QLoRA comparison are the method notes. Serving is a different sum: weights plus KV cache, written on how to deploy an LLM. Do not paste this training total into that budget.
Activation memory depends on architecture, sequence length, batch and checkpointing. A single multiplier would look precise and be fiction. Leave it out rather than invent it.
It is the 4-bit storage width, before scales and block metadata. Real files are larger. Treat the result as a lower bound on the weight term.
Bring the workflow, the constraints and where inference should run. We use that brief to decide whether sovereign LLM & SLM fine-tuning, retrieval or a readiness review is the right first step.
Explore your AI options