Improve model card: add license, details, links, and usage
#1
by
nielsr
HF Staff
- opened
README.md
CHANGED
@@ -2,192 +2,145 @@
|
|
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-S_code_llama3_rank_32
|
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 |
-
|
24 |
-
-
|
25 |
-
-
|
26 |
-
-
|
27 |
-
-
|
28 |
-
- **License:** [More Information Needed]
|
29 |
-
- **Finetuned from model [optional]:** [More Information Needed]
|
30 |
-
|
31 |
-
### Model Sources [optional]
|
32 |
-
|
33 |
-
<!-- Provide the basic links for the model. -->
|
34 |
-
|
35 |
-
- **Repository:** [More Information Needed]
|
36 |
-
- **Paper [optional]:** [More Information Needed]
|
37 |
-
- **Demo [optional]:** [More Information Needed]
|
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 |
-
<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
|
52 |
-
|
53 |
-
[More Information Needed]
|
54 |
|
55 |
### Out-of-Scope Use
|
56 |
-
|
57 |
-
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
58 |
-
|
59 |
-
[More Information Needed]
|
60 |
|
61 |
## Bias, Risks, and Limitations
|
62 |
-
|
63 |
-
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
64 |
-
|
65 |
-
[More Information Needed]
|
66 |
|
67 |
### Recommendations
|
68 |
-
|
69 |
-
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
|
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 |
Use the code below to get started with the model.
|
76 |
|
77 |
-
|
|
|
|
|
78 |
|
79 |
-
|
|
|
80 |
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
|
85 |
-
|
|
|
86 |
|
87 |
-
|
|
|
|
|
|
|
|
|
88 |
|
89 |
-
|
90 |
|
91 |
-
|
|
|
92 |
|
93 |
-
|
|
|
|
|
|
|
94 |
|
|
|
95 |
|
96 |
#### Training Hyperparameters
|
|
|
|
|
|
|
97 |
|
98 |
-
|
99 |
-
|
100 |
-
#### Speeds, Sizes, Times [optional]
|
101 |
-
|
102 |
-
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
|
103 |
-
|
104 |
-
[More Information Needed]
|
105 |
|
106 |
## Evaluation
|
107 |
|
108 |
-
<!-- This section describes the evaluation protocols and provides the results. -->
|
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 |
-
|
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 |
-
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
169 |
|
170 |
**APA:**
|
|
|
171 |
|
172 |
-
|
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 |
-
## More Information [optional]
|
181 |
-
|
182 |
-
[More Information Needed]
|
183 |
-
|
184 |
-
## Model Card Authors [optional]
|
185 |
-
|
186 |
-
[More Information Needed]
|
187 |
|
188 |
## Model Card Contact
|
|
|
189 |
|
190 |
-
[More Information Needed]
|
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-S_code_llama3_rank_32
|
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 |
+
**Abstract:** Low-Rank Adaptation (LoRA) has emerged as a popular parameter-efficient fine-tuning (PEFT) method for Large Language Models (LLMs), yet it still incurs notable overhead and suffers from parameter interference in multi-task scenarios. We propose LoRA with Reduced Interference (LoRI), 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. Extensive experiments across natural language understanding, mathematical reasoning, code generation, and safety alignment tasks demonstrate that LoRI outperforms full fine-tuning and existing PEFT methods, while using up to 95% fewer trainable parameters than LoRA. In multi-task experiments, LoRI enables effective adapter merging and continual learning with reduced cross-task interference.
|
|
|
|
|
13 |
|
14 |
## Model Details
|
15 |
|
16 |
### Model Description
|
17 |
+
LoRI (LoRA with Reduced Interference) is a simple yet effective variant of Low-Rank Adaptation (LoRA) for fine-tuning Large Language Models (LLMs). It improves efficiency and performance by freezing projection matrices (`A`) as random projections and sparsifying matrices (`B`) using task-specific masks. This design significantly reduces trainable parameters while maintaining strong task performance. LoRI also minimizes cross-task interference in adapter merging and supports continual learning by mitigating catastrophic forgetting through sparsity.
|
18 |
|
19 |
+
- **Developed by:** Juzheng Zhang, Jiacheng You, Ashwinee Panda, Tom Goldstein
|
20 |
+
- **Shared by:** tomg-group-umd
|
21 |
+
- **Model type:** Parameter-Efficient Fine-Tuning (PEFT) adapter (LoRA variant)
|
22 |
+
- **Language(s) (NLP):** English
|
23 |
+
- **License:** Apache-2.0
|
24 |
+
- **Finetuned from model:** `meta-llama/Meta-Llama-3-8B`
|
25 |
|
26 |
+
### Model Sources
|
27 |
+
- **Repository:** https://github.com/juzhengz/LoRI/
|
28 |
+
- **Paper:** https://arxiv.org/abs/2504.07448
|
29 |
+
- **Project Page:** https://juzhengz.github.io/
|
30 |
+
- **Hugging Face Collection:** https://huggingface.co/collections/tomg-group-umd/lori-adapters-67f795549d792613e1290011
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
|
32 |
## Uses
|
33 |
|
|
|
|
|
34 |
### Direct Use
|
35 |
+
LoRI adapters can be directly loaded with a compatible base LLM (e.g., `meta-llama/Meta-Llama-3-8B`) using the `peft` library. This model, `LoRI-S_code_llama3_rank_32`, is specifically fine-tuned for code generation tasks. LoRI is designed for efficient fine-tuning across various tasks including natural language understanding, mathematical reasoning, code generation, and safety alignment, and supports effective adapter merging and continual learning.
|
36 |
|
37 |
+
### Downstream Use
|
38 |
+
LoRI can be integrated into larger AI systems and applications requiring efficient multi-task learning or continual adaptation of LLMs. Its reduced cross-task interference makes it suitable for complex scenarios where multiple capabilities are needed from a single adapter.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
|
40 |
### Out-of-Scope Use
|
41 |
+
This model is designed for text-based generation and understanding tasks, specifically in the context of code generation. Using it for tasks outside of its trained modalities, for applications requiring very high precision in domains not covered by its training data, or for generating harmful content is not recommended.
|
|
|
|
|
|
|
42 |
|
43 |
## Bias, Risks, and Limitations
|
44 |
+
As with any model finetuned from a large language model, this adapter may inherit biases present in its underlying training data (`meta-llama/Meta-Llama-3-8B`) and the specific finetuning datasets. While the LoRI paper mentions "safety alignment tasks", comprehensive evaluation for all potential risks is recommended.
|
|
|
|
|
|
|
45 |
|
46 |
### Recommendations
|
47 |
+
Users should be aware of the inherent biases and limitations of large language models. It is recommended to perform further evaluation in specific deployment contexts and to implement appropriate safeguards, especially in sensitive applications.
|
|
|
|
|
|
|
48 |
|
49 |
## How to Get Started with the Model
|
50 |
|
51 |
Use the code below to get started with the model.
|
52 |
|
53 |
+
```python
|
54 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
55 |
+
from peft import PeftModel
|
56 |
|
57 |
+
# Load the base model (e.g., Llama-3-8B)
|
58 |
+
base_model = AutoModelForCausalLM.from_pretrained("meta-llama/Meta-Llama-3-8B")
|
59 |
|
60 |
+
# Load the LoRI adapter on top of the base model
|
61 |
+
# This example loads the LoRI-S adapter for code generation, rank 32
|
62 |
+
adapter = PeftModel.from_pretrained(base_model, "tomg-group-umd/LoRI-S_code_llama3_rank_32")
|
63 |
|
64 |
+
# Load the tokenizer for the base model
|
65 |
+
tokenizer = AutoTokenizer.from_pretrained("meta-llama/Meta-Llama-3-8B")
|
66 |
|
67 |
+
# Example usage (for text generation with the adapted model)
|
68 |
+
# from transformers import pipeline
|
69 |
+
# generator = pipeline("text-generation", model=adapter, tokenizer=tokenizer)
|
70 |
+
# print(generator("def fibonacci(n):", max_new_tokens=50))
|
71 |
+
```
|
72 |
|
73 |
+
## Training Details
|
74 |
|
75 |
+
### Training Data
|
76 |
+
LoRI adapters are trained on various datasets relevant to different tasks. This specific adapter (`LoRI-S_code_llama3_rank_32`) was trained for code generation using the **CodeAlpaca dataset**. Other datasets mentioned in the paper/repo include GSM8K (mathematical reasoning) and SaferPaca (safety alignment).
|
77 |
|
78 |
+
### Training Procedure
|
79 |
+
LoRI employs a two-stage training procedure:
|
80 |
+
1. **LoRI-D (Discovery):** Initial training where projection matrices `A` are frozen as random projections, and matrices `B` are trained to discover task-specific masks.
|
81 |
+
2. **LoRI-S (Sparse):** Continues training using the sparse masks extracted from LoRI-D, typically with 90% sparsity, further reducing trainable parameters.
|
82 |
|
83 |
+
Training is implemented using [Fully Sharded Data Parallel (FSDP)](https://pytorch.org/tutorials/intermediate/FSDP_tutorial.html) to support multi-GPU environments.
|
84 |
|
85 |
#### Training Hyperparameters
|
86 |
+
- **Adapter Ranks:** 32 (for this model) and 64 (general for LoRI).
|
87 |
+
- **Sparsity:** Up to 90% in LoRI-S stage.
|
88 |
+
- **Training regime:** Mixed precision (e.g., fp16 or bf16).
|
89 |
|
90 |
+
#### Speeds, Sizes, Times
|
91 |
+
LoRI uses up to **95% fewer trainable parameters** than traditional LoRA while maintaining strong task performance.
|
|
|
|
|
|
|
|
|
|
|
92 |
|
93 |
## Evaluation
|
94 |
|
|
|
|
|
95 |
### Testing Data, Factors & Metrics
|
|
|
96 |
#### Testing Data
|
97 |
+
For code generation tasks, evaluation was performed on the **HumanEval** benchmark. LoRI was also evaluated across natural language understanding, mathematical reasoning, and safety alignment tasks on various datasets.
|
|
|
|
|
|
|
98 |
|
99 |
#### Factors
|
100 |
+
No specific disaggregated factors (e.g., subpopulations) were explicitly mentioned for evaluation in the provided context.
|
|
|
|
|
|
|
101 |
|
102 |
#### Metrics
|
103 |
+
For code generation, the primary metric is typically **pass@k**, which measures the percentage of generated code samples that pass unit tests for a given problem.
|
|
|
|
|
|
|
104 |
|
105 |
### Results
|
106 |
+
LoRI consistently outperforms full fine-tuning and existing PEFT methods, while using significantly fewer trainable parameters. It also demonstrates reduced cross-task interference in adapter merging and improved resistance to catastrophic forgetting in continual learning. For detailed quantitative results, please refer to the [paper](https://arxiv.org/abs/2504.07448).
|
107 |
|
108 |
+
## Technical Specifications
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
|
110 |
### Model Architecture and Objective
|
111 |
+
LoRI modifies the standard LoRA architecture by freezing the projection matrices `A` as random projections and sparsifying the matrices `B` using task-specific masks. This design aims to achieve substantial reduction in trainable parameters, minimize cross-task interference between different adaptations, and support continual learning by mitigating catastrophic forgetting.
|
|
|
112 |
|
113 |
### Compute Infrastructure
|
|
|
|
|
|
|
114 |
#### Hardware
|
115 |
+
Training and inference are supported on multi-GPU environments, leveraging technologies like FSDP.
|
|
|
116 |
|
117 |
#### Software
|
118 |
+
The project builds on `PyTorch`, `transformers`, and `peft`.
|
119 |
|
120 |
+
## Citation
|
121 |
+
If you use LoRI in your work, please cite:
|
|
|
|
|
|
|
122 |
|
123 |
**BibTeX:**
|
124 |
+
```bibtex
|
125 |
+
@article{zhang2025lori,
|
126 |
+
title={LoRI: Reducing Cross-Task Interference in Multi-Task Low-Rank Adaptation},
|
127 |
+
author={Zhang, Juzheng and You, Jiacheng and Panda, Ashwinee and Goldstein, Tom},
|
128 |
+
journal={arXiv preprint arXiv:2504.07448},
|
129 |
+
year={2025}
|
130 |
+
}
|
131 |
+
```
|
132 |
|
133 |
**APA:**
|
134 |
+
Zhang, J., You, J., Panda, A., & Goldstein, T. (2025). LoRI: Reducing Cross-Task Interference in Multi-Task Low-Rank Adaptation. *arXiv preprint arXiv:2504.07448*.
|
135 |
|
136 |
+
## Model Card Authors
|
137 |
+
Niels Drost (huggingface.co/nielsr)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
|
139 |
## Model Card Contact
|
140 | |
141 |
|
|
|
142 |
### Framework versions
|
143 |
|
144 |
+
- PEFT 0.12.0
|
145 |
+
- Transformers (compatible with recent versions)
|
146 |
+
- PyTorch (compatible with recent versions)
|