File size: 5,036 Bytes
740c5fe
 
 
 
 
 
 
 
7ebe029
 
 
 
b680ff9
 
 
740c5fe
 
18bdcae
7ebe029
18bdcae
740c5fe
7ebe029
740c5fe
7ebe029
740c5fe
7ebe029
740c5fe
 
 
7ebe029
740c5fe
7ebe029
 
 
 
 
740c5fe
7ebe029
740c5fe
7ebe029
740c5fe
 
 
7ebe029
740c5fe
7ebe029
 
 
740c5fe
7ebe029
740c5fe
7ebe029
 
 
 
 
740c5fe
 
 
7ebe029
 
 
 
740c5fe
7ebe029
740c5fe
7ebe029
740c5fe
7ebe029
 
 
740c5fe
 
 
7ebe029
740c5fe
7ebe029
740c5fe
7ebe029
740c5fe
7ebe029
 
740c5fe
7ebe029
01ee11f
 
7ebe029
 
740c5fe
7ebe029
 
 
740c5fe
7ebe029
 
740c5fe
7ebe029
 
 
 
 
 
740c5fe
7ebe029
 
 
 
 
 
 
740c5fe
7ebe029
 
 
 
740c5fe
7ebe029
740c5fe
7ebe029
740c5fe
7ebe029
740c5fe
7ebe029
740c5fe
7ebe029
740c5fe
7ebe029
 
 
740c5fe
7ebe029
740c5fe
7ebe029
740c5fe
7ebe029
 
 
 
740c5fe
7ebe029
740c5fe
7ebe029
740c5fe
7ebe029
 
 
 
740c5fe
7ebe029
740c5fe
7ebe029
740c5fe
7ebe029
 
 
 
 
740c5fe
7ebe029
740c5fe
7ebe029
740c5fe
7ebe029
 
 
 
740c5fe
7ebe029
740c5fe
7ebe029
740c5fe
7ebe029
 
 
 
 
 
 
740c5fe
7ebe029
740c5fe
7ebe029
740c5fe
7ebe029
740c5fe
7ebe029
 
740c5fe
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
---
base_model: Qwen/Qwen2.5-3B-Instruct
library_name: peft
pipeline_tag: text-generation
tags:
- base_model:adapter:Qwen/Qwen2.5-3B-Instruct
- lora
- transformers
- custom-llm
- knowledge-llm
- tony-stark
- fine-tuning
license: mit
language:
- en
---


# 🧠 Custom Knowledge LLM: Tony Stark Edition
![Banner](./banner.png)

