Tinker Inference engineering

by Samy (Kondasamy Jayaraman)

Loading Larkspur mini

Chapter 4 of 7

Smaller numbers

The server’s memory is mostly weights, each stored as a 16-bit number. Would 8 bits, or even 4, do?

This chapter: What does storing the weights in fewer bits save, and what does it cost?

About this chapter

You will learn

  • Quantization: rounding each weight to one of a few levels
  • How much memory 8 and 4 bits save, counted from the model’s shape
  • How to check what it costs: held-out text and the top 5 next tokens

Words you’ll meet

Quantization
Storing numbers with fewer bits by rounding each to the nearest of a fixed set of levels.
int8
Whole numbers stored in 8 bits: 255 levels, scaled to each row of weights.
int4
Whole numbers stored in 4 bits: 15 levels, scaled to each row of weights.
Held-out text
Text kept out of training, used only to score the model.
Loss
How surprised the model is by the next piece of text, on average: lower is better.

Step 1 of 5

rounds each weight to one of a few levels, scaled per row to its largest weight.

Store them as : 8 bits.

Loading Larkspur mini