Skip to content
IJK

Why LLM Weights Cost Memory and What Quantization Does

By IJK ·

What a Hugging Face post says LLMs usually train with, what a value costs in memory and what quantization does about both problems.

What LLMs train with and what it costs

LLMs usually train with 16-bit floating point parameters (a.k.a FP16/BF16). [1]

Thus, storing the value of a single weight or activation value requires 2 bytes of memory. [2]

Why floating point costs more

In addition, floating point arithmetic is more complex and slower than integer arithmetic and requires additional computing power. [3]

plusaddresses16-bit parametersFP16 or BF16, 2 bytes per weight or activation valueFloating point arithmeticmore complex and slower than integer arithmeticQuantizationreduces the range of unique values the parameters...
Where does the cost come from?

What quantization does

Quantization is a model compression technique that aims to solve both problems by reducing the range of unique values that model parameters can take. [4]

In a nutshell, quantization rescales model parameters to smaller value ranges. [5]

Sources

  1. The Hugging Face source says: LLMs usually train with 16-bit floating point parameters (a.k.a FP16/BF16). Smaller is better: Q8-Chat, an efficient generative AI experience on Xeon
  2. The Hugging Face source says: Thus, storing the value of a single weight or activation value requires 2 bytes of memory. Smaller is better: Q8-Chat, an efficient generative AI experience on Xeon
  3. The Hugging Face source says: In addition, floating point arithmetic is more complex and slower than integer arithmetic and requires additional computing power. Smaller is better: Q8-Chat, an efficient generative AI experience on Xeon
  4. The Hugging Face source says: Quantization is a model compression technique that aims to solve both problems by reducing the range of unique values that model parameters can take. Smaller is better: Q8-Chat, an efficient generative AI experience on Xeon
  5. The Hugging Face source says: In a nutshell, quantization rescales model parameters to smaller value ranges. Smaller is better: Q8-Chat, an efficient generative AI experience on Xeon

Editorial (AI-assisted; automatically checked, not human-reviewed). Each statement is linked to its source; check the source before relying on a detail.

  • quantization
  • llm
  • inference
  • hugging face