Official Pytorch repository for Extreme Compression of Large Language Models via Additive Quantization https://arxiv.org/pdf/2401.06118.pdf and PV-Tuning: Beyon
Official Pytorch repository for Extreme Compression of Large Language Models via Additive Quantization https://arxiv.org/pdf/2401.06118.pdf and PV-Tuning: Beyon
Official PyTorch implementation for Extreme Compression of Large Language Models via Additive Quantization
[2025.04] Released aqlm v1.1.7. Added support for arbitrary 8-dimensional codebooks on GPU, improved accuracy for 1-bit models, e.g. ISTA-DASLab/Llama-2-7b-AQLM-1Bit-1x8-hf at ~1 bit achieves WikiText 2 PPL 7.85. To quantize your own models this way, use num_codebooks=1, nbits_per_codebook=256 as per the tutorial below.
[2024.11] PV-tuning was accepted to NeurIPS'2024 for oral presentation!
[2024.05] AQLM was accepted to ICML'2024! If you're attending, meet us around this poster.
[2024.06] We released a new paper that extends AQLM with new finetuning algorithm called PV-tuning. We're also releasing PV-tuned AQLM models in this collection
[2024.08] We have merged the PV-Tuning branch into the main branch. To reproduce results with old finetuning (before Aug 21), use commit 559a366.
Learn how to run the prequantized models using this Google Colab examples:
| Basic AQLM generation | Streaming with GPU/CPU | Inference with CUDA graphs (3x speedup) | Fine-tuning with PEFT | Serving with
vLLM |
|:-----------:|:-------:|:---------------:|:----------:|:--------:|
| | | | | |
If you want to try AQLM+PV inference on CPU directly in your browser, check out aqlm-rs:
This repository is currently designed to work with models of LLaMA, Mistral and Mixtral families.
The models reported below use full model fine-tuning as described in appendix A, with cross-entropy objective with teacher logits.
We provide a number of prequantized AQLM models without PV-Tuning (scroll down for PV-Tuned models):
| Model | AQLM scheme | WikiText-2 PPL | MMLU (5-shot) FP16→AQLM | Model size, Gb | Hub link |
|---|---|---|---|---|---|
| Llama-3-8b | 1x16 | - | 0.65→0.56 | 4.1 | Link |
| Llama-3-8b-Instruct | 1x16 | - | 0.66→0.59 | 4.1 | Link |
| Llama-3-70b | 1x16 | - | 0.79→0.75 | 21.9 | Link |
| Llama-3-70b-Instruct | 1x16 | - | 0.80→0.76 | 21.9 | Link |
| Command-R | 1x16 | - | 0.68→0.57 | 12.7 | Link |
| Command-R+ | 1x16 | - | 0.74→0.68 | 31.9 | Link |
| Mistral-7b | 1x16 | 5.40 | - | 2.5 | Link |
| Mistral-7B-Instruct-v0.2 | 2x8 | - | 0.59→0.44 | 2.5 | Link |
| Mixtral-8x7b | 1x16 | 3.35 | - | 12.6 | Link |
| Mixtral-8x7b-Instruct | 1x16 | - | - | 12.6 | Link |
| Llama-2-7b | 1x16 | 5.92 | 0.46→0.39 | 2.4 | Link |
| Llama-2-7b | 2x8 | 6.69 | - | 2.2 | Link |
| Llama-2-7b | 8x8 | 6.61 | - | 2.2 | Link |
| Llama-2-13b | 1x16 | 5.22 | 0.55→0.49 | 4.1 | Link |
| Llama-2-13b | 2x8 | 5.63 | - | 3.8 | Link |
| Llama-2-70b | 1x16 | 3.83 | 0.69→0.65 | 18.8 | Link |
| Llama-2-70b | 2x8 | 4.21 | - | 18.2 | Link |
| gemma-2b | 1x16 | - | - | 1.7 | Link |
| gemma-2b | 2x8 | - | - | 1.6 | Link |
You can also download AQLM models tuned via PV-tuning:
| Model | AQLM scheme | WikiText-2 PPL | Model size, Gb | Hub link |
|---|---|---|---|---|
| Llama-2-7b | 1x16g8 | 5.68 | 2.4 | Link |
| Llama-2-7b | 2x8g8 | 5.90 | 2.2 | Link |
| Llama-2-7b | 1x16g16 | 9.21 | 1.7 | Link |
| Llama-2-7b | 1x8g8 (New!) | 7.85 | 1.34 | Link |
| Llama-2-13b | 1x16g8 | 5.05 | 4.1 | Link |
| Llama-2-70b | 1x16g8 | 3.78 | 18.8 | Link |
| Meta-Llama-3.2-1B | 2x8g8 | - | 0.8 | Link |
| Meta-Llama-3.2-1B-Instruct | 2x8g8 | - | 0.8 | Link |
| Meta-Llama-3.2-3B | 2x8g8 | - | 1.5 | Link |
| Meta-Llama-3.2-3B-Instruct | 2x8g8 | - | 1.5 | Link |
| Meta-Llama-3-8B | 1x16g8 | 6.99 | 4.1 | Link |
| Meta-Llama-3-8B | 1x16g16 | 9.43 | 3.9 | Link |
| Meta-Llama-3.1-8B | 1x16g16 | - | - | Link |
| Meta-Llama-3.1-8B | 1x16g8 | - | - | Link |
| Meta-Llama-3.1-8B-Instruct | 1x16g16 | - | - | Link |
| Meta-Llama-3.1-8B-Instruct | 1x16g8 | - | - | Link |
| Meta-Llama-3.1-8B-Instruct | 2x8g8 | - | - | Link |
| Meta-Llama-3-70B | 1x16g8 | 4.57 | 21.9 | Link |
| Meta-Llama-3-70B | 1x16g16 | 8.67 | 13 | Link |
| Meta-Llama-3.1-70B-Instruct | 1x16g8 | - | 18.8 | Link |
| Mistral-7B-v0.1 | 1x16g8 | 5.22 | 2.51 | Link |
| Phi-3-mini-4k-instruct | 1x16g8 | 6.63 | 1.4 | Link |
| Phi-3-medium-4k-instruct | 1x16g8 | 5.18 | 4.2 | Link |
| Phi-3-medium-4k-instruct | 1x16g16 | 7.42 | 2.7 | Link |
| Qwen2-72B | 1x16g8 | - | - | Link |
| Qwen2-72B | 1x16g16 | - | - | Link |
| Qwen2-72B-Instruct | 1x16g8 | - | - | Link |
| Qwen2-72B-Instruct | 1x16g16 | - | - | Link |
Note that models with "g16" in their scheme require aqlm inference library v1.1.6 or newer:
pip install aqlm[gpu,cpu]>=1.1.6Above perplexity is evaluated on 4k context length for Llama 2 models and 8k for Mistral/Mixtral and Llama 3. Please also note that token-level perplexity can only be compared within the same model family, but should not be compared between models that use different vocabularies. While Mistral has a lower perplexity than Llama 3 8B but this does not mean that Mistral is better: Llama's perplexity is computed on a much larger dictionary and has higher per-token perplexity because of that.
For more evaluation results and detailed explanations, please see our papers: Egiazarian et al. (2024) for pure AQLM and Malinovskii et al. (2024) for PV-Tuned models.
AQLM quantization setpus vary mainly on the number of codebooks used as well as the codebook sizes in bits. The most popular setups, as well as inference kernels they support are:
| Kernel | Number of codebooks | Codebook size, bits | Scheme Notation | Accuracy | Speedup | Fast GPU inference | Fast CPU inference |
|---|---|---|---|---|---|---|---|
| Triton | K | N | KxN | - | Up to ~0.7x | ✅ | ❌ |
| CUDA | 1 | 16 | 1x16 | Best | Up to ~1.3x | ✅ | ❌ |
| CUDA | 2 | 8 | 2x8 | OK | Up to ~3.0x | ✅ | ❌ |
| Numba | K | 8 | Kx8 | Good | Up to ~4.0x | ❌ | ✅ |
To run the models, one woul
No open issues yet, or sync has not completed.