This is the coder branch of the SakThai family: small, offline-capable, and tuned to write code while still supporting tool-style outputs. It is packaged as a single GGUF file so you can run it on a laptop CPU without any GPU.
Nanthasit/sakthai-coder-1.5b is a fine-tuned Qwen2.5-Coder-1.5B-Instruct model optimized for:llama.cpp./llama-server -m qwen2.5-coder-1.5b-instruct-q4_k_m.gguf --n-gpu-layers 0 -c 4096 --temp 0.2 -ngl 01import requests
2
3response = requests.post(
4 "http://localhost:8080/completion",
5 json={
6 "prompt": "Write a Python binary search for a sorted list:",
7 "n_predict": 512,
8 "temperature": 0.2,
9 "top_p": 0.9,
10 },
11)
12print(response.json()["content"])llama-cpp-python1from llama_cpp import Llama
2
3llm = Llama(
4 model_path="qwen2.5-coder-1.5b-instruct-q4_k_m.gguf",
5 n_ctx=4096,
6 n_threads=4,
7)
8
9out = llm(
10 "Write a Python decorator that retries a function 3 times.",
11 max_tokens=512,
12 temperature=0.2,
13 top_p=0.9,
14)
15print(out["choices"][0]["text"])<tools> block when you want tool-calling JSON outputs.llama.cpp Q4_K_M on CPU. Each item is run from repo-local eval artifacts and SakThai trust-pass checks.| Task | Metric | Value | Notes |
|---|---|---|---|
| Tool Calling | Valid JSON rate | 100% | requires proper <tools> prompt format |
| Tool Selection | Selection accuracy | 91.2% | SakThai Bench v2, multi-set scorer |
| Code: factorial | pass | true | verified |
| Code: debugging | pass | true | verified |
| Code: async_explain | pass | true | verified |
| Code: refactor | pass | true | verified |
| Code: primes | pass | true | verified |
| MBPP reference | pass@1 | 71.2% | base-model reference point |
| Speed (CPU) | throughput | ~9–10 tok/s | 1.1 GB GGUF, 2 threads |
| Parameter | Value |
|---|---|
| Base model | Qwen/Qwen2.5-Coder-1.5B-Instruct |
| Training data | sakthai-combined-v6, sakthai-combined-v7, sakthai-bench-v2, sakthai-irrelevance-supplement |
| License | Apache 2.0 |
| Hardware | Free CPU/Colab sessions |
| Budget | $0 |
| Optimizer | AdamW |
| Learning rate | 5e-5 with warmup |
| Epochs | 3 |
| Batch size | 8 |
| GGUF quant | Q4_K_M via llama.cpp |
<tools> prompt block is present; without it, the model may answer directly instead of emitting a call.1@misc{sakthai-coder-1.5b,
2 title = {SakThai Coder 1.5B: Code Generation and Tool Calling on CPU},
3 author = {Nanthasit},
4 year = {2026},
5 url = {https://huggingface.co/Nanthasit/sakthai-coder-1.5b}
6}1git clone https://huggingface.co/Nanthasit/sakthai-coder-1.5b
2cd sakthai-coder-1.5b
3uv venv && uv pip install transformers datasets peft accelerate llama-cpp-python requests| Runtime | Command / Notes |
|---|---|
| llama-server | ./llama-server -m qwen2.5-coder-1.5b-instruct-q4_k_m.gguf --n-gpu-layers 0 -c 4096 |
| Ollama | ollama run ./qwen2.5-coder-1.5b-instruct-q4_k_m.gguf |
| llama-cpp-python | See llama_cpp.Llama example in this README |
| HF InferenceClient | Use a local endpoint; serverless hosting may not serve this GGUF repo directly |
| Transformers | Best for unquantized weights; this artifact is optimized for GGUF/CPU |