AI, LLM & Machine Learning Engineering Training & Fine-Tuning Compute C = 6ND scaling estimate (Kaplan et al. 2020; Hoffmann et al. 2022)

LLM Training Compute (FLOPs) Calculator

This calculator turns a parameter count and a token budget into the three numbers that decide whether a pre-training run is affordable: total floating-point operations, aggregate GPU-hours, and wall-clock days on the cluster you actually have. It uses the standard dense-transformer estimate C ≈ 6ND, divides by the throughput your GPUs sustain rather than their marketing peak, and compares your token budget against the roughly 20 tokens per parameter that the Chinchilla analysis found compute-optimal.

Calculator

This calculator runs in your browser. Enable JavaScript for live results — the inputs, formula and worked example below remain fully readable without it.

Inputs this calculator takes, with typical values
InputWhat to enterExample
Parameter countTotal trainable parameters in billions, embeddings included. For a mixture-of-experts model enter the parameters actually active per token, not the full checkpoint.175 B
Training tokensTokens processed across the whole run in billions. If you train for several epochs, multiply the corpus size by the number of epochs.300 B
Accelerator peak throughputDense tensor-core throughput at your training precision, from the vendor datasheet. Use the dense number, not the sparsity-enabled one that datasheets print first.312 TFLOP/s
Model FLOPs utilisation (MFU)Fraction of peak throughput the run actually sustains end to end. Published large-scale runs report figures in the 30-55% band; measure yours from a short pilot if you can.40 %
Number of acceleratorsHow many devices run the job in parallel. This changes wall-clock time but not total FLOPs or total GPU-hours.1024 GPUs
Price per GPU-hourYour rented or amortised cost for one accelerator for one hour. Set it to zero if you only want the compute figures.2 $

It returns

  • Total training compute — The 6ND estimate: forward and backward passes over every token, for every parameter.
  • Petaflop/s-days
  • Aggregate GPU-hours
  • Wall-clock time
  • Compute cost at your rate
  • Tokens per parameter — Chinchilla-optimal is roughly 20.
  • Compute-optimal token budget

The formula

C6ND
t=CPpeakuG
Dopt20N

In plain text: C ≈ 6 · N · D

  • CTotal training compute (FLOPs)
  • NTrainable parameters (active per token for MoE) (count)
  • DTokens processed over the whole run (count)
  • 62 FLOPs per parameter for the forward pass and 4 for the backward pass, per token (—)

The factor of 6 counts one multiply and one add (2 FLOPs) per parameter in the forward pass and twice that in the backward pass, because the backward pass computes gradients with respect to both activations and weights. It ignores attention's quadratic term, layer norms, softmax and the optimiser update, all of which are small at typical sequence lengths.

Updated Category Training & Fine-Tuning Compute Verified against published test cases Reading time 11 min

What training compute means and why one number governs the budget

Training compute is the total count of floating-point operations a run performs from initialisation to the final checkpoint. It is the currency of large-model training: hardware, electricity, wall-clock time and money are all downstream of it, and it is the one quantity you can estimate accurately before writing a line of training code.

The estimate works because a transformer's forward pass is dominated by dense matrix multiplications, and every one of those multiplications touches each parameter exactly once per token. A multiply-accumulate is two floating-point operations, so the forward pass costs about 2 FLOPs per parameter per token. The backward pass computes two sets of gradients — with respect to the layer inputs and with respect to the weights — and so costs roughly twice the forward pass. Add them and you get 6 FLOPs per parameter per token, which is where C = 6ND comes from.

What the number buys you is planning leverage. Once you know C, the rest is division: divide by what your cluster actually sustains and you have GPU-hours; divide again by the device count and you have days on the calendar; multiply by your hourly rate and you have the invoice. That chain is the whole calculator, and each division is where an optimistic assumption quietly doubles the bill.

Reading the formula: what the factor of 6 includes and what it leaves out

