nielsr HF Staff commited on
Commit
cdf190c
·
verified ·
1 Parent(s): 57d18ae

Improve model card: Add license, tags, paper, code, project page, and usage example

Browse files

This PR significantly enhances the model card for `LoRI-S_nlu_llama3_rank_32` by:

- Adding the `license: apache-2.0` to the metadata.
- Including relevant `tags` such as `lora`, `peft`, `nlu`, `code-generation`, `mathematical-reasoning`, `safety-alignment`, and `multi-task-learning` to improve discoverability.
- Updating the main paper link to the Hugging Face Papers page (`https://huggingface.co/papers/2504.07448`).
- Providing a comprehensive description of the LoRI model, its features, and how it addresses cross-task interference.
- Adding direct links to the official GitHub repository (`https://github.com/juzhengz/LoRI/`) and the project page (`https://juzhengz.github.io/`).
- Including a clear Python code snippet for quick inference, making it easier for users to get started.
- Populating various sections such as `Model Details`, `Uses`, `Bias, Risks, and Limitations`, `Training Details`, and `Evaluation` with information extracted from the paper abstract and the GitHub repository's README.
- Adding the academic citation for the paper.
- Embedding an illustrative image from the GitHub repository.

These improvements make the model card much more informative, discoverable, and user-friendly for researchers and practitioners.

Files changed (1) hide show
  1. README.md +114 -117
README.md CHANGED
@@ -2,192 +2,189 @@
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_nlu_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
- <!-- Provide a quick summary of what the model is/does. -->
12
 
 
 
 
13
 
 
 
 
14
 
15
  ## Model Details
16
 
17
  ### Model Description
18
 
19
- <!-- Provide a longer summary of what this model is. -->
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
- ### 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
- <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
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
- [More Information Needed]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
 
79
  ## Training Details
80
 
81
  ### Training Data
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
- [More Information Needed]
86
 
87
  ### Training Procedure
88
 
89
- <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
90
-
91
- #### Preprocessing [optional]
92
-
93
- [More Information Needed]
94
-
95
 
96
  #### Training Hyperparameters
97
 
