Concepts / Designing Language Models

Designing Language Models

Training a model is a fixed amount of work, so that work is measured in FLOPs.

  • Programming

Why Compute Figures Get Confused

When people talk about the compute requirements of a language model, they often seem to be talking about one simple quantity. In practice, a compute figure can describe two very different things: how much arithmetic a job demands, and how fast a machine can do arithmetic. The two are written with similar notation, and that similarity causes a great deal of confusion. This article separates them, then uses each one to make the kind of estimates that planning a model's training and deployment requires.

What do you think happens?

Before reading on: are FLOPs and FLOP/s the same unit, just written differently?

  • Yes, the plural s and the slash are only notation

  • No, one counts operations in a task and the other measures operations per second

Reveal answer
Answer:

No, they are not the same unit. FLOPs counts the operations a task requires, while FLOP/s measures how many operations a machine can perform each second.

A FLOP is one floating point operation, and a FLOP count describes how much arithmetic a task demands. FLOP/s, read as floating point operations per second, is a rate that describes a machine. Treating them as interchangeable produces wrong estimates.

Work Versus Speed: FLOPs and FLOP/s

A FLOP is one floating point operation, and a FLOP count measures how much arithmetic a task demands. Because the count describes a task rather than a machine, it works as a standardized unit for a model's compute requirement. Training a model is a fixed amount of work, so that work is measured in FLOPs. FLOP/s, read as floating point operations per second, is a rate. It describes what a machine can do in one second at its best. A single chip therefore has one FLOP/s rating, while a particular training job needs a separate number expressed in FLOPs. Keeping these two roles apart is the core skill of this section.

FLOPsCount of operationsDescribes the taskFixed amount of workStandard compute unitIndependent of the machineFLOP/sOperations per secondDescribes the machineA rate, at bestPeak rating of a chipOne value per chipmeasuresbecomesmeasuresbecomes
Which quantity describes the job and which describes the machine, and how the two roles differ.

Trace the two quantities through a simple question. Suppose someone asks how much compute a model needs. The answer is a total in FLOPs, because the model's training is a fixed job. Now suppose someone asks how fast a GPU is. The answer is a rate in FLOP/s, because the GPU has a capacity per second. A total and a rate answer different questions, and combining them correctly requires a step that connects them, which the next section supplies.

Turning a Chip's Speed into a Daily Total

Because FLOP/s is a rate, multiplying it by a length of time converts it into a total count of operations. For large workloads the most useful length is a day. The conversion uses 60 seconds, times 60 minutes, times 24 hours, which gives 86,400 seconds in a day.

Formula, step by step
  1. 1
    Start with the machine's rate in FLOP/s, which is operations per second.
  2. 2
    Multiply by 60 to convert seconds into minutes of operations.
  3. 3
    Multiply by 60 again to convert minutes into hours.
  4. 4
    Multiply by 24 to convert hours into a full day, giving the total operations in one day.
Worked example

A chip rated at 1 TeraFLOP/s

A machine can perform 1 TeraFLOP/s, which is $10^{12}$ FLOP/s at its best. How many FLOPs can it perform in one day if it runs at that rate continuously?

  1. 1
    Write the rate

    The rate is $10^{12}$ FLOP/s, meaning $10^{12}$ operations every second.

  2. 2
    Count the seconds in a day

    $60 \times 60 \times 24 = 86{,}400$ seconds.

  3. 3
    Multiply rate by time

    $10^{12} \times 86{,}400 = 8.64 \times 10^{16}$ operations.

Result

The machine can perform $8.64 \times 10^{16}$ FLOPs in one day, assuming it sustains its peak rate the whole time.

Memory Floor from Parameters

A model's parameter count helps estimate the compute resources needed to train and run it, and memory is the most direct link. Each parameter is stored as a number that takes up space. The total storage therefore follows from two values: how many parameters there are, and how many bytes each one occupies. Multiplying the two gives the storage for the parameters alone.

Parameter count7 billionBytes per parameter2 bytes (16 bits)Parameter storage14 GB, the memory floormultiplied bymultiplied by
How the parameter count and the bytes per parameter combine into the memory floor for inference.
Worked example

Memory floor for a 7 billion parameter model

