Text Generation
PEFT
Safetensors
English
code
coding
full-stack
frontend
backend
agent
qwen3
lora
unsloth
fine-tuned
conversational
Instructions to use usernamebetter/nanocoder-v1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use usernamebetter/nanocoder-v1 with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("unsloth/Qwen3-4B-unsloth-bnb-4bit") model = PeftModel.from_pretrained(base_model, "usernamebetter/nanocoder-v1") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Unsloth Studio
How to use usernamebetter/nanocoder-v1 with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for usernamebetter/nanocoder-v1 to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for usernamebetter/nanocoder-v1 to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for usernamebetter/nanocoder-v1 to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="usernamebetter/nanocoder-v1", max_seq_length=2048, )
NanoCoder V1 π§ β‘
A 4B parameter full-stack coding assistant fine-tuned from Qwen3-4B using Unsloth + LoRA. Trained through a multi-phase pipeline with joint domain training and validation-driven checkpoint selection.
Best checkpoint: step 150 β combined score 73.6% across all skill domains.
π Benchmarks
| Benchmark | Score | Notes |
|---|---|---|
| HumanEval pass@1 | 49.4% | 164 problems, executed against test cases |
| LiveCodeBench | 13.3% | Execution eval on 30 problems (public tests) |
| Frontend (custom) | 58.3% | React, Next.js, TypeScript, Tailwind, a11y |
| Backend (custom) | 87.5% | FastAPI, Express, PostgreSQL, JWT, MongoDB |
| Agent (custom) | 75.0% | Thought β Action β Patch β Reasoning format |
| Combined | 73.6% | Averaged across skill domains |
π― What it does well
- Backend β API design, auth (JWT/bcrypt), SQL/NoSQL, N+1 fixes, CORS
- Debugging agent β structured reasoning (
### Thought β ### Action β ### Patch β ### Reasoning) - Full-stack integration β connects frontend + backend flows
- Bug pattern recognition β race conditions, memory leaks, type errors
β οΈ Known limitations
- Frontend scores lower than backend (weakest domain in v1)
- Not a replacement for larger models (7B+) on hard competitive programming
- English-only
π Usage
from unsloth import FastLanguageModel
model, tokenizer = FastLanguageModel.from_pretrained(
model_name="usernamebetter/nanocoder-v1",
max_seq_length=2048,
load_in_4bit=True,
)
FastLanguageModel.for_inference(model)
SYSTEM = "You are NanoCoder, an expert Senior Full-Stack Engineer and debugging agent."
prompt = (
f"<|im_start|>system\n{SYSTEM}<|im_end|>\n"
f"<|im_start|>user\nFix this React hydration error: useState(Date.now())<|im_end|>\n"
f"<|im_start|>assistant\n"
)
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens=300, do_sample=False)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
ποΈ Training pipeline
Multi-phase joint training from Qwen3-4B base:
- Phase 1 β General coding (Magicoder-Evol-Instruct)
- Phase 2 β Frontend specialization
- Phase 3 β Fullstack (frontend + backend interleaved)
- Phase 4 β Agent reasoning training
- Final β Joint retrain from base with all domains mixed (this checkpoint)
Training configuration
- Base: Qwen3-4B (4-bit quantized)
- LoRA: r=32, alpha=32, dropout=0
- LR: 1e-5 with cosine scheduler
- Steps: 400 (best checkpoint at step 150)
- Batch: 2 Γ grad accum 4 = effective 8
- Optimizer: adamw_8bit
- Dataset: ~13.7k samples interleaved
- π€ Agent (synthetic + real): 40%
- π¨ Frontend: 35%
- βοΈ Backend: 15%
- π Bug fixing: 10%
Data sources
- ise-uiuc/Magicoder-Evol-Instruct-110K
- sahil2801/CodeAlpaca-20k
- nickrosh/Evol-Instruct-Code-80k-v1
- iamtarun/code_instructions_120k_alpaca
- m-a-p/CodeFeedback-Filtered-Instruction
- bigcode/self-oss-instruct-sc2-exec-filter-50k
- HuggingFaceH4/CodeAlpaca_20K
- TokenBender/code_instructions_122k_alpaca_style
- Custom synthetic agent examples with structured reasoning format
π§ͺ Prompt format
Uses Qwen chat template:
<|im_start|>system
You are NanoCoder, an expert Senior Full-Stack Engineer and debugging agent.
<|im_end|>
<|im_start|>user
{your question}
<|im_end|>
<|im_start|>assistant
For debugging tasks, the model responds in structured format:
### Thought:
{root cause analysis}
### Action:
{what to do}
### Patch:
{code fix}
### Reasoning:
{why it works}
π Roadmap
- β v1: Joint multi-domain training (this release)
- π§ v2: Frontend boost + reasoning domain + label smoothing + cosine restarts
- π§ v3: DPO alignment + tool calling
- π§ GGUF: Q4_K_M / Q5_K_M / Q8_0 exports
π Credits
- Base model: Qwen/Qwen3-4B
- Fine-tuning framework: Unsloth
- Training: Kaggle T4 + Google Colab T4
π License
Apache-2.0 (inherited from Qwen3-4B base).
- Downloads last month
- 225