Quantization

Quantization is a technique that stores and computes an AI model's numbers at lower precision, for example 8-bit or 4-bit instead of 16-bit, so the model needs less memory and runs faster with a small loss in accuracy.

Also known as: Model quantization, low-bit inference

Related terms in this glossary

How it works

Model weights are usually trained in 16-bit or 32-bit floating point. Quantization maps them to fewer bits. A 16-bit model with 8 billion parameters needs about 16 GB just for weights; at 4-bit it needs about 4 GB, small enough for a single consumer GPU or a laptop. Common approaches include:

  • Post-training quantization: convert a finished model, using methods such as GPTQ or AWQ, both published in 2023.
  • Quantization-aware training: train with quantization in mind for better accuracy at low bit widths.
  • Formats: GGUF for llama.cpp and Ollama, FP8 and INT8 on data-center GPUs, and newer 4-bit floating-point formats on recent hardware.
  • KV cache quantization: compress the attention cache to fit longer contexts.

Why it matters

Quantization is often what makes self-hosting practical. It lets a model fit on cheaper GPUs, serve more users per GPU and respond faster, which lowers the cost of private deployments. The cost is some quality loss, usually small at 8-bit and more noticeable at 4-bit and below, and it varies by task. Reasoning, math and non-English text can degrade more than simple chat. Always evaluate the quantized model on your own test set rather than relying on general benchmarks, and compare against the full-precision version. Gepton applies it in private AI deployment.

Quantization in depth

Choosing a quantization method

The right method depends on the hardware, the serving software and how much quality loss the task can tolerate:

Method or formatTypical use
FP8 weights and activationsRecent data-center GPUs that support FP8, served with vLLM or TensorRT-LLM
INT8 weight-only or SmoothQuant-style W8A8Broad GPU support with small quality loss
GPTQ or AWQ 4-bit weightsFitting larger models on fewer or smaller GPUs
GGUF quantization levelsllama.cpp and Ollama on CPUs, laptops and small servers
bitsandbytes 4-bit with QLoRAFine-tuning large models on limited GPU memory

Weight-only quantization saves memory and helps when generation is limited by memory bandwidth. Quantizing activations as well can raise throughput further on hardware with fast low-precision math, but it is harder to do without accuracy loss.

Example: fitting a model onto existing GPUs

Example: a team wants to serve a 14 billion parameter open-weight model on GPUs it already has, each with 24 GB of memory. At 16-bit, the weights alone need about 28 GB, so the model will not fit on one card. With AWQ 4-bit weights, they need roughly 8 GB, leaving room for the attention cache and several concurrent users. The team runs its evaluation set through both the full-precision model (on a rented larger GPU) and the 4-bit version. Extraction accuracy is nearly unchanged, but answers to Hindi questions drop slightly, so they test an 8-bit version for that route and compare again. The decision is recorded with the scores, and both versions stay in the model registry.

How to evaluate a quantized model

  1. Run the same evaluation set on the full-precision and quantized versions, with identical prompts and sampling settings.
  2. Compare task scores, not just perplexity. Perplexity changes can be small while task accuracy moves more.
  3. Break results down by language, task type and input length.
  4. Measure serving metrics on target hardware: memory use, time to first token, tokens per second and maximum concurrent requests.
  5. Repeat after any change to the serving stack, since kernels and formats affect both speed and output.

Common mistakes

  • Choosing the lowest bit width that loads, without measuring quality.
  • Using a calibration dataset that does not resemble real inputs, such as English-only text for a Hindi workload.
  • Forgetting the attention cache, which can need as much memory as the weights for long contexts and many users.
  • Downloading community quantizations without checking the source model and method.
  • Assuming a format runs fast everywhere. Some formats are fast only on specific GPUs or runtimes.

Quantization is one of several ways to make inference faster and less costly. Distillation trains a smaller model to imitate a larger one, and small language models start small by design; the approaches combine well. Quantization often decides whether a private deployment is practical at all. Gepton applies it in private AI deployment, sizes GPU platforms in MLOps and AI infrastructure, and weighs it against other options in AI cost optimization.

Questions about Quantization

Something else? Send us your question and an engineer replies with next steps.

Does quantization affect Indian-language performance more than English?

It can. Quality loss from quantization is not uniform: less common languages and harder tasks may degrade more than everyday English tasks, partly because calibration data is often English-heavy. The effect varies by model and method. If your users write in Hindi or other Indian languages, include those languages in both the calibration data and the evaluation set, and compare 8-bit and 4-bit versions before choosing.

Can a quantized model be fine-tuned?

Yes, through methods such as QLoRA, which keeps the base model in 4-bit precision and trains small adapter layers in higher precision. This makes fine-tuning large models possible on limited GPU memory. After training, the adapters can be merged and the result quantized again for serving. Evaluate the final served version, since merging and re-quantizing can change behavior slightly.

Articles that mention Quantization

All articles

Jump to

↑↓ to move↵ to open