Buckets:

|
download
raw
10.3 kB
# Overview
Quantization lowers the memory requirements of loading and using a model by storing the weights in a lower precision while trying to preserve as much accuracy as possible. Weights are typically stored in full-precision (fp32) floating point representations, but half-precision (fp16 or bf16) are increasingly popular data types given the large size of models today. Some quantization methods can reduce the precision even further to integer representations, like int8 or int4.
Transformers supports many quantization methods, each with their pros and cons, so you can pick the best one for your specific use case. Some methods require calibration for greater accuracy and extreme compression (1-2 bits), while other methods work out of the box with on-the-fly quantization.
Use the [quantization picker](https://huggingface.co/spaces/stevhliu/quantization-picker) to find a method for your model and hardware. Pick a model, your hardware, and what you need the method to do: load the model on the fly, fine-tune it with PEFT, compile it with `torch.compile()`, or save the quantized result. The picker shows whether the model fits in memory at each precision, including the KV cache, and the **Compare** view lists the methods that match.
<iframe
src="https://stevhliu-quantization-picker.hf.space"
frameborder="0"
width="100%"
height="420"
>
Full compatibility table
| Quantization Method | On the fly quantization | CPU | CUDA GPU | ROCm GPU | Metal (Apple Silicon) | Intel GPU | Torch compile() | Bits | PEFT Fine Tuning | Serializable with πŸ€—Transformers | πŸ€—Transformers Support | Link to library |
|-------------------------------------------|----------------------|-----------------|----------|-----------|------------------------------------|-----------------|-----------------|--------------|------------------|-----------------------------|-------------------------|---------------------------------------------|
| [AQLM](./aqlm) | πŸ”΄ | 🟒 | 🟒 | πŸ”΄ | πŸ”΄ | 🟒 | 🟒 | 1/2 | 🟒 | 🟒 | 🟒 | https://github.com/Vahe1994/AQLM |
| [AutoRound](./auto_round) | πŸ”΄ | 🟒 | 🟒 | πŸ”΄ | πŸ”΄ | 🟒 | πŸ”΄ | 2/3/4/8 | πŸ”΄ | 🟒 | 🟒 | https://github.com/intel/auto-round |
| [AWQ](./awq) | πŸ”΄ | 🟒 | 🟒 | 🟒 | πŸ”΄ | 🟒 | ? | 4 | 🟒 | 🟒 | 🟒 | https://github.com/casper-hansen/AutoAWQ |
| [bitsandbytes](./bitsandbytes) | 🟒 | 🟒 | 🟒 | 🟑 | 🟑 | 🟒 | 🟒 | 4/8 | 🟒 | 🟒 | 🟒 | https://github.com/bitsandbytes-foundation/bitsandbytes |
| [compressed-tensors](./compressed_tensors) | πŸ”΄ | 🟒 | 🟒 | 🟒 | πŸ”΄ | 🟒 | πŸ”΄ | 1/8 | 🟒 | 🟒 | 🟒 | https://github.com/neuralmagic/compressed-tensors |
| [EETQ](./eetq) | 🟒 | πŸ”΄ | 🟒 | πŸ”΄ | πŸ”΄ | πŸ”΄ | ? | 8 | 🟒 | 🟒 | 🟒 | https://github.com/NetEase-FuXi/EETQ |
| [Four Over Six](./fouroversix) | 🟒 | 🟒 | 🟒 | πŸ”΄ | πŸ”΄ | πŸ”΄ | 🟒 | 4 | πŸ”΄ | 🟒 | 🟒 | https://github.com/mit-han-lab/fouroversix |
| [FP-Quant](./fp_quant) | 🟒 | πŸ”΄ | 🟒 | πŸ”΄ | πŸ”΄ | πŸ”΄ | 🟒 | 4 | πŸ”΄ | 🟒 | 🟒 | https://github.com/IST-DASLab/FP-Quant |
| [GGUF / GGML (llama.cpp)](./gguf) | πŸ”΄ | 🟒 | 🟒 | πŸ”΄ | 🟒 | 🟒 | 🟒 | 1/8 | πŸ”΄ | πŸ”΄ | [See Notes](./gguf) | https://github.com/ggerganov/llama.cpp |
| [GPT-QModel](./gptq) | πŸ”΄ | 🟒 | 🟒 | 🟒 | 🟒 | 🟒 | πŸ”΄ | 2/3/4/8 | 🟒 | 🟒 | 🟒 | https://github.com/ModelCloud/GPTQModel |
| [HIGGS](./higgs) | 🟒 | πŸ”΄ | 🟒 | πŸ”΄ | πŸ”΄ | πŸ”΄ | 🟒 | 2/4 | πŸ”΄ | 🟒 | 🟒 | https://github.com/HanGuo97/flute |
| [HQQ](./hqq) | 🟒 | 🟒 | 🟒 | πŸ”΄ | πŸ”΄ | 🟒 | 🟒 | 1/8 | 🟒 | πŸ”΄ | 🟒 | https://github.com/mobiusml/hqq/ |
| [Metal](./metal) | 🟒 | πŸ”΄ | πŸ”΄ | πŸ”΄ | 🟒 | πŸ”΄ | πŸ”΄ | 2/4/8 | πŸ”΄ | 🟒 | 🟒 | [Hub Kernels](https://huggingface.co/kernels-community/mlx-quantization-metal-kernels) |
| [NVFP4](./nvfp4) | 🟒 | πŸ”΄ | 🟒 | πŸ”΄ | πŸ”΄ | πŸ”΄ | 🟒 | 4 | πŸ”΄ | πŸ”΄ | 🟒 | [Hub Kernels](https://huggingface.co/kernels-community/nvfp4-gemm) |
| [optimum-quanto](./quanto) | 🟒 | 🟒 | 🟒 | πŸ”΄ | 🟒 | 🟒 | 🟒 | 2/4/8 | πŸ”΄ | πŸ”΄ | 🟒 | https://github.com/huggingface/optimum-quanto |
| [SINQ](./sinq) | 🟒 | 🟒 | 🟒 | 🟑 | 🟑 | 🟑 | 🟑 | 2/3/4/6/8 | πŸ”΄ | 🟒 | 🟒 | https://github.com/huawei-csl/SINQ |
| [FBGEMM_FP8](./fbgemm_fp8) | 🟒 | πŸ”΄ | 🟒 | πŸ”΄ | πŸ”΄ | πŸ”΄ | πŸ”΄ | 8 | πŸ”΄ | 🟒 | 🟒 | https://github.com/pytorch/FBGEMM |
| [torchao](./torchao) | 🟒 | 🟒 | 🟒 | πŸ”΄ | 🟑 | 🟒 | | 4/8 | | πŸŸ’πŸ”΄ | 🟒 | https://github.com/pytorch/ao |
| [VPTQ](./vptq) | πŸ”΄ | πŸ”΄ | 🟒 | 🟑 | πŸ”΄ | πŸ”΄ | 🟒 | 1/8 | πŸ”΄ | 🟒 | 🟒 | https://github.com/microsoft/VPTQ |
| [FINEGRAINED_FP8](./finegrained_fp8) | 🟒 | πŸ”΄ | 🟒 | πŸ”΄ | πŸ”΄ | 🟒 | πŸ”΄ | 8 | πŸ”΄ | 🟒 | 🟒 | Built-in |
| [SpQR](./spqr) | πŸ”΄ | πŸ”΄ | 🟒 | πŸ”΄ | πŸ”΄ | πŸ”΄ | 🟒 | 3 | πŸ”΄ | 🟒 | 🟒 | https://github.com/Vahe1994/SpQR/ |
| [Quark](./quark) | πŸ”΄ | 🟒 | 🟒 | 🟒 | 🟒 | 🟒 | ? | 2/4/6/8/9/16 | πŸ”΄ | πŸ”΄ | 🟒 | https://quark.docs.amd.com/latest/ |
## Resources
If you are new to quantization, we recommend checking out these beginner-friendly quantization courses in collaboration with DeepLearning.AI.
* [Quantization Fundamentals with Hugging Face](https://www.deeplearning.ai/short-courses/quantization-fundamentals-with-hugging-face/)
* [Quantization in Depth](https://www.deeplearning.ai/short-courses/quantization-in-depth)
## User-Friendly Quantization Tools
If you are looking for a user-friendly quantization experience, you can use the following community spaces and notebooks:
* [Bitsandbytes Space](https://huggingface.co/spaces/bnb-community/bnb-my-repo)
* [GGUF Space](https://huggingface.co/spaces/ggml-org/gguf-my-repo)
* [MLX Space](https://huggingface.co/spaces/mlx-community/mlx-my-repo)
* [AutoQuant Notebook](https://colab.research.google.com/drive/1b6nqC7UZVt8bx4MksX7s656GXPM-eWw4?usp=sharing#scrollTo=ZC9Nsr9u5WhN)

Xet Storage Details

Size:
10.3 kB
Β·
Xet hash:
ae4daf6f6780a28a22bc9298a18bbb4cf61252634144a34f2b0ab6f30c0e9bbb

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.