Pritish92 commited on
Commit
a5874d3
·
verified ·
1 Parent(s): aa3e5bb

Upload locally saved GRIT fine-tuned model: open_llama_3b_v2 on Alpaca

Browse files
README.md ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - llama3
4
+ - alpaca
5
+ - grit
6
+ - lora
7
+ - qlora
8
+ - instruction-tuning
9
+ - fine-tuned
10
+ base_model: openlm-research/open_llama_3b_v2
11
+ library_name: peft
12
+ license: apache-2.0
13
+ datasets:
14
+ - tatsu-lab/alpaca
15
+ language:
16
+ - en
17
+ pipeline_tag: text-generation
18
+ ---
19
+
20
+ # OpenLlama-3B-v2 Fine-tuned with GRIT and QLoRA
21
+
22
+ This model is a fine-tuned version of [openlm-research/open_llama_3b_v2](https://huggingface.co/openlm-research/open_llama_3b_v2) using the **GRIT** (Gradient Regularized Instruction Tuning) algorithm and **QLoRA** on the [Alpaca dataset](https://huggingface.co/datasets/tatsu-lab/alpaca).
23
+
24
+ The base model is quantized to 4-bit (NF4) to enable efficient fine-tuning.
25
+
26
+ ## 🚀 Training Details
27
+
28
+ ### GRIT Algorithm
29
+ - **K-FAC Updates**: Every 200 steps for second-order preconditioning
30
+ - **Neural Reprojection**: Every 500 steps for rank optimization
31
+ - **Optimized LoRA Modules**: attention + key MLP layers (as per design)
32
+
33
+ ### Fine-tuning Configuration
34
+ - **Base Model**: OpenLlama 3B v2
35
+ - **Quantization**: 4-bit (NF4) with float16 compute
36
+ - **LoRA Rank**: 64
37
+ - **LoRA Alpha**: 128
38
+ - **Batch Size**: 16 (per device)
39
+ - **Gradient Accumulation**: 4 (Effective batch = 64)
40
+ - **Learning Rate**: 5.0e-05
41
+ - **Precision**: bf16 mixed precision
42
+ - **Sequence Length**: 512 tokens
43
+ - **Gradient Checkpointing**: Enabled
44
+
45
+ ### Performance Improvements
46
+ - ✅ **Faster Convergence**: K-FAC preconditioning aligns updates with curvature
47
+ - ✅ **Memory-Efficient**: 4-bit quantization (QLoRA) and gradient checkpointing used.
48
+ - ✅ **Efficient Training**: Utilizes `accelerate` for efficient training.
49
+
50
+ ## 📊 Training Metrics (sample)
51
+ - **Total Steps**: N/A (training session interrupted)
52
+ - **Final Loss**: N/A (training session interrupted)
53
+ - **BLEU (val)**: N/A (training session interrupted)
54
+ - **Trainable Params**: N/A (training session interrupted)
55
+
56
+ ## 🏷️ Model Tags
57
+ - Instruction-tuned with GRIT and QLoRA
58
+ - GRIT-tuned Model
59
+ - 4-bit Quantized Model
60
+ - LoRA rank 64
61
+ - Mixed precision (bf16)
62
+ - Alpaca dataset fine-tuning
63
+
64
+ ## 📝 Algorithm Details
65
+ - **K-FAC Preconditioning** (Natural Gradient) and **Neural Reprojection** as per GRIT method
66
+ - **Memory Efficient**: Covariance matrices on CPU to reduce GPU load
67
+
68
+ ## 🏆 Results
69
+ In benchmark comparisons, GRIT has shown **faster convergence and better stability** than standard LoRA or fine-tuning, making it well-suited for efficient single-epoch training.
70
+
71
+ ## 📝 Citation
72
+ If you use this model, please cite:
73
+ ```bibtex
74
+ @misc{grit-openllama-3b-alpaca,
75
+ title={OpenLlama 3B v2 Fine-tuned with GRIT on Alpaca},
76
+ author={Pritish92},
77
+ year={2025},
78
+ publisher={Hugging Face},
79
+ url={https://huggingface.co/Pritish92/open-llama-3b-v2-grit-alpaca}
80
+ }
81
+ ```
82
+
83
+ ## ⚖️ License
84
+ This model inherits the Apache 2.0 license.
adapter_config.json ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alpha_pattern": {},
3
+ "auto_mapping": null,
4
+ "base_model_name_or_path": "openlm-research/open_llama_3b_v2",
5
+ "bias": "none",
6
+ "corda_config": null,
7
+ "eva_config": null,
8
+ "exclude_modules": null,
9
+ "fan_in_fan_out": false,
10
+ "inference_mode": true,
11
+ "init_lora_weights": true,
12
+ "layer_replication": null,
13
+ "layers_pattern": null,
14
+ "layers_to_transform": null,
15
+ "loftq_config": {},
16
+ "lora_alpha": 128,
17
+ "lora_bias": false,
18
+ "lora_dropout": 0.05,
19
+ "megatron_config": null,
20
+ "megatron_core": "megatron.core",
21
+ "modules_to_save": null,
22
+ "peft_type": "LORA",
23
+ "qalora_group_size": 16,
24
+ "r": 64,
25
+ "rank_pattern": {},
26
+ "revision": null,
27
+ "target_modules": [
28
+ "o_proj",
29
+ "v_proj",
30
+ "k_proj",
31
+ "q_proj"
32
+ ],
33
+ "task_type": "CAUSAL_LM",
34
+ "trainable_token_indices": null,
35
+ "use_dora": false,
36
+ "use_qalora": false,
37
+ "use_rslora": false
38
+ }
adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6929a2ecf69a74e1a32c26800ef41ae3c3a117aee3db75a1b64ffc61dd7a918a
3
+ size 170421784
special_tokens_map.json ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<s>",
4
+ "lstrip": false,
5
+ "normalized": true,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "eos_token": {
10
+ "content": "</s>",
11
+ "lstrip": false,
12
+ "normalized": true,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "pad_token": "</s>",
17
+ "unk_token": {
18
+ "content": "<unk>",
19
+ "lstrip": false,
20
+ "normalized": true,
21
+ "rstrip": false,
22
+ "single_word": false
23
+ }
24
+ }
tokenizer.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:91b289e85fa20fd375d8b33dc12f77616f18abc6359804471d1fafcb425fecb8
3
+ size 511574
tokenizer_config.json ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": true,
3
+ "add_eos_token": false,
4
+ "add_prefix_space": true,
5
+ "added_tokens_decoder": {
6
+ "0": {
7
+ "content": "<unk>",
8
+ "lstrip": false,
9
+ "normalized": true,
10
+ "rstrip": false,
11
+ "single_word": false,
12
+ "special": true
13
+ },
14
+ "1": {
15
+ "content": "<s>",
16
+ "lstrip": false,
17
+ "normalized": true,
18
+ "rstrip": false,
19
+ "single_word": false,
20
+ "special": true
21
+ },
22
+ "2": {
23
+ "content": "</s>",
24
+ "lstrip": false,
25
+ "normalized": true,
26
+ "rstrip": false,
27
+ "single_word": false,
28
+ "special": true
29
+ }
30
+ },
31
+ "bos_token": "<s>",
32
+ "clean_up_tokenization_spaces": false,
33
+ "eos_token": "</s>",
34
+ "extra_special_tokens": {},
35
+ "legacy": true,
36
+ "model_max_length": 2048,
37
+ "pad_token": "</s>",
38
+ "sp_model_kwargs": {},
39
+ "spaces_between_special_tokens": false,
40
+ "tokenizer_class": "LlamaTokenizer",
41
+ "unk_token": "<unk>",
42
+ "use_default_system_prompt": false
43
+ }