Table of Contents
Model Description
Key characteristics:
- Tool-selection accuracy: 93.1% on
sakthai-bench-v2 (multi-turn), verified.
- Format correctness: 100% valid JSON/XML tool-call formatting under multi-turn dialogue.
- Dialogue completion: 97.8% success rate on multi-turn benchmark scenarios.
- LoRA adapter only: lightweight patch for the base 0.5B model.
- Better instruction following: SFT improves adherence without catastrophic forgetting.
Architecture & Config
- Base model: Qwen2.5-0.5B (
Nanthasit/sakthai-context-0.5b-tools)
- Adapter type: LoRA via PEFT
- Target modules: verified from
adapter_config.json
- Rank: r=16
- Context window: inherits base context length
- Tokenizer:
AutoTokenizer from base repo, plus chat_template.jinja
Training Details
- Method: supervised fine-tuning with TRL
SFTTrainer
- Adapters: PEFT LoRA on Qwen2.5 attention/MLP projections
- Datasets:
Nanthasit/sakthai-combined-v7
Nanthasit/sakthai-irrelevance-supplement
- Hardware: CPU / zero-cost workflow; no paid GPU used
- Framework:
transformers, trl, peft, uv
- Artifacts:
adapter_config.json, , , ,
How to Use
Load with PeftModel (recommended)
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
base = "Nanthasit/sakthai-context-0.5b-tools"
adapter = "Nanthasit/sakthai-context-0.5b-tools-sft-v2"
tokenizer = AutoTokenizer.from_pretrained(base)
model = AutoModelForCausalLM.from_pretrained(base, device_map="auto")
model = PeftModel.from_pretrained(model, adapter)
messages = [
{"role": "user", "content": "What's the weather in Tokyo?"},
{"role": "assistant", "content": '<tools>{"function": "get_weather", "params": {"location": "Tokyo"}}</tools>'},
{"role": "user", "content": "And in Bangkok?"},
]
inputs = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt")
outputs = model.generate(inputs, max_new_tokens=128, temperature=0.3)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Reproducible CPU baseline
from transformers import AutoModelForCausalLM, AutoTokenizer
base = AutoModelForCausalLM.from_pretrained(
"Nanthasit/sakthai-context-0.5b-tools",
device_map="cpu",
)
model = PeftModel.from_pretrained(base, "Nanthasit/sakthai-context-0.5b-tools-sft-v2")
tokenizer = AutoTokenizer.from_pretrained("Nanthasit/sakthai-context-0.5b-tools")
model.eval()
prompt = tokenizer.apply_chat_template(
[{"role": "user", "content": "Set a reminder for 3pm"}],
add_generation_prompt=True,
return_tensors="pt",
)
out = model.generate(prompt, max_new_tokens=128, temperature=0.3, top_p=0.9)
print(tokenizer.decode(out[0], skip_special_tokens=True))
Reproduce Evaluation
git clone https://huggingface.co/Nanthasit/sakthai-pipeline
cd sakthai-pipeline
uv run scripts/run-eval.py --model Nanthasit/sakthai-context-0.5b-tools-sft-v2 --publish
Expected artifact: .eval_results/cron-eval-*.yaml with status: success and the three verified metrics above.
Reproduce Training / Merge
git clone https://huggingface.co/Nanthasit/sakthai-context-0.5b-tools-sft-v2
cd sakthai-context-0.5b-tools-sft-v2
uv run python - <<'PY'
from peft import PeftModel
from transformers import AutoModelForCausalLM
base = AutoModelForCausalLM.from_pretrained("Nanthasit/sakthai-context-0.5b-tools", device_map="auto")
model = PeftModel.from_pretrained(base, "./")
model.merge_and_save("./merged-sft-v2")
PY
SakThai Model Family
Table with columns: Repo, Type, Downloads, Verified| Repo | Type | Downloads | Verified |
|---|
| Nanthasit/sakthai-context-0.5b-tools | base 0.5B | fetched from API | bench-v2 verified |
| Nanthasit/sakthai-context-0.5b-tools-sft-v2 | adapter SFT v2 | fetched from API | bench-v2 verified |
| Nanthasit/sakthai-context-0.5b-tools-sft | adapter SFT v1 | fetched from API | if available |
| Nanthasit/sakthai-context-0.5b-merged | merged 0.5B | fetched from API |
Limitations
- Adapter-only artifact: weights depend on the base model revision
b696deb3fc45aca1e54ffc20abae1437054052ec.
- Use temperature
<= 0.3 to reduce tool-format drift at inference.
- Serverless inference may return
400 model_not_supported; prefer local/CPU inference for adapters.
- Merging requires sufficient RAM for the base model footprint.
Citation
@misc{sakthai-context-0.5b-tools-sft-v2,
title = {SakThai Context 0.5B Tools SFT v2},
author = {Beer / SakThai Agent},
year = {2026},
url = {https://huggingface.co/Nanthasit/sakthai-context-0.5b-tools-sft-v2}
}