Quantization
Storing a model’s weights with fewer bits, so it needs less memory and runs faster, at a small cost in quality.
Quantization stores a model’s weights with fewer bits, for example 4 instead of 16, so the model needs less memory and runs faster on the same hardware, at a small cost in quality. It is what makes mid-sized open models practical on a single machine.
A model stored in 16 bits per weight needs about two bytes per parameter. Common 4-bit formats need roughly a third of that, which is what lets mid-sized open models run on a single workstation. The memory needed is about parameters times bits per weight divided by eight, plus room for the context. By that formula a 7-billion-parameter model needs about 14 GB for its weights at 16 bits. Quality loss grows as bits drop and varies by model and task; the Hugging Face quantization overview lists the main methods.
Quantization compresses an existing model. Teaching it new behavior or vocabulary is the job of fine-tuning. The common mistake is trusting a general benchmark score: test the quantized local LLM on your own questions with evals, because an average can hide failures on exactly the tasks you care about.
Sources
- Hugging Face: Overview · Hugging Face huggingface.co
Related terms
- Local LLM: A language model running on hardware you control instead of a provider’s API, so documents stay where you decide.
- Tokens: The pieces of text models read and write, and the unit you pay for.
- Model routing and fallback: Sending each request to the model that fits it, and to another one when the first fails.
- Fine-tuning (vs RAG and prompting): Further training a model on your own examples so it adopts a style, format or narrow skill; poor at teaching it new facts.
- Evals: A repeatable test set that scores an AI feature, so changes can be measured instead of guessed.
- LLM benchmark: A public, standardized test set used to compare models with each other, as opposed to evals built for your own task.