This is a fine-tuned version of the [Qwen2.5-3B-Instruct](https://huggingface.co/Qwen/Qwen2.5-3B-Instruct) model, adapted to answer domain-specific questions related to **Tony Stark**, using the LoRA (Low-Rank Adaptation) method for parameter-efficient fine-tuning.

---

## πŸ“Œ Model Details

### Model Description

This project is a fun + educational experiment that fine-tunes a base LLM using a fictional dataset based on Tony Stark from the Marvel universe.

- **Developed by:** [Aviral Srivastava](https://www.linkedin.com/in/aviral-srivastava26/)
- **Model type:** Causal Language Model (Instruction-tuned)
- **Language:** English
- **License:** MIT
- **Finetuned from model:** [`Qwen/Qwen2.5-3B-Instruct`](https://huggingface.co/Qwen/Qwen2.5-3B-Instruct)

---

## πŸ§‘β€πŸ’» Uses

### Direct Use

This model is fine-tuned to answer Tony Stark–related prompts such as:

- "Who is Tony Stark?"
- "What suits did Iron Man build?"
- "What are leadership traits of Stark?"

### Downstream Use

The methodology can be directly reused for:
- Corporate knowledge assistants
- Domain-specific customer support
- Educational tutors trained on custom material
- Healthcare, law, and e-commerce Q&A bots

### Out-of-Scope Use

This model is not designed for:
- Real-world advice in medical, legal, or financial domains
- Factual accuracy outside of Tony Stark lore
- Handling unrelated general-purpose queries

---

## ⚠️ Bias, Risks, and Limitations

- This model is trained on fictional data and is not meant for serious tasks.
- It reflects only the content provided in the custom dataset.
- It may "hallucinate" facts if asked general questions.

### Recommendations

Please do not use this for any commercial or factual purpose without re-training on a verified dataset.

---

## πŸš€ How to Use

```python
from transformers import pipeline

qa = pipeline(
    model="Avirallm/Custom-Knowledge-LLM-Tony-Stark-Edition",
    tokenizer="Avirallm/Custom-Knowledge-LLM-Tony-Stark-Edition",
    device="cuda"  # or "cpu" if not using GPU
)

qa("List all Iron Man suits and their features.")
```
## πŸ‹οΈβ€β™‚οΈ Training Details

### πŸ“¦ Training Data  
A custom JSON dataset of prompt-completion pairs related to Tony Stark. Example entry:

~json
{
  "prompt": "Who is Tony Stark?",
  "completion": "Tony Stark is a fictional billionaire inventor from Marvel..."
}
~

### πŸ”§ Training Hyperparameters  
- **Epochs:** 10  
- **Batch Size:** 1  
- **Optimizer:** AdamW  
- **Learning Rate:** 0.001  
- **Mixed Precision:** FP16  
- **Framework:** Hugging Face `Trainer` + PEFT LoRA  

### πŸ–₯️ Training Setup  
- Trained fully on **Google Colab Free Tier**  
- Using **Qwen/Qwen2.5-3B-Instruct** with LoRA adapters  
- Fine-tuned only **adapter layers** (not full model)  

---

## πŸ“Š Evaluation

This project is **primarily exploratory** and not evaluated on public benchmarks.

---

## 🌱 Environmental Impact

- **Hardware:** Google Colab Free GPU (Tesla T4)  
- **Training Time:** ~380 seconds (10 epochs, 1580 steps)  
- **Carbon Emission:** Negligible (low-compute, single GPU)  

---

## 🧠 Architecture

- **Base Model:** Qwen2.5-3B-Instruct (Alibaba Cloud)  
- **Fine-Tuning:** LoRA adapters on top of base weights  
- **Task Type:** Text generation, instruction following  
- **Token Limit:** 128 tokens (during training)  

---

## ✨ Example Applications

- Fan-based AI chatbot (Iron Man Assistant)  
- Fictional universe assistants for games and comics  
- Domain-specific tutors for educational platforms  
- Startup knowledge bots (replace "Tony Stark" with your brand)  

---

## πŸ“ Repository Structure

- `adapter_model.safetensors` – LoRA adapter weights  
- `tokenizer_config.json`, `tokenizer.json`, `vocab.json` – Tokenizer files  
- `README.md` – Project overview  
- `training_args.bin` – Training arguments  
- `tonyst.json` (optional) – Custom dataset (if shared)  

---

## πŸ“¬ Get in Touch

Have a use case in mind? Want your own custom-trained LLM?  
πŸ“§ **Email:** [[email protected]](mailto:[email protected])  
πŸ”— **LinkedIn:** [Aviral Srivastava](https://www.linkedin.com/in/aviral-srivastava26/)  
πŸ’» **GitHub:** [aviral-sri](https://github.com/aviral-sri)  

---

## πŸ™ Credits

- **Base Model:** [Qwen2.5-3B-Instruct](https://huggingface.co/Qwen/Qwen2.5-3B-Instruct)  
- **Fine-Tuning:** PEFT + LoRA  
- **Tools Used:**  
  - Hugging Face Transformers  
  - Hugging Face Datasets  
  - Google Colab  
  - W&B for tracking  

**Inspired by:** Marvel's Tony Stark (for learning only, non-commercial)

---

## πŸͺͺ License

This project is licensed under the MIT License.  
Feel free to modify, share, and build upon it.