Instructions to use K-Ai-Official/Kanata-S2-8B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use K-Ai-Official/Kanata-S2-8B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="K-Ai-Official/Kanata-S2-8B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("K-Ai-Official/Kanata-S2-8B") model = AutoModelForCausalLM.from_pretrained("K-Ai-Official/Kanata-S2-8B", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.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(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use K-Ai-Official/Kanata-S2-8B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "K-Ai-Official/Kanata-S2-8B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "K-Ai-Official/Kanata-S2-8B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/K-Ai-Official/Kanata-S2-8B
- SGLang
How to use K-Ai-Official/Kanata-S2-8B 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 "K-Ai-Official/Kanata-S2-8B" \ --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": "K-Ai-Official/Kanata-S2-8B", "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 "K-Ai-Official/Kanata-S2-8B" \ --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": "K-Ai-Official/Kanata-S2-8B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use K-Ai-Official/Kanata-S2-8B with Docker Model Runner:
docker model run hf.co/K-Ai-Official/Kanata-S2-8B
Kanata S2-8B — Agentic & Coding Intelligence
Kanata S2-8B is K-Ai's second approach to the Kanata agentic model family. It targets tool calling, multi-step problem solving, and coding in Indonesian, Japanese, and English.
"We Build Because We Believe We Can." — K-Ai (Kortex AI)
K-Ai's second approach to Agentic Kanata
| Kanata S1-3B (first approach) | Kanata S2-8B (second approach) | |
|---|---|---|
| Base | IBM Granite 4.1 3B Base | Qwen3-8B |
| Goal | First agentic experiment | Multilingual agent + coding (design goal) |
| Tool-call format | Custom experiment | Native Qwen3/Hermes <tool_call> format (unchanged chat template) |
| Data | ~2.5k samples, mostly synthetic | 2,400 training samples, curated, audited, deduplicated, leak-checked |
| Evaluation | Small preliminary check | Public-benchmark regression check + in-house tool-calling suite |
S1 showed that a small model with a narrow dataset struggles with tool-call format validity, especially in Japanese (0% in our preliminary check). S2 is designed to address this with a stronger base, native tool-call serialization, per-language data coverage, and an explicit dataset audit. Whether fine-tuning improves on the base model is discussed honestly in Benchmarks. S1 remains available as an experimental baseline: K-Ai-Official/Kanata-S1-3B.
Kanata S2 is not a general-purpose model. For general assistance see K-Oss-9-Mini. Both may share a Qwen3-8B foundation but have different data and objectives.
Model details
- Base model: Qwen/Qwen3-8B
- Why the post-trained checkpoint: we first tried Qwen3-8B-Base, but its chat and tool-call special tokens were untrained, so LoRA on attention/MLP could not make it emit tool calls reliably. Kanata S2 therefore starts from the post-trained Qwen3-8B (same license).
- Method: QLoRA (4-bit NF4), LoRA r=16, alpha=32, all attention + MLP projections; merged to 16-bit for this release
- Context during training: 1024 tokens (the base model supports longer context; long-context behavior was not tuned or evaluated here)
- Hardware: single NVIDIA T4 (16 GB), Google Colab
- Training time: 71.1 min, 150 optimizer steps, one pass over the curated subset
- Adapter only: Keanualfahd/Kanata-S2-8B-LoRA
How tool calling works
Kanata S2 only generates tool calls; your agent runtime must execute the tool and return the result in a tool message. The model never executes tools itself. It uses the standard Qwen3 chat template.
from transformers import AutoTokenizer, AutoModelForCausalLM
repo = "K-Ai-Official/Kanata-S2-8B"
tok = AutoTokenizer.from_pretrained(repo); model = AutoModelForCausalLM.from_pretrained(repo, torch_dtype="auto", device_map="auto")
tools = [{"type":"function","function":{"name":"get_weather","description":"Get weather","parameters":{"type":"object","properties":{"city":{"type":"string"}},"required":["city"]}}}]
msgs = [{"role":"user","content":"Cuaca di Bandung sekarang gimana?"}]
ids = tok.apply_chat_template(msgs, tools=tools, add_generation_prompt=True, enable_thinking=False, return_tensors="pt").to(model.device)
print(tok.decode(model.generate(ids, max_new_tokens=128)[0][ids.shape[1]:]))
# -> <tool_call>\n{"name": "get_weather", "arguments": {"city": "Bandung"}}\n</tool_call>
Behaviors trained: tool selection among distractors, valid JSON arguments, asking for missing required arguments, answering directly when no tool is needed, interpreting tool results, and recovering from tool errors.
Training data
All sources were schema-validated. Tool calls were parsed and re-serialized into canonical JSON, exact and near-duplicate prompts were removed, and splits are assigned by hash of the first user prompt so that no prompt appears in more than one split (leakage check: 0 overlaps). The candidate pool was quality-scored per module, then a token-budgeted subset of 2,400 training samples was selected, with Indonesian and Japanese deliberately up-weighted. Full per-source statistics are in dataset_audit.json.
| Module | Dataset | Lang | License | Planned share | Converted / source size |
|---|---|---|---|---|---|
| Agentic tool calling | NousResearch/hermes-function-calling-v1 (4 configs) | en | apache-2.0 | ~26% | 8,403 / 10,337 |
| Agentic (synthetic) | K-Ai generated (see below) | id | K-Ai | ~12% | n/a |
| Agentic (synthetic) | K-Ai generated (see below) | ja | K-Ai | ~12% | n/a |
| Agentic (synthetic) | K-Ai generated (see below) | en | K-Ai | ~5% | n/a |
| Coding | m-a-p/CodeFeedback-Filtered-Instruction | en | apache-2.0 | ~15% | 12,000 / 156,526 |
| Coding | ise-uiuc/Magicoder-OSS-Instruct-75K | en | mit | ~7% | 8,000 / 75,197 |
| General (Japanese) | kunishou/databricks-dolly-15k-ja | ja | cc-by-sa-3.0 | ~11.5% | 6,000 / 15,015 |
| General (Indonesian) | FreedomIntelligence/alpaca-gpt4-indonesian | id | see dataset card | ~11.5% | 6,000 / 49,969 |
| Identity | K-Ai generated (3 samples) | en/id/ja | K-Ai | <1% | n/a |
Training samples by language: English 1,272, Japanese 564, Indonesian 564. Shares are the planned composition. Large sources were randomly subsampled before conversion, and a module with too few usable samples would have been topped up from the agentic modules. Per-module token counts are in dataset_audit.json.
Synthetic agentic data (K-Ai). Template-based generation, validated against tool schemas and deduplicated: tool calls, tool-result interpretation, clarification when required arguments are missing, direct answers when no tool is needed, and error recovery. It was capped, and its phrasing variety in Indonesian and Japanese is limited.
Licensing and contamination notes. Dataset licenses differ (including a share-alike source); verify them before commercial redistribution of data derived from this model's training set. CodeFeedback and Magicoder may overlap with public coding benchmarks.
Benchmarks
1. Regression check against the base model (public benchmarks)
Kanata S2-8B was compared with its base, Qwen3-8B, using lm-evaluation-harness under identical settings. The purpose is to check that tool-calling fine-tuning did not substantially degrade general ability.
| Benchmark (metric) | Qwen3-8B | Kanata S2-8B | Δ (pts) | n |
|---|---|---|---|---|
| Belebele Japanese (acc_norm) | 80.0 ±4.0 | 81.0 ±3.9 | +1.0 | 100 |
| Belebele Indonesian (acc_norm) | 87.0 ±3.4 | 88.0 ±3.3 | +1.0 | 100 |
| MGSM Japanese, direct (exact_match) | 26.0 ±4.4 | 27.0 ±4.5 | +1.0 | 100 |
| GSM8K (exact_match) | 90.0 ±4.8 | 82.5 ±6.1 | -7.5 | 40 |
| MBPP (pass@1) | 75.0 ±6.9 | 65.0 ±7.6 | -10.0 | 40 |
All differences are within statistical noise (±2 standard errors) at these sample sizes. We do not claim improvement over Qwen3-8B on these benchmarks. The lower GSM8K and MBPP point estimates cannot be ruled out as a small regression; larger samples are needed.
Setup: 4-bit (bitsandbytes), fp16 compute, greedy decoding, no chat template, subsets of each test set (n shown). Because no chat template is used, this check does not exercise tool calling. Numbers are not comparable to officially reported scores.
2. In-house tool-calling suite (saturated)
Small in-house evaluation on held-out prompts. Format valid / correct tool name / required arguments complete.
| Language | S1-3B (preliminary, n=4/lang) | Qwen3-8B before fine-tuning (held-out) | Kanata S2-8B (held-out) | Kanata S2-8B (unseen tools) |
|---|---|---|---|---|
| Indonesian | 25% / 25% / 25% | 100% / 100% / 100% | 100% / 100% / 100% (n=12) | 100% / 100% / 100% (n=3) |
| Japanese | 0% / 0% / 0% | 100% / 100% / 100% | 100% / 100% / 100% (n=12) | 100% / 100% / 100% (n=3) |
| English | 25% / 25% / 25% | 100% / 100% / 100% | 100% / 100% / 100% (n=12) | 100% / 100% / 100% (n=3) |
Coding (mini, executed unit tests, Python, 6 problems incl. one debugging task): 6/6 before → 6/6 after fine-tuning.
Both the base and the fine-tuned model score 100%, so this suite is saturated and does not show an improvement from fine-tuning. Held-out = test prompts never seen in training (hash-split), same tool-schema family. Unseen tools = convert_currency, get_stock_price, never used in training. S1 numbers come from a separate small evaluation and are not directly comparable. A harder suite (multiple tools, ambiguous requests, multi-turn, natural Indonesian/Japanese phrasing) is planned.
Not yet evaluated: HumanEval, IFEval, MMLU-style benchmarks, BFCL, long-context tasks, multi-turn agent loops with a real runtime.
Limitations
- Improvement over the base Qwen3-8B has not been demonstrated; the in-house suite is saturated and the public regression check shows no significant difference.
- GSM8K and MBPP point estimates are lower than the base; a small regression is not ruled out.
- Evaluations are small, so confidence intervals are wide.
- Japanese and Indonesian agentic data is largely synthetic and template-based; behavior on unusual phrasing may be weaker than in English.
- Trained at 1024-token sequences; very long tool outputs may degrade quality.
- May produce invalid or wrong arguments; always validate tool calls and sandbox execution (never run model-written code or commands unreviewed with real credentials).
- Not safety-tuned beyond the base model.
License
Released under Apache-2.0, following the license of the base model (Qwen3-8B). Training data licenses vary (see table).
Citation
@misc{kanata_s2_8b_2026,
title = {Kanata S2-8B: Agentic & Coding Intelligence},
author = {K-Ai (Kortex AI)},
year = {2026},
url = {https://huggingface.co/K-Ai-Official/Kanata-S2-8B}
}
- Downloads last month
- 155