The source uses a 7 billion parameter model stored at 2 bytes (16 bits) per parameter. What is the storage needed for the parameters alone?

  1. 1
    Write the parameter count

    $7 \times 10^{9}$ parameters.

  2. 2
    Write the bytes per parameter

    2 bytes per parameter, which is 16 bits.

  3. 3
    Multiply

    $7 \times 10^{9} \times 2 = 14 \times 10^{9}$ bytes.

  4. 4
    Convert to gigabytes

    $14 \times 10^{9}$ bytes is 14 GB in decimal units.

Result

The parameters alone require about 14 GB. This is a floor: the least GPU memory needed to run inference with this model, not a full memory budget.

Utilization: Why Peak Is a Ceiling

Peak performance is a ceiling that a machine rarely stays at. Utilization measures how much of the maximum compute capacity you can actually use, expressed as a percentage. Utilization is the ratio of delivered performance to peak performance, so it is always between 0% and 100%. Any estimate that uses the peak rating without adjusting for utilization is therefore an optimistic best case.

Worked example

Finding utilization from rated and delivered performance

A machine is rated at 60 TeraFLOP/s and delivers 30 TeraFLOP/s in practice. What is its utilization?

  1. 1
    Identify the peak

    The rated maximum is 60 TeraFLOP/s.

  2. 2
    Identify the delivered rate

    The practical performance is 30 TeraFLOP/s.

  3. 3
    Divide and convert

    $\frac{30}{60} = 0.5$, which is 50% utilization.

Result

The machine runs at 50% utilization. The source describes this as getting half the advertised performance.

What counts as good utilization depends on the model, the workload, and the hardware. As a rough guide, the source says that 50% utilization means you are doing okay, and anything above 70% is considered great. A later chapter covers hardware metrics and utilization in more detail.

Estimating Training Time and Cost

Now combine the two units. If a training job needs a fixed number of FLOPs, and each machine supplies some FLOP/s, then the time required is the total work divided by the total rate. The total rate is the number of machines multiplied by the effective rate per machine, where the effective rate is the peak rate multiplied by utilization. Utilization below 100% therefore lengthens the training time.

Formula, step by step
  1. 1
    Total FLOPs is the fixed amount of work the training job needs.
  2. 2
    Machines times peak FLOP/s gives the combined peak rate of the hardware.
  3. 3
    Multiplying by utilization gives the rate actually delivered.
  4. 4
    Dividing the work by the delivered rate gives the training time in seconds, which can be converted to days or months.
MachinesNumber of GPUsTotal job FLOPsFixed workTraining timeWork divided by rateTotal costMachine-hours times costper machine-hourPeak FLOP/s permachineRated maximumEffective FLOP/sRate delivered to the jobUtilizationShare actually usedcombined withcombined withscalesdivided by ratesetshours feed
How the number of machines, the peak rate, and utilization combine into an effective rate, which then sets the training time and cost.
Worked example

Training time for 256 GPUs at full use

The source assumes 256 H100 GPUs, each used at its maximum capacity with no training mistakes, to train a job with a fixed number of FLOPs. How long does the job take?

  1. 1
    Identify the numerator

    The job's total FLOPs, which the source does not restate in this passage.

  2. 2
    Identify the denominator

    The combined daily capacity of the 256 machines at full use.

  3. 3
    Divide

    Dividing total FLOPs by that daily capacity gives the number of days.

Result

The source gives the result as about 236 days, or approximately 7.8 months. This assumes perfect use of the hardware, so it is the best case rather than a realistic prediction.

Worked example

How utilization changes a cost estimate

A cluster has 100 machines, each rated at 60 TeraFLOP/s, running for 500 hours at a cost of 2 dollars per machine-hour. Compare the machine-hours and cost at 100% utilization with a run at 50% utilization, where the same work takes twice as long.

  1. 1
    Compute machine-hours at full use

    $100 \times 500 = 50{,}000$ machine-hours.

  2. 2
    Compute cost at full use

    $50{,}000 \times 2 = 100{,}000$ dollars.

  3. 3
    Adjust for 50% utilization

    Halving utilization doubles the hours to 1,000, so machine-hours become $100 \times 1{,}000 = 100{,}000$.

  4. 4
    Compute cost at 50% use

    $100{,}000 \times 2 = 200{,}000$ dollars.

Result

Halving utilization doubles both the training time and the cost, because the same work occupies twice as many machine-hours.

