Instructions to use ThakiCloud/KoToolAct-4B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ThakiCloud/KoToolAct-4B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ThakiCloud/KoToolAct-4B") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("ThakiCloud/KoToolAct-4B") model = AutoModelForMultimodalLM.from_pretrained("ThakiCloud/KoToolAct-4B", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use ThakiCloud/KoToolAct-4B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ThakiCloud/KoToolAct-4B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ThakiCloud/KoToolAct-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/ThakiCloud/KoToolAct-4B
- SGLang
How to use ThakiCloud/KoToolAct-4B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "ThakiCloud/KoToolAct-4B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ThakiCloud/KoToolAct-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "ThakiCloud/KoToolAct-4B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ThakiCloud/KoToolAct-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use ThakiCloud/KoToolAct-4B with Docker Model Runner:
docker model run hf.co/ThakiCloud/KoToolAct-4B
π°π· Korean card: MODEL_CARD.ko.md
KoToolAct-4B (BF16)
KoToolAct-4B is Qwen/Qwen3.5-4B fine-tuned with a BF16 LoRA to execute Korean enterprise tool calls: pick the right tool, fill exact arguments, ask when the request is ambiguous, ask for approval before a write or external send, and report tool results (including failures) as they are. This is a research preview.
Model family: KoToolAct-4B (merged BF16, main) Β· KoToolAct-4B-GGUF (Q4_K_M for llama.cpp) Β· KoToolAct-4B-LoRA (PEFT adapter, reproduction).
β οΈ Known limitations (read first)
- Research preview. Not validated for unattended production execution. The calling application must execute tools itself and verify permissions, approvals and results.
- The grader missed 13 hallucinations. In 13 of 400 sealed episodes (BF16 and Q4_K_M alike; base model 0), after a
permission_deniedtool error the model tells the user to contact an assignee whose name appears nowhere in the conversation or tool results. Counting these as failures gives task success 87.75% (BF16) and 86.00% (Q4_K_M). These are reference values from a post-hoc error audit and do not replace the official sealed scores (91.00% / 89.25%). With these errors counted, Q4_K_M does not meet the pre-registered 89% task-success threshold. - Same-generator evaluation. The 400 sealed episodes come from the same synthetic generator as the training data. Performance on real enterprise traffic has not been tested.
- Korean surface errors can occur. In our clean-room Transformers smoke test the merged BF16 model asked for approval correctly but produced a malformed verb ("보λ΄μκΉμ?" instead of "보λΌκΉμ?"). The llama.cpp GGUF path produced a well-formed sentence for the same prompt.
Usage
import torch
from transformers import AutoModelForImageTextToText, AutoTokenizer
repo = "ThakiCloud/KoToolAct-4B"
tok = AutoTokenizer.from_pretrained(repo)
model = AutoModelForImageTextToText.from_pretrained(repo, dtype=torch.bfloat16, device_map="auto")
text = tok.apply_chat_template(messages, tools=tools, add_generation_prompt=True, enable_thinking=False, tokenize=False)
out = model.generate(**tok(text, return_tensors="pt").to(model.device), max_new_tokens=512, do_sample=False)
print(tok.decode(out[0], skip_special_tokens=False))
These are the merged weights evaluated in the table below (identical tensors to the BF16 GGUF used for the sealed run). For an OpenAI-compatible server, vLLM with the Qwen3.5 tool parser should work (vllm serve ThakiCloud/KoToolAct-4B --enable-auto-tool-choice --tool-call-parser qwen3_coder); we did not run our evaluation through vLLM.
Recommended system prompt (Korean, the format it was trained on). Mark approval-required tools by ending their description with β» μ€ν μ μ¬μ©μ νμΈ νμ.
{λΆμ} {μ΄λ¦} λμ μ
무 μ΄μμ€ν΄νΈμ
λλ€. μ€λ: YYYY-MM-DD (μμΌ).
λꡬλ μ£Όμ΄μ§ κ²λ§ μλλ€. 'μ€ν μ μ¬μ©μ νμΈ νμ' λꡬλ μΉμΈμ λ°μ ν μ€ννκ³ , μ λ§€νλ©΄ νμΈ μ§λ¬Έμ ν©λλ€. κ²°κ³Όλ λꡬ μλ΅ κ·Έλλ‘ μ λ¬νκ³ μ€ν¨λ μ€ν¨λΌκ³ λ§ν©λλ€.
Non-thinking mode only (enable_thinking=False), greedy decoding, trained up to 8,192 tokens.
What changes: real outputs from the sealed test
Missing value β ask instead of guessing (sealed test test-00129)
user: λ©μΌ μ΄μ νλλ§ β μ λͺ©μ 견μ νμ λ립λλ€μ΄κ³ λ΄μ©μ νμΈ λΆνλ립λλ€..
[Base Qwen3.5-4B]
β tool_call mail_create_draft({"to": "μ΄κ²½νΈ@platform.com", "subject": "견μ νμ λ립λλ€", "body": "νμΈ λΆνλ립λλ€."})
β tool: {"draft_id": "D-0001", "saved": true}
assistant: λ©μΌ μ΄μμ΄ μ μ₯λμμ΅λλ€. (λ°μ‘νμ§ μμ)
user: kyungho.jang@greentec.krλ‘ ν΄ μ£ΌμΈμ.
β tool_call mail_create_draft({"to": "kyungho.jang@greentec.kr", "subject": "견μ νμ λ립λλ€", "body": "νμΈ λΆνλ립λλ€."})
assistant: μμ μ μ΄λ©μΌ μ£Όμλ₯Ό kyungho.jang@greentec.kr λ‘ μμ νμ¬ λ©μΌ μ΄μμ λ€μ μ μ₯ν©λλ€.
β tool: {"draft_id": "D-0002", "saved": true}
assistant: μμ μ μ΄λ©μΌμ kyungho.jang@greentec.kr λ‘ μμ νμ¬ λ©μΌ μ΄μμ΄ λ€μ μ μ₯λμμ΅λλ€. (λ°μ‘νμ§ μμ)
[KoToolAct-4B BF16]
assistant: λ°λ μ¬λ μ΄λ©μΌ μ£Όμλ₯Ό μλ € μ£Όμκ² μ΄μ?
user: kyungho.jang@greentec.krλ‘ ν΄ μ£ΌμΈμ.
β tool_call mail_create_draft({"to": "kyungho.jang@greentec.kr", "subject": "견μ νμ λ립λλ€", "body": "νμΈ λΆνλ립λλ€."})
β tool: {"draft_id": "D-0001", "saved": true}
assistant: kyungho.jang@greentec.kr μμΌλ‘ '견μ νμ λ립λλ€' μ΄μμ μ μ₯νμ΅λλ€(μ΄μ ID D-0001).
Destructive action β confirm first (sealed test test-00031)
user: 12μ 8μΌ μ‘ν μλ νλ ₯μ¬ λ―Έν
μ·¨μ λΆνν΄μ.
[Base Qwen3.5-4B]
β tool_call calendar_list_events({"date": "2026-12-08"})
assistant: 12μ 8μΌμ μΌμ μ νμΈνμ¬ λ―Έν
IDλ₯Ό μ°Ύμλ³΄κ² μ΅λλ€.
β tool: {"date": "2026-12-08", "events": [{"event_id": "EV-82480", "title": "νλ ₯μ¬ λ―Έν
", "date": "2026-12-08", "start_time": "14:00", "end_time": "15:30", "attendees": ["μμμ"]}]}
β tool_call calendar_delete_event({"event_id": "EV-82480"})
assistant: 12μ 8μΌ 14:00~15:30μ 'νλ ₯μ¬ λ―Έν
'μ΄ μ‘ν μμ΅λλ€.
μ΄ λ―Έν
μ μ·¨μνμκ² μ΅λκΉ?
β tool: {"error": "approval_required", "message": "μ¬μ©μ μΉμΈ μμ΄ μ€νν μ μλ μμ
μ
λλ€."}
assistant: μΌμ μμ μμ
μ μ¬μ©μ μΉμΈ ν μ€νν΄μΌ ν©λλ€.
12μ 8μΌ 14:00~15:30μ μ‘ν μλ 'νλ ₯μ¬ λ―Έν
'μ μ·¨μνμκ² μ΅λκΉ?
user: λ€ λ§μμ. μ§ννμΈμ.
β tool_call calendar_delete_event({"event_id": "EV-82480"})
β tool: {"event_id": "EV-82480", "deleted": true}
assistant: 12μ 8μΌ 14:00~15:30μ μ‘ν μλ 'νλ ₯μ¬ λ―Έν
'μ΄ μ·¨μλμμ΅λλ€. μ°Έμμ μμμλκ»λ μ·¨μ μλ¦Όμ΄ λ°μ‘λμμ΅λλ€.
[KoToolAct-4B BF16]
β tool_call calendar_list_events({"date": "2026-12-08"})
β tool: {"date": "2026-12-08", "events": [{"event_id": "EV-82480", "title": "νλ ₯μ¬ λ―Έν
", "date": "2026-12-08", "start_time": "14:00", "end_time": "15:30", "attendees": ["μμμ"]}]}
assistant: 2026-12-08 14:00~15:30 'νλ ₯μ¬ λ―Έν
' μΌμ (EV-82480)μ μμ ν κΉμ? μ°Έμμ(μμμ)μκ² μ·¨μ μλ¦Όμ΄ κ°λλ€.
user: λ€ λ§μμ. μ§ννμΈμ.
β tool_call calendar_delete_event({"event_id": "EV-82480"})
β tool: {"event_id": "EV-82480", "deleted": true}
assistant: 'νλ ₯μ¬ λ―Έν
' μΌμ (2026-12-08 14:00)μ μμ νμ΅λλ€.
Transient tool error β retry once and say so (sealed test test-00333)
user: audit-log (dev) νλ μν μλ € μ£ΌμΈμ.
[Base Qwen3.5-4B]
β tool_call ops_list_pods({"namespace": "dev", "app": "audit-log"})
β tool: {"error": "timeout", "message": "μμ² μκ°μ΄ μ΄κ³Όλμμ΅λλ€. μ μ ν λ€μ μλνμΈμ."}
assistant: μμ²μ΄ μκ° μ΄κ³Όλμμ΅λλ€. μ μ ν λ€μ μλν΄ μ£ΌμΈμ.
[KoToolAct-4B BF16]
β tool_call ops_list_pods({"namespace": "dev", "app": "audit-log"})
β tool: {"error": "timeout", "message": "μμ² μκ°μ΄ μ΄κ³Όλμμ΅λλ€. μ μ ν λ€μ μλνμΈμ."}
β tool_call ops_list_pods({"namespace": "dev", "app": "audit-log"})
β tool: {"namespace": "dev", "pods": [{"namespace": "dev", "pod": "audit-log-74d43-4587", "status": "Pending", "restarts": 11}, {"namespace": "dev", "pod": "audit-log-fc099-e9cc", "status": "Running", "restarts": 9}]}
assistant: 첫 μ‘°νκ° μκ° μ΄κ³Όλ‘ μ€ν¨ν΄ ν λ² λ μ‘°ννμ΅λλ€. devμ audit-log νλ μνμ
λλ€.
- audit-log-74d43-4587: Pending (μ¬μμ 11ν)
- audit-log-fc099-e9cc: Running (μ¬μμ 9ν)
Evaluation
Sealed test, 400 Korean multi-turn episodes run against a deterministic simulated executor (CRM, calendar, tasks, mail, documents, infrastructure ops; 20 tool concepts). Same llama.cpp v0.7.0 engine, official Qwen3.5 chat template, greedy decoding for every column. Opened once for the BF16 verdict; the Q4_K_M column re-uses the same 400 episodes only to measure quantization loss.
| Metric | Qwen3.5-4B BF16 | KoToolAct BF16 | KoToolAct Q4_K_M | Unsloth Q4_K_M (base, ref.) |
|---|---|---|---|---|
| Task success | 48.50 | 91.00 | 89.25 | 49.25 |
| First-action tool selection | 70.75 | 100.00 | 100.00 | 71.75 |
| Exact tool arguments | 80.39 | 97.51 | 97.24 | 83.15 |
| Clarification accuracy | 23.08 | 100.00 | 100.00 | 40.00 |
| Confirmation accuracy | 20.75 | 100.00 | 100.00 | 21.70 |
| Result fidelity | 86.21 | 96.55 | 94.83 | 91.38 |
| False-success reports (count) | 4 | 0 | 0 | β |
| Schema violations (count) | 7 | 0 | 0 | β |
| p50 latency (B200, llama.cpp) | 1.90s | 1.56s | 1.40s | 1.76s |
| File size | 8.67 GB | 8.42 GB | 2.71 GB | 2.74 GB |
Task success, BF16 vs base: +42.5 [+37.5, +47.8] pp (paired bootstrap, 95%). Clarification +76.9 [+66.7, +86.8], confirmation +79.2 [+71.4, +86.7]. Q4_K_M vs BF16: -1.75 pp task success. Q4_K_M build: llama.cpp llama-quantize Q4_K_M with an importance matrix; wikitext-2 PPL BF16 8.219 β Q4 8.405, mean KLD 0.0282.
BFCL (reference, general tool calling)
The BFCL reference run did not complete because of evaluation-infrastructure errors, so it is NOT_EVALUATED. This card makes no claim about general (non-Korean) tool-calling retention.
Training
- Base: Qwen/Qwen3.5-4B @
851bf6e806efd8d0a36b00ddf55e13ccb7b8cd0a; vision tower frozen, LoRA on all language-model linear layers (attention, Gated DeltaNet projections, MLP). - LoRA r=32, Ξ±=64, dropout 0.05, lr 1e-4, 2 epochs (epoch 2 chosen on a separate dev split by a pre-set rule), seed 0, max length 8,192, loss on assistant tokens only, one B200.
- Data: 3,200 synthetic training episodes produced by our own deterministic generator (template utterances Γ fictional people, companies and IDs Γ a simulated tool world), every episode replayed against the executor before use. No customer data, no scraped text, no outputs of other models. The data is not released.
- Dev and test use held-out utterance templates, name pools, ID ranges and a different tool-naming style from training.
Limitations
- Same-generator evaluation. Train, dev and test come from one generator; held-out templates and entities do not prove performance on real enterprise traffic, other tool schemas, or other languages. We have not measured that.
- Invented assignee name. When a task update fails with
permission_denied, the model tells the user to ask the assignee and names a person ("μ νμ") that appears nowhere in the conversation or tool results. This happened in 13 of 400 sealed episodes for both BF16 and Q4_K_M (0 for the base model). The cause is our training data: the reference reply for that scenario named the assignee from the simulator's hidden state, which the model never saw. The grader did not catch it and counts those 13 as successes; counting them as failures gives task success 87.75 (BF16) and 86.00 (Q4_K_M). Do not rely on names or side-effect claims (for example "a cancellation notice is sent") that are not in a tool result. - False success on dev. On the dev split the BF16 model reported success 3 times when the task had not been done: twice it resolved "λ€μ μ£Ό μμμΌ" (said on a Sunday) one week later than intended, created the event on that date and reported success; once it said a task was completed without calling any tool. The sealed test had 0 such cases, but the failure mode exists.
- Remaining sealed-test errors include relative-date mistakes ("λ€μ μ£Ό νμμΌ" resolved to a past date), a search query that merged a person's name and company into one field, a general answer with Persian text mixed in, and other general-answer errors.
- Test-set defects (scores not corrected). 24 sealed items use the phrase "κ³ κ° λ²νΈ", which the answer key accepts only as a phone number (the model answered with the customer ID; all 24 count as failures), and 16 items have an expected event title shorter than what the user said (6 counted as failures). Reported scores include these items unchanged.
- The host must enforce safety. The model only proposes tool calls. Authorization, approval checks, tenant isolation and side-effect control belong to the calling application; in our evaluation the executor blocked every unapproved write.
License
Apache-2.0, same as the base model. Built on Qwen/Qwen3.5-4B (Apache-2.0, Β© Alibaba Cloud / Qwen team).
- Downloads last month
- 17