PEFT
Safetensors
English
jacobfulano commited on
Commit
dc9f82d
1 Parent(s): 0304451

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +172 -154
README.md CHANGED
@@ -1,77 +1,72 @@
1
  ---
2
- base_model: meta-llama/Llama-2-7b-hf
3
  library_name: peft
 
 
 
 
 
 
 
 
 
4
  ---
5
 
6
- # Model Card for Model ID
7
 
8
- <!-- Provide a quick summary of what the model is/does. -->
9
 
 
10
 
11
 
12
  ## Model Details
13
 
14
- ### Model Description
15
 
16
- <!-- Provide a longer summary of what this model is. -->
 
 
 
 
 
 
17
 
18
 
 
 
 
 
 
 
19
 
20
- - **Developed by:** [More Information Needed]
21
- - **Funded by [optional]:** [More Information Needed]
22
- - **Shared by [optional]:** [More Information Needed]
23
- - **Model type:** [More Information Needed]
24
- - **Language(s) (NLP):** [More Information Needed]
25
- - **License:** [More Information Needed]
26
- - **Finetuned from model [optional]:** [More Information Needed]
27
 
28
- ### Model Sources [optional]
29
 
30
  <!-- Provide the basic links for the model. -->
31
 
32
- - **Repository:** [More Information Needed]
33
- - **Paper [optional]:** [More Information Needed]
34
- - **Demo [optional]:** [More Information Needed]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
 
36
  ## Uses
37
 
38
  <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
 
39
 
40
- ### Direct Use
41
-
42
- <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
43
-
44
- [More Information Needed]
45
-
46
- ### Downstream Use [optional]
47
-
48
- <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
49
-
50
- [More Information Needed]
51
-
52
- ### Out-of-Scope Use
53
-
54
- <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
55
-
56
- [More Information Needed]
57
-
58
- ## Bias, Risks, and Limitations
59
-
60
- <!-- This section is meant to convey both technical and sociotechnical limitations. -->
61
-
62
- [More Information Needed]
63
-
64
- ### Recommendations
65
-
66
- <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
67
-
68
- Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
69
-
70
- ## How to Get Started with the Model
71
-
72
- Use the code below to get started with the model.
73
-
74
- [More Information Needed]
75
 
76
  ## Training Details
77
 
@@ -79,124 +74,147 @@ Use the code below to get started with the model.
79
 
80
  <!-- 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. -->
81
 
82
- [More Information Needed]
83
-
84
- ### Training Procedure
85
-
86
- <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
87
-
88
- #### Preprocessing [optional]
89
-
90
- [More Information Needed]
91
-
92
 
93
- #### Training Hyperparameters
 
 
 
 
 
94
 
95
- - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
96
 
97
- #### Speeds, Sizes, Times [optional]
98
 
99
- <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
100
 
101
- [More Information Needed]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
102
 
103
  ## Evaluation
104
 
105
- <!-- This section describes the evaluation protocols and provides the results. -->
106
-
107
- ### Testing Data, Factors & Metrics
108
-
109
- #### Testing Data
110
-
111
- <!-- This should link to a Dataset Card if possible. -->
112
-
113
- [More Information Needed]
114
-
115
- #### Factors
116
-
117
- <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
118
 
119
- [More Information Needed]
120
 
121
- #### Metrics
122
-
123
- <!-- These are the evaluation metrics being used, ideally with a description of why. -->
124
-
125
- [More Information Needed]
126
-
127
- ### Results
128
-
129
- [More Information Needed]
130
-
131
- #### Summary
132
-
133
-
134
-
135
- ## Model Examination [optional]
136
-
137
- <!-- Relevant interpretability work for the model goes here -->
138
-
139
- [More Information Needed]
140
-
141
- ## Environmental Impact
142
-
143
- <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
144
-
145
- Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
146
-
147
- - **Hardware Type:** [More Information Needed]
148
- - **Hours used:** [More Information Needed]
149
- - **Cloud Provider:** [More Information Needed]
150
- - **Compute Region:** [More Information Needed]
151
- - **Carbon Emitted:** [More Information Needed]
152
-
153
- ## Technical Specifications [optional]
154
-
155
- ### Model Architecture and Objective
156
-
157
- [More Information Needed]
158
-
159
- ### Compute Infrastructure
160
-
161
- [More Information Needed]
162
-
163
- #### Hardware
164
-
165
- [More Information Needed]
166
-
167
- #### Software
168
-
169
- [More Information Needed]
170
-
171
- ## Citation [optional]
172
-
173
- <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
174
 
