Qwen3-4B-Coder
A fine-tuned Qwen3-4B model specialized for Python code generation, trained by an elementary school student on an RTX 4060 Laptop GPU (8 GB VRAM).
Qwen3-4Bをベースに、Pythonコード生成に特化してファインチューニングしたモデルです。小学生がRTX 4060 Laptop GPU (VRAM 8GB) で学習しました。
Benchmark Results
MBPP-sanitized (Practical Python Tasks)
| Model | MBPP pass@1 | Condition |
|---|---|---|
| Qwen3-4B-Coder (this model) | 69.3% (178/257) | Q4_K_M, temperature=0.0 |
| Qwen3-4B (official) | 62.0% | FP16, EvalPlus |
+7.3 points improvement on practical coding tasks.
HumanEval (Algorithmic Tasks)
| Model | HumanEval pass@1 | Condition |
|---|---|---|
| Qwen3-4B-Coder (this model) | 47.6% (78/164) | Q4_K_M, temperature=0.0 |
| Qwen3-4B (official) | 65.6% | FP16, EvalPlus |
Inference Speed
| Benchmark | Qwen3-4B-Coder | Qwen3-4B (Q4_K_M) | Speed Ratio |
|---|---|---|---|
| HumanEval (164 tasks) | 793s | 3623s | 4.6x faster |
| MBPP (257 tasks) | 1274s | - | - |
Syntax error rate on HumanEval: 0% (164/164)
Key Findings
This model demonstrates that SFT for code-only output has two major benefits:
- Practical code generation ability improved (MBPP +7.3 points)
- Inference speed improved 4.6x by eliminating think blocks and explanations
Training Details
| Parameter | Value |
|---|---|
| Base Model | Qwen/Qwen3-4B |
| Method | SFT with LoRA (r=16, alpha=32) |
| Dataset | PersonalAILab/AFM-CodeAgent-SFT-Dataset |
| Training Samples | 8,869 (filtered to 512 tokens) |
| Epochs | 3 |
| Final Loss | 0.72 |
| MAX_SEQ | 512 |
| GPU | NVIDIA RTX 4060 Laptop (8 GB VRAM) |
| Training Time | ~5.5 hours |
| Quantization | Q4_K_M (~2.4 GB) |
Features
- Code-only output without extra explanations
- 4.6x faster inference than base model
- Supports English and Japanese prompts
- Optimized for agent pipelines
- Syntax error rate 0% on HumanEval
AI Code Agent (CLI Tool)
An interactive CLI tool that uses this model to generate, execute, and auto-fix Python code.
git clone https://github.com/jiexiang018-tech/ai-python-agent.git
cd ai-python-agent
pip install -r requirements.txt
python setup.py
python agent.py
- Downloads last month
- 127
Hardware compatibility
Log In to add your hardware
4-bit