Basis Lab

What It Costs to Run a Model

What a Million Words Actually Costs

Last timeTwo Phases, Two Bottlenecks

Everything in this course assembles into a single number, a price per million words, and that number ranks the available changes honestly.

Everything in this course has been a term in one calculation. This lesson runs

it, and then uses it to put the available changes in order.

FIG 1From bytes per pass to dollars per million words
stepthe stepthe arithmeticthe resultwhat happened
1the bytes one pass must move140 gigabytes of weights, read once for the whole group, plus 64 kept conversations at 1.34 gigabytes each, which is 86226 gigabytesBoth terms are already known: the weights from the third lesson, the stores from the fourth, the group from the sixth.
2the seconds that pass takes226 gigabytes divided by 3,000 gigabytes a second of memory bandwidth0.075 seconds, so 75 millisecondsThe one division the whole course rests on. The divisor is printed on a specification sheet and the dividend was worked out in the row above.
3the words a second that comes to64 words a pass, one for each grouped request, divided by 0.075 seconds853 words a second, which is 3.07 million an hourThis is the only place the group appears twice: it put 86 gigabytes into the first row and it takes 64 words out of this one.
4the dollars a million words24 dollars an hour divided by 3.07 million words an hour7.80 dollarsTwenty-four dollars an hour is the going rate for eight chips. It is the only number here that is a price rather than a property of the machine.
4 steps
Nothing in this needs measuring. The bytes come from the model and the group, the bandwidth and the price come from the hardware, and the four rows are two divisions with a change of units between them. The result is a floor that a real system will land above.

The four steps

That machine is the one this course has been using throughout: a hundred and

forty gigabytes of weights, three thousand gigabytes a second of memory

bandwidth, sixty-four conversations grouped, each holding one and a third

gigabytes. Eight dollars a million words, before anything is marked up.

It is worth pausing on how little that calculation needed. No profiler, no

benchmark run, no access to the machine. Four numbers about the model, two about

the hardware and one about the group, and the result is within a small factor of

what a well-run service will actually achieve. That is unusual in computing, and

it is a consequence of the whole system being limited by one resource whose rate

is published on a specification sheet.

FIG 2What a single pass is actually reading
At a group of sixty-four the two are already comparable. Grow the group further and the second slice overtakes the first, which is the point at which adding requests stops being nearly free.
FIG 3Four configurations of the same machine
stepgigabytes moved per passmilliseconds per passwords per seconddollars per million wordswhat happened
1226758537.8The starting point: two bytes a number, summaries shared eight ways, sixty-four grouped.
211337.716983.9One byte a number instead of two. Both the weights and the stores halve, so the whole pass halves.
348316115904.2Back to two bytes but with two hundred and fifty-six grouped. Each pass is much slower and produces four times as many words.
424280.731722.1Both changes at once. They multiply rather than overlapping, because one shrinks the bytes and the other spreads them.
4 steps
The last row costs a quarter of the first. No new hardware was bought and the model is the same model, slightly less accurate in its arithmetic and reaching the same answers.
FIG 4The changes, ranked by what they do to the bill
throughput against the starting pointdollars per million words
one byte a number instead of two2.003.90
group of two hundred and fifty-six1.864.20
summaries shared sixty-four ways1.495.20
half the conversation length1.236.30
the starting point1.007.80
The order is stable across model sizes, because every entry is a statement about bytes moved per word and nothing else. What changes between deployments is which ones are available.

What each one is paid for with

The ranking above is only half an answer, because the column it leaves out is

what you give up.

The lesson stops here

2 more paragraphs to go

You have read the opening. The rest of the argument, the problems that check whether it landed, and the lines worth keeping at the end all come with a plan.

The first lesson of every course in the library reads the whole way through, free, so you can see exactly what the rest of them are.

See the planThe contents

This is the reading half

Starting the course gives you your own copy of it. Every idea on every page has problems standing under it, marked with a reason rather than a tick, and any sentence you do not believe can be opened and argued with. None of that can happen on a page nobody owns.

The contents

The rest of this course

  1. 01The Two Kinds of Work
  2. 02Paying for Precisionopening only
  3. 03The Ceiling You Cannot Code Aroundopening only
  4. 04What the Model Holds On Toopening only
  5. 05The Length at Which Everything Changesopening only
  6. 06The One Trick That Actually Worksopening only
  7. 07Reading and Writing Are Different Jobsopening only
  8. 08What a Million Words Actually Costsyou are here

Read alongside