Three Numbers That Signal Scale

The source summarizes a model's scale with three numbers: parameters, tokens trained on, and FLOPs. Each one is a proxy, meaning an indirect measure of something harder to observe directly. Keeping the three separate prevents you from treating a single figure as a complete description of a model.

Scale numberWhat it stands in forThe question it answers
ParametersLearning capacityHow much the model can represent
Tokens trained onAmount learnedHow much training exposure the model received
FLOPsTraining costHow much arithmetic the training consumed

The three proxies for model scale and what each one stands for

These three numbers answer different questions. A model can be described by any one of them, but a fuller picture requires reading them together. Two models with the same parameter count can have very different training exposure and cost, so a single figure rarely tells the whole story.

Why Bigger Is Not Always Better

It is tempting to assume that a larger model is always the better model, but the source describes cases where that assumption fails. In 2022, Anthropic found that more alignment training, discussed in a later chapter on post-training, could lead to models that align less with human preferences, according to the authors of that study.

In 2023, a group of researchers, mostly from New York University, launched the Inverse Scaling Prize to find tasks where larger language models perform worse. Prizes were offered at three levels, and the competition received 99 submissions, of which 11 earned third prizes. The organizers found that larger models are sometimes, though only sometimes, worse on tasks that require memorization and on tasks with strong priors. No second or first prizes were awarded, because the failures appeared on a small test set but none showed up in the real world.

Mistakes When Reading Compute Figures

  • Common mistake

    Treating FLOPs and FLOP/s as the same unit

    What it looks like

    Reading 'the model needs 10 TeraFLOP/s' as if it were the total work of the job.

    Why it fails

    FLOPs counts the operations a task requires, while FLOP/s is the rate at which a machine performs them. A total and a rate answer different questions.

    Do this instead

    Ask whether the figure describes the job's total work or a machine's speed, and write the unit that matches.

  • Common mistake

    Using peak FLOP/s directly to predict training time

    What it looks like

    Dividing total FLOPs by the rated peak of 256 machines and reporting that as the expected duration.

    Why it fails

    Peak performance is a ceiling that machines rarely sustain. The source's 236-day figure is a best case with perfect use.

    Do this instead

    Multiply the peak rate by utilization before dividing, and treat the result as an optimistic lower bound on time.

  • Common mistake

    Treating the parameter storage as the full memory budget

    What it looks like

    Concluding that a 7 billion parameter model needs exactly 14 GB of GPU memory to run.

    Why it fails

    The 14 GB covers only stored parameters, which the source describes as a floor, not a full budget.

    Do this instead

    Use the parameter storage as the minimum and allow additional memory on top of it.

  • Common mistake

    Assuming a larger model is always better

    What it looks like

    Choosing the biggest model without checking its performance on the target task.

    Why it fails

    The source reports tasks where larger models do worse, and alignment work where more training hurt alignment in one study.

    Do this instead

    Read the three scale numbers together and evaluate the model on the task that matters.

Practice Estimating Scale

MEDIUM

A machine is rated at 120 TeraFLOP/s and runs at 25% utilization. How many FLOPs can it deliver in one day? Show the effective rate before multiplying by the seconds in a day.

Hints
  • Start by computing the effective rate: peak multiplied by utilization.
  • A TeraFLOP/s is $10^{12}$ FLOP/s, and a day has 86,400 seconds.
  • Multiply the effective rate by 86,400 to get the daily total.
EASY

A 13 billion parameter model is stored at 2 bytes per parameter. What is the minimum GPU memory needed for its parameters, and why is this figure a floor rather than a complete memory budget?

Hints
  • Multiply the parameter count by the bytes per parameter.
  • Think about what memory is needed beyond the stored parameters.

Key Takeaways

  • FLOPs count the operations a task requires, while FLOP/s is the rate at which a machine performs them, so the two must not be mixed.
  • Multiplying a FLOP/s rate by 60 times 60 times 24 converts it into a daily total of operations, which is a peak figure until utilization is applied.
  • Parameter count times bytes per parameter gives a memory floor for inference, and utilization below 100% lengthens training time and raises cost.
  • Parameters, tokens trained on, and FLOPs are three proxies for model scale, standing for learning capacity, amount learned, and training cost, and bigger is not always better.

Related concepts

More concepts starting with D