98
- - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
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
- [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
- ## 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
+ tags:
7
+ - lora
8
+ - peft
9
+ - nlu
10
+ - code-generation
11
+ - mathematical-reasoning
12
+ - safety-alignment
13
+ - multi-task-learning
14
  ---
15
 
16
  # Model Card for LoRI-S_nlu_llama3_rank_32
17
 
18
+ This model is part of [LoRI: Reducing Cross-Task Interference in Multi-Task Low-Rank Adaptation](https://huggingface.co/papers/2504.07448).
19
 
20
+ LoRI (LoRA with Reduced Interference) is a simple yet effective variant of LoRA for fine-tuning Large Language Models (LLMs). It addresses notable overhead and parameter interference in multi-task scenarios by freezing the projection matrices `A` as random projections and sparsifying the matrices `B` using task-specific masks. This design substantially reduces the number of trainable parameters while maintaining strong task performance.
21
 
22
+ <div align="center">
23
+ <img src="https://github.com/juzhengz/LoRI/raw/main/LoRI.png" alt="LoRI" width="80%">
24
+ </div>
25
 
26
+ ## Abstract
27
+
28
+ 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. Code is available at: this https URL
29
 
30
  ## Model Details
31
 
32
  ### Model Description
33
 
34
+ 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. This particular model, `LoRI-S_nlu_llama3_rank_32`, is an adapter fine-tuned for Natural Language Understanding (NLU) tasks, based on the Llama-3-8B model with an adapter rank of 32. It is an "LoRI-S" (Sparsified) adapter, indicating it has undergone an additional sparsity-inducing training stage after initial LoRI-D training.
 
 
35
 
36
+ - **Developed by:** Juzheng Zhang, Jiacheng You, Ashwinee Panda, Tom Goldstein
37
+ - **Model type:** Low-Rank Adaptation (LoRA) variant, Parameter-Efficient Fine-Tuning (PEFT) method for Causal Language Models
38
+ - **Language(s) (NLP):** English
39
+ - **License:** Apache 2.0
40
+ - **Finetuned from model:** `meta-llama/Meta-Llama-3-8B`
 
 
41
 
42
+ ### Model Sources
43
 
44
+ - **Repository:** [https://github.com/juzhengz/LoRI/](https://github.com/juzhengz/LoRI/)
45
+ - **Paper:** [https://huggingface.co/papers/2504.07448](https://huggingface.co/papers/2504.07448) ([arXiv:2504.07448](https://arxiv.org/abs/2504.07448))
46
+ - **Project Page:** [https://juzhengz.github.io/](https://juzhengz.github.io/)
47
+ - **Hugging Face Collection:** [https://huggingface.co/collections/tomg-group-umd/lori-adapters-67f795549d792613e1290011](https://huggingface.co/collections/tomg-group-umd/lori-adapters-67f795549d792613e1290011)
 
48
 
49
  ## Uses
50
 
 
 
51
  ### Direct Use
52
 
53
+ This model is intended to be used as a PEFT adapter for the `meta-llama/Meta-Llama-3-8B` base model to enhance its performance on Natural Language Understanding tasks. It allows for efficient fine-tuning and deployment of large language models without modifying the original base model's weights.
 
 
54
 
55
+ ### Downstream Use
56
 
57
+ LoRI adapters are designed to minimize cross-task interference, enabling effective adapter merging for multi-task scenarios and supporting continual learning by mitigating catastrophic forgetting. This makes them suitable for a wide range of downstream applications across NLU, code generation, mathematical reasoning, and safety alignment.
 
 
58
 
59
  ### Out-of-Scope Use
60
 
61
+ As an adapter, this model is not intended for standalone use; it requires a compatible base language model (e.g., `meta-llama/Meta-Llama-3-8B`). Users should also be mindful of the ethical implications and potential biases inherited from the base model and training data when deploying in sensitive applications.
 
 
62
 
63
  ## Bias, Risks, and Limitations
64
 
65
+ LoRI, like any LLM or PEFT method, may inherit biases present in its foundational `Meta-Llama-3-8B` model and the datasets it was fine-tuned on. While LoRI is designed to reduce cross-task interference and mitigate catastrophic forgetting, these are complex challenges in AI, and complete elimination cannot be guaranteed, especially in highly diverse or long-term continual learning scenarios.
 
 
66
 
67
  ### Recommendations
68
 
69
+ Users should perform thorough evaluations for their specific use cases to identify and mitigate potential biases. Continuous monitoring for performance degradation or unintended behaviors is advised, particularly in critical applications. It is recommended to consult the original paper for detailed experimental results and discussions on limitations.
 
 
70
 
71
  ## How to Get Started with the Model
72
 
73
+ Use the code below to get started with the model using the `transformers` and `peft` libraries. This example demonstrates loading the `LoRI-S_nlu_llama3_rank_32` adapter and performing basic text generation.
74
+
75
+ ```python
76
+ from transformers import AutoModelForCausalLM, AutoTokenizer
77
+ from peft import PeftModel
78
+ import torch
79
+
80
+ # Load the base model
81
+ base_model_name = "meta-llama/Meta-Llama-3-8B"
82
+ base_model = AutoModelForCausalLM.from_pretrained(
83
+ base_model_name,
84
+ torch_dtype=torch.bfloat16, # or torch.float16, depending on your hardware
85
+ device_map="auto"
86
+ )
87
+
88
+ # Load the LoRI adapter
89
+ adapter_name = "tomg-group-umd/LoRI-S_nlu_llama3_rank_32" # This specific model
90
+ model = PeftModel.from_pretrained(base_model, adapter_name)
91
+
92
+ # Load the tokenizer
93
+ tokenizer = AutoTokenizer.from_pretrained(base_model_name)
94
+
95
+ # Example inference for text generation
96
+ prompt = "The capital of France is"
97
+ inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
98
+
99
+ output_ids = model.generate(**inputs, max_new_tokens=20, temperature=0.7)
100
+ output_text = tokenizer.decode(output_ids[0], skip_special_tokens=True)
101
+ print(output_text)
102
+
103
+ # Example for chat completion (if the base model supports chat templates)
104
+ # messages = [
105
+ # {"role": "user", "content": "Explain the concept of quantum entanglement."},
106
+ # ]
107
+ # text = tokenizer.apply_chat_template(
108
+ # messages,
109
+ # tokenize=False,
110
+ # add_generation_prompt=True
111
+ # )
112
+ # inputs = tokenizer(text, return_tensors="pt").to(model.device)
113
+ # output_ids = model.generate(**inputs, max_new_tokens=100, temperature=0.7)
114
+ # output_text = tokenizer.decode(output_ids[0], skip_special_tokens=True)
115
+ # print(output_text)
116
+ ```
117
 
118
  ## Training Details
119
 
120
  ### Training Data
121
 
122
+ LoRI models were extensively evaluated across various domains and tasks. For the "LoRI-S_nlu_llama3_rank_32" adapter, it was fine-tuned for Natural Language Understanding (NLU) tasks. Other LoRI adapters in the collection were trained for:
123
+ - **Code Generation:** Using datasets like CodeAlpaca.
124
+ - **Mathematical Reasoning:** Using datasets like GSM8K.
125
+ - **Safety Alignment:** Using datasets like Saferpaca.
126
 
127
+ Further details on specific datasets used for NLU tasks can be found in the [original paper](https://arxiv.org/abs/2504.07448) and the [LoRI GitHub repository](https://github.com/juzhengz/LoRI/).
128
 
129
  ### Training Procedure
130
 
131
+ LoRI training involves a two-stage process implemented using Fully Sharded Data Parallel (FSDP) for multi-GPU environments:
132
+ 1. **LoRI-D (Density/Distribution) training:** Initial training where the projection matrices `A` are frozen as random projections.
133
+ 2. **LoRI-S (Sparsification) training:** Continues training from the `LoRI-D` stage, where matrix `B` is sparsified using task-specific masks, typically at 90% sparsity.
 
 
 
134
 
135
  #### Training Hyperparameters
136
 
137
+ - **Base Models:** LLaMA-3-8B and Mistral-7B were used across experiments.
138
+ - **Adapter Ranks (`r`):** 32 (for this model) and 64.
139
+ - **LoRA Alpha (`lora_alpha`):** 64 (from `adapter_config.json`).
140
+ - **LoRA Dropout (`lora_dropout`):** 0.05 (from `adapter_config.json`).
141
+ - **Sparsity:** Typically 90% for LoRI-S adapters.
142
+ - **Training regime:** Mixed precision (e.g., `bf16`).
 
143
 
144
  ## Evaluation
145
 
 
 
146
  ### Testing Data, Factors & Metrics
147
 
148
+ LoRI was evaluated across natural language understanding, mathematical reasoning, code generation (e.g., HumanEval), and safety alignment tasks. The paper presents comprehensive results comparing LoRI against full fine-tuning and other PEFT methods.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
149
 
150
  ### Results
151
 
152
+ Extensive experiments demonstrate that LoRI outperforms full fine-tuning and existing PEFT methods, while using up to 95% fewer trainable parameters than standard LoRA. In multi-task experiments, LoRI enables effective adapter merging and continual learning with reduced cross-task interference. For detailed quantitative results, please refer to the [official paper](https://huggingface.co/papers/2504.07448).
 
 
 
 
153
 
154
+ ## Technical Specifications
 
 
 
 
 
 
155
 
156
  ### Model Architecture and Objective
157
 
158
+ LoRI modifies the standard LoRA architecture. The `A` matrices are frozen as random projections, and the `B` matrices are sparsified using task-specific masks. This design aims to promote monosemanticity (where adapters specialize in specific knowledge) and reduce interference between different adapters, especially in multi-task and continual learning settings. The objective remains to efficiently fine-tune the LLM for various downstream tasks.
159
 
160
  ### Compute Infrastructure
161
 
162
+ The training scripts are designed to leverage multi-GPU setups using PyTorch's Fully Sharded Data Parallel (FSDP) for efficient distributed training.
 
 
 
 
163
 
164
  #### Software
165
 
166
+ - Python 3.10
167
+ - PyTorch
168
+ - Transformers library
169
+ - PEFT library (version `0.12.0`)
170
 
171
+ ## Citation
172
 
173
+ If you use LoRI in your work, please cite:
174
 
175
+ ```bibtex
176
+ @article{zhang2025lori,
177
+ title={LoRI: Reducing Cross-Task Interference in Multi-Task Low-Rank Adaptation},
178
+ author={Zhang, Juzheng and You, Jiacheng and Panda, Ashwinee and Goldstein, Tom},
179
+ journal={arXiv preprint arXiv:2504.07448},
180
+ year={2025}
181
+ }
182
+ ```
 
 
 
 
 
 
 
 
 
 
 
 
 
183
 
184
  ## Model Card Contact
185
 
186
+ For questions, feel free to reach out via the [LoRI GitHub repository](https://github.com/juzhengz/LoRI/) or contact the authors of the paper.
187
+
188
  ### Framework versions
189
 
190
+ - PEFT 0.12.0