Four Ways to Fit, and What Each One Costs
Last timeDoing More with Each Byte
A job too large for the device can use smaller numbers, smaller batches, memory off the device or a second device. Each has a price that can be worked out first.
Lesson one showed how to tell that a job will not fit. This lesson is about what to do then. Take a model of 70 billion weights at two bytes each, the one What It Costs to Run a Model uses. Its weights are 140 GB. The A100 80GB holds 80.
Fewer bytes per value, fewer items per batch
Store each weight in one byte and the model is 70 GB. It fits, with 10 GB over for the working part. It is also faster. Lesson two put the floor for a pass at the bytes over the memory rate: 140 GB would take 68.7 milliseconds on a device that could hold it, and 70 GB takes 34.3. Nothing else in this lesson both fits the job and speeds it up. The price is in the answers, and Making a Model Smaller covers what one byte can and cannot represent.
Now the batch. Suppose each request needs half a gigabyte of working memory at its largest moment. With 10 GB left, 20 requests fit. If the working part were what overflowed, halving the batch to 10 would cure it, and since a pass takes the same 34.3 milliseconds for any batch this side of the balance point, the rate of work would halve too: from 583 requests a second to 291.
Memory off the device
Suppose the weights must stay at two bytes. The computer the device sits in has its own, larger memory, and the vendor provides a way to treat the two as one, which it calls unified memory. Data that is not on the device is brought across when a worker touches it, and something else is pushed out to make room. The program does not change.
The price is the link. The same product page that gives 2,039 GB a second for the device's memory gives 64 GB a second for its connection to the computer: about one thirty-second of the rate.
The lesson stops here
5 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 contentsThis 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