Text Generation
PEFT
Safetensors
English
code-generation
coding-assistant
lora
qwen2.5
blitzkode
conversational
Instructions to use neuralbroker/blitzkode-1.5b-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use neuralbroker/blitzkode-1.5b-lora with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-1.5B-Instruct") model = PeftModel.from_pretrained(base_model, "neuralbroker/blitzkode-1.5b-lora") - Notebooks
- Google Colab
- Kaggle
Clean up adapter model card and evaluation notes
Browse files
README.md
CHANGED
|
@@ -1,183 +1,84 @@
|
|
| 1 |
-
---
|
| 2 |
-
language:
|
| 3 |
-
- en
|
| 4 |
-
license: mit
|
| 5 |
-
library_name: peft
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
-
|
| 9 |
-
-
|
| 10 |
-
-
|
| 11 |
-
-
|
| 12 |
-
-
|
| 13 |
-
-
|
| 14 |
-
base_model: Qwen/Qwen2.5-1.5B-Instruct
|
| 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 |
-
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|