Take the three symbols one at a time. N is the trainable parameter count including embeddings. For a mixture-of-experts model, use the parameters active per token rather than the checkpoint total, because a router that sends each token to two of sixty-four experts only performs arithmetic against those two. Sizing N from a layer configuration is what the transformer parameter count calculator does.

D is tokens processed across the entire run, not corpus size. Two epochs over a 500B-token corpus is D = 1T. Discarded tokens from packing, padding and dropped batches still cost compute, so a run that reports 2T tokens consumed usually did slightly more arithmetic than 2T implies.

The factor of 6 is an approximation with known omissions. It ignores the attention score matrix, whose cost scales with sequence length squared rather than with parameters; at a 2,048-token context that term adds a few percent, and at 128k it stops being negligible. It ignores layer norms, activation functions and the optimiser step. It also ignores recomputation: activation checkpointing trades memory for arithmetic by recomputing the forward pass during the backward pass, which pushes the true factor from 6 towards 8. If your run uses full activation checkpointing, treat this calculator's output as a floor and add roughly a third.

The second formula converts compute into time. Sustained throughput is peak throughput multiplied by model FLOPs utilisation, the ratio of useful model FLOPs to what the hardware could theoretically retire in the same window. MFU is where the honest estimate lives: it absorbs data-loading stalls, pipeline bubbles, gradient all-reduce, checkpoint writes and every failed node restart.

Worked example: GPT-3 scale, 175B parameters on 300B tokens

Take the configuration GPT-3 was trained at: 175 billion parameters, 300 billion tokens, on 1,024 accelerators rated at 312 TFLOP/s dense BF16, sustaining 40% MFU, rented at $2.00 per GPU-hour.

  1. Convert to raw counts. N = 175 × 109 = 1.75 × 1011. D = 300 × 109 = 3.0 × 1011.
  2. Apply 6ND. C = 6 × 1.75 × 1011 × 3.0 × 1011 = 6 × 5.25 × 1022 = 3.15 × 1023 FLOPs. The GPT-3 paper reports 3.14 × 1023 for the same run, so the estimate lands within a third of a percent of the published figure.
  3. Express it in petaflop/s-days. One petaflop/s sustained for one day is 1015 × 86,400 = 8.64 × 1019 FLOPs. So 3.15 × 1023 ÷ 8.64 × 1019 = 3,645.8 petaflop/s-days.
  4. Find sustained per-device throughput. 312 TFLOP/s × 0.40 = 124.8 TFLOP/s = 1.248 × 1014 FLOP/s.
  5. Divide for GPU-seconds. 3.15 × 1023 ÷ 1.248 × 1014 = 2.524 × 109 GPU-seconds, which is 2.524 × 109 ÷ 3,600 = 701,122 GPU-hours.
  6. Divide by the cluster. 701,122 ÷ 1,024 = 684.7 wall-clock hours = 28.5 days.
  7. Price it. 701,122 × $2.00 = $1,402,244 of compute, before storage, egress and the runs you throw away.

The Chinchilla check comes free: 300B ÷ 175B = 1.71 tokens per parameter, far below the ratio of roughly 20 that later work identified as compute-optimal. At the same 3.15 × 1023 FLOP budget, a model of about 40B parameters trained on 800B tokens would have reached a lower loss.

How to read the result: MFU, the Chinchilla ratio, and what to do with each

Read the tokens-per-parameter figure first, because it tells you whether the run is well specified before you worry about how long it takes. Hoffmann and colleagues fitted parameter count and token count jointly against a fixed compute budget and found that the loss-minimising split puts them in roughly equal proportion — about 20 tokens per parameter across the range they studied. A ratio far below 20 means you are spending compute on a model too large for the data you are giving it.

A ratio far above 20 is not an error. Chinchilla optimises training loss for a fixed training budget and says nothing about inference. Production models are routinely trained well past the compute-optimal point on purpose, because every extra training FLOP buys a permanently smaller model to serve, and serving cost accumulates for the life of the product. Weigh that trade with the self-host vs API breakeven calculator and the GPU VRAM requirement calculator, which price the model you end up with rather than the one you train.

