LLM Training Cost Calculator
Estimate the compute and cost of training or fine-tuning a large language model. Enter parameters, training tokens, epochs, GPU and utilisation to get total FLOPs, GPU-hours and dollars using the 6 × N × D rule of thumb. It is an estimate, not a quote.
Training run
N. For example 7 for a 7B model.
D. Count your dataset with the AI tokens calculator.
Only changes wall-clock time, not GPU-hours.
Example on-demand rates checked 2026-11-19.
Editable. Use your provider's rate.
Preset for NVIDIA H100 SXM 80 GB. Edit for other GPUs.
Share of peak you actually achieve. 35–55% is typical for tuned runs.
Estimated compute and cost
Total compute: 42.00 exaFLOPs (6 × 7B parameters × 1B tokens).
Estimate only. Excludes failed runs, sweeps, evaluation, data prep, storage, idle time and egress.
How to estimate LLM training cost
- Enter the number of parameters (N) and the training tokens per epoch (D), and the number of epochs.
- Pick full training or LoRA/QLoRA, and tick gradient checkpointing if you use it.
- Choose a GPU, or edit its peak TFLOPS and hourly price, and set a realistic utilisation.
- Read the GPU-hours and cost. Add a margin for restarts and experiments.
How it is calculated
- FLOPs = k × N × D, with D = tokens × epochs. k is 6 for full training (2 forward + 4 backward), about 4 for LoRA and QLoRA (no gradients for frozen weights), plus 2 with gradient checkpointing.
- GPU-hours = FLOPs ÷ (peak TFLOPS × 10^12 × MFU) ÷ 3,600.
- Cost = GPU-hours × price per GPU-hour. Wall-clock time = GPU-hours ÷ number of GPUs.
- Peak figures are dense bf16 tensor-core TFLOPS from NVIDIA datasheets (without sparsity). The attention term, which grows with context length, is ignored, so very long contexts cost more than shown.
- Prices are example on-demand rates, not live. Expect the result to be within roughly a factor of two.
Worked example
Full training of a 7B model on 1 billion tokens for one epoch: 6 × 7 × 10^9 × 10^9 = 4.2 × 10^19 FLOPs. An H100 (989 TFLOPS peak) at 40% MFU delivers 395.6 TFLOPS, so the run takes about 29.5 GPU-hours, which is about $79 at $2.69 per GPU-hour. On 8 GPUs it finishes in under 4 hours of wall-clock time for the same cost. With LoRA the same job is about 4 × 7 × 10^18 = 2.8 × 10^19 FLOPs, roughly 19.7 GPU-hours and $53.
Add storage, idle time and egress with the GPU rental cost calculator. Check that the model fits with the fine-tuning VRAM calculator, and count dataset tokens with the AI tokens calculator.
Updated November 19, 2026. Not financial advice. This calculator is for education and rough estimates only. It relies on simplified models and your inputs, ignores taxes and many real-world costs, and past or modelled results do not guarantee future outcomes. Consult a licensed professional before making financial decisions.
See also
- Add storage, idle time and egress with the GPU rental cost calculator.
- Check the model fits in GPU memory with the fine-tuning VRAM calculator.
- Count the tokens in your dataset with the AI tokens calculator.
Frequently Asked Questions (FAQ)
It scales with parameters × tokens. As an example, a 7B model trained on 1 billion tokens takes about 4.2 × 10^19 FLOPs, roughly 30 H100 GPU-hours at 40% utilisation, or about $80 at $2.69 per GPU-hour. Training the same model on 2 trillion tokens is 2,000 times more, in the region of $160,000. These are estimates, not quotes.
Training a dense transformer takes about 6 floating-point operations per parameter per training token: 2 for the forward pass and 4 for the backward pass. Total training FLOPs ≈ 6 × N (parameters) × D (tokens). It ignores attention cost, which matters at long context lengths, so it slightly underestimates real compute.
Divide total FLOPs by the FLOPs the GPU actually delivers per second, then by 3,600. Actual throughput is the GPU's peak dense bf16 TFLOPS multiplied by the model FLOPs utilisation (MFU). An H100 at 40% MFU delivers about 396 TFLOPS.
Model FLOPs utilisation is the share of the GPU's peak throughput that goes into useful model math. Well-tuned large runs report roughly 35–55%. Small or poorly tuned jobs, slow interconnects, data loading stalls and short sequences can land at 20–30%. The default of 40% is a middle-of-the-road planning value.
The formula is the same, but the token count is far smaller and you can use a cheaper method. LoRA and QLoRA do not compute gradients for the frozen base weights, so this calculator uses about 4 FLOPs per parameter per token instead of 6. QLoRA adds de-quantization overhead, so lower its MFU if you want to be conservative.
Yes. It re-runs the forward pass during the backward pass to save memory, adding about 2 FLOPs per parameter per token (6ND becomes 8ND, about 33% more compute). Turn it on here if your run uses it.
In this estimate, no: total GPU-hours stay the same and the wall-clock time is divided by the number of GPUs. In practice, scaling efficiency drops as you add GPUs and nodes, so cost rises a little. Lower the MFU to account for it.
No. The rates are dated example on-demand prices from one provider and are editable. Use the GPU rental cost calculator for storage, idle time and egress, and enter your own provider's rate here.
Failed runs and restarts, hyperparameter sweeps, evaluation, data preparation, checkpoint storage, idle time and engineering time. Many teams add 20–100% on top of a single-run estimate. Check that the model fits in GPU memory first with the fine-tuning VRAM calculator.
Treat it as a planning figure, within roughly a factor of two. The biggest uncertainty is MFU, then attention cost at long context lengths, then the price you actually pay.
Related Tools
- LLM API Rate Limit CalculatorTurn requests per minute and average tokens into tokens per minute (TPM) and concurrency, check if your RPM/TPM tier is enough, and get headroom and backoff advice. Runs in your browser.
- Vector Database Storage CalculatorEstimate vector database storage from vector count, dimensions and precision (float32, float16, int8, binary), HNSW index overhead, metadata and replicas. Runs in your browser.
- LLM API Cost CalculatorCompare GPT, Claude and Gemini API rates and estimate monthly token costs.
- Prompt Caching Savings CalculatorCalculate monthly LLM API savings from prompt caching using prefix size, cache hit rate and cache read/write prices, with the break-even hit rate.
- RAG Chunking and Embedding Cost CalculatorEstimate RAG chunk count, one-off embedding (indexing) cost and monthly query cost from document size, chunk size, overlap, embedding price and retrieval settings. Prices are dated and editable.
- AI Token CounterCount tokens, words and characters in your prompts for GPT, Claude, Gemini and Llama.