175
  **BibTeX:**
176
 
177
- [More Information Needed]
178
-
179
- **APA:**
180
-
181
- [More Information Needed]
182
-
183
- ## Glossary [optional]
184
-
185
- <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
186
-
187
- [More Information Needed]
188
-
189
- ## More Information [optional]
190
-
191
- [More Information Needed]
192
-
193
- ## Model Card Authors [optional]
194
-
195
- [More Information Needed]
196
 
197
- ## Model Card Contact
198
 
199
- [More Information Needed]
200
  ### Framework versions
201
 
202
  - PEFT 0.11.1
 
1
  ---
 
2
  library_name: peft
3
+ base_model: meta-llama/Llama-2-7b-hf
4
+ license: cc-by-nc-4.0
5
+ datasets:
6
+ - meta-math/MetaMathQA
7
+ - open-web-math/open-web-math
8
+ - bigcode/starcoderdata
9
+ - ise-uiuc/Magicoder-Evol-Instruct-110K
10
+ language:
11
+ - en
12
  ---
13
 
14
+ # LoRA Learns Less and Forgets Less
15
 
 
16
 
17
+ These are model checkpoints and LoRA adapters from the research paper ["LoRA Learns Less and Forgets Less"](https://arxiv.org/abs/2405.09673) (Biderman et al. TMLR, 2024). This work was done in collaboration with [Databricks Mosaic AI Research](https://www.databricks.com/research/mosaic).
18
 
19
 
20
  ## Model Details
21
 
 
22
 
23
+ - **Developed by:** Databricks Mosaic AI
24
+ - **Model type:** Research Artifacts
25
+ - **Language(s) (NLP):** English
26
+ - **License:** cc-by-nc-4.0
27
+ - **Finetuned from model:** Llama-2-7b
28
+
29
+ We trained [Llama-2-7B](https://huggingface.co/meta-llama/Llama-2-7b-hf) using full finetuning and LoRA. Model checkpoints and LoRA adapters can be found on HuggingFace here: [LoRA-TMLR-2024](https://huggingface.co/LoRA-TMLR-2024). Intermediate checkpoints can be found in the branches of the respective models.
30
 
31
 
32
+ | Setting | Dataset | HuggingFace Collection |
33
+ | --------| ------| ------ |
34
+ | Continued Pretraining - Code | [StarCoder-Python](https://huggingface.co/datasets/bigcode/starcoderdata) | [LoRA-TMLR-2024/continued-pretraining-code-starcoder-python](https://huggingface.co/collections/LoRA-TMLR-2024/continued-pretraining-code-starcoder-python-66f22ce3b26f416f21f58142) |
35
+ | Continued Pretraing - Math | [OpenWebMath](https://huggingface.co/datasets/open-web-math/open-web-math) | [LoRA-TMLR-2024/continued-pretraining-math-openwebmath](https://huggingface.co/collections/LoRA-TMLR-2024/continued-pretraining-math-openwebmath-66f31d12f55fb27de05b2e3f) |
36
+ | Instruction Finetuning - Code | [Magicoder-Evol-Instruct-110K](https://huggingface.co/datasets/ise-uiuc/Magicoder-Evol-Instruct-110K)| [LoRA-TMLR-2024/instruction-finetuning-code-magicoder-evol-instruct-110k](https://huggingface.co/collections/LoRA-TMLR-2024/instruction-finetuning-code-magicoder-evol-instruct-110k-66f224a800152f31e4942a3b) |
37
+ | Instruction Finetuning - Math | [MetaMathQA](https://huggingface.co/datasets/meta-math/MetaMathQA) | [LoRA-TMLR-2024/instruction-finetuning-math-metamathqa](https://huggingface.co/collections/LoRA-TMLR-2024/instruction-finetuning-math-metamathqa-66f31cc40fda6b6b938d33e2) |
38
 
39
+ All training was done using the Databricks MosaicML
40
+ [composer](https://github.com/mosaicml/composer), [streaming](https://github.com/mosaicml/streaming), and [llm-foundry](https://github.com/mosaicml/llm-foundry) repositories, as well as the HuggingFace [peft](https://huggingface.co/docs/peft/en/index) library.
 
 
 
 
 
41
 
42
+ ### Model Sources
43
 
44
  <!-- Provide the basic links for the model. -->
45
 
46
+ - **Repository:** [https://github.com/danbider/lora-tradeoffs](https://github.com/danbider/lora-tradeoffs)
47
+ - **Paper:** [LoRA Learns Less and Forgets Less](https://arxiv.org/abs/2405.09673)
48
+
49
+ ### Abstract
50
+
51
+ Low-Rank Adaptation (LoRA) is a widely-used parameter-efficient finetuning method for
52
+ large language models. LoRA saves memory by training only low rank perturbations to
53
+ selected weight matrices. In this work, we compare the performance of LoRA and full
54
+ finetuning on two target domains, programming and mathematics. We consider both the
55
+ instruction finetuning (≈100K prompt-response pairs) and continued pretraining (≈20B
56
+ unstructured tokens) data regimes. Our results show that, in the standard low-rank settings,
57
+ LoRA substantially underperforms full finetuning. Nevertheless, LoRA better maintains the
58
+ base model’s performance on tasks outside the target domain. We show that LoRA mitigates
59
+ forgetting more than common regularization techniques such as weight decay and dropout;
60
+ it also helps maintain more diverse generations. Finally, we show that full finetuning learns
61
+ perturbations with a rank that is 10-100× greater than typical LoRA configurations, possibly
62
+ explaining some of the reported gaps. We conclude by proposing best practices for finetuning
63
+ with LoRA.
64
 
65
  ## Uses
66
 
67
  <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
68
+ These are research artifacts that are intended for research purposes only.
69
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
 
71
  ## Training Details
72
 
 
74
 
75
  <!-- 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. -->
76
 
77
+ The following datasets were used:
 
 
 
 
 
 
 
 
 
78
 
79
+ | Setting | Dataset |
80
+ | --------| ------|
81
+ | Continued Pretraining - Code | [StarCoder-Python](https://huggingface.co/datasets/bigcode/starcoderdata) |
82
+ | Continued Pretraing - Math | [OpenWebMath](https://huggingface.co/datasets/open-web-math/open-web-math) |
83
+ | Instruction Finetuning - Code | [Magicoder-Evol-Instruct-110K](https://huggingface.co/datasets/ise-uiuc/Magicoder-Evol-Instruct-110K)|
84
+ | Instruction Finetuning - Math | [MetaMathQA](https://huggingface.co/datasets/meta-math/MetaMathQA) |
85
 
 
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
+ In all four scenarios below, we use the Llama-2-7B base model [meta-llama/Llama-2-7b-hf](https://huggingface.co/meta-llama/Llama-2-7b-hf). For
92
+ the CPT runs, we use the [meta-llama/Llama-2-7b-hf](https://huggingface.co/meta-llama/Llama-2-7b-hf) tokenizer, while for the IFT runs we use the
93
+ [meta-llama/Llama-2-7b-chat-hf](https://huggingface.co/meta-llama/Llama-2-7b-chat-hf) tokenizer.
94
+
95
+
96
+ ## Code CPT (StarCoder-Python)
97
+
98
+ [StarCoder-Python](https://huggingface.co/datasets/bigcode/starcoderdata) (Li et al., 2023a) This dataset consists of permissively licensed repositories from GitHub, including Git commits, in 80+ programming languages. We chose the Python
99
+ subset and sub-sampled it to 20B tokens.
100
+
101
+ | Parameter | Value |
102
+ |------------------------------|-----------------------------------------------------------------------------------------|
103
+ | seq_len | 4096 |
104
+ | optimizer | decoupled_lionw (betas=[0.9, 0.95]) |
105
+ | learning_rate | 1.0e-05 for LoRA and Full Finetuning |
106
+ | scheduler | inv_sqrt_with_warmup (t_scale=1000ba, t_warmup=1000ba, t_cooldown=5086ba, alpha_f_decay=1, alpha_f_cooldown=0) |
107
+ | weight_decay | 1.0e-06 |
108
+ | precision | amp_bf16 |
109
+ | global_train_batch_size | 192 |
110
+ | device_train_microbatch_size | 6 |
111
+ | gradient_clipping | norm (threshold=1) |
112
+ | num_gpus | 32 |
113
+
114
+ We trained models for 0.25B, 0.5B, 1B, 2B, 4B, 8B, 16B and 20B tokens. These checkpoints can be found for each LoRA and full finetuning setting in the HuggingFace model branches.
115
+
116
+ ## Math CPT (OpenWebMath)
117
+
118
+ [OpenWebMath](https://huggingface.co/datasets/open-web-math/open-web-math) (Paster et al., 2023) - This dataset contains 14.7B tokens derived from mathematical web pages from Common Crawl, correctly formatted to preserve mathematical content such as LaTeX equations. To match with the StarCoder-Python dataset, we trained on up to 20B tokens, repeating tokens beyond the first 14.7B. An analysis of this dataset shows that it contains a considerable amount of full English sentences.
119
+
120
+ | Parameter | Value |
121
+ |------------------------------|-----------------------------------------------------------------------------------------|
122
+ | max_seq_len | 4096 |
123
+ | optimizer | decoupled_lionw (betas=[0.9, 0.95]) |
124
+ | learning_rate | 1.0e-05 for full finetuning, 4.0e-05 for LoRA |
125
+ | scheduler | inv_sqrt_with_warmup (t_scale=1000ba, t_warmup=1000ba, t_cooldown=5086ba, alpha_f_decay=1, alpha_f_cooldown=0) |
126
+ | weight_decay | 0 |
127
+ | precision | amp_bf16 |
128
+ | global_train_batch_size | 192 |
129
+ | device_train_microbatch_size | 6 |
130
+ | gradient_clipping | norm (threshold=1) |
131
+ | num_gpus | 32 |
132
+
133
+
134
+ We trained models for 0.25B, 0.5B, 1B, 2B, 4B, 8B, 16B and 20B tokens. These checkpoints can be found for each LoRA and full finetuning setting in the HuggingFace model branches.
135
+
136
+ ## Code IFT (Magicoder-Evol-Instruct-110K)
137
+
138
+ [Magicoder-Evol-Instruct-110K](https://huggingface.co/datasets/ise-uiuc/Magicoder-Evol-Instruct-110K) (Wei et al., 2023) This dataset contains 72.97M tokens
139
+ of programming questions and answers. It reproduces the “Evol-Instruct” dataset of WizardCoder (Luo et al., 2023b) by iteratively prompting an LLM (GPT-4) to increase the difficulty of a set of question-answer pairs
140
+ from Code Alpaca (Chaudhary, 2023).
141
+
142
+ | Parameter | Value |
143
+ |------------------------------|-----------------------------------------------------------------------------------------|
144
+ | max_seq_len | 4096 |
145
+ | optimizer | decoupled_lionw (betas=[0.9, 0.95]) |
146
+ | learning_rate | 5e-5 for full finetuning; 2e-4 for rank r = 16, 64 and 1e-4 for r = 256 α = 2r = 512 (due to instabilities/loss spikes at 2e-4) |
147
+ | scheduler | cosine_with_warmup (alpha_f=0.01, t_warmup=0.1dur) |
148
+ | weight_decay | 0 |
149
+ | precision | amp_bf16 |
150
+ | global_train_batch_size | 192 |
151
+ | device_train_microbatch_size | 6 |
152
+ | gradient_clipping | norm (threshold=1) |
153
+ | num_gpus | 32 |
154
+
155
+ Each model was finetuned separately for 1, 2, 4, 8 and 16 epochs.
156
+
157
+ | Epoch | Number of Batches | Estimated Tokens |
158
+ | -------- | ---------- | ----------------|
159
+ | 1 | 193 | 72,970,000 |
160
+ | 2 | 386 | 145,940,000 |
161
+ | 4 | 772 | 291,880,000 |
162
+ | 8 | 1544 | 583,760,000 |
163
+ | 16 | 3088 | 1,167,520,000 |
164
+
165
+ ## Math IFT (MetaMathQA)
166
+
167
+ [MetaMathQA](https://huggingface.co/datasets/meta-math/MetaMathQA) (Yu et al., 2023) This dataset was built by bootstrapping mathematical
168
+ word problems from the training sets of GSM8K (Cobbe et al., 2021) and MATH (Hendrycks et al., 2021) by
169
+ rewriting the questions with variations using GPT-3.5. This dataset contains 395K question-answer pairs and
170
+ roughly 103M tokens.
171
+
172
+ | Parameter | Value |
173
+ |------------------------------|-----------------------------------------------------------------------------------------|
174
+ | seq_len | 1024 |
175
+ | optimizer | decoupled_lionw (betas=[0.9, 0.95]) |
176
+ | learning_rate | Full finetuning: 1e-5, LoRA: 1e-4 for r = 16, 64, 5e-5 for r = 256 due to instabilities |
177
+ | scheduler | cosine_with_warmup (alpha_f=0.01, t_warmup=0.1dur) |
178
+ | weight_decay | 0 |
179
+ | precision | amp_bf16 |
180
+ | global_train_batch_size | 768 |
181
+ | device_train_microbatch_size | 24 |
182
+ | gradient_clipping | norm (threshold=1) |
183
+ | num_gpus | 32 |
184
+
185
+ Each model was finetuned separately for 1, 2, 4, 8 and 16 epochs.
186
+
187
+ | Epoch | Estimated Tokens |
188
+ | -------- | ----------------|
189
+ | 1 | 103,000,000 |
190
+ | 2 | 206,000,000 |
191
+ | 4 | 412,000,000 |
192
+ | 8 | 824,000,000 |
193
+ | 16 | 1,648,000,000 |
194
 
195
  ## Evaluation
196
 
197
+ Model performance can be found in the paper [LoRA Learns Less and Forgets Less](https://arxiv.org/pdf/2405.09673). See Appendix for relevant tables.
 
 
 
 
 
 
 
 
 
 
 
 
198
 
 
199
 
200
+ ## Citation
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
201
 
202
  **BibTeX:**
203
 
204
+ ```
205
+ @article{
206
+ biderman2024lora,
207
+ title={Lo{RA} Learns Less and Forgets Less},
208
+ author={Dan Biderman and Jacob Portes and Jose Javier Gonzalez Ortiz and Mansheej Paul and Philip Greengard and Connor Jennings and Daniel King and Sam Havens and Vitaliy Chiley and Jonathan Frankle and Cody Blakeney and John Patrick Cunningham},
209
+ journal={Transactions on Machine Learning Research},
210
+ issn={2835-8856},
211
+ year={2024},
212
+ url={https://openreview.net/forum?id=aloEru2qCG},
213
+ note={Featured Certification}
214
+ }
215
+ ```
 
 
 
 
 
 
 
216
 
 
217
 
 
218
  ### Framework versions
219
 
220
  - PEFT 0.11.1