56 6 days ago

A QLoRA fine-tune of Qwen2.5-Coder-1.5B into a terse, code-first Python assistant — 78% shorter answers, trained on a single 8 GB GPU.

ollama run mohdnihalll03/qwen2.5-coder-1.5b-codeslm-nihal

Models

View all →

Readme

qwen2.5-coder-1.5b-CodeSLM-Nihal

A QLoRA fine-tune of Qwen2.5-Coder-1.5B-Instruct into a terse, code-first Python assistant — trained on a single 8 GB consumer GPU (RTX 5060) as a phase-by-phase learning project.

The base model is a capable coder but chronically verbose (every answer trails a prose essay). This fine-tune trains it to reply with correct, minimal code and nothing else.

Headline result — 78% shorter answers

On 18 held-out prompts (greedy decoding), average output length dropped from 272 to 60 tokens (−78%) while core algorithm correctness was preserved.

Training curve — clean convergence, no overfitting

Training vs. validation loss

Checkpoint (epoch) Validation loss
0.13 0.5157
0.38 0.5020
0.88 0.4927
1.00 0.4928

Final train loss 0.4906; validation mean token-accuracy ~85.4%.

Training details

Base Qwen/Qwen2.5-Coder-1.5B-Instruct
Method QLoRA (4-bit NF4 + LoRA), completion-only loss
Dataset sahil2801/CodeAlpaca-20k → Qwen ChatML (19,020 / 1,002)
LoRA r=16, α=32, dropout=0.05, all 7 proj modules
Trainable 18.46M params (~1.18%)
Schedule 1 epoch, 1,189 steps, LR 2e-4 cosine + 3% warmup
Hardware RTX 5060 (8 GB), ~50 min, peak VRAM 3.32 GB

Usage

ollama run mohdnihalll03/qwen2.5-coder-1.5b-codeslm-nihal

Recommended: temperature 0.2. Full weights, adapter, and GGUFs on Hugging Face: https://huggingface.co/MohdNihal03/qwen2.5-coder-1.5b-CodeSLM-Nihal

Limitations

Fine-tuning changed style far more than correctness. A few subtle base-model bugs persist and one answer regressed — review generated code before use. Python-focused; 1.5B + 4-bit is not a substitute for a large frontier model.