neuralbroker commited on
Commit
8f202ac
·
verified ·
1 Parent(s): efc2b01

Clean up adapter model card and evaluation notes

Browse files
Files changed (1) hide show
  1. README.md +84 -183
README.md CHANGED
@@ -1,183 +1,84 @@
1
- ---
2
- language:
3
- - en
4
- license: mit
5
- library_name: peft
6
- tags:
7
- - code-generation
8
- - lora
9
- - qwen2.5
10
- - blitzkode
11
- - coding-assistant
12
- - fine-tuned
13
- - peft
14
- base_model: Qwen/Qwen2.5-1.5B-Instruct
15
- pipeline_tag: text-generation
16
- ---
17
-
18
- # BlitzKode LoRA Adapter (0.5B)
19
-
20
- **BlitzKode** is a local AI coding assistant fine-tuned from
21
- **[Qwen/Qwen2.5-1.5B-Instruct](https://huggingface.co/Qwen/Qwen2.5-1.5B-Instruct)** using LoRA
22
- (Low-Rank Adaptation). This repository contains the PEFT adapter — the
23
- research-friendly version that can be hot-loaded on top of the base model.
24
-
25
- > **Creator:** [Sajad (neuralbroker)](https://github.com/neuralbroker)
26
- > **GitHub:** <https://github.com/neuralbroker/blitzkode>
27
- > **Production GGUF:** [`neuralbroker/blitzkode`](https://huggingface.co/neuralbroker/blitzkode)
28
-
29
- ---
30
-
31
- ## Model Details
32
-
33
- | Property | Value |
34
- |---|---|
35
- | **Adapter version** | 2.1 |
36
- | **Base model** | `Qwen/Qwen2.5-1.5B-Instruct` |
37
- | **LoRA rank (r)** | 16 |
38
- | **LoRA alpha** | 32 |
39
- | **LoRA dropout** | 0.05 |
40
- | **Target modules** | `up_proj`, `down_proj`, `q_proj`, `o_proj`, `k_proj`, `gate_proj`, `v_proj` |
41
- | **Training steps** | 50 |
42
- | **Final loss** | ~0.48 |
43
- | **Library** | PEFT |
44
- | **License** | MIT |
45
-
46
- ---
47
-
48
- ## Training Pipeline
49
-
50
- This adapter was produced by a **4-stage fine-tuning pipeline** applied
51
- to the Qwen2.5 family:
52
-
53
- | Stage | Method | Purpose |
54
- |---|---|---|
55
- | 1 | SFT | Supervised fine-tuning on 71 curated algorithmic coding problems |
56
- | 2 | Reward-SFT | Continued SFT with heuristic reward signals for code correctness and formatting |
57
- | 3 | DPO | Direct Preference Optimization on handcrafted chosen/rejected pairs |
58
- | 4 | LoRA SFT (this adapter) | Final LoRA fine-tune (r=16) on 99 samples; base model Qwen2.5-0.5B |
59
-
60
- ### Training Dataset (199 total samples)
61
-
62
- | Subset | Count | Source | License |
63
- |---|---|---|---|
64
- | Curated algorithmic problems | 71 | Custom (local) — arrays, strings, trees, DP, graphs | MIT |
65
- | MetaMathQA samples | 100 | [`meta-math/MetaMathQA`](https://huggingface.co/datasets/meta-math/MetaMathQA) | CC BY 4.0 |
66
- | Python/JavaScript patterns | 28 | Custom (local) — decorators, context managers, data classes | MIT |
67
- | **Total** | **199** | | |
68
-
69
- ---
70
-
71
- ## Usage
72
-
73
- ### Load with PEFT
74
-
75
- ```python
76
- from peft import PeftModel
77
- from transformers import AutoModelForCausalLM, AutoTokenizer
78
-
79
- base_model_id = "Qwen/Qwen2.5-1.5B-Instruct"
80
- adapter_repo = "neuralbroker/blitzkode-1.5b-lora"
81
-
82
- tokenizer = AutoTokenizer.from_pretrained(base_model_id, trust_remote_code=True)
83
- model = AutoModelForCausalLM.from_pretrained(
84
- base_model_id,
85
- torch_dtype="auto",
86
- device_map="auto",
87
- trust_remote_code=True,
88
- )
89
- model = PeftModel.from_pretrained(model, adapter_repo)
90
- model.eval()
91
- ```
92
-
93
- ### Generate code
94
-
95
- ```python
96
- prompt = (
97
- "<|im_start|>system\n"
98
- "You are BlitzKode, a precise AI coding assistant created by Sajad.\n"
99
- "<|im_end|>\n"
100
- "<|im_start|>user\n"
101
- "Write a Python function for binary search with full edge-case handling.\n"
102
- "<|im_end|>\n"
103
- "<|im_start|>assistant\n"
104
- )
105
-
106
- inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
107
- outputs = model.generate(
108
- **inputs,
109
- max_new_tokens=300,
110
- temperature=0.7,
111
- do_sample=True,
112
- repetition_penalty=1.1,
113
- )
114
- print(tokenizer.decode(outputs[0], skip_special_tokens=True))
115
- ```
116
-
117
- ### Merge adapter into base model (for export)
118
-
119
- ```python
120
- merged = model.merge_and_unload()
121
- merged.save_pretrained("blitzkode-0.5b-merged")
122
- tokenizer.save_pretrained("blitzkode-0.5b-merged")
123
- ```
124
-
125
- ---
126
-
127
- ## Prompt Format
128
-
129
- BlitzKode uses the **ChatML** template standard for Qwen models:
130
-
131
- ```
132
- <|im_start|>system
133
- You are BlitzKode, a precise AI coding assistant created by Sajad.<|im_end|>
134
- <|im_start|>user
135
- {your question}<|im_end|>
136
- <|im_start|>assistant
137
- ```
138
-
139
- ---
140
-
141
- ## Limitations
142
-
143
- - **Text-only** — no image/multimodal support.
144
- - **0.5B parameters** — smaller and faster than the 1.5B GGUF variant; may be
145
- less accurate on complex algorithmic tasks.
146
- - **2048-token context** — not suitable for long repository-level analysis.
147
- - **Review all outputs** — generated code must be tested before use in production.
148
- - **Not security-audited** — do not use for cryptographic or safety-critical code
149
- without thorough expert review.
150
- - **Math reasoning** — MetaMathQA training improves basic reasoning but does not
151
- substitute a dedicated math model.
152
-
153
- ---
154
-
155
- ## Relation to the Production Model
156
-
157
- | Variant | Repo | Size | Runtime | Use case |
158
- |---|---|---|---|---|
159
- | GGUF (1.5B, F16) | [`neuralbroker/blitzkode`](https://huggingface.co/neuralbroker/blitzkode) | ~3 GB | llama.cpp / llama-cpp-python | Production; CPU/GPU, no Python ML stack needed |
160
- | LoRA adapter (0.5B) | `neuralbroker/blitzkode-1.5b-lora` (this repo) | ~100 MB | PEFT + Transformers | Research; merging, further fine-tuning, quantization |
161
-
162
- ---
163
-
164
- ## License
165
-
166
- **MIT** — see [LICENSE](https://github.com/neuralbroker/blitzkode/blob/main/LICENSE).
167
-
168
- You must also comply with the upstream
169
- [Qwen/Qwen2.5-1.5B-Instruct](https://huggingface.co/Qwen/Qwen2.5-1.5B-Instruct) license
170
- when redistributing any derived weights.
171
-
172
- ---
173
-
174
- ## Citation
175
-
176
- ```bibtex
177
- @software{blitzkode2025,
178
- author = {Sajad},
179
- title = {BlitzKode: A Local AI Coding Assistant},
180
- year = {2025},
181
- url = {https://github.com/neuralbroker/blitzkode}
182
- }
183
- ```
 
1
+ ---
2
+ language:
3
+ - en
4
+ license: mit
5
+ library_name: peft
6
+ pipeline_tag: text-generation
7
+ tags:
8
+ - code-generation
9
+ - coding-assistant
10
+ - lora
11
+ - peft
12
+ - qwen2.5
13
+ - blitzkode
14
+ base_model: Qwen/Qwen2.5-1.5B-Instruct
15
+ ---
16
+
17
+ # BlitzKode 1.5B LoRA Adapter
18
+
19
+ This repository contains the **BlitzKode 1.5B PEFT/LoRA adapter** for `Qwen/Qwen2.5-1.5B-Instruct`. It is intended for research, inspection, and reproducible adapter loading. The production local-inference artifact is the merged GGUF model at [`neuralbroker/blitzkode`](https://huggingface.co/neuralbroker/blitzkode).
20
+
21
+ ## Intended use
22
+
23
+ - Local coding-assistant research
24
+ - Adapter inspection and continued fine-tuning
25
+ - Reproducing the BlitzKode GGUF export pipeline
26
+ - Educational experiments with PEFT/LoRA on Qwen2.5
27
+
28
+ Do **not** use generated code in production without review and tests.
29
+
30
+ ## Loading
31
+
32
+ ```python
33
+ from peft import PeftModel
34
+ from transformers import AutoModelForCausalLM, AutoTokenizer
35
+
36
+ base_model_id = "Qwen/Qwen2.5-1.5B-Instruct"
37
+ adapter_id = "neuralbroker/blitzkode-1.5b-lora"
38
+
39
+ tokenizer = AutoTokenizer.from_pretrained(base_model_id, trust_remote_code=True)
40
+ model = AutoModelForCausalLM.from_pretrained(
41
+ base_model_id,
42
+ torch_dtype="auto",
43
+ device_map="auto",
44
+ trust_remote_code=True,
45
+ )
46
+ model = PeftModel.from_pretrained(model, adapter_id)
47
+ model.eval()
48
+ ```
49
+
50
+ ## Training summary
51
+
52
+ BlitzKode was developed through staged coding-assistant post-training:
53
+
54
+ | Stage | Method | Purpose |
55
+ |---|---|---|
56
+ | SFT | Curated coding examples | Teach concise coding responses and common algorithms |
57
+ | Reward-SFT | Heuristic continuation | Reinforce formatting, correctness patterns, and practical explanations |
58
+ | DPO | Preference pairs | Penalize weak answers and hallucinated details |
59
+ | Export | Merge + GGUF | Produce the production `blitzkode.gguf` artifact |
60
+
61
+ Dataset provenance is tracked in the GitHub project and the production model repository docs.
62
+
63
+ ## Evaluation
64
+
65
+ The latest published smoke evaluation is attached to the production GGUF repository: [`neuralbroker/blitzkode`](https://huggingface.co/neuralbroker/blitzkode). Current GGUF smoke eval: **3 / 4 passed (75%)** on Python factorial, binary search, SQL top users, and fictional-API uncertainty checks. The raw model still fails the fictional-API uncertainty case, so downstream serving should keep guardrails enabled.
66
+
67
+ This is a lightweight regression smoke eval, not a comprehensive benchmark such as HumanEval, MBPP, or SWE-bench.
68
+
69
+ ## Limitations
70
+
71
+ - Small-model limitations apply; outputs can be wrong or incomplete.
72
+ - Direct prompting may hallucinate unsupported APIs or signatures.
73
+ - Default deployment context is 2,048 tokens.
74
+ - Text-only model; no image/file multimodal support.
75
+
76
+ ## Related repositories
77
+
78
+ - Production GGUF/API docs: [`neuralbroker/blitzkode`](https://huggingface.co/neuralbroker/blitzkode)
79
+ - Lightweight 0.5B adapter: [`neuralbroker/blitzkode-lora-0.5b`](https://huggingface.co/neuralbroker/blitzkode-lora-0.5b)
80
+ - GitHub source: <https://github.com/neuralbroker/blitzkode>
81
+
82
+ ## License
83
+
84
+ MIT for BlitzKode project files and adapter release metadata. You must also comply with the upstream Qwen2.5 license for the base model.