htqin / IR-QLoRA

[ICML 2024 Oral] This project is the official implementation of our Accurate LoRA-Finetuning Quantization of LLMs via Information Retention
55 stars 3 forks source link

Code for int4 #1

Closed hoagy-davis-digges closed 6 months ago

hoagy-davis-digges commented 7 months ago

Thanks for sharing, I was wondering if you had the code you used to run the integer comparison with qa-lora?

hoagy-davis-digges commented 7 months ago

Also for integrating the IEC parameters into the LoRA adapters

Xingyu-Zheng commented 6 months ago

Thanks for sharing, I was wondering if you had the code you used to run the integer comparison with qa-lora?

We are very honored by your interest in our work! We have improved the code for "IR-QLoRA with Integer Quantizer" in the latest submission. If you have any further questions, please feel free to contact us at any time.

Xingyu-Zheng commented 6 months ago

Also for integrating the IEC parameters into the LoRA adapters

Thank you for your question. Here's an example of integrating the IEC parameters into the LoRA adapters:

Set $x\in \mathbb{R}^{1\times 4}, x' \in \mathbb{R}^{1\times 2} ,\ell_1 \in \mathbb{R}^{4\times 2}, \ell_2 \in \mathbb{R}^{2\times 4}$, $h=o=4$, $r=2$,

$$ \begin{aligned} x &= \begin{bmatrix} x{11} & x{12} & x{13} & x{14} \end{bmatrix} \ \ell1 &= \begin{bmatrix} \ell{1{11}} & \ell{1{12}} \ \ell{1{21}} & \ell{1{22}} \ \ell{1{31}} & \ell{1{32}} \ \ell{1{41}} & \ell{1_{42}} \end{bmatrix} \ \ell2 &= \begin{bmatrix} \ell{2{11}} & \ell{2{12}} & \ell{2{13}} & \ell{2{14}} \ \ell{2{21}} & \ell{2{22}} & \ell{2{23}} & \ell{2_{24}} \ \end{bmatrix} \ \ \end{aligned} $$

The process of merging the IEC parameters into the LoRA for the given structure is as follows::

image

For the structure in QA-LoRA, the process is similar. Please feel free to reach out if you have any questions about this.