The finding#
A full fine-tune of a 7B model on 60 million tokens — say 20,000 examples of 1,000 tokens for three epochs — takes about 2.6 H100-hours at 40% model FLOPs utilisation: roughly $5.3–$11 at $2–$4 per GPU-hour. Even a 72B model costs $50–$100 for the same data.
That should change how you budget. If compute for one run is a rounding error, project cost is driven by how many runs you need and by work that isn’t training at all: data, evaluation and engineering time. The levers that matter are the ones that reduce wasted experiments.
FLOPs per training token#
For a dense transformer with parameters, a forward pass costs about floating-point operations per token (one multiply and one add per weight). The backward pass computes two things — gradients with respect to activations and gradients with respect to weights — each costing about the same as the forward pass. That gives the familiar estimate from Kaplan et al.:
LoRA changes the backward pass. The base weights are frozen, so their weight gradients are never computed; activation gradients still flow through every layer. Adapter weight gradients are negligible for small ranks:
So LoRA saves about a third of the compute, not the 99% its parameter count suggests. Activation checkpointing adds one recomputed forward pass, , in both cases. Attention adds a term that grows with sequence length : roughly per token for training, small next to at typical fine-tuning lengths.
where is training tokens, is the accelerator’s dense BF16 throughput (989 TFLOPS for an H100 SXM) and MFU is the fraction you actually achieve. Well-tuned training reaches 35–55%; small batches, short sequences and LoRA kernels often land at 15–30%.
Cost per run, 0.5B to 72B#
60 million training tokens, sequence length 2,048, activation checkpointing on, H100 SXM at 40% MFU, priced at $2–$4 per GPU-hour:
| Model | Method | Training FLOPs | H100-hours | Cost |
|---|---|---|---|---|
| Qwen2.5-0.5B | Full | 2.58e+17 | 0.2 | $0.4–$0.7 |
| Qwen2.5-0.5B | LoRA | 1.99e+17 | 0.1 | $0.3–$0.6 |
| Qwen2.5-7B | Full | 3.75e+18 | 2.6 | $5.3–$11 |
| Qwen2.5-7B | LoRA | 2.84e+18 | 2.0 | $4.0–$8.0 |
| Qwen2.5-14B | Full | 7.33e+18 | 5.1 | $10–$21 |
| Qwen2.5-14B | LoRA | 5.56e+18 | 3.9 | $7.8–$16 |
| Qwen2.5-32B | Full | 1.60e+19 | 11.3 | $23–$45 |
| Qwen2.5-32B | LoRA | 1.21e+19 | 8.5 | $17–$34 |
| Qwen2.5-72B | Full | 3.55e+19 | 25.0 | $50–$100 |
| Qwen2.5-72B | LoRA | 2.68e+19 | 18.8 | $38–$75 |
Memory, not FLOPs, usually decides how many GPUs a run occupies: full fine-tuning a 7B model needs ~114 GB of optimizer and weight state (see our memory model), so it runs on at least two GPUs even though one could do the arithmetic in under three hours.
Sensitivity to utilisation#
MFU is the most uncertain input. For the 7B full fine-tune above:
research/e3_flops/flops.py.As a sanity check we computed the throughput our own laptop-scale experiment actually achieved. The LoRA rank experiment trained a 0.5B model on an Apple M4 Max GPU shared with other workloads. Full fine-tuning sustained about 0.7 TFLOP/s, LoRA r=16 about 0.6 TFLOP/s — a small fraction of a data-centre GPU, which is why the same job that took minutes there takes seconds on an H100.
Where the money actually goes#
If a run costs tens of dollars, why do fine-tuning projects spend thousands on compute? Four multipliers:
1. The number of runs#
A typical project runs a base-model bake-off (3–5 models), learning-rate and rank sweeps, two or three data iterations and ablations. Thirty to eighty training runs is normal. Multiply the table by 50.
2. Reinforcement learning is mostly generation#
GRPO and PPO sample several completions per prompt every step. Generation costs FLOPs per token but is memory-bandwidth bound, so it typically runs at single-digit MFU. An RL step can cost ten times an SFT step on the same number of tokens. See GRPO explained.
3. Evaluation is generation too#
Scoring every checkpoint on a 2,000-example held-out set with 300-token outputs is 600k generated tokens per checkpoint, plus judge-model calls. Over a project, evaluation compute rivals training compute.
4. Idle and minimum billing#
Reserved multi-GPU nodes bill while you analyse results. The cheapest compute strategy is usually a small node for exploration and short bursts on large nodes for final runs.
Estimate one run with , multiply by your experiment count, add 50–100% for evaluation, and 3–10× for any RL stage. For an 8B SFT+DPO project that lands at $500–$5,000 of GPU time; with RL, $5,000–$15,000.
From MFU to tokens per second#
Inverting the cost equation gives the training throughput to expect, which is the number to check against a real run in its first minutes:
For a 7B model with full fine-tuning and checkpointing ( FLOPs per token) at 40% MFU on an H100, that is about 6,490 tokens per second per GPU. If your logged throughput is half that, you are at 20% MFU and something — data loading, padding, small micro-batches, communication — deserves attention before you scale up.
# Measure achieved MFU from your training logs
N = 7.62e9 # parameters
flops_tok = 8 * N # full FT with activation checkpointing (6N + 2N)
tokens_s = 3.1e3 # logged training tokens/s per GPU
peak = 989e12 # H100 SXM dense BF16
print(f"MFU = {tokens_s * flops_tok / peak:.1%}") # -> 19.1%Worked example: compute budget for a project#
A realistic 8B project, assuming 25% MFU for training jobs and 5% for generation-heavy work (evaluation and RL sampling are memory-bandwidth bound):
| Line | What runs | H100-hours |
|---|---|---|
| Base-model bake-off | 4 models × 1 LoRA run, 10M tokens | 2.1 |
| Hyperparameter sweep | 12 LoRA runs, 10M tokens | 6.4 |
| Data iterations | 3 rounds × 2 runs, 30M tokens | 9.6 |
| Preference tuning (DPO) | 3 runs, 15M tokens incl. reference model | 3.2 |
| Evaluation | 40 checkpoints × 2,000 items × 300 tokens generated | 2.1 |
| RL stage (optional) | GRPO, G=8, 2,000 prompts × 3 epochs × 500 tokens | 3.7 |
| Total | 27 |
At $2–$4 per GPU-hour that is roughly $54–$108 — consistent with the $500–$5,000 range for SFT+DPO projects in our cost guide, with RL pushing toward the top. Note how evaluation and RL, both generation-heavy, account for 21% of the total despite being a minority of the “training”.
Assumptions and limitations#
The rule ignores embedding lookups and some elementwise operations and slightly overstates FLOPs for models with large tied embeddings. MFU varies with kernel quality, sequence packing and interconnect. GPU prices are assumption ranges, not quotes; spot and reserved pricing can sit well outside them. Mixture-of-experts models need instead of for FLOPs but full for memory.
Script: research/e3_flops/flops.py; inputs: parameter counts from research/results/e2_memory.json; peak throughput from the NVIDIA datasheet; output: research/results/e3_flops.json. The measured anchor uses wall-clock training time from the E1 runs.
References#
- Kaplan, J. et al. (2020). Scaling Laws for Neural Language Models. arXiv:2001.08361.
- NVIDIA. H100 Tensor Core GPU datasheet (BF16 dense tensor throughput, SXM form factor: 989 TFLOPS).
- Korthikanti, V. et al. (2023). Reducing Activation Recomputation in Large Transformer Models. MLSys 2023. arXiv:2205.05198.
- Hu, E. J. et al. (2021). LoRA: Low-Rank Adaptation of Large Language Models. arXiv:2106.09685.