Read MFU second. It is the single assumption that most changes the answer, and the utilisation table on this page exists to show how much: holding N and D fixed, moving from 20% to 60% MFU cuts both time and cost by two-thirds. Large published dense pre-training runs report MFU in roughly the 30–55% band — the PaLM paper reports 46.2% and the Megatron-LM scaling work reports about 52% at 3,072 A100s — so a plan built on 70% needs evidence behind it. Measure it on a pilot: run a few hundred steps, count tokens per second, multiply by 6N, divide by aggregate peak.

Finally, treat the cost figure as a floor. It prices successful GPU-time only. Real programmes carry failed runs, hyperparameter sweeps, data preprocessing, evaluation and idle reservation.

Training compute for representative model and token budgets

Every value is 6ND evaluated directly, then converted at 1 petaflop/s-day = 8.64 × 1019 FLOPs. The last column assumes 400 TFLOP/s sustained per device, so one petaflop/s-day takes 2.5 device-days.
Parameters (N)Tokens (D)Tokens per parameterCompute (FLOPs)Petaflop/s-daysDevice-days at 400 TFLOP/s
1B20B201.20 × 10201.393.5
7B140B205.88 × 102168.1170
7B2T2868.40 × 10229722,431
70B2T28.68.40 × 10239,72224,306
175B300B1.713.15 × 10233,6469,115
405B15T37.03.65 × 1025421,8751,054,688

Device-days are aggregate: divide by your accelerator count for wall-clock time. A 24,306 device-day run finishes in 24 days on 1,024 devices, assuming nothing fails.

Mistakes that make a compute estimate wrong

  • Using the sparsity-enabled peak. Datasheets lead with a number that assumes 2:4 structured sparsity, which dense pre-training does not use. It is exactly double the dense figure, so this mistake halves your estimate.
  • Confusing corpus size with tokens processed. D is tokens seen, so multiple epochs multiply it. A three-epoch fine-tune on a 10B-token corpus is D = 30B.
  • Ignoring activation checkpointing. Full recomputation adds an extra forward pass, moving the effective factor from 6 towards 8 — about 33% more compute for the same N and D.
  • Counting all MoE parameters. Only the experts a token is routed to perform arithmetic for that token. Use active parameters, or the estimate overshoots by the sparsity factor.
  • Assuming MFU is constant across scale. Utilisation usually falls as you add devices, because communication grows while per-device arithmetic does not. Estimate it at the cluster size you will actually run.
  • Forgetting the long-context term. Attention costs roughly 12 × layers × d_model × sequence-length FLOPs per token beyond 6N. At 2k context this is small; at 128k it can rival the parameter term.

Where this estimate sits among the alternatives

6ND is a planning instrument, not an accounting one. If you need the actual arithmetic your run performed, instrument it: most frameworks can report tokens per second, and multiplying that by 6N gives measured model FLOPs directly. Hardware counters give a different number again — total FLOPs retired, including recomputation and padding — and the ratio between the two is precisely what MFU measures.

For fine-tuning rather than pre-training, the same formula applies with a much smaller D, but parameter-efficient methods break it. LoRA still runs the full forward and backward passes through the frozen base model, so compute barely falls even though the number of trainable parameters collapses; use full N in the formula and expect only the optimiser-state memory to shrink. The fine-tune vs prompting breakeven calculator handles that comparison, and the model training time estimate calculator works from measured steps per second when you already have a job running.

For the money question specifically, compute is only one line. Storage for checkpoints of a 405B model runs to terabytes per snapshot, interconnect provisioning is often bundled into the hourly rate, and reserved capacity bills whether or not a job is healthy. The GPU-hours cost calculator takes the aggregate hours this page produces and prices them against instance types and commitment terms.

Finally, note the regulatory angle. Several jurisdictions now use total training compute as a threshold for reporting obligations on frontier models, with 1025 and 1026 FLOPs both appearing in current rules. Because 6ND is the standard estimator, the number this page returns is the number those thresholds are written against.

Key terms

