Jackrong commited on
Commit
3c59131
·
verified ·
1 Parent(s): 563c8b4

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +137 -11
README.md CHANGED
@@ -1,21 +1,147 @@
1
  ---
2
- base_model: unsloth/llama-3.2-3b-instruct-unsloth-bnb-4bit
3
  tags:
4
- - text-generation-inference
5
- - transformers
6
- - unsloth
7
  - llama
8
- license: apache-2.0
 
 
 
 
 
 
9
  language:
10
  - en
 
 
 
11
  ---
12
 
13
- # Uploaded finetuned model
14
 
15
- - **Developed by:** Jackrong
16
- - **License:** apache-2.0
17
- - **Finetuned from model :** unsloth/llama-3.2-3b-instruct-unsloth-bnb-4bit
18
 
19
- This llama model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.
 
 
 
 
 
 
 
 
20
 
21
- [<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
 
2
  tags:
3
+ - gguf
 
 
4
  - llama
5
+ - llama-3.2
6
+ - text-generation
7
+ - conversational
8
+ license: llama3.2
9
+ datasets:
10
+ - Jackrong/ShareGPT-Qwen3-235B-A22B-Instuct-2507
11
+ - ytz20/LMSYS-Chat-GPT-5-Chat-Response
12
  language:
13
  - en
14
+ - zh
15
+ base_model:
16
+ - unsloth/Llama-3.2-3B-Instruct
17
  ---
18
 
19
+ # GPT-5-Distill-llama3.2-3B-Instruct
20
 
21
+ ![Llama-3.2](https://img.shields.io/badge/Base_Model-Llama--3.2--3B-blue?style=flat&logo=meta&logoColor=white)
22
+ ![Instruct](https://img.shields.io/badge/Type-Instruction--Tuned-green?style=flat)
23
+ ![GPT-5](https://img.shields.io/badge/Distillation-GPT--5_Responses-8A2BE2?style=flat)
24
 
25
+ **Model Type**: Instruction-tuned Edge LLM (Llama 3.2 Architecture)
26
+ - **Base Model**: `unsloth/Llama-3.2-3B-Instruct`
27
+ - **Parameters**: ~3.2B (Optimized for Edge/Consumer GPU)
28
+ - **Training Method**:
29
+ - **SFT (Supervised Fine-Tuning)** using Unsloth & TRL
30
+ - **Knowledge Distillation**: Trained on GPT-5 responses to mimic superior reasoning and tone
31
+ - **LoRA Config**: r=32, alpha=32, targeting all linear projections
32
+ - **Max Context Length**: **32K tokens** (`max_seq_length = 32768`)
33
+ - **Quantization**: Native GGUF support (Q4_K_M, Q8_0, FP16) provided
34
 
35
+ This model represents a high-efficiency distillation attempt, combining the lightweight, edge-ready architecture of **Llama-3.2-3B** with the high-quality conversational patterns of **GPT-5**. By filtering for "normal" (flawless) responses from the LMSYS dataset, this model aims to deliver flagship-level instruction following in a 3B parameter package.
36
+
37
+ ---
38
+
39
+ ## 2. Intended Use Cases
40
+
41
+ ### ✅ Recommended:
42
+ - **On-Device Chat**: Perfect for laptops, phones, and low-VRAM GPUs due to small size.
43
+ - **Reasoning & Explanations**: Distilled GPT-5 logic helps in providing clearer answers.
44
+ - **Summarization & Rewriting**: Inherits strong English/Chinese capabilities from the dataset mix.
45
+ - **RAG Applications**: 32K context window allows for processing moderate-sized documents.
46
+
47
+ ### ⚠️ Not Suitable For:
48
+ - **Math/Complex Coding**: While capable, 3B models have limitations compared to 70B+ models in complex logic.
49
+ - **High-Stakes Medical/Legal Advice**: Outputs should always be verified.
50
+ - **Hallucination-Free Tasks**: Small models may still hallucinate facts.
51
+
52
+ ---
53
+
54
+ ## 3. Training Data & Methodology
55
+
56
+ The model was trained on a curated mix of **~104,000 high-quality samples**:
57
+
58
+ ### (1) ds1: ShareGPT-Qwen3 Instruction Mix (~3,900 samples)
59
+ - **Source**: `Jackrong/ShareGPT-Qwen3-235B-A22B-Instuct-2507`
60
+ - **Role**: Provides diverse, multi-turn instruction following capabilities, enhancing the model's ability to handle complex prompts (English & Chinese mixed).
61
+
62
+ ### (2) ds2: LMSYS GPT-5 Teacher Responses (~100,000 samples)
63
+ - **Source**: `ytz20/LMSYS-Chat-GPT-5-Chat-Response`
64
+ - **Filtering Logic**:
65
+ - Applied rigorous filtering: `flaw == "normal"` (Removed hallucinations, refusals, and bad formatting).
66
+ - Only clean, high-quality "Teacher" responses were used for distillation.
67
+ - **Role**: Imparts the "GPT-5" conversational style, politeness, and reasoning structure to the smaller Llama model.
68
+
69
+ ### Training Configuration:
70
+ - **Framework**: Unsloth + Hugging Face TRL
71
+ - **Loss Masking**: `train_on_responses_only` was enabled (Model learns to generate answers, not questions).
72
+ - **Optimizer**: AdamW 8-bit for efficiency.
73
+ - **Precision**: Trained in 4-bit, exported to 16-bit and GGUF.
74
+
75
+ ---
76
+
77
+ ## 4. Prompt Format (Llama 3.2 Standard)
78
+
79
+ This model uses the standard **Llama 3 / 3.2** prompt template.
80
+
81
+ ```text
82
+ <|begin_of_text|><|start_header_id|>system<|end_header_id|>
83
+
84
+ You are a helpful assistant.<|eot_id|><|start_header_id|>user<|end_header_id|>
85
+
86
+ {Your Prompt Here}<|eot_id|><|start_header_id|>assistant<|end_header_id|>
87
+ ````
88
+
89
+ **Python Inference Example:**
90
+
91
+ ```python
92
+ from transformers import AutoTokenizer, AutoModelForCausalLM
93
+ import torch
94
+
95
+ model_id = "Jackrong/GPT-5-Distill-llama3.2-3B-Instruct"
96
+
97
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
98
+ model = AutoModelForCausalLM.from_pretrained(
99
+ model_id,
100
+ torch_dtype=torch.bfloat16,
101
+ device_map="auto",
102
+ )
103
+
104
+ messages = [
105
+ {"role": "system", "content": "You are a helpful assistant."},
106
+ {"role": "user", "content": "Explain quantum mechanics to a 5-year-old."},
107
+ ]
108
+
109
+ input_ids = tokenizer.apply_chat_template(
110
+ messages,
111
+ add_generation_prompt=True,
112
+ return_tensors="pt"
113
+ ).to(model.device)
114
+
115
+ outputs = model.generate(
116
+ input_ids,
117
+ max_new_tokens=512,
118
+ temperature=0.7,
119
+ do_sample=True
120
+ )
121
+
122
+ print(tokenizer.decode(outputs[0][input_ids.shape[-1]:], skip_special_tokens=True))
123
+ ```
124
+
125
+ -----
126
+
127
+ ## 5\. Key Features Summary
128
+
129
+ | Feature | Description |
130
+ |--------|-------------|
131
+ | **Super Lightweight** | 3B Parameters. Runs on almost any modern consumer hardware. |
132
+ | **GPT-5 Distilled** | Learned from 100k+ clean GPT-5 outputs for superior tone. |
133
+ | **Long Context** | Supports up to **32k context**, great for long conversations. |
134
+ | **GGUF Ready** | Available in `q4_k_m` (very fast) and `q8_0` quantizations. |
135
+
136
+ -----
137
+
138
+ ## 6\. Acknowledgements
139
+
140
+ - **Unsloth**: For the 2x faster training and 4-bit loading capabilities.
141
+ - **LMSYS Org**: For providing the GPT-5 response dataset.
142
+ - **Meta AI**: For the robust Llama-3.2 base model.
143
+
144
+ This project is an open research effort to bring "Big Model Intelligence" to "Small Model Footprints."
145
+
146
+ ```
147
+ ```