yuvraj17 commited on
Commit
c1c4a11
1 Parent(s): 158dfb9

Update README.md

Browse files

added Model-Description

Files changed (1) hide show
  1. README.md +15 -243
README.md CHANGED
@@ -5,6 +5,8 @@ base_model: meta-llama/Meta-Llama-3-8B-Instruct
5
  tags:
6
  - axolotl
7
  - generated_from_trainer
 
 
8
  model-index:
9
  - name: Llama-3-8B-spectrum-25
10
  results: []
@@ -13,194 +15,23 @@ model-index:
13
  <!-- This model card has been generated automatically according to the information the Trainer had access to. You
14
  should probably proofread and complete it, then remove this comment. -->
15
 
16
- [<img src="https://raw.githubusercontent.com/axolotl-ai-cloud/axolotl/main/image/axolotl-badge-web.png" alt="Built with Axolotl" width="200" height="32"/>](https://github.com/axolotl-ai-cloud/axolotl)
17
- <details><summary>See axolotl config</summary>
18
-
19
- axolotl version: `0.4.1`
20
- ```yaml
21
- base_model: meta-llama/Meta-Llama-3-8B-Instruct
22
- model_type: LlamaForCausalLM
23
- tokenizer_type: AutoTokenizer
24
- is_llama_derived_model: true
25
- tokenizer_use_fast: true
26
- hub_model_id: Llama-3-8B-spectrum-25
27
-
28
- # load_in_8bit: true
29
- # load_in_4bit: false
30
- # strict: false
31
-
32
- datasets:
33
- - path: yuvraj17/finetune_alpaca_1K
34
- type: alpaca
35
-
36
- dataset_prepared_path: last_run_prepared
37
- val_set_size: 0.02
38
- output_dir: ./outputs/llama-3-8b-spectrum-25
39
-
40
- sequence_len: 2048
41
- sample_packing: false
42
- eval_sample_packing: false
43
- pad_to_sequence_len: true
44
-
45
- # Model Layers for Llama-3-8B-Instruct (Spectrum with snr values (25%)):
46
- unfrozen_parameters:
47
- - ^lm_head.weight$
48
- - ^model.embed_tokens.weight$
49
- # input_layernorm layers
50
- - model.layers.0.input_layernorm
51
- - model.layers.1.input_layernorm
52
- - model.layers.2.input_layernorm
53
- - model.layers.3.input_layernorm
54
- - model.layers.4.input_layernorm
55
- - model.layers.5.input_layernorm
56
- - model.layers.6.input_layernorm
57
- - model.layers.7.input_layernorm
58
- # lm_head layers
59
- # mlp.down_proj layers
60
- - model.layers.1.mlp.down_proj
61
- - model.layers.0.mlp.down_proj
62
- - model.layers.2.mlp.down_proj
63
- - model.layers.30.mlp.down_proj
64
- - model.layers.22.mlp.down_proj
65
- - model.layers.21.mlp.down_proj
66
- - model.layers.5.mlp.down_proj
67
- - model.layers.29.mlp.down_proj
68
- # mlp.gate_proj layers
69
- - model.layers.1.mlp.gate_proj
70
- - model.layers.2.mlp.gate_proj
71
- - model.layers.3.mlp.gate_proj
72
- - model.layers.0.mlp.gate_proj
73
- - model.layers.4.mlp.gate_proj
74
- - model.layers.25.mlp.gate_proj
75
- - model.layers.26.mlp.gate_proj
76
- - model.layers.5.mlp.gate_proj
77
- # mlp.up_proj layers
78
- - model.layers.4.mlp.up_proj
79
- - model.layers.0.mlp.up_proj
80
- - model.layers.3.mlp.up_proj
81
- - model.layers.5.mlp.up_proj
82
- - model.layers.7.mlp.up_proj
83
- - model.layers.6.mlp.up_proj
84
- - model.layers.2.mlp.up_proj
85
- - model.layers.1.mlp.up_proj
86
- # model.embed_tokens layers
87
- # model.norm layers
88
- # post_attention_layernorm layers
89
- - model.layers.0.post_attention_layernorm
90
- - model.layers.1.post_attention_layernorm
91
- - model.layers.2.post_attention_layernorm
92
- - model.layers.3.post_attention_layernorm
93
- - model.layers.4.post_attention_layernorm
94
- - model.layers.5.post_attention_layernorm
95
- - model.layers.6.post_attention_layernorm
96
- - model.layers.7.post_attention_layernorm
97
- # self_attn.k_proj layers
98
- - model.layers.29.self_attn.k_proj
99
- - model.layers.25.self_attn.k_proj
100
- - model.layers.23.self_attn.k_proj
101
- - model.layers.28.self_attn.k_proj
102
- - model.layers.21.self_attn.k_proj
103
- - model.layers.19.self_attn.k_proj
104
- - model.layers.22.self_attn.k_proj
105
- - model.layers.20.self_attn.k_proj
106
- # self_attn.o_proj layers
107
- - model.layers.14.self_attn.o_proj
108
- - model.layers.7.self_attn.o_proj
109
- - model.layers.5.self_attn.o_proj
110
- - model.layers.11.self_attn.o_proj
111
- - model.layers.9.self_attn.o_proj
112
- - model.layers.6.self_attn.o_proj
113
- - model.layers.13.self_attn.o_proj
114
- - model.layers.10.self_attn.o_proj
115
- # self_attn.q_proj layers
116
- - model.layers.13.self_attn.q_proj
117
- - model.layers.9.self_attn.q_proj
118
- - model.layers.10.self_attn.q_proj
119
- - model.layers.8.self_attn.q_proj
120
- - model.layers.14.self_attn.q_proj
121
- - model.layers.11.self_attn.q_proj
122
- - model.layers.0.self_attn.q_proj
123
- - model.layers.15.self_attn.q_proj
124
- # self_attn.v_proj layers
125
- - model.layers.26.self_attn.v_proj
126
- - model.layers.17.self_attn.v_proj
127
- - model.layers.28.self_attn.v_proj
128
- - model.layers.3.self_attn.v_proj
129
- - model.layers.29.self_attn.v_proj
130
- - model.layers.21.self_attn.v_proj
131
- - model.layers.16.self_attn.v_proj
132
- - model.layers.15.self_attn.v_proj
133
-
134
- # adapter: lora
135
- # lora_model_dir:
136
- # lora_r: 32
137
- # lora_alpha: 16
138
- # lora_dropout: 0.05
139
- # lora_target_linear: true
140
- # lora_fan_in_fan_out:
141
-
142
- wandb_project: llama-3-8B-spectrum
143
- wandb_entity:
144
- wandb_watch:
145
- wandb_name:
146
- wandb_log_model:
147
-
148
- gradient_accumulation_steps: 4
149
- micro_batch_size: 4
150
- num_epochs: 2
151
- optimizer: paged_adamw_32bit
152
- lr_scheduler: cosine
153
- learning_rate: 0.0002
154
-
155
- train_on_inputs: false
156
- group_by_length: false
157
- bf16: auto
158
- fp16:
159
- tf32: false
160
-
161
- gradient_checkpointing: true
162
- early_stopping_patience:
163
- resume_from_checkpoint:
164
- local_rank:
165
- logging_steps: 1
166
- xformers_attention:
167
- flash_attention: true
168
-
169
- warmup_steps: 100
170
- eval_steps: 0.01
171
- save_strategy: epoch
172
- save_steps:
173
- debug:
174
- deepspeed: deepspeed_configs/zero2.json
175
- weight_decay: 0.1
176
- fsdp:
177
- fsdp_config:
178
- special_tokens:
179
- pad_token: "<|end_of_text|>"
180
-
181
- ```
182
-
183
- </details><br>
184
 
185
  # Llama-3-8B-spectrum-25
186
 
187
- This model is a fine-tuned version of [meta-llama/Meta-Llama-3-8B-Instruct](https://huggingface.co/meta-llama/Meta-Llama-3-8B-Instruct) on the None dataset.
188
  It achieves the following results on the evaluation set:
189
  - Loss: 1.2791
190
 
191
- ## Model description
 
 
192
 
193
- More information needed
194
 
195
- ## Intended uses & limitations
 
 
196
 
197
- More information needed
198
-
199
- ## Training and evaluation data
200
-
201
- More information needed
202
-
203
- ## Training procedure
204
 
205
  ### Training hyperparameters
206
 
@@ -219,75 +50,16 @@ The following hyperparameters were used during training:
219
  - lr_scheduler_warmup_steps: 100
220
  - num_epochs: 2
221
 
222
- ### Training results
223
 
224
- | Training Loss | Epoch | Step | Validation Loss |
225
- |:-------------:|:------:|:----:|:---------------:|
226
- | 1.4618 | 0.0325 | 1 | 1.2057 |
227
- | 1.2189 | 0.0650 | 2 | 1.1976 |
228
- | 1.0899 | 0.0976 | 3 | 1.1611 |
229
- | 1.2787 | 0.1301 | 4 | 1.1385 |
230
- | 1.1341 | 0.1626 | 5 | 1.1368 |
231
- | 1.2793 | 0.1951 | 6 | 1.1228 |
232
- | 1.2094 | 0.2276 | 7 | 1.1123 |
233
- | 1.3289 | 0.2602 | 8 | 1.1126 |
234
- | 1.1179 | 0.2927 | 9 | 1.1123 |
235
- | 1.2456 | 0.3252 | 10 | 1.1109 |
236
- | 1.2253 | 0.3577 | 11 | 1.1083 |
237
- | 1.2563 | 0.3902 | 12 | 1.1079 |
238
- | 1.3222 | 0.4228 | 13 | 1.1059 |
239
- | 1.2197 | 0.4553 | 14 | 1.1080 |
240
- | 1.1862 | 0.4878 | 15 | 1.1054 |
241
- | 1.1136 | 0.5203 | 16 | 1.1040 |
242
- | 1.2221 | 0.5528 | 17 | 1.1040 |
243
- | 1.4475 | 0.5854 | 18 | 1.1049 |
244
- | 1.0187 | 0.6179 | 19 | 1.1054 |
245
- | 1.0596 | 0.6504 | 20 | 1.1057 |
246
- | 1.2075 | 0.6829 | 21 | 1.1063 |
247
- | 1.0671 | 0.7154 | 22 | 1.1062 |
248
- | 1.2115 | 0.7480 | 23 | 1.1059 |
249
- | 1.1137 | 0.7805 | 24 | 1.1061 |
250
- | 1.5483 | 0.8130 | 25 | 1.1097 |
251
- | 1.369 | 0.8455 | 26 | 1.1120 |
252
- | 1.0528 | 0.8780 | 27 | 1.1155 |
253
- | 1.2126 | 0.9106 | 28 | 1.1169 |
254
- | 1.0164 | 0.9431 | 29 | 1.1167 |
255
- | 1.2082 | 0.9756 | 30 | 1.1183 |
256
- | 1.0256 | 1.0081 | 31 | 1.1191 |
257
- | 0.6859 | 1.0407 | 32 | 1.1267 |
258
- | 0.722 | 1.0732 | 33 | 1.1505 |
259
- | 0.7161 | 1.1057 | 34 | 1.1719 |
260
- | 0.724 | 1.1382 | 35 | 1.1829 |
261
- | 0.67 | 1.1707 | 36 | 1.1844 |
262
- | 0.5737 | 1.2033 | 37 | 1.1874 |
263
- | 0.7081 | 1.2358 | 38 | 1.1940 |
264
- | 0.7239 | 1.2683 | 39 | 1.1978 |
265
- | 0.5927 | 1.3008 | 40 | 1.2022 |
266
- | 0.6079 | 1.3333 | 41 | 1.2070 |
267
- | 0.6427 | 1.3659 | 42 | 1.2104 |
268
- | 0.506 | 1.3984 | 43 | 1.2134 |
269
- | 0.4582 | 1.4309 | 44 | 1.2195 |
270
- | 0.7492 | 1.4634 | 45 | 1.2208 |
271
- | 0.538 | 1.4959 | 46 | 1.2258 |
272
- | 0.7147 | 1.5285 | 47 | 1.2299 |
273
- | 0.6565 | 1.5610 | 48 | 1.2339 |
274
- | 0.8011 | 1.5935 | 49 | 1.2365 |
275
- | 0.6986 | 1.6260 | 50 | 1.2396 |
276
- | 0.7924 | 1.6585 | 51 | 1.2472 |
277
- | 0.8128 | 1.6911 | 52 | 1.2542 |
278
- | 0.6733 | 1.7236 | 53 | 1.2616 |
279
- | 0.7363 | 1.7561 | 54 | 1.2693 |
280
- | 0.5815 | 1.7886 | 55 | 1.2762 |
281
- | 0.6571 | 1.8211 | 56 | 1.2750 |
282
- | 0.6985 | 1.8537 | 57 | 1.2748 |
283
- | 0.7519 | 1.8862 | 58 | 1.2715 |
284
- | 0.8171 | 1.9187 | 59 | 1.2733 |
285
- | 0.7373 | 1.9512 | 60 | 1.2791 |
286
 
287
 
288
  ### Framework versions
289
 
 
290
  - Transformers 4.44.2
291
  - Pytorch 2.4.0+cu121
292
  - Datasets 2.20.0
293
- - Tokenizers 0.19.1
 
5
  tags:
6
  - axolotl
7
  - generated_from_trainer
8
+ - spectrum finetuning
9
+ - Deepspeed MultiGPU
10
  model-index:
11
  - name: Llama-3-8B-spectrum-25
12
  results: []
 
15
  <!-- This model card has been generated automatically according to the information the Trainer had access to. You
16
  should probably proofread and complete it, then remove this comment. -->
17
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
 
19
  # Llama-3-8B-spectrum-25
20
 
21
+ This model is a fine-tuned version of [meta-llama/Meta-Llama-3-8B-Instruct](https://huggingface.co/meta-llama/Meta-Llama-3-8B-Instruct) on the [yuvraj17/finetune_alpaca_1K](https://huggingface.co/datasets/yuvraj17/finetune_alpaca_1K) dataset.
22
  It achieves the following results on the evaluation set:
23
  - Loss: 1.2791
24
 
25
+ ## Spectrum Fine-tuning:
26
+ I have used the **Spectrum Fine-tuning** method as described in [Eric Hartford et. al 2024](https://arxiv.org/abs/2406.06623), which selectively targets some ***t%*** of the model layers with the highest **Signal-to-Noise Ratio (SNR)**. By focusing on the most information-dense layers, this approach maximizes fine-tuning efficiency while minimizing compute resources.
27
+ The key goal of Spectrum Fine-tuning is: *minimize the memory footprint and accelerate LLM training without sacrificing performance.*
28
 
29
+ The 25% layer selection ensures minimal computational overhead for fine-tuning.
30
 
31
+ ## Training:
32
+ - Trained on **2x A40s (48GB VRAM each)** for over 1 hour using the **Axolotl**.
33
+ - Fine-tuning aimed to optimize the balance between model performance and resource efficiency, demonstrating how targeted spectrum fine-tuning can deliver substantial improvements without the need for full-scale model adjustments.
34
 
 
 
 
 
 
 
 
35
 
36
  ### Training hyperparameters
37
 
 
50
  - lr_scheduler_warmup_steps: 100
51
  - num_epochs: 2
52
 
 
53
 
54
+ ![Train/loss Curve Image](https://cdn-uploads.huggingface.co/production/uploads/66137d95e8d2cda230ddcea6/eSBh0SmeGYYUfx9pKgMIv.png)
55
+
56
+ ![eval/loss Curve Image](https://cdn-uploads.huggingface.co/production/uploads/66137d95e8d2cda230ddcea6/xNslkLH1pKot7tzWtIiu9.png)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
 
58
 
59
  ### Framework versions
60
 
61
+ - Axolotl 0.4.0
62
  - Transformers 4.44.2
63
  - Pytorch 2.4.0+cu121
64
  - Datasets 2.20.0
65
+ - Tokenizers 0.19.1