FLOP
One floating-point operation. Note the distinction from FLOP/s, a rate. Training compute is measured in FLOPs (a count); hardware is rated in FLOP/s (a speed).
Petaflop/s-day
The compute performed by a machine sustaining 1015 FLOP/s for 24 hours: 8.64 × 1019 FLOPs. Used in the GPT-3 paper and widely since.
MFU (model FLOPs utilisation)
Useful model FLOPs divided by the hardware's theoretical peak over the same wall-clock window. It excludes recomputation, so it is always at or below hardware FLOPs utilisation.
Compute-optimal
The parameter and token split that minimises loss for a fixed training compute budget. The Chinchilla result puts it near 20 tokens per parameter.
Active parameters
For sparse mixture-of-experts models, the parameters that participate in the forward pass for a single token. This is the N that belongs in 6ND.

Frequently asked questions

Why is the constant 6 and not 2?

Because training runs both a forward and a backward pass. The forward pass costs about 2 FLOPs per parameter per token, one multiply and one add per weight. The backward pass costs roughly twice that, because it computes gradients with respect to the layer inputs and with respect to the weights — two matrix multiplications of the same shape. Total: 2 + 4 = 6. Pure inference, which runs the forward pass only, is estimated at 2ND.

How accurate is C = 6ND in practice?

Within a few percent for dense transformers at moderate context lengths. Applied to GPT-3's published configuration it gives 3.15 × 1023 against the 3.14 × 1023 the paper reports. Accuracy degrades in three situations: very long sequences, where attention's quadratic term matters; activation checkpointing, which adds an extra forward pass; and mixture-of-experts routing, where you must use active rather than total parameters.

What MFU should I assume if I have not measured it?

Assume 35–45% for a dense transformer on a well-configured GPU cluster, and treat anything above 55% as needing evidence. The PaLM paper reports 46.2% MFU and the Megatron-LM scaling work reports about 52% on 3,072 A100s; both describe carefully tuned parallelism strategies. Small clusters with poor interconnect, long-context training and heavy checkpointing all push the figure down. Measure it on a few hundred pilot steps before committing a budget.

Does this include the compute for data preprocessing and evaluation?

No. It covers the training loop only. Tokenisation, deduplication, quality filtering and evaluation all consume real resources, and on large corpora the CPU-side preprocessing can occupy weeks of a cluster's calendar even though it uses almost no GPU FLOPs. Budget them separately, along with failed runs and hyperparameter sweeps, which on a first-of-its-kind model often exceed the cost of the run that ships.

How do I handle a mixture-of-experts model?

Enter the active parameters per token, not the checkpoint size. A model with 8 experts per layer that routes each token to 2 of them performs dense arithmetic against roughly a quarter of the expert weights, plus all the shared attention and embedding parameters. Compute is governed by what is multiplied; memory is governed by what is stored. That is why the VRAM calculator uses total parameters while this one uses active parameters.

Why does adding GPUs cut wall-clock time but not GPU-hours?

Because total FLOPs are fixed by N and D. Splitting the same arithmetic across twice the devices halves the calendar time and leaves the aggregate device-hours unchanged — in theory. In practice MFU usually falls as the cluster grows, because gradient synchronisation and pipeline bubbles grow with device count, so aggregate GPU-hours rise slightly. Re-enter a lower MFU alongside a larger device count to model that.

Is 20 tokens per parameter still the right target?

It is the right target for minimising loss at a fixed training budget, which is the question Chinchilla asked. It is not the right target if you will serve the model at volume. Training past 20 makes the model cheaper to run forever, and several widely deployed open-weight models sit at 100–300 tokens per parameter for exactly that reason. Decide which budget you are optimising before treating the ratio as a rule.

What does the 10^26 FLOPs warning mean?

Total training compute has become a regulatory threshold. Several jurisdictions use a fixed FLOP count — 1025 and 1026 both appear in current instruments — to define which training runs carry notification, evaluation or safety-testing obligations. Because C = 6ND is the standard estimator, the figure this calculator produces is the one such rules are written against. Check the obligations that apply in your jurisdiction rather than relying on this note.

References