Saved in:
| Main Authors: | , , , , , , , , |
|---|---|
| Format: | Preprint |
| Published: |
2024
|
| Subjects: | |
| Online Access: | https://arxiv.org/abs/2404.00456 |
| Tags: |
Add Tag
No Tags, Be the first to tag this record!
|
| _version_ | 1866914996367130624 |
|---|---|
| author | Ashkboos, Saleh Mohtashami, Amirkeivan Croci, Maximilian L. Li, Bo Cameron, Pashmina Jaggi, Martin Alistarh, Dan Hoefler, Torsten Hensman, James |
| author_facet | Ashkboos, Saleh Mohtashami, Amirkeivan Croci, Maximilian L. Li, Bo Cameron, Pashmina Jaggi, Martin Alistarh, Dan Hoefler, Torsten Hensman, James |
| contents | We introduce QuaRot, a new Quantization scheme based on Rotations, which is able to quantize LLMs end-to-end, including all weights, activations, and KV cache in 4 bits. QuaRot rotates LLMs in a way that removes outliers from the hidden state without changing the output, making quantization easier. This computational invariance is applied to the hidden state (residual) of the LLM, as well as to the activations of the feed-forward components, aspects of the attention mechanism, and to the KV cache. The result is a quantized model where all matrix multiplications are performed in 4 bits, without any channels identified for retention in higher precision. Our 4-bit quantized LLaMa2-70B model has losses of at most 0.47 WikiText-2 perplexity and retains 99% of the zero-shot performance. We also show that QuaRot can provide lossless 6 and 8 bit LLaMa2 models without any calibration data using round-to-nearest quantization. Code is available at: https://github.com/spcl/QuaRot. |
| format | Preprint |
| id |
arxiv_https___arxiv_org_abs_2404_00456 |
| institution | arXiv |
| publishDate | 2024 |
| record_format | arxiv |
| spellingShingle | QuaRot: Outlier-Free 4-Bit Inference in Rotated LLMs Ashkboos, Saleh Mohtashami, Amirkeivan Croci, Maximilian L. Li, Bo Cameron, Pashmina Jaggi, Martin Alistarh, Dan Hoefler, Torsten Hensman, James Machine Learning We introduce QuaRot, a new Quantization scheme based on Rotations, which is able to quantize LLMs end-to-end, including all weights, activations, and KV cache in 4 bits. QuaRot rotates LLMs in a way that removes outliers from the hidden state without changing the output, making quantization easier. This computational invariance is applied to the hidden state (residual) of the LLM, as well as to the activations of the feed-forward components, aspects of the attention mechanism, and to the KV cache. The result is a quantized model where all matrix multiplications are performed in 4 bits, without any channels identified for retention in higher precision. Our 4-bit quantized LLaMa2-70B model has losses of at most 0.47 WikiText-2 perplexity and retains 99% of the zero-shot performance. We also show that QuaRot can provide lossless 6 and 8 bit LLaMa2 models without any calibration data using round-to-nearest quantization. Code is available at: https://github.com/spcl/QuaRot. |
| title | QuaRot: Outlier-Free 4-Bit Inference in Rotated LLMs |
| topic | Machine Learning |
| url | https://arxiv.org/abs/2404.00456 |