From a Matrix Multiply to a Forward Pass
Halving the Size of a Number Is Worth Exactly Two to Memory and Whatever the Units Say to Arithmetic
Last timeUnits Built for Just This
Half-size numbers halve the bytes of a multiply, which is worth two when memory is the limit. When arithmetic is the limit the gain is a ratio read off the data sheet.
What It Costs to Run a Model asks how few bits a weight needs, and *Making a Model Smaller* asks what that does to the answers. This lesson takes the decision as made, four bytes a number down to two, and asks only what the device does with it. The vendor's guide on the subject names two separate effects, and they belong to the two limits.
The two effects
A multiply takes the longer of two times: the time to move its bytes and the time to do its arithmetic.
- the numbers read and written, which does not depend on their size
- the bytes per number, four or two
- the memory rate of the device in bytes a second, which does not depend on what the bytes mean
- the operations, which also do not depend on the size of a number
- the peak arithmetic rate for numbers of f bytes, a figure the builder publishes for each format
The first term is simple. Half the bytes, half the wait. In the guide's words, half-size numbers halve the bytes accessed and so reduce the time spent in memory-limited layers. The factor is two and nothing can make it more.
The second term is a matter of what was built. Nothing about a smaller number makes arithmetic quicker in itself. The gain is the ratio of two peaks on a data sheet, and it depends on which two.
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