Views
No views yet
--model parameter to load the fake-quantized model. At the same time, we need to specify the bit parameter as 16 to skip the quantization step. For example:CUDA_VISIBLE_DEVICES=0 python main.py \
--model /path/to/llama-13b-w2a16g128 --eval_ppl \
--output_dir ./log/llama-13b-w2a16g128 \
--wbits 16 --abits 16 --let parameter, you need to enable the bias in the layernorm layers and specific linear layers within the transformer repository to load the shift parameters. For instance, for the llama model, we make the following modifications in modeling_llama.py:self.q_proj = nn.Linear(self.hidden_size, self.num_heads * self.head_dim, bias=True)
self.k_proj = nn.Linear(self.hidden_size, self.num_key_value_heads * self.head_dim, bias=True)
self.v_proj = nn.Linear(self.hidden_size, self.num_key_value_heads * self.head_dim, bias=True)
self.o_proj = nn.Linear(self.num_heads * self.head_dim, self.hidden_size, bias=True)
self.gate_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=True)
self.up_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=True)AffineLlamaRMSNorm from AffineQuant.| PIQA($\uparrow$) | ARC-e($\uparrow$) | WinoGrande($\uparrow$) | BoolQ($\uparrow$) | ARC-c($\uparrow$) | HellaSwag($\uparrow$) | Avg.($\uparrow$) | |
|---|---|---|---|---|---|---|---|
| LLaMA-7B, OmniQuant | 66.15 | 45.20 | 53.43 | 63.51 | 31.14 | 56.44 | 52.65 |
| LLaMA-7B, AffineQuant | 69.37 | 42.55 | 55.33 | 63.73 | 31.91 | 57.65 | 53.42 |
| LLaMA-13B, OmniQuant | 69.69 | 47.39 | 55.80 | 62.84 | 33.10 | 58.96 | 54.37 |
| LLaMA-13B, AffineQuant | 66.32 | 43.90 | 54.70 | 64.10 | 29.61 | 56.88 | 52.58 |
| LLaMA-30B, OmniQuant | 71.21 | 49.45 | 59.19 | 65.33 | 34.47 | 64.65 | 56.63 |
| LLaMA-30B, AffineQuant | 70.84 | 49.41 | 58.64 | 70.12 | 37.12 | 65.53 | 58.61 |
| Methods | WikiText2 | C4 | |
|---|---|---|---|
| LLaMA-7B | OmniQuant | 11.26 | 14.51 |
| AffineQuant | 10.28 | 13.64 | |
| LLaMA-13B | OmniQuant | 10.87 | 13.78 |
| AffineQuant | 10.32 | 13.44 | |
| LLaMA-30B | OmniQuant | 10.33 | 12.49 |
| AffineQuant | 9.35 | 11.58 | |
| LLaMA2-7B | OmniQuant | 14.26 | 18.02 |
| AffineQuant | 12.69 | 15.76 | |
| LLaMA2-13B | OmniQuant | 12.30 | 14.55 |
| AffineQuant | 11.45 | 13.97 |
1@inproceedings{
2ma2024affinequant,
3title={AffineQuant: Affine Transformation Quantization for Large Language Models},
4author={Yuexiao Ma and Huixia Li and Xiawu Zheng and Feng Ling and Xuefeng Xiao and Rui Wang and Shilei Wen and Fei Chao and Rongrong Ji},
5booktitle={The Twelfth International Conference on Learning Representations},
6year={2024},
7url={https://openreview.net/forum?id=of2rhALq8l}
8}