shettynavisha25 commited on
Commit
551d7b8
·
verified ·
1 Parent(s): a3e62af

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +168 -139
README.md CHANGED
@@ -10,198 +10,227 @@ tags:
10
 
11
  # Model Card for Model ID
12
 
13
- <!-- Provide a quick summary of what the model is/does. -->
14
 
 
15
 
 
16
 
17
- ## Model Details
 
 
 
 
 
 
18
 
19
- ### Model Description
20
 
21
- <!-- Provide a longer summary of what this model is. -->
 
 
 
 
 
 
 
22
 
 
23
 
24
-
25
- - **Developed by:** [More Information Needed]
26
- - **Funded by [optional]:** [More Information Needed]
27
- - **Shared by [optional]:** [More Information Needed]
28
- - **Model type:** [More Information Needed]
29
- - **Language(s) (NLP):** [More Information Needed]
30
- - **License:** [More Information Needed]
31
- - **Finetuned from model [optional]:** [More Information Needed]
32
-
33
- ### Model Sources [optional]
34
-
35
- <!-- Provide the basic links for the model. -->
36
-
37
- - **Repository:** [More Information Needed]
38
- - **Paper [optional]:** [More Information Needed]
39
- - **Demo [optional]:** [More Information Needed]
40
-
41
- ## Uses
42
-
43
- <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
44
 
45
  ### Direct Use
46
 
47
- <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
 
 
48
 
49
- [More Information Needed]
 
 
 
 
50
 
51
- ### Downstream Use [optional]
 
 
 
 
52
 
53
- <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
54
 
55
- [More Information Needed]
 
 
56
 
57
- ### Out-of-Scope Use
 
58
 
59
- <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
 
 
 
60
 
61
- [More Information Needed]
62
 
63
- ## Bias, Risks, and Limitations
 
 
64
 
65
- <!-- This section is meant to convey both technical and sociotechnical limitations. -->
 
66
 
67
- [More Information Needed]
 
 
68
 
69
- ### Recommendations
70
-
71
- <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
72
-
73
- Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
74
-
75
- ## How to Get Started with the Model
76
-
77
- Use the code below to get started with the model.
78
-
79
- [More Information Needed]
80
 
81
  ## Training Details
82
 
83
  ### Training Data
84
 
85
- <!-- 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. -->
86
-
87
- [More Information Needed]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
 
89
  ### Training Procedure
90
 
91
- <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
92
-
93
- #### Preprocessing [optional]
94
-
95
- [More Information Needed]
96
-
97
-
98
- #### Training Hyperparameters
99
-
100
- - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
101
-
102
- #### Speeds, Sizes, Times [optional]
103
-
104
- <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
105
-
106
- [More Information Needed]
107
-
108
- ## Evaluation
109
-
110
- <!-- This section describes the evaluation protocols and provides the results. -->
111
-
112
- ### Testing Data, Factors & Metrics
113
 
114
- #### Testing Data
115
-
116
- <!-- This should link to a Dataset Card if possible. -->
117
-
118
- [More Information Needed]
119
-
120
- #### Factors
121
-
122
- <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
123
-
124
- [More Information Needed]
125
-
126
- #### Metrics
127
-
128
- <!-- These are the evaluation metrics being used, ideally with a description of why. -->
129
-
130
- [More Information Needed]
131
-
132
- ### Results
133
-
134
- [More Information Needed]
135
-
136
- #### Summary
137
-
138
-
139
-
140
- ## Model Examination [optional]
141
-
142
- <!-- Relevant interpretability work for the model goes here -->
143
-
144
- [More Information Needed]
145
-
146
- ## Environmental Impact
147
-
148
- <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
149
 
150
- 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).
 
 
 
 
151
 
152
- - **Hardware Type:** [More Information Needed]
153
- - **Hours used:** [More Information Needed]
154
- - **Cloud Provider:** [More Information Needed]
155
- - **Compute Region:** [More Information Needed]
156
- - **Carbon Emitted:** [More Information Needed]
157
 
158
- ## Technical Specifications [optional]
159
 
160
- ### Model Architecture and Objective
161
 
162
- [More Information Needed]
 
 
163
 
164
- ### Compute Infrastructure
165
 
166
- [More Information Needed]
 
 
 
 
167
 
168
- #### Hardware
169
 
170
- [More Information Needed]
 
 
 
 
 
171
 
172
- #### Software
173
 
174
- [More Information Needed]
 
 
 
 
 
175
 
176
- ## Citation [optional]
177
 
178
- <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
179
 
180
- **BibTeX:**
 
 
 
 
 
 
 
 
181
 
182
- [More Information Needed]
183
 
184
- **APA:**
 
 
 
 
 
 
 
185
 
186
- [More Information Needed]
187
 
188
- ## Glossary [optional]
 
 
 
 
 
 
 
 
 
189
 
190
- <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
191
 
192
- [More Information Needed]
 
 
 
193
 
194
- ## More Information [optional]
195
 
196
- [More Information Needed]
 
 
 
 
 
197
 
198
- ## Model Card Authors [optional]
199
 
200
- [More Information Needed]
201
 
202
- ## Model Card Contact
203
-
204
- [More Information Needed]
205
- ### Framework versions
206
 
207
- - PEFT 0.17.1
 
10
 
11
  # Model Card for Model ID
12
 
13
+ # TinyLlama-1.1B Alpaca Fine-tuned
14
 
15
+ This is a fine-tuned version of [TinyLlama/TinyLlama-1.1B-Chat-v1.0](https://huggingface.co/TinyLlama/TinyLlama-1.1B-Chat-v1.0) trained on the [Alpaca dataset](https://huggingface.co/datasets/tatsu-lab/alpaca) for improved instruction-following capabilities.
16
 
17
+ ## Model Description
18
 
19
+ - **Developed by:** [Navisha Shetty]
20
+ - **Model type:** Causal Language Model (Decoder-only Transformer)
21
+ - **Language:** English
22
+ - **License:** Apache 2.0
23
+ - **Finetuned from:** TinyLlama/TinyLlama-1.1B-Chat-v1.0
24
+ - **Training method:** QLoRA (Quantized Low-Rank Adaptation)
25
+ - **Dataset:** Stanford Alpaca (52,002 instruction-following examples)
26
 
27
+ ## Model Architecture
28
 
29
+ - **Base Model:** TinyLlama-1.1B (1.1 billion parameters)
30
+ - **Fine-tuning Method:** QLoRA with LoRA adapters
31
+ - **Trainable Parameters:** 4.5M (0.4% of total)
32
+ - **LoRA Configuration:**
33
+ - Rank (r): 16
34
+ - Alpha: 32
35
+ - Target modules: q_proj, k_proj, v_proj, o_proj
36
+ - Dropout: 0.05
37
 
38
+ ## Intended Use
39
 
40
+ This model is designed for **instruction-following tasks** and can:
41
+ - Answer questions
42
+ - Generate creative content (stories, poems, etc.)
43
+ - Provide explanations and summaries
44
+ - Help with brainstorming and ideation
45
+ - Assist with text formatting and rewriting
46
+ - Follow multi-step instructions
 
 
 
 
 
 
 
 
 
 
 
 
 
47
 
48
  ### Direct Use
49
 
50
+ ```python
51
+ from transformers import AutoModelForCausalLM, AutoTokenizer
52
+ from peft import PeftModel
53
 
54
+ # Load base model
55
+ base_model = AutoModelForCausalLM.from_pretrained(
56
+ "TinyLlama/TinyLlama-1.1B-Chat-v1.0",
57
+ device_map="auto"
58
+ )
59
 
60
+ # Load fine-tuned adapter
61
+ model = PeftModel.from_pretrained(
62
+ base_model,
63
+ "shettynavisha25/tinyllama-alpaca-finetuned"
64
+ )
65
 
66
+ tokenizer = AutoTokenizer.from_pretrained("TinyLlama/TinyLlama-1.1B-Chat-v1.0")
67
 
68
+ # Format your prompt
69
+ prompt = """### Instruction:
70
+ Write a haiku about artificial intelligence
71
 
72
+ ### Response:
73
+ """
74
 
75
+ inputs = tokenizer(prompt, return_tensors="pt")
76
+ outputs = model.generate(**inputs, max_length=150, temperature=0.7)
77
+ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
78
+ ```
79
 
80
+ ### Example Prompts
81
 
82
+ ```
83
+ ### Instruction:
84
+ Explain quantum computing in simple terms
85
 
86
+ ### Response:
87
+ ```
88
 
89
+ ```
90
+ ### Instruction:
91
+ Write a Python function to calculate fibonacci numbers
92
 
93
+ ### Response:
94
+ ```
 
 
 
 
 
 
 
 
 
95
 
96
  ## Training Details
97
 
98
  ### Training Data
99
 
100
+ The model was fine-tuned on the [Stanford Alpaca dataset](https://huggingface.co/datasets/tatsu-lab/alpaca), which contains 52,002 instruction-response pairs generated using OpenAI's `text-davinci-003` model. The dataset covers diverse tasks including:
101
+ - Open-ended generation
102
+ - Question answering
103
+ - Brainstorming
104
+ - Chat
105
+ - Rewriting
106
+ - Summarization
107
+ - Classification
108
+
109
+ ### Training Hyperparameters
110
+
111
+ | Hyperparameter | Value |
112
+ |----------------|-------|
113
+ | Learning rate | 2e-4 |
114
+ | Batch size | 4 |
115
+ | Gradient accumulation steps | 4 |
116
+ | Effective batch size | 16 |
117
+ | Number of epochs | 3 |
118
+ | Max sequence length | 512 |
119
+ | Optimizer | paged_adamw_8bit |
120
+ | Learning rate schedule | Linear warmup (100 steps) |
121
+ | Weight decay | 0 |
122
+ | Warmup steps | 100 |
123
 
124
  ### Training Procedure
125
 
126
+ - **Quantization:** 4-bit quantization using bitsandbytes
127
+ - **Precision:** FP16 mixed precision training
128
+ - **Gradient Checkpointing:** Enabled to reduce memory usage
129
+ - **Training Steps:** 9,753 total steps
130
+ - **Checkpointing:** Every 500 steps (last 3 checkpoints retained)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
131
 
132
+ ### Compute Infrastructure
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
133
 
134
+ - **Hardware:** NVIDIA Tesla T4 GPU (16GB VRAM)
135
+ - **Cloud Provider:** AWS (g4dn.2xlarge instance)
136
+ - **Orchestration:** Kubernetes
137
+ - **Training Time:** ~13 hours
138
+ - **Framework:** PyTorch 2.1.0 with CUDA 12.1
139
 
140
+ ## Performance
 
 
 
 
141
 
142
+ ### Training Loss
143
 
144
+ The model achieved a final training loss of **1.14** after 3 epochs, showing consistent improvement throughout training:
145
 
146
+ - Epoch 1: Loss decreased from 1.85 → 1.35
147
+ - Epoch 2: Loss decreased from 1.35 → 1.20
148
+ - Epoch 3: Loss decreased from 1.20 → 1.14
149
 
150
+ ### Qualitative Improvements
151
 
152
+ Compared to the base TinyLlama model, this fine-tuned version demonstrates:
153
+ - Better instruction-following behavior
154
+ - More structured and coherent responses
155
+ - Improved task completion for creative and analytical tasks
156
+ - Reduced hallucination on instruction-based queries
157
 
158
+ ## Limitations and Biases
159
 
160
+ - **Model Size:** With only 1.1B parameters, this model has limited world knowledge compared to larger models
161
+ - **Dataset Biases:** Inherits biases present in the Alpaca dataset and the underlying base model
162
+ - **English-only:** Primarily trained on English text
163
+ - **Factual Accuracy:** May generate plausible-sounding but incorrect information
164
+ - **Context Length:** Limited to 512 tokens during fine-tuning
165
+ - **Not for Production:** This is a research/educational model and should be thoroughly tested before production use
166
 
167
+ ## Ethical Considerations
168
 
169
+ This model should not be used for:
170
+ - Generating harmful, toxic, or biased content
171
+ - Impersonating individuals
172
+ - Providing medical, legal, or financial advice
173
+ - Making critical decisions without human oversight
174
+ - Spreading misinformation
175
 
176
+ ## Citation
177
 
178
+ If you use this model, please cite:
179
 
180
+ ```bibtex
181
+ @misc{tinyllama-alpaca-finetuned,
182
+ author = {Navisha Shetty},
183
+ title = {TinyLlama-1.1B Alpaca Fine-tuned},
184
+ year = {2025},
185
+ publisher = {HuggingFace},
186
+ howpublished = {\url{https://huggingface.co/shettynavisha25/tinyllama-alpaca-finetuned}}
187
+ }
188
+ ```
189
 
190
+ ### Base Model Citation
191
 
192
+ ```bibtex
193
+ @article{zhang2024tinyllama,
194
+ title={TinyLlama: An Open-Source Small Language Model},
195
+ author={Zhang, Peiyuan and Guangtao, Zeng and Wang, Tianduo and Lu, Wei},
196
+ journal={arXiv preprint arXiv:2401.02385},
197
+ year={2024}
198
+ }
199
+ ```
200
 
201
+ ### Alpaca Dataset Citation
202
 
203
+ ```bibtex
204
+ @misc{alpaca,
205
+ author = {Rohan Taori and Ishaan Gulrajani and Tianyi Zhang and Yann Dubois and Xuechen Li and Carlos Guestrin and Percy Liang and Tatsunori B. Hashimoto},
206
+ title = {Stanford Alpaca: An Instruction-following LLaMA model},
207
+ year = {2023},
208
+ publisher = {GitHub},
209
+ journal = {GitHub repository},
210
+ howpublished = {\url{https://github.com/tatsu-lab/stanford_alpaca}},
211
+ }
212
+ ```
213
 
214
+ ## Acknowledgments
215
 
216
+ - **Base Model:** TinyLlama team for the excellent base model
217
+ - **Dataset:** Stanford Alpaca team for the instruction-following dataset
218
+ - **Training Framework:** Hugging Face Transformers and PEFT libraries
219
+ - **Infrastructure:** AWS for GPU compute resources
220
 
221
+ ## Framework Versions
222
 
223
+ - **PyTorch:** 2.1.0
224
+ - **Transformers:** 4.35.0+
225
+ - **PEFT:** 0.7.0+
226
+ - **Accelerate:** 0.24.0+
227
+ - **Bitsandbytes:** 0.41.0+
228
+ - **CUDA:** 12.1
229
 
230
+ ## Contact
231
 
232
+ For questions or issues, please open an issue on the model repository or contact [shetty.navi@northeastern.edu].
233
 
234
+ ---
 
 
 
235
 
236
+ **Note:** This model is released for research and educational purposes. Please use responsibly and be aware of its limitations.