Text Generation
Transformers
Safetensors
English
Chinese
k2_horizon
k2-horizon
0.9b
dense
reasoning
knowledge-distillation
ifm
conversational
custom_code
Instructions to use IFM/K2-Horizon-0.9B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use IFM/K2-Horizon-0.9B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="IFM/K2-Horizon-0.9B", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("IFM/K2-Horizon-0.9B", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use IFM/K2-Horizon-0.9B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "IFM/K2-Horizon-0.9B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "IFM/K2-Horizon-0.9B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/IFM/K2-Horizon-0.9B
- SGLang
How to use IFM/K2-Horizon-0.9B 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 "IFM/K2-Horizon-0.9B" \ --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": "IFM/K2-Horizon-0.9B", "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 "IFM/K2-Horizon-0.9B" \ --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": "IFM/K2-Horizon-0.9B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use IFM/K2-Horizon-0.9B with Docker Model Runner:
docker model run hf.co/IFM/K2-Horizon-0.9B
Update README.md
Browse files
README.md
CHANGED
|
@@ -37,7 +37,7 @@ model-index:
|
|
| 37 |
metrics:
|
| 38 |
- type: accuracy
|
| 39 |
name: avg@16
|
| 40 |
-
value: 0.
|
| 41 |
- task:
|
| 42 |
type: text-generation
|
| 43 |
name: Code Generation
|
|
@@ -64,7 +64,7 @@ model-index:
|
|
| 64 |
type: livecodebench_v6
|
| 65 |
metrics:
|
| 66 |
- type: pass@1
|
| 67 |
-
value: 0.
|
| 68 |
- task:
|
| 69 |
type: text-generation
|
| 70 |
name: General Knowledge / Reasoning
|
|
@@ -160,7 +160,18 @@ K2-Horizon-0.9B is the compact dense member of the K2-Horizon family: a 0.9B-cla
|
|
| 160 |
| BFCL v4 | **28.0** | 25.3 | 25.15 | 43.6 |
|
| 161 |
|
| 162 |
|
| 163 |
-
## Model
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 164 |
|
| 165 |
| Property | Value |
|
| 166 |
|---|---|
|
|
@@ -179,7 +190,16 @@ The `main` revision publishes `K2HorizonForCausalLM`,
|
|
| 179 |
`modeling_k2_horizon.py` modules. The Transformers and vLLM preflights below
|
| 180 |
validate that public contract before loading weights.
|
| 181 |
|
| 182 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 183 |
|
| 184 |
Training examples were routed to a math-and-code teacher, a STEM teacher, or
|
| 185 |
an instruction-following teacher through the example's `opd_domain` metadata.
|
|
@@ -197,7 +217,7 @@ to 131,072 tokens. The `mid1_75k` and `mid2_47k` repository revisions preserve
|
|
| 197 |
the corresponding intermediate checkpoints. The distilled release checkpoint
|
| 198 |
is on `main`; all stages use a vocabulary of 64,256 tokens.
|
| 199 |
|
| 200 |
-
##
|
| 201 |
|
| 202 |
K2-Horizon-0.9B begins with a task-arithmetic merge of three specialist
|
| 203 |
checkpoints. mOPD then trains that merged student against math-and-code, STEM,
|
|
@@ -212,8 +232,7 @@ submetric over the pre-distillation merge. This makes the model useful for
|
|
| 212 |
research on compact reasoning models, local inference, distillation, and
|
| 213 |
task-specific adaptation.
|
| 214 |
|
| 215 |
-
|
| 216 |
-
## How to Use
|
| 217 |
|
| 218 |
K2-Horizon-0.9B emits a reasoning segment before its final answer when the
|
| 219 |
chat template is used. The template supports `reasoning_effort` values `high`,
|
|
@@ -227,7 +246,7 @@ IFBench used `temperature=0.8`. Long math and coding tasks may require several
|
|
| 227 |
thousand output tokens; choose limits from application measurements rather
|
| 228 |
than treating an evaluation limit as a universal default.
|
| 229 |
|
| 230 |
-
###
|
| 231 |
|
| 232 |
The validated serving image was reconstructed into the following manual
|
| 233 |
runtime contract:
|
|
@@ -349,7 +368,7 @@ print(message.content)
|
|
| 349 |
|
| 350 |
</details>
|
| 351 |
|
| 352 |
-
###
|
| 353 |
|
| 354 |
Native K2 Horizon support is provided by
|
| 355 |
[sgl-project/sglang#37654](https://github.com/sgl-project/sglang/pull/37654).
|
|
@@ -387,7 +406,7 @@ This uses SGLang's native `K2HorizonForCausalLM` implementation; no
|
|
| 387 |
8,192-token limit is a conservative starting point; increase it only after
|
| 388 |
measuring KV-cache capacity.
|
| 389 |
|
| 390 |
-
###
|
| 391 |
|
| 392 |
The checkpoint can also be loaded directly from the Hugging Face repository.
|
| 393 |
Its `configuration_k2_horizon.py` and `modeling_k2_horizon.py` files are loaded
|
|
@@ -465,7 +484,7 @@ print(tokenizer.decode(new_tokens, skip_special_tokens=True))
|
|
| 465 |
|
| 466 |
</details>
|
| 467 |
|
| 468 |
-
## Hardware
|
| 469 |
|
| 470 |
The BF16 weights occupy approximately 2.0 GiB. One CUDA GPU is sufficient for
|
| 471 |
short-context inference; 8 GiB is a practical minimum for a one-request smoke
|
|
@@ -475,7 +494,7 @@ tokens and approximately 7 GiB at 131,072 tokens, before allocator, activation,
|
|
| 475 |
CUDA-graph, and framework overhead. Start with a short context and one sequence,
|
| 476 |
then increase context length and concurrency from measured memory headroom.
|
| 477 |
|
| 478 |
-
##
|
| 479 |
|
| 480 |
The model repository stores the checkpoint directly at its root. It includes:
|
| 481 |
|
|
@@ -488,7 +507,7 @@ Use `chat_template.jinja` for ordinary chat and OpenAI-compatible serving.
|
|
| 488 |
`chat_template_generation.jinja` and `chat_template_asst_tool_gen.jinja` are
|
| 489 |
specialized generation and assistant-tool-generation variants.
|
| 490 |
|
| 491 |
-
##
|
| 492 |
|
| 493 |
- **Training:** multi-teacher on-policy distillation with OPD loss weight 0.1,
|
| 494 |
reference-KL weight 0.01, learning rate `1e-7`, and a 500-step schedule. The
|
|
@@ -501,4 +520,36 @@ specialized generation and assistant-tool-generation variants.
|
|
| 501 |
matched. The architecture label was later updated from `XllmForCausalLM` to
|
| 502 |
`K2HorizonForCausalLM` without changing the weights.
|
| 503 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 504 |
|
|
|
|
|
|
| 37 |
metrics:
|
| 38 |
- type: accuracy
|
| 39 |
name: avg@16
|
| 40 |
+
value: 0.417
|
| 41 |
- task:
|
| 42 |
type: text-generation
|
| 43 |
name: Code Generation
|
|
|
|
| 64 |
type: livecodebench_v6
|
| 65 |
metrics:
|
| 66 |
- type: pass@1
|
| 67 |
+
value: 0.3741
|
| 68 |
- task:
|
| 69 |
type: text-generation
|
| 70 |
name: General Knowledge / Reasoning
|
|
|
|
| 160 |
| BFCL v4 | **28.0** | 25.3 | 25.15 | 43.6 |
|
| 161 |
|
| 162 |
|
| 163 |
+
## Model Series Overview
|
| 164 |
+
|
| 165 |
+
K2-Horizon spans compact and larger dense models for transparent foundation-model research, staged checkpoint analysis, and practical deployment. The repositories share a common release structure while preserving model-specific training and serving guidance.
|
| 166 |
+
|
| 167 |
+
| Model | Architecture | Parameters | Context length | Intended use |
|
| 168 |
+
| --- | --- | ---: | ---: | --- |
|
| 169 |
+
| **K2-Horizon-0.9B** | Dense decoder-only | 1.08B including embeddings | 131,072 | Compact reasoning, local inference, and distillation research |
|
| 170 |
+
| K2-Horizon-3.7B | Dense decoder-only | 3.78B core | 524,288 | Efficient research, evaluation, and single-node serving |
|
| 171 |
+
| K2-Horizon-7B | Dense decoder-only | 7B core | 524,288 | General research, fine-tuning, and cost-conscious deployment |
|
| 172 |
+
| K2-Horizon-32B | Dense decoder-only | 32B core | 524,288 | Stronger long-context and reasoning experiments |
|
| 173 |
+
|
| 174 |
+
## This Repository
|
| 175 |
|
| 176 |
| Property | Value |
|
| 177 |
|---|---|
|
|
|
|
| 190 |
`modeling_k2_horizon.py` modules. The Transformers and vLLM preflights below
|
| 191 |
validate that public contract before loading weights.
|
| 192 |
|
| 193 |
+
<!-- ## Checkpoint Revisions
|
| 194 |
+
|
| 195 |
+
| Revision | Stage | Max context |
|
| 196 |
+
| --- | --- | ---: |
|
| 197 |
+
| `main` | Distilled release checkpoint, step 249 | 128K |
|
| 198 |
+
| `mid2_47k` | Second context-extension stage | 128K |
|
| 199 |
+
| `mid1_75k` | First context-extension stage | 40K |
|
| 200 |
+
| Base model | Pre-distillation specialist merge | 8K |
|
| 201 |
+
-->
|
| 202 |
+
## Training Provenance
|
| 203 |
|
| 204 |
Training examples were routed to a math-and-code teacher, a STEM teacher, or
|
| 205 |
an instruction-following teacher through the example's `opd_domain` metadata.
|
|
|
|
| 217 |
the corresponding intermediate checkpoints. The distilled release checkpoint
|
| 218 |
is on `main`; all stages use a vocabulary of 64,256 tokens.
|
| 219 |
|
| 220 |
+
## Training Loss
|
| 221 |
|
| 222 |
K2-Horizon-0.9B begins with a task-arithmetic merge of three specialist
|
| 223 |
checkpoints. mOPD then trains that merged student against math-and-code, STEM,
|
|
|
|
| 232 |
research on compact reasoning models, local inference, distillation, and
|
| 233 |
task-specific adaptation.
|
| 234 |
|
| 235 |
+
## Deployment Guide
|
|
|
|
| 236 |
|
| 237 |
K2-Horizon-0.9B emits a reasoning segment before its final answer when the
|
| 238 |
chat template is used. The template supports `reasoning_effort` values `high`,
|
|
|
|
| 246 |
thousand output tokens; choose limits from application measurements rather
|
| 247 |
than treating an evaluation limit as a universal default.
|
| 248 |
|
| 249 |
+
### vLLM
|
| 250 |
|
| 251 |
The validated serving image was reconstructed into the following manual
|
| 252 |
runtime contract:
|
|
|
|
| 368 |
|
| 369 |
</details>
|
| 370 |
|
| 371 |
+
### SGLang
|
| 372 |
|
| 373 |
Native K2 Horizon support is provided by
|
| 374 |
[sgl-project/sglang#37654](https://github.com/sgl-project/sglang/pull/37654).
|
|
|
|
| 406 |
8,192-token limit is a conservative starting point; increase it only after
|
| 407 |
measuring KV-cache capacity.
|
| 408 |
|
| 409 |
+
### Transformers
|
| 410 |
|
| 411 |
The checkpoint can also be loaded directly from the Hugging Face repository.
|
| 412 |
Its `configuration_k2_horizon.py` and `modeling_k2_horizon.py` files are loaded
|
|
|
|
| 484 |
|
| 485 |
</details>
|
| 486 |
|
| 487 |
+
## Hardware Planning
|
| 488 |
|
| 489 |
The BF16 weights occupy approximately 2.0 GiB. One CUDA GPU is sufficient for
|
| 490 |
short-context inference; 8 GiB is a practical minimum for a one-request smoke
|
|
|
|
| 494 |
CUDA-graph, and framework overhead. Start with a short context and one sequence,
|
| 495 |
then increase context length and concurrency from measured memory headroom.
|
| 496 |
|
| 497 |
+
## Source Code
|
| 498 |
|
| 499 |
The model repository stores the checkpoint directly at its root. It includes:
|
| 500 |
|
|
|
|
| 507 |
`chat_template_generation.jinja` and `chat_template_asst_tool_gen.jinja` are
|
| 508 |
specialized generation and assistant-tool-generation variants.
|
| 509 |
|
| 510 |
+
## Evaluation
|
| 511 |
|
| 512 |
- **Training:** multi-teacher on-policy distillation with OPD loss weight 0.1,
|
| 513 |
reference-KL weight 0.01, learning rate `1e-7`, and a 500-step schedule. The
|
|
|
|
| 520 |
matched. The architecture label was later updated from `XllmForCausalLM` to
|
| 521 |
`K2HorizonForCausalLM` without changing the weights.
|
| 522 |
|
| 523 |
+
## Intended Use
|
| 524 |
+
|
| 525 |
+
K2-Horizon-0.9B is intended for compact reasoning research, local inference, evaluation dry runs, distillation studies, and task-specific adaptation. It is a research release and should be evaluated on representative prompts before deployment.
|
| 526 |
+
|
| 527 |
+
## Limitations and Safety
|
| 528 |
+
|
| 529 |
+
- AIME 2025 remains below the math-and-code teacher, and AIME results have high
|
| 530 |
+
sampling uncertainty because each benchmark contains only 30 problems.
|
| 531 |
+
- GPQA-Diamond is statistically close to the pre-distillation base result, so
|
| 532 |
+
the reported run does not demonstrate a clear STEM improvement.
|
| 533 |
+
- Long-horizon tool use remains substantially weaker than single-turn tool
|
| 534 |
+
calling in the BFCL v4 breakdown.
|
| 535 |
+
- Benchmark scores depend on prompt templates, reasoning effort, sampling
|
| 536 |
+
parameters, framework versions, and evaluation harness details. Validate the
|
| 537 |
+
model on representative prompts before deployment.
|
| 538 |
+
- As with other language models, K2-Horizon-0.9B can produce inaccurate,
|
| 539 |
+
biased, or unsafe text. Applications should use task-specific evaluation,
|
| 540 |
+
input and output controls, monitoring, and human review where appropriate.
|
| 541 |
+
|
| 542 |
+
## Citation
|
| 543 |
+
|
| 544 |
+
```bibtex
|
| 545 |
+
@misc{k2horizon2026,
|
| 546 |
+
title = {Introducing K2 Horizon: Frontier Performance, Radically Open},
|
| 547 |
+
author = {{IFM Team}},
|
| 548 |
+
year = {2026},
|
| 549 |
+
url = {https://ifm.ai/blog/k2/},
|
| 550 |
+
}
|
| 551 |
+
```
|
| 552 |
+
|
| 553 |
+
## Contact
|
| 554 |
|
| 555 |
+
For questions and feedback, open a discussion in this Hugging Face repository or contact the IFM team through the K2-Horizon project channels.
|