Improve model card: Add license, paper, code, and usage for LoRI-D_code_llama3_rank_64
Browse filesThis PR significantly enhances the model card for `LoRI-D_code_llama3_rank_64` by adding crucial information derived from the paper abstract and the associated GitHub repository.
Specifically, it addresses:
- Inclusion of the `license: apache-2.0` tag in the metadata.
- Comprehensive details for `Model Details`, `Uses`, `Bias, Risks, and Limitations`, `How to Get Started with the Model`, `Training Details`, and `Evaluation` sections, populating `[More Information Needed]` placeholders.
- Direct links to the Hugging Face paper page ([LoRI: Reducing Cross-Task Interference in Multi-Task Low-Rank Adaptation](https://huggingface.co/papers/2504.07448)) and the GitHub repository ([https://github.com/juzhengz/LoRI/](https://github.com/juzhengz/LoRI/)).
- Addition of a runnable Python code snippet for quick inference.
- Inclusion of the BibTeX citation and a visual image of LoRI.
This improvement aims to provide users with a more complete understanding of the model's capabilities, origins, and proper usage, making it more discoverable and user-friendly.
@@ -2,192 +2,141 @@
|
|
2 |
base_model: meta-llama/Meta-Llama-3-8B
|
3 |
library_name: peft
|
4 |
pipeline_tag: text-generation
|
|
|
5 |
---
|
6 |
|
7 |
# Model Card for LoRI-D_code_llama3_rank_64
|
8 |
|
9 |
This model is part of [LoRI: Reducing Cross-Task Interference in Multi-Task Low-Rank Adaptation](https://arxiv.org/abs/2504.07448).
|
10 |
|
11 |
-
|
12 |
-
|
13 |
|
|
|
|
|
|
|
14 |
|
15 |
## Model Details
|
16 |
|
17 |
### Model Description
|
18 |
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
- **Developed by:** [More Information Needed]
|
24 |
-
- **Funded by [optional]:** [More Information Needed]
|
25 |
-
- **Shared by [optional]:** [More Information Needed]
|
26 |
-
- **Model type:** [More Information Needed]
|
27 |
-
- **Language(s) (NLP):** [More Information Needed]
|
28 |
-
- **License:** [More Information Needed]
|
29 |
-
- **Finetuned from model [optional]:** [More Information Needed]
|
30 |
|
31 |
-
|
|
|
|
|
|
|
|
|
32 |
|
33 |
-
|
34 |
|
35 |
-
-
|
36 |
-
-
|
37 |
-
-
|
38 |
|
39 |
## Uses
|
40 |
|
41 |
-
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
42 |
-
|
43 |
### Direct Use
|
44 |
|
45 |
-
|
46 |
-
|
47 |
-
[More Information Needed]
|
48 |
-
|
49 |
-
### Downstream Use [optional]
|
50 |
|
51 |
-
|
52 |
|
53 |
-
|
54 |
|
55 |
### Out-of-Scope Use
|
56 |
|
57 |
-
|
58 |
-
|
59 |
-
[More Information Needed]
|
60 |
|
61 |
## Bias, Risks, and Limitations
|
62 |
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
|
67 |
### Recommendations
|
68 |
|
69 |
-
|
70 |
-
|
71 |
-
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
72 |
|
73 |
## How to Get Started with the Model
|
74 |
|
75 |
-
|
76 |
|
77 |
-
|
|
|
|
|
|
|
78 |
|
79 |
-
|
|
|
|
|
|
|
|
|
|
|
80 |
|
81 |
-
|
82 |
-
|
83 |
-
<!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
|
84 |
|
85 |
-
|
|
|
86 |
|
87 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
|
89 |
-
|
|
|
|
|
90 |
|
91 |
-
|
|
|
|
|
92 |
|
93 |
-
|
94 |
|
|
|
95 |
|
96 |
-
|
|
|
|
|
|
|
97 |
|
98 |
-
|
99 |
|
100 |
-
|
|
|
|
|
101 |
|
102 |
-
|
103 |
|
104 |
-
|
|
|
|
|
105 |
|
106 |
## Evaluation
|
107 |
|
108 |
-
|
109 |
-
|
110 |
-
### Testing Data, Factors & Metrics
|
111 |
-
|
112 |
-
#### Testing Data
|
113 |
-
|
114 |
-
<!-- This should link to a Dataset Card if possible. -->
|
115 |
-
|
116 |
-
[More Information Needed]
|
117 |
-
|
118 |
-
#### Factors
|
119 |
-
|
120 |
-
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
121 |
-
|
122 |
-
[More Information Needed]
|
123 |
-
|
124 |
-
#### Metrics
|
125 |
-
|
126 |
-
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
127 |
-
|
128 |
-
[More Information Needed]
|
129 |
-
|
130 |
-
### Results
|
131 |
-
|
132 |
-
[More Information Needed]
|
133 |
-
|
134 |
-
#### Summary
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
## Model Examination [optional]
|
139 |
-
|
140 |
-
<!-- Relevant interpretability work for the model goes here -->
|
141 |
-
|
142 |
-
[More Information Needed]
|
143 |
-
|
144 |
-
## Technical Specifications [optional]
|
145 |
-
|
146 |
-
### Model Architecture and Objective
|
147 |
-
|
148 |
-
[More Information Needed]
|
149 |
-
|
150 |
-
### Compute Infrastructure
|
151 |
-
|
152 |
-
[More Information Needed]
|
153 |
-
|
154 |
-
#### Hardware
|
155 |
-
|
156 |
-
[More Information Needed]
|
157 |
-
|
158 |
-
#### Software
|
159 |
-
|
160 |
-
[More Information Needed]
|
161 |
-
|
162 |
-
## Citation [optional]
|
163 |
-
|
164 |
-
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
165 |
-
|
166 |
-
**BibTeX:**
|
167 |
-
|
168 |
-
[More Information Needed]
|
169 |
-
|
170 |
-
**APA:**
|
171 |
-
|
172 |
-
[More Information Needed]
|
173 |
-
|
174 |
-
## Glossary [optional]
|
175 |
-
|
176 |
-
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
177 |
-
|
178 |
-
[More Information Needed]
|
179 |
|
180 |
-
##
|
181 |
|
182 |
-
[
|
183 |
|
184 |
-
##
|
185 |
|
186 |
-
|
187 |
|
188 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
|
190 |
-
|
191 |
-
### Framework versions
|
192 |
|
193 |
- PEFT 0.12.0
|
|
|
2 |
base_model: meta-llama/Meta-Llama-3-8B
|
3 |
library_name: peft
|
4 |
pipeline_tag: text-generation
|
5 |
+
license: apache-2.0
|
6 |
---
|
7 |
|
8 |
# Model Card for LoRI-D_code_llama3_rank_64
|
9 |
|
10 |
This model is part of [LoRI: Reducing Cross-Task Interference in Multi-Task Low-Rank Adaptation](https://arxiv.org/abs/2504.07448).
|
11 |
|
12 |
+
**LoRI** (LoRA with Reduced Interference) is a simple yet effective approach that freezes the projection matrices $A$ as random projections and sparsifies the matrices $B$ using task-specific masks. This design substantially reduces the number of trainable parameters while maintaining strong task performance. Moreover, LoRI minimizes cross-task interference in adapter merging by leveraging the orthogonality between adapter subspaces, and supports continual learning by using sparsity to mitigate catastrophic forgetting.
|
|
|
13 |
|
14 |
+
<div align="center">
|
15 |
+
<img src="https://github.com/juzhengz/LoRI/raw/main/LoRI.png" alt="LoRI" width="80%">
|
16 |
+
</div>
|
17 |
|
18 |
## Model Details
|
19 |
|
20 |
### Model Description
|
21 |
|
22 |
+
LoRI-D_code_llama3_rank_64 is an adapter for the `meta-llama/Meta-Llama-3-8B` base model, fine-tuned using the LoRI (LoRA with Reduced Interference) framework specifically for code generation tasks. LoRI is a parameter-efficient fine-tuning (PEFT) method designed to address overhead and parameter interference in multi-task scenarios when using traditional LoRA. It achieves this by freezing projection matrices `A` as random projections and sparsifying matrices `B` with task-specific masks, significantly reducing trainable parameters while maintaining strong performance. This model utilizes a rank of 64 for its LoRA adaptations.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
+
- **Developed by:** Juzheng Zhang, Jiacheng You, Ashwinee Panda, Tom Goldstein
|
25 |
+
- **Model type:** Low-Rank Adaptation (LoRA) adapter for Causal Language Models
|
26 |
+
- **Language(s) (NLP):** English
|
27 |
+
- **License:** Apache-2.0
|
28 |
+
- **Finetuned from model:** `meta-llama/Meta-Llama-3-8B`
|
29 |
|
30 |
+
### Model Sources
|
31 |
|
32 |
+
- **Repository:** [https://github.com/juzhengz/LoRI/](https://github.com/juzhengz/LoRI/)
|
33 |
+
- **Paper:** [https://huggingface.co/papers/2504.07448](https://huggingface.co/papers/2504.07448)
|
34 |
+
- **Hugging Face Collection:** [LoRI Adapters](https://huggingface.co/collections/tomg-group-umd/lori-adapters-67f795549d792613e1290011)
|
35 |
|
36 |
## Uses
|
37 |
|
|
|
|
|
38 |
### Direct Use
|
39 |
|
40 |
+
This model is intended to be loaded as a PEFT adapter on top of the `meta-llama/Meta-Llama-3-8B` base model to enhance its performance on code generation tasks. It provides an efficient way to fine-tune large language models with significantly fewer trainable parameters.
|
|
|
|
|
|
|
|
|
41 |
|
42 |
+
### Downstream Use
|
43 |
|
44 |
+
LoRI adapters facilitate effective adapter merging and continual learning across various tasks, including natural language understanding, mathematical reasoning, code generation, and safety alignment. This makes them suitable for multi-task learning environments and adaptive model deployments.
|
45 |
|
46 |
### Out-of-Scope Use
|
47 |
|
48 |
+
This model is not intended for generating harmful, biased, or unethical content. Users should exercise caution and implement appropriate safeguards when deploying it in real-world applications, especially in sensitive domains.
|
|
|
|
|
49 |
|
50 |
## Bias, Risks, and Limitations
|
51 |
|
52 |
+
As an adaptation method built upon pre-trained Large Language Models, LoRI models inherit biases and risks present in their base models (e.g., Meta-Llama-3-8B) and the datasets they were fine-tuned on. Users should be aware of potential issues related to fairness, toxicity, and factual accuracy. Specific limitations include:
|
53 |
+
- Performance might vary depending on the chosen base model and the sparsity level.
|
54 |
+
- While LoRI significantly reduces cross-task interference, perfect isolation of knowledge across tasks is not guaranteed during adapter merging.
|
55 |
|
56 |
### Recommendations
|
57 |
|
58 |
+
Users (both direct and downstream) should refer to the original `meta-llama/Meta-Llama-3-8B` model card for inherent biases and risks. It is recommended to perform task-specific evaluations and careful validation when deploying models fine-tuned with LoRI in sensitive applications.
|
|
|
|
|
59 |
|
60 |
## How to Get Started with the Model
|
61 |
|
62 |
+
Pretrained LoRI adapters are available via the Hugging Face collection and can be loaded as follows:
|
63 |
|
64 |
+
```python
|
65 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
66 |
+
from peft import PeftModel
|
67 |
+
import torch
|
68 |
|
69 |
+
# Load the base model
|
70 |
+
base_model = AutoModelForCausalLM.from_pretrained(
|
71 |
+
"meta-llama/Meta-Llama-3-8B",
|
72 |
+
torch_dtype=torch.bfloat16,
|
73 |
+
device_map="auto" # or specify your device, e.g., "cuda"
|
74 |
+
)
|
75 |
|
76 |
+
# Load the LoRI adapter
|
77 |
+
adapter = PeftModel.from_pretrained(base_model, "tomg-group-umd/LoRI-D_code_llama3_rank_64")
|
|
|
78 |
|
79 |
+
# Load the tokenizer
|
80 |
+
tokenizer = AutoTokenizer.from_pretrained("meta-llama/Meta-Llama-3-8B")
|
81 |
|
82 |
+
# Example for text generation (code generation)
|
83 |
+
prompt = "def factorial(n):
|
84 |
+
if n == 0:
|
85 |
+
return 1
|
86 |
+
else:
|
87 |
+
"
|
88 |
+
inputs = tokenizer(prompt, return_tensors="pt").to(base_model.device)
|
89 |
|
90 |
+
# Generate text
|
91 |
+
with torch.no_grad():
|
92 |
+
outputs = adapter.generate(**inputs, max_new_tokens=50, temperature=0.7, do_sample=True)
|
93 |
|
94 |
+
generated_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
95 |
+
print(generated_text)
|
96 |
+
```
|
97 |
|
98 |
+
## Training Details
|
99 |
|
100 |
+
### Training Data
|
101 |
|
102 |
+
LoRI adapters were extensively evaluated and trained on various datasets relevant to specific tasks. For code generation tasks, like this model, the `CodeAlpaca` dataset was primarily used. Other tasks included:
|
103 |
+
- Mathematical reasoning: `GSM8K`
|
104 |
+
- Safety alignment: `Saferpaca`
|
105 |
+
- Natural language understanding: (specific datasets for NLU implied but not detailed in source)
|
106 |
|
107 |
+
### Training Procedure
|
108 |
|
109 |
+
LoRI is implemented using Fully Sharded Data Parallel (FSDP) and supports multi-GPU training environments. The training process involves two main stages:
|
110 |
+
1. **LoRI-D (Decomposition):** Initial training where projection matrices `A` are frozen as random projections, and matrices `B` are learned. This stage also extracts sparse masks.
|
111 |
+
2. **LoRI-S (Sparsity):** Continued training with the learned sparse masks (e.g., 90% sparsity) applied to matrices `B`, further reducing parameters and promoting orthogonality.
|
112 |
|
113 |
+
#### Training Hyperparameters
|
114 |
|
115 |
+
- **Adapter ranks:** Models were trained with adapter ranks of 32 and 64 (this model uses rank 64).
|
116 |
+
- **Sparsity:** 90% (for `LoRI-S` stage).
|
117 |
+
- **Base models used:** LLaMA-3-8B and Mistral-7B.
|
118 |
|
119 |
## Evaluation
|
120 |
|
121 |
+
Extensive experiments demonstrated that LoRI outperforms full fine-tuning and existing PEFT methods while using up to 95% fewer trainable parameters than standard LoRA. For code generation, performance was evaluated on the HumanEval benchmark. In multi-task experiments, LoRI enabled effective adapter merging and continual learning with reduced cross-task interference. Detailed evaluation results and comparisons can be found in the accompanying paper.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
|
123 |
+
## Acknowledgements
|
124 |
|
125 |
+
This project builds on the codebase of [dpo-rlaif](https://github.com/architsharma97/dpo-rlaif) and incorporates code from [lottery-ticket-adaptation](https://github.com/kiddyboots216/lottery-ticket-adaptation). Code generation performance on HumanEval is evaluated using the [bigcode-evaluation-harness](https://github.com/bigcode-project/bigcode-evaluation-harness).
|
126 |
|
127 |
+
## Citation
|
128 |
|
129 |
+
If you use LoRI in your work, please cite:
|
130 |
|
131 |
+
```bibtex
|
132 |
+
@article{zhang2025lori,
|
133 |
+
title={LoRI: Reducing Cross-Task Interference in Multi-Task Low-Rank Adaptation},
|
134 |
+
author={Zhang, Juzheng and You, Jiacheng and Panda, Ashwinee and Goldstein, Tom},
|
135 |
+
journal={arXiv preprint arXiv:2504.07448},
|
136 |
+
year={2025}
|
137 |
+
}
|
138 |
+
```
|
139 |
|
140 |
+
## Framework versions
|
|
|
141 |
|
142 |
- PEFT 0.12.0
|