24/30
Part 7 of 7 · Follow-upsLearn

Fewer bytes per weight make every memory-bound step faster

Store the weights in 8 bits instead of 16, and every step reads half the weight bytes.

# 8 bits is 1 byte a weight
weights_8bit_gb = params * 1 / 1e9
# batch 1: the weights and one 2,000-token cache
read_gb = weights_8bit_gb + kv_per_token * 2000 / 1e9
print(f"weights {weights_8bit_gb:.1f} GB, a batch-1 step reads {read_gb:.1f} GB in {read_gb / 3.35:.1f} ms")
weights 7.6 GB, a batch-1 step reads 7.7 GB in 2.3 ms

That's 2.3 ms against 4.58 ms in 16 bits, and the 7.6 GB the weights free holds more conversations. The catch is accuracy: measure the quantized model on your own evals before it serves anyone.