訓練或微調大語言模型需要多少 tokens?
How many tokens do you need to train or fine-tune an LLM?
按 Chinchilla 規則,8B 模型從零預訓練約需 160 billion tokens;持續預訓練通常需數十億 tokens,微調則往往遠低於 1 million。
Pretraining a model from scratch takes about 20 tokens per parameter to be compute-optimal, so roughly 160 billion tokens for an 8B model, while continued pretraining takes billions and a fine-tune often takes well under a million. Nodus prices any of these budgets before it runs: a TrainingJob dry run returns the estimated cost, and at the H100 SXM rate listed at $2.60/hr on the Nodus pricing page, the token counts in this post range from $3.51 to about $1.75 million of GPU time. Which one you need depends on what you want the model to learn, not on how much data you happen to have.
Think in tokens first and dollars second. The token count tells you what kind of job you are running, and the cost follows from one formula.
How much is 1 million tokens in words?
One million tokens is about 750,000 English words. OpenAI's token help page gives the rule of thumb: one token is about four characters, or three quarters of a word, for English text. Code, other languages and unusual formatting use more tokens per word, so treat the ratio as an estimate and count with your own tokenizer before you commit money.
To make the numbers feel real, we also convert words to pages. We assume 500 words per single-spaced page, which is our assumption, not a standard.
| Tokens | English words (0.75 per token) | Pages (500 words each) | Typical use |
|---|---|---|---|
| 1,000 | 750 | 1.5 | One long fine-tuning example |
| 1 million | 750,000 | 1,500 | A 1,000-example fine-tune with long answers |
| 30 million | 22.5 million | 45,000 | 10,000 examples x 1,000 tokens x 3 epochs |
| 10 billion | 7.5 billion | 15 million | A modest continued pretraining run |
| 160 billion | 120 billion | 240 million | Compute-optimal 8B pretraining |
| 15 trillion | 11.25 trillion | 22.5 billion | Llama 3 pretraining |
Fine-tuning sits at the top of that table and pretraining at the bottom, about six orders of magnitude apart.
Where does the 20 tokens per parameter rule come from?
It comes from DeepMind's Chinchilla paper (Hoffmann et al., 2022). The authors trained over 400 models from 70 million to over 16 billion parameters on 5 to 500 billion tokens. They found that for a fixed compute budget, model size and training tokens should grow equally: double the parameters, double the tokens.
Their test case was Chinchilla itself, a 70B model trained on 1.4 trillion tokens. That is 20 tokens per parameter, and the ratio became the shorthand. Chinchilla used the same compute as the 280B Gopher model and beat it on a wide range of benchmarks.
The rule tells you the best model for a given training budget. It says nothing about what that model costs to serve afterwards.
Why do modern models train on far more than 20 tokens per parameter?
Because a smaller model that trained longer is cheaper to run forever after. Meta trained Llama 3 on over 15 trillion tokens, and its announcement says the Chinchilla-optimal amount for the 8B model is about 200 billion tokens. Meta found both the 8B and 70B models kept improving log-linearly up to 15 trillion tokens.
That works out to about 1,875 tokens per parameter for the 8B model (15T / 8B) and about 214 for the 70B (15T / 70B). Meta's own explanation is that larger models can match smaller ones with less training compute, but smaller models are much more efficient at inference.

Llama 3 8B saw about 94 times more tokens per parameter than the Chinchilla rule suggests.
Over-training has a data limit. Muennighoff et al.'s data-constrained scaling study found that repeating data for up to 4 epochs gave negligible change in loss compared with unique data. Past that, the value of more compute eventually decays to zero. If your corpus is 50 billion tokens, a budget much above 200 billion mostly buys repetition.
How many tokens does continued pretraining need?
Continued pretraining usually needs billions of tokens, because you are shifting what the model knows, not how it answers. Meta's Code Llama started from Llama 2 weights and trained on 500 billion tokens of code-heavy data (1 trillion for the 70B). The Python variant then added another 100 billion tokens.
Most teams adapting a model to a legal, medical or internal corpus work far below that. The binding limit is usually how much clean in-domain text you own, and the 4-epoch finding above caps how far you can stretch it. We cover data mixing, replay of general text and learning rate schedules in our continued pretraining guide.
How many examples does fine-tuning need?
Far fewer than most people collect first. OpenAI's supervised fine-tuning guide sets a minimum of 10 examples and says it sees improvements from 50 to 100. It also says that if 50 examples have no impact, you should rethink the task or prompt before adding data.
The LIMA paper (Zhou et al., 2023) fine-tuned a 65B LLaMa model on only 1,000 carefully curated prompts and responses. In a controlled human study, its answers were equivalent to or preferred over GPT-4 in 43% of cases. The authors' conclusion is that almost all knowledge is learned in pretraining, and fine-tuning mostly teaches format and style.
So the token count for a fine-tune is examples times average length times epochs. A 10,000-example dataset at 1,000 tokens each, trained for 3 epochs, is 30 million tokens. A LIMA-sized set at the same length is 3 million.
What do these token budgets cost in GPU-hours?
Training compute is about 6 floating point operations per parameter per token. That approximation comes from Kaplan et al.'s scaling laws paper, where the 6 covers the forward and backward passes. An NVIDIA H100 SXM peaks near 989 teraFLOPS of dense BF16; NVIDIA's H100 page lists 1,979 with sparsity, which training rarely uses.
We assume 30% model FLOPs utilization (MFU), the planning figure we explain in how much it costs to train an LLM. At 30%, one H100-hour delivers 989e12 x 0.30 x 3,600 = 1.068e18 useful FLOPs. Here is the arithmetic once, for continued pretraining of an 8B model on 10 billion tokens:
- Compute: 6 x 8e9 x 10e9 = 4.8e20 FLOPs
- GPU-hours: 4.8e20 / 1.068e18 = 449.4 H100-hours
- Cost: 449.4 x $2.60 = $1,168.41
The same formula gives every row below. Prices are the H100 SXM rate listed at $2.60/hr on the Nodus pricing page.
| Job | Model | Tokens | H100-hours | GPU cost |
|---|---|---|---|---|
| LoRA or full fine-tune (10k examples, 3 epochs) | 8B | 30 million | 1.35 | $3.51 |
| Small model from scratch, Chinchilla | 1B | 20 billion | 112.3 | $292.10 |
| Continued pretraining | 8B | 10 billion | 449.4 | $1,168.41 |
| From scratch, Chinchilla | 8B | 160 billion | 7,190.2 | $18,694.53 |
| From scratch, Llama 3 style | 8B | 15 trillion | 674,081.6 | $1,752,612.07 |
Prices checked November 25, 2026.
The fine-tune row is a ceiling. LoRA skips most weight-gradient work, so it needs fewer FLOPs than 6 x N x D, but short sequences and small batches usually run below 30% MFU. Real fine-tunes are dominated by startup, evaluation and your own iteration time, not by the token math.

The 8B Chinchilla run costs about 5,300 times the 30-million-token fine-tune.
The Llama 3 style row is left out of the chart because it would flatten every other bar. It is about 94 times the Chinchilla 8B cost for the same model size. For GPU counts and deadlines rather than tokens, use our training cost calculator.
How should you pick a token budget?
Start from what the model must learn, then let your data and serving volume set the size. This is the rule we use when we scope runs:
- If the model already knows the subject and you need a format, tone or task behavior, fine-tune. Start with 50 to 100 good examples, grow toward 1,000 curated ones, and stop adding data when your held-out eval stops improving.
- If the model lacks domain knowledge or vocabulary, run continued pretraining. Budget the clean in-domain tokens you own, times at most 4 epochs, then fine-tune on top.
- If no open model fits your language, tokenizer or license, pretrain from scratch. Use 20 tokens per parameter as the floor.
- If the from-scratch model will serve heavy traffic, train a smaller model on more tokens, as Meta did. Stop when held-out loss gains no longer justify the extra GPU-hours.
Step 3 is rarely the cheapest path to a good model for one company's task, so check steps 1 and 2 first.
How do you check a token budget before paying for it?
Convert the budget into steps and let a dry run price it. On Nodus, a TrainingJob on the nodus/sft runtime handles fine-tuning and, with task: Pretrain, continued or from-scratch pretraining. You set parameters.steps and a maxCostUSD cap. Steps times batch size times sequence length should equal your token budget.
From the Nodus training docs:
$ nodus apply -f sft.yaml --dry-run -o yaml # status.estimate: cost to completion, first hold, start time
$ nodus apply -f sft.yaml
The estimate is steps times the runtime's measured seconds per step on the slowest GPU type you allowed. If it disagrees with your 6 x N x D math by a lot, find out why before you launch.
FAQ
How many tokens are in a typical fine-tuning example?
It depends on the task, so count your own. A classification example may be under 100 tokens, while a chat with long answers can pass 1,000. Multiply your average by examples and epochs to get the training token count.
Do tokens per parameter apply to fine-tuning?
No. The 20 tokens per parameter rule is about pretraining a model at a fixed compute budget. A fine-tune adjusts behavior the model already learned, which is why LIMA needed only 1,000 examples for a 65B model.
Does the tokenizer change how many tokens my data is?
Yes. The 0.75 words per token ratio is an English rule of thumb, and different tokenizers split text differently. Code and many non-English languages need more tokens per word, so tokenize a sample with the model's own tokenizer.
Can I stop a Nodus training run once it has seen enough tokens?
Yes. Nodus TrainingJobs can select the checkpoint with the lowest validation loss and stop after three validation passes without improvement, using parameters.validation in the training docs. That turns a fixed token budget into a ceiling rather than a commitment.
Originally published on the Nodus blog.
來源:DEV Community · dev.to