homeprojectsblogcredentialsresumeaboutcontact
projects/qwen-data-science-instruct
PythonPyTorchUnslothQLoRAQwen2.5LLMFine-TuningHuggingFace

Qwen Data Science Instruct – QLoRA Fine-Tuned LLM

Fine-tuned version of Qwen2.5-3B-Instruct optimized for Data Science and ML coding tasks using QLoRA on 16.4K instruct examples with Unsloth. Achieved an 86% win rate over the base model with +109.5% BLEU and +66.9% ROUGE-L score gains.

GitHub ↗
86% Win Rate+109% BLEU+67% ROUGE-L6.5GB VRAM
Live Repository Metrics:
0 stars0 forks👁 0 watchers
Holdout Win Rate vs Base
86%
Semantic Similarity
78.8%
ROUGE-L (Structural)
42.3%
BLEU (Code Exactness)
17.9%
Jupyter Notebook99.2%Python0.8%
86%Win Ratevs base Qwen2.5-3B
+109%BLEU Gainsyntax exactness
6.5 GBTraining VRAMTesla T4 single-GPU
16.4kDataset SizeDS & ML instruct pairs

General-purpose small LLMs frequently produce non-idiomatic, unoptimized, or hallucinated Data Science and Machine Learning code. They struggle with complex Pandas vectorized manipulation, statistical edge cases, and strict data leakage prevention in scikit-learn pipelines.

Fine-tuned Qwen2.5-3B-Instruct using QLoRA (4-bit quantization, rank 16, alpha 16) with Unsloth on the ed001/ds-coder-instruct-v1 dataset (~16.4k examples). Enforced generation-only loss backpropagation by masking loss on user prompt tokens. Optimized with AdamW 8-bit, 2e-4 learning rate, and cosine scheduler, completing 3 epochs on a single Tesla T4 GPU in 7.38 hours using just 6.51 GB peak VRAM.

Python 3.12PyTorchUnslothHuggingFace TransformersQLoRABitsAndBytesCUDATesla T4
  • 86% win rate against base Qwen2.5-3B-Instruct on 100 held-out data science coding test cases
  • +109.49% BLEU score improvement (0.0855 -> 0.1791) measuring exact code syntax and token match
  • +66.89% ROUGE-L score improvement (0.2535 -> 0.4231) validating structural code alignment
  • +12.59% semantic similarity gain (0.7001 -> 0.7883) evaluated against canonical solutions
  • +25.65% overall composite score gain across combined code quality metrics
  • Trained on a single Tesla T4 GPU in 7.38 hours with ultra-lean 6.51 GB peak VRAM footprint
  • 01Unsloth kernel optimizations deliver ~2x training speedup and 60% memory reduction over standard HuggingFace PEFT
  • 02Prompt loss masking is vital for instruct fine-tuning; backpropagating on prompt tokens introduces severe gradient noise
  • 03Targeting all linear projection layers (q, k, v, o, gate, up, down) with LoRA rank 16 yielded superior generalization compared to q/v-only adapters
  • 04Automated NLP metrics (BLEU, ROUGE-L) provide strong stylistic alignment proxies, but sandbox execution validation is key for future iterations
← Back to projects