hongli-zhan commited on
Commit
8395542
·
verified ·
1 Parent(s): a3c84c2

Model card: benchmark chart, results table, technical appendix

Browse files
Files changed (4) hide show
  1. .gitattributes +1 -0
  2. APPENDIX.md +509 -0
  3. README.md +102 -450
  4. assets/k2-horizon-32b-benchmarks.png +3 -0
.gitattributes CHANGED
@@ -35,3 +35,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
  assets/k2-horizon-32b-training-loss-vs-tokens.png filter=lfs diff=lfs merge=lfs -text
37
  tokenizer.json filter=lfs diff=lfs merge=lfs -text
 
 
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
  assets/k2-horizon-32b-training-loss-vs-tokens.png filter=lfs diff=lfs merge=lfs -text
37
  tokenizer.json filter=lfs diff=lfs merge=lfs -text
38
+ assets/k2-horizon-32b-benchmarks.png filter=lfs diff=lfs merge=lfs -text
APPENDIX.md ADDED
@@ -0,0 +1,509 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # K2-Horizon-32B Technical Appendix
2
+
3
+ This page holds the complete technical reference for [IFM/K2-Horizon-32B](README.md): architecture details, checkpoint revisions, training provenance, validated dependency versions, full serving commands for Transformers, xLLM, vLLM, and SGLang, parser configuration, hardware planning, and every evaluation table. The model card `README.md` is the short version.
4
+
5
+ ---
6
+
7
+ [Training Code](https://github.com/LLM360/xllm) - [Evaluation Code](https://github.com/LLM360/Eval360-V2) - [Pretraining Data](https://huggingface.co/datasets/IFM/K2-Horizon-Pretrain-Data) - [Midtraining Data](https://huggingface.co/datasets/IFM/K2-Horizon-Midtrain-Data)
8
+
9
+ K2-Horizon-32B is a large dense base model in the IFM K2-Horizon family.
10
+
11
+ K2-Horizon is an open-weight IFM model family built for transparent foundation-model research, staged checkpoint analysis, and practical deployment. The series spans compact dense models for local experimentation, dense mid-size and large models for high-quality research workloads, and sparse expert models for higher-capacity serving.
12
+
13
+ All model cards in this family intentionally share the same structure and family-level reference material. Each repository focuses on one model size, but the card also describes the full release series so users can compare architectures, context length, serving requirements, and benchmark behavior before selecting a model.
14
+
15
+ The repositories provide base/pretraining and staged midtraining revisions, making it possible to study capability changes across training phases instead of evaluating only one checkpoint. The `main` branch contains the default checkpoint, while stable stage tags such as `base_final`, `mid_1_final`, and `mid_4_final` identify specific model states for reproducible use.
16
+
17
+
18
+ ## Model Series Overview
19
+
20
+ K2-Horizon is released as a family of checkpoints that share the same post-training recipe, release process, and user-facing deployment guidance while covering dense, MoE, and MoVA configurations. The table below summarizes the public family view; individual repositories contain the files and branches for one model size.
21
+
22
+ | Model | Architecture | Stored parameters | Active parameters/token | Context length | Vocab size | Intended use |
23
+ | --- | --- | --- | --- | --- | --- | --- |
24
+ | K2-Horizon-0.9B | K2HorizonForCausalLM; dense decoder-only | 0.9B | 0.9B | 8,192 | 64,256 | Lightweight experimentation, local development, evaluation dry runs |
25
+ | K2-Horizon-3.7B | XllmForCausalLM; dense decoder-only | 5.06B | 5.06B | 524,288 | 250,624 | Efficient research, evaluation, and single-node serving |
26
+ | K2-Horizon-7B | XllmForCausalLM; dense decoder-only | 9.00B | 9.00B | 524,288 | 250,624 | General research, fine-tuning, and cost-conscious deployment |
27
+ | K2-Horizon-32B | K2HorizonForCausalLM; dense decoder-only | 34.78B | 34.78B | 524,288 | 250,624 | Stronger long-context and reasoning experiments |
28
+ | K2-Horizon-36B | K2HorizonForCausalLM; MoVA + MoE | 37.44B | 5.95B | 524,288 | 250,624 | Multistage research and production-style serving experiments |
29
+ | K2-Horizon-375B | XllmForCausalLM; sparse MoE | 379.17B | 26.67B | 524,288 | 250,624 | Frontier-scale open research, long-context evaluation, and high-capacity serving |
30
+
31
+ Tokenizer files are distributed with each model repository. The compact K2-Horizon-0.9B model comes from the IFM Mobile line and uses a 64,256-token vocabulary. The 3.7B, 7B, 32B, 36B, and 375B models use a 250,624-token vocabulary.
32
+
33
+ The native 0.9B `main`, 32B `mid_4`, and 36B `main`/`mid_4` revisions publish `K2HorizonForCausalLM`, `model_type: k2_horizon`, and matching `configuration_k2_horizon.py` and `modeling_k2_horizon.py` modules. The deployment preflights below validate that public contract before loading weights.
34
+
35
+ ## This Repository
36
+
37
+ | Field | Value |
38
+ | --- | --- |
39
+ | Model name | K2-Horizon-32B |
40
+ | Repository | IFM/K2-Horizon-32B |
41
+ | Model family | K2-Horizon |
42
+ | Architecture class | K2HorizonForCausalLM |
43
+ | Classification | Dense |
44
+ | Stored parameters | 32.21B core; 34.78B including embeddings |
45
+ | Active parameters per token | 32.21B core; 34.78B including embeddings |
46
+ | Context length | 512K tokens |
47
+ | Transformer layers | 64 |
48
+ | Hidden size | 5,120 |
49
+ | Dense / expert intermediate size | 26,624 / 0 |
50
+ | Attention heads / KV heads | 64 / 8 |
51
+ | Dense attention / sparse attention blocks | 64 / 0 |
52
+ | Dense FFN / sparse FFN blocks | 64 / 0 |
53
+ | MoE experts / active experts | 0 / 0 |
54
+ | MoVA count / active values | 0 / 0 |
55
+ | Vocab size | 250,624 |
56
+ | Tokenizer metadata | Hugging Face tokenizer files; vocab size 250,624 |
57
+ | Checkpoint storage dtype | float32 (FP32) |
58
+ | Checkpoint config dtype metadata | float32 |
59
+ | Evaluation and sample dtype | bfloat16 (BF16) |
60
+ | Shard/index summary | 64 shards |
61
+
62
+ ## Checkpoint Revisions
63
+
64
+ Each repository uses branches for model stages and stable tags for specific checkpoints. Pin a revision tag when reproducibility matters; use `main` for the default model checkpoint.
65
+
66
+ | Stage | Branch | Revision tag | Max context | Description |
67
+ | --- | --- | --- | --- | --- |
68
+ | Base / pretraining | `pretrain` | `base_final` | 8K tokens | Base model checkpoint |
69
+ | Midtraining 1 | `mid_1` | `mid_1_final` | 32K tokens | Midtraining 1 checkpoint |
70
+ | Midtraining 2 | `mid_2` | `mid_2_final` | 131,072 tokens | Midtraining 2 checkpoint |
71
+ | Midtraining 3 | `mid_3` | `mid_3_final` | 512K tokens | Midtraining 3 checkpoint |
72
+ | Midtraining 4 | `mid_4` | `mid_4_final` | 512K tokens | Midtraining 4 checkpoint |
73
+ | Default | `main` | `main` | 512K tokens | Default release view of `mid_4_final` |
74
+
75
+ Example revision pinning:
76
+
77
+ <details>
78
+ <summary>Show revision pinning example</summary>
79
+
80
+ ```python
81
+ # Validated with Python 3.14,
82
+ # Transformers 5.15.0, and
83
+ # Safetensors 0.8.0.
84
+ from transformers import AutoModelForCausalLM, AutoTokenizer
85
+
86
+ model_id = "IFM/K2-Horizon-32B"
87
+ revision = "mid_4_final"
88
+
89
+ tokenizer = AutoTokenizer.from_pretrained(model_id, revision=revision, trust_remote_code=True)
90
+ model = AutoModelForCausalLM.from_pretrained(
91
+ model_id,
92
+ revision=revision,
93
+ device_map="auto",
94
+ dtype="bfloat16",
95
+ low_cpu_mem_usage=True,
96
+ trust_remote_code=True,
97
+ )
98
+ ```
99
+
100
+ </details>
101
+
102
+
103
+
104
+ ## Training Provenance
105
+
106
+ Each row identifies the last W&B process record associated with the selected checkpoint, together with its Slurm job and exact xLLM source revision. A training stage can span multiple W&B process records when checkpointed training is resumed.
107
+
108
+ | Stage | Revision | Checkpoint context | xLLM source | W&B last run | Slurm job | Training nodes |
109
+ | --- | --- | --- | --- | --- | --- | --- |
110
+ | Base / pretraining | `base_final` | 8K tokens | [`ad6dac16`](https://github.com/LLM360/xllm/commit/ad6dac16031ae74d3e02c10bf3f37384815503a2) | [`k2v3-32b/5ptu101d`](https://wandb.ai/mbzuai-llm/k2v3-32b/runs/5ptu101d) | `443488` | 152 |
111
+ | Midtraining 1 | `mid_1_final` | 32K tokens | [`b69a6b2e`](https://github.com/LLM360/xllm/commit/b69a6b2ed17091dfee8af68a570f78816f765bad) | [`k2v3_midtrain/6zcj31kj`](https://wandb.ai/mbzuai-llm/k2v3_midtrain/runs/6zcj31kj) | `498822` | 152 |
112
+ | Midtraining 2 | `mid_2_final` | 131,072 tokens | [`9ab31836`](https://github.com/LLM360/xllm/commit/9ab3183694cbf36cf77a5c60761576435f550433) | [`k2v3_midtrain/4lo14vpx`](https://wandb.ai/mbzuai-llm/k2v3_midtrain/runs/4lo14vpx) | `968789` | 152 |
113
+ | Midtraining 3 | `mid_3_final` | 512K tokens | [`9ab31836`](https://github.com/LLM360/xllm/commit/9ab3183694cbf36cf77a5c60761576435f550433) | [`k2v3_midtrain/4753a9v1`](https://wandb.ai/mbzuai-llm/k2v3_midtrain/runs/4753a9v1) | `974704` | 152 |
114
+ | Midtraining 4 | `mid_4_final` | 512K tokens | [`5494c84c`](https://github.com/LLM360/xllm/commit/5494c84cc7a2a66e5d6439bf9aa07454097ce9be) | [`k2v3_midtrain/lagg1h7w`](https://wandb.ai/mbzuai-llm/k2v3_midtrain/runs/lagg1h7w) | `1189061` | 152 |
115
+
116
+
117
+
118
+ ## Training Loss
119
+
120
+ The chart reconstructs the release checkpoint lineage for Pretraining, Midtraining 1, Midtraining 2, Midtraining 3, Midtraining 4. Training loss is the next-token prediction objective; lower values indicate that the model assigns greater probability to the observed next token. Training loss is not a validation score and should not be compared across different tokenizers or data mixtures without additional controls.
121
+
122
+ ![K2-Horizon-32B training loss versus cumulative training tokens](./assets/k2-horizon-32b-training-loss-vs-tokens.png)
123
+
124
+ Each panel combines the W&B process records that contribute to the release checkpoint. Faint lines show sampled raw training loss; bold lines show an unpadded centered moving average with a raised-cosine taper over the final half-window. The final sample retains 20% of its base weight, limiting right-edge bias without hiding the raw tail. Checkpoint restart overlap is replaced by the later process record.
125
+
126
+
127
+ ## Deployment Guide
128
+
129
+ These are base checkpoints. They can be served for research, evaluation, retrieval-augmented generation experiments, tool-use research, and downstream adaptation. They are not instruction-aligned assistants by default, so production deployments should add application-level safety filters, system prompting, and task-specific validation.
130
+
131
+ All reported K2-Horizon evaluation used BF16. Some released checkpoint shards and configuration metadata remain FP32; the examples below explicitly load or serve them as BF16 to match the evaluation runtime and reduce accelerator memory usage.
132
+
133
+ ### Validated Independent Dependency Versions
134
+
135
+ Use a separate Python environment for every workflow. Direct Transformers loading, xLLM conversion, vLLM, and the pinned SGLang production revision have independent dependency contracts. Do not install one row into another row's environment. Versions intentionally differ when a framework or remote-model contract requires them.
136
+
137
+ | Workflow | Python | PyTorch | CUDA | Transformers | Safetensors | Attention kernel | Framework revision |
138
+ | --- | --- | --- | --- | --- | --- | --- | --- |
139
+ | Direct Transformers loading | 3.14 | 2.13.0 | 12.6 | 5.15.0 | 0.8.0 | PyTorch SDPA 2.13.0 | Transformers 5.15.0 remote code |
140
+ | xLLM checkpoint conversion | 3.12 | 2.8.0 | 12.8 | 4.57.3 | 0.8.0 | FlashAttention 2.8.3.post1 | xLLM `7cfa3b2c` |
141
+ | vLLM serving | 3.12 | 2.13.0 | 12.9 | 5.16.1 | 0.8.0 | FlashInfer 0.6.17 | vLLM 0.26.1rc1.dev1212 source `d9fd5f11` (PR #53806) |
142
+ | SGLang serving | 3.12 | 2.9.1 | 12.8 (CUDA Python 12.9) | 5.3.0 | 0.8.0 | FA3 (sglang-kernel 0.4.1); FlashInfer 0.6.7.post2 available | SGLang `ffb41d77` (stable-only metadata) |
143
+
144
+ ### Inference Parameter Starting Points
145
+
146
+ K2-Horizon does not use one family-wide sampling preset. The values below are operational baselines: temperature 0 is the validated deterministic serving comparison, while sampled settings are conservative starting points that should be tuned on application prompts. Benchmark reproduction must use the decoding configuration attached to that benchmark.
147
+
148
+ | Use case | Temperature | Top-p | Max new tokens | Notes |
149
+ | --- | --- | --- | --- | --- |
150
+ | Checkpoint smoke test and deterministic evaluation | 0.0 | 1.0 | 512-4,096 | Greedy decoding is the reproducible baseline used by serving comparisons. |
151
+ | Base-model continuation | 0.6 | 0.95 | 1,024-4,096 | A conservative sampling baseline; tune on a held-out prompt set. |
152
+ | Long-context continuation or summarization | 0.2 | 0.9 | 2,048-8,192 | Start with one request and increase context only after KV-cache capacity checks. |
153
+ | Reasoning and tool-call validation | 0.0 | 1.0 | 4,096 | Use a compatible chat template and the K2Horizon parser stack below. |
154
+
155
+ ### Transformers
156
+
157
+ The selected default checkpoint is loaded with Transformers 5.15.0 and PyTorch 2.13.0 on CUDA 12.6. Select the corresponding PyTorch build for your accelerator when that CUDA runtime is unavailable. The selected default checkpoint uses the self-contained native K2 remote implementation. Its saved Transformers 5.13.0 contract is source-compatible with the newer stable 5.15.0 release, and it does not import xLLM native extensions.
158
+
159
+ <details>
160
+ <summary>Show Transformers installation commands</summary>
161
+
162
+ ```bash
163
+ python -m pip install "torch==2.13.0" \
164
+ --index-url "https://download.pytorch.org/whl/cu126"
165
+ python -m pip install \
166
+ "transformers==5.15.0" \
167
+ "safetensors==0.8.0" \
168
+ "accelerate==1.14.0"
169
+ ```
170
+
171
+ </details>
172
+
173
+ <details>
174
+ <summary>Show Transformers inference example</summary>
175
+
176
+ ```python
177
+ from transformers import AutoModelForCausalLM, AutoTokenizer
178
+
179
+ MODEL_ID = "IFM/K2-Horizon-32B"
180
+ REVISION = "mid_4"
181
+
182
+ tokenizer = AutoTokenizer.from_pretrained(
183
+ MODEL_ID,
184
+ revision=REVISION,
185
+ trust_remote_code=True,
186
+ )
187
+ model = AutoModelForCausalLM.from_pretrained(
188
+ MODEL_ID,
189
+ revision=REVISION,
190
+ device_map="auto",
191
+ dtype="bfloat16",
192
+ low_cpu_mem_usage=True,
193
+ trust_remote_code=True,
194
+ )
195
+
196
+ prompt = "Explain why long-context evaluation is difficult."
197
+ inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
198
+ inputs.pop("token_type_ids", None)
199
+ outputs = model.generate(
200
+ **inputs,
201
+ max_new_tokens=512,
202
+ temperature=0.7,
203
+ top_p=0.9,
204
+ do_sample=True,
205
+ )
206
+ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
207
+ ```
208
+
209
+ </details>
210
+
211
+ ### xLLM
212
+
213
+ xLLM provides the training framework, checkpoint converter, serving bridges, and runtime kernels used by the XLLM-based K2-Horizon repositories. For checkpoint conversion, parity work, or loading a legacy 36B `XllmForCausalLM` stage that imports xLLM MoVA kernels, use the isolated legacy contract and reviewed bridge revision [`7cfa3b2c`](https://github.com/LLM360/xllm/commit/7cfa3b2c61fad3b2ef48f7f7b497ef360087c72f):
214
+
215
+ <details>
216
+ <summary>Show xLLM setup and conversion commands</summary>
217
+
218
+ ```bash
219
+ git clone https://github.com/LLM360/xllm.git
220
+ cd xllm
221
+ git checkout 7cfa3b2c61fad3b2ef48f7f7b497ef360087c72f
222
+
223
+ python -m pip install "torch==2.8.0" \
224
+ --index-url "https://download.pytorch.org/whl/cu128"
225
+ export XLLM_BUILD_ROOT="${XLLM_BUILD_ROOT:-$PWD/.xllm-build}"
226
+ export TMPDIR="$XLLM_BUILD_ROOT/tmp"
227
+ export PIP_CACHE_DIR="$XLLM_BUILD_ROOT/pip-cache"
228
+ mkdir -p "$TMPDIR" "$PIP_CACHE_DIR"
229
+ python -m pip install packaging ninja
230
+ python -m pip install "https://github.com/Dao-AILab/flash-attention/releases/download/v2.8.3.post1/flash_attn-2.8.3.post1+cu12torch2.8cxx11abiTRUE-cp312-cp312-linux_x86_64.whl"
231
+ python -m pip install -r requirements.txt
232
+ python -m pip install -e . --no-build-isolation \
233
+ --config-settings editable_mode=compat
234
+ python -m pip install \
235
+ "transformers==4.57.3" \
236
+ "safetensors==0.8.0" \
237
+ accelerate fire
238
+
239
+ python xllm_bridges/huggingface/xllm_to_hf_main.py --help
240
+ ```
241
+
242
+ </details>
243
+
244
+ The converter requires an original xLLM distributed checkpoint and tokenizer. Released Hugging Face revisions are already converted. On K2-Horizon-32B, `mid_4` uses the native Transformers 5 contract above; `pretrain` through `mid_3` use the pure Transformers 4.57.6/SDPA direct contract, without xLLM. The xLLM row remains the converter contract. Pinning a revision does not make runtime contracts interchangeable.
245
+
246
+ ### vLLM
247
+
248
+ The example pins [vLLM PR #53806](https://github.com/vllm-project/vllm/pull/53806) at [`d9fd5f11`](https://github.com/vllm-project/vllm/commit/d9fd5f11423a1a5628fe29e7296ceb9de91aac3c). That source registers `K2HorizonForCausalLM` plus the built-in `k2_horizon` reasoning and tool parsers. The command uses vLLM's `vllm` model implementation for this checkpoint contract.
249
+
250
+ <details>
251
+ <summary>Show vLLM setup and serving commands</summary>
252
+
253
+ ```bash
254
+ git clone --filter=blob:none --no-checkout \
255
+ https://github.com/vllm-project/vllm.git
256
+ cd vllm
257
+ git fetch origin \
258
+ pull/53806/head:refs/remotes/origin/pr-53806
259
+ git checkout --detach d9fd5f11423a1a5628fe29e7296ceb9de91aac3c
260
+ test "$(git rev-parse HEAD)" = "d9fd5f11423a1a5628fe29e7296ceb9de91aac3c"
261
+
262
+ python3.12 -m venv .venv
263
+ source .venv/bin/activate
264
+ python -m pip install --upgrade pip uv
265
+ export UV_LINK_MODE=copy
266
+ VLLM_USE_PRECOMPILED=1 uv pip install --upgrade --editable . \
267
+ --torch-backend=auto
268
+ uv pip install \
269
+ "transformers==5.16.1" \
270
+ "safetensors==0.8.0"
271
+ python -m pip check
272
+
273
+ python - <<'PY'
274
+ from vllm import ModelRegistry
275
+ from vllm.reasoning import ReasoningParserManager
276
+ from vllm.tool_parsers import ToolParserManager
277
+
278
+ assert "K2HorizonForCausalLM" in ModelRegistry.get_supported_archs()
279
+ assert ReasoningParserManager.get_reasoning_parser("k2_horizon") is not None
280
+ assert ToolParserManager.get_tool_parser("k2_horizon") is not None
281
+ PY
282
+
283
+ export MODEL_ID="IFM/K2-Horizon-32B"
284
+ export MODEL_REVISION="mid_4"
285
+ export TENSOR_PARALLEL_SIZE=2
286
+ export MAX_MODEL_LEN=131072
287
+
288
+ vllm serve "$MODEL_ID" \
289
+ --revision "$MODEL_REVISION" \
290
+ --model-impl vllm \
291
+ --tensor-parallel-size "$TENSOR_PARALLEL_SIZE" \
292
+ --trust-remote-code \
293
+ --dtype bfloat16 \
294
+ --served-model-name "$MODEL_ID" \
295
+ --max-model-len "$MAX_MODEL_LEN" \
296
+ --reasoning-parser k2_horizon \
297
+ --enable-auto-tool-choice \
298
+ --tool-call-parser k2_horizon
299
+ ```
300
+
301
+ </details>
302
+
303
+ The source checkout is immutable at `d9fd5f11423a1a5628fe29e7296ceb9de91aac3c`. The command serves `mid_4`; the repository's longest checkpoint configuration reports 524,288 tokens, while this example starts at 131,072 tokens. Increase context and concurrency only after measuring KV-cache capacity. The preflight fails immediately if the native architecture or either Horizon parser registration is absent.
304
+
305
+ ### SGLang
306
+
307
+ Native K2 Horizon support is provided by
308
+ [sgl-project/sglang#37654](https://github.com/sgl-project/sglang/pull/37654).
309
+ Use a `lmsysorg/sglang:dev` image built after that PR is merged. Once support is
310
+ included in a tagged SGLang release, use the corresponding versioned image.
311
+
312
+ <details>
313
+ <summary>Show the SGLang serving command</summary>
314
+
315
+ ```bash
316
+ docker run --gpus all \
317
+ --shm-size 32g \
318
+ -p 30000:30000 \
319
+ -v ~/.cache/huggingface:/root/.cache/huggingface \
320
+ --ipc=host \
321
+ lmsysorg/sglang:dev \
322
+ python3 -m sglang.launch_server \
323
+ --model-path "IFM/K2-Horizon-32B" \
324
+ --revision main \
325
+ --tp 2 \
326
+ --dtype bfloat16 \
327
+ --context-length 131072 \
328
+ --attention-backend fa3 \
329
+ --reasoning-parser k2_horizon \
330
+ --tool-call-parser k2_horizon \
331
+ --mem-fraction-static 0.85 \
332
+ --host 0.0.0.0 \
333
+ --port 30000
334
+ ```
335
+
336
+ </details>
337
+
338
+ This uses SGLang's native `K2HorizonForCausalLM` implementation; no
339
+ `--trust-remote-code`, source patch, or external parser plugin is required. The
340
+ 131,072-token limit is a conservative starting point; increase it only after
341
+ measuring KV-cache capacity.
342
+
343
+ ### Reasoning and Tool Parsers
344
+
345
+ Parser configuration is part of the deployment contract. The canonical K2-Horizon format uses `<ifm|...>` reasoning and tool tokens; test streaming and non-streaming responses before exposing an OpenAI-compatible endpoint.
346
+
347
+ | Goal | vLLM guidance | SGLang guidance | When to use |
348
+ | --- | --- | --- | --- |
349
+ | Plain text generation | Do not enable a reasoning or tool parser. | Do not enable a reasoning or tool parser. | Base-model evaluation, completion-style generation, and checkpoint smoke tests. |
350
+ | Canonical K2-Horizon reasoning | Use the built-in `--reasoning-parser k2_horizon`. | Use `--reasoning-parser k2_horizon`. | Checkpoints and chat templates using `<ifm|think>`, `<ifm|think_fast>`, or `<ifm|think_faster>`. |
351
+ | Canonical K2-Horizon tool calls | Use `--enable-auto-tool-choice --tool-call-parser k2_horizon`. | Use `--tool-call-parser k2_horizon`. | XML, typed-XML, or JSON calls wrapped in `<ifm|tool_call>`. |
352
+ | Legacy K2 reasoning traces | Use the legacy parser only in a compatibility image that registers it. | Use `--reasoning-parser k2_horizon_legacy`. | Older traces using `<think>`, `<think_fast>`, or `<think_faster>` instead of canonical IFM tokens. |
353
+ | Mixed tool-call corpora | Use `multi_format` only in a build that includes and tests that parser. | Use `--tool-call-parser multi_format`. | Evaluation corpora that intentionally mix K2, GLM, or JSON tool-call dialects. |
354
+
355
+ PR #53806 registers both Horizon parsers in-tree; no external parser plugin is required.
356
+
357
+ For OpenAI-compatible requests, select reasoning effort through chat-template kwargs:
358
+
359
+ <details>
360
+ <summary>Show OpenAI-compatible request example</summary>
361
+
362
+ ```python
363
+ from openai import OpenAI
364
+
365
+ client = OpenAI(base_url="http://localhost:8000/v1", api_key="unused")
366
+ response = client.chat.completions.create(
367
+ model="IFM/K2-Horizon-32B",
368
+ messages=[{"role": "user", "content": "Explain the result step by step."}],
369
+ temperature=0,
370
+ max_tokens=4096,
371
+ extra_body={"chat_template_kwargs": {"reasoning_effort": "high"}},
372
+ )
373
+ print(response.choices[0].message)
374
+ ```
375
+
376
+ </details>
377
+
378
+ ### Other Serving Frameworks
379
+
380
+ Text Generation Inference, TensorRT-LLM, llama.cpp, Ollama, and LM Studio may require model-specific conversion, quantization, or custom architecture support. Validate tokenizer behavior, remote-code requirements, attention implementation, and long-context behavior before publishing service results.
381
+
382
+
383
+ ## Hardware Planning
384
+
385
+ The table below gives capacity-planning starting points for self-hosted inference. Weight memory uses the parameter count including input and output embeddings. On-disk FP32 shards and dtype conversion can require substantially more host RAM during loading than the final BF16 GPU footprint. KV-cache estimates use BF16 keys and values for one request at the smaller of the model maximum and 128K tokens; batching, allocator overhead, activations, CUDA graphs, and framework workspaces require additional memory.
386
+
387
+ | Model | Stored params | Active params/token | BF16 weight memory | FP32 weight memory | BF16 KV cache / request | Starting TP | Recommended starting point |
388
+ | --- | --- | --- | --- | --- | --- | --- | --- |
389
+ | K2-Horizon-0.9B | 0.9B | 0.9B | 2.0 GiB | 4.0 GiB | 0.4 GiB @ 8K tokens | 1 | 1 GPU with 16 GiB is a practical starting point for the model's 8K context; allow additional memory for batching. |
390
+ | K2-Horizon-3.7B | 5.06B | 5.06B | 9.4 GiB | 18.8 GiB | 18.0 GiB @ 128K tokens | 1 | 1 GPU with 24 GiB can serve short contexts in BF16; use 48-80 GiB for larger KV caches and 128K-class requests. |
391
+ | K2-Horizon-7B | 9.00B | 9.00B | 16.8 GiB | 33.5 GiB | 18.0 GiB @ 128K tokens | 1 | 1 GPU with 40-48 GiB is suitable for short-context BF16 serving; 80 GiB is the practical starting point for 128K-class requests. |
392
+ | K2-Horizon-32B | 34.78B | 34.78B | 64.8 GiB | 129.6 GiB | 32.0 GiB @ 128K tokens | 2-4 | 1x 80 GiB fits BF16 weights only at short context; start with 2x 80 GiB for 128K requests and 4x 80 GiB for larger context or throughput. |
393
+ | K2-Horizon-36B | 37.44B | 5.95B | 69.7 GiB | 139.5 GiB | 24.0 GiB @ 128K tokens | 2-4 | Use at least 256 GiB of host RAM to load the current 139.5 GiB FP32 shard set. Start with 2x 80 GiB GPUs for BF16 weight sharding, or 1x H200 141 GiB for short single-request validation; use 4x 80 GiB for 128K-class requests. |
394
+ | K2-Horizon-375B | 379.17B | 26.67B | 706.3 GiB | 1.38 TiB | 30.5 GiB @ 128K tokens | 8 H200 or 16x 80 GiB | The full 512K profile is validated on 8x H200 141 GiB GPUs at TP=8 and 0.92 memory utilization; use at least 16x 80 GiB GPUs on lower-memory hardware. |
395
+
396
+ ## Evaluation
397
+
398
+ Benchmark values are reported as percentages unless otherwise noted. A dash means the metric was not reported for that model or revision in the release evaluation records. The family tables below use each model's latest listed midtraining release checkpoint.
399
+
400
+ ### Family Evaluation: Knowledge and Instruction Following
401
+
402
+ | Model | Revision | IFEval | MMLU-Pro | MMLU | BBH |
403
+ | --- | --- | --- | --- | --- | --- |
404
+ | K2-Horizon-0.9B | `mid_2_final` | 43.1 | 40.3 | 44.4 | 43.8 |
405
+ | K2-Horizon-3.7B | `mid_4_final` | 85.7 | 73.0 | 80.7 | 84.4 |
406
+ | K2-Horizon-7B | `mid_4_final` | 89.9 | 75.7 | 83.3 | 87.8 |
407
+ | K2-Horizon-32B | `mid_4_final` | 88.0 | 79.5 | 87.5 | 89.1 |
408
+ | K2-Horizon-36B | `mid_4_final` | 89.6 | 79.2 | 87.3 | 88.6 |
409
+ | K2-Horizon-375B | `mid_4_final` | 92.1 | 82.6 | 89.5 | 87.5 |
410
+
411
+ ### Family Evaluation: STEM, Reasoning, and Coding
412
+
413
+ | Model | Revision | AIME26 | GPQA-Diamond | GSM8K | MBPP |
414
+ | --- | --- | --- | --- | --- | --- |
415
+ | K2-Horizon-0.9B | `mid_2_final` | 12.3 | 27.8 | 53.1 | 53.2 |
416
+ | K2-Horizon-3.7B | `mid_4_final` | 88.2 | 73.3 | 92.3 | 86.4 |
417
+ | K2-Horizon-7B | `mid_4_final` | 87.6 | 73.9 | 95.1 | 91.0 |
418
+ | K2-Horizon-32B | `mid_4_final` | 91.7 | 75.4 | 95.5 | 87.8 |
419
+ | K2-Horizon-36B | `mid_4_final` | 92.7 | 75.4 | 95.2 | 87.2 |
420
+ | K2-Horizon-375B | `mid_4_final` | 92.5 | 84.9 | 95.1 | 93.8 |
421
+
422
+ ### Family Evaluation: Agentic and Long-Context Tasks
423
+
424
+ | Model | Revision | SWE-Bench Verified (avg@3) | Terminal-Bench 2.1 (avg@3) | GDPval (acc@75%) | Tau3 Banking | BrowseComp+ (acc@1) | Apex Agents (pass@1) | WildClawBench | LCR |
425
+ | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
426
+ | K2-Horizon-7B | `mid_4_final` | 57.5 | 28.1 | 34.5 | 10.4 | 52.2 | 6.0 | 23.9 | - |
427
+ | K2-Horizon-375B | `mid_4_final` | 67.8 | 38.2 | 39.6 | 11.4 | 58.1 | 13.8 | 34.8 | 56.0 |
428
+
429
+ Agentic results are joined only to exact selected release checkpoints. SWE-Bench Verified and Terminal-Bench 2.1 report three-run averages where available; GDPval reports accuracy at 75 percent; BrowseComp+ reports accuracy at one; Apex Agents reports pass at one. Fractional workbook values are converted to percentages. When a source cell contains multiple reported aggregates, the first aggregate is shown unless the cell contains only three slash-separated trial values, in which case their mean is reported. A dash means the exact release checkpoint has no reported result for that benchmark.
430
+
431
+ ### Family Evaluation: Advanced Research Benchmarks
432
+
433
+ | Model | Revision | MCP Atlas | HLE | SciCode | OmniScience Accuracy | OmniScience Non-Hallucination | CritPT |
434
+ | --- | --- | --- | --- | --- | --- | --- | --- |
435
+ | K2-Horizon-7B | `mid_4_final` | 53.6 | 13.8 | - | - | 43.7 | - |
436
+ | K2-Horizon-375B | `mid_4_final` | 59.0 | 21.2 | 40.3 | 20.6 | 49.2 | 5.1 |
437
+
438
+ These results use exact final-stage checkpoint records. Benchmark availability differs by model, so unreported cells remain `-`.
439
+
440
+ ### This Repository: Base / Pretraining Snapshot
441
+
442
+ | Revision | ArabicMMLU | ARC-C | BBH | GPQA-Diamond-CoT | GSM8K | MMLU | MMLU-Pro | HumanEval | MBPP | IFEval |
443
+ | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
444
+ | `base_final` | 73.5 | 69.8 | 84.7 | 18.2 | 86.0 | 78.9 | 57.9 | 64.0 | 68.2 | 27.5 |
445
+
446
+ ### This Repository: Midtraining Snapshot
447
+
448
+ | Revision | IFEval avg | MMLU-Pro | GSM8K | MMLU | BBH | MBPP | AIME26 | GPQA-Diamond | LongBench-v2 | LCR | SWE-Bench Verified | Terminal Bench 2 |
449
+ | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
450
+ | `mid_1_final` | 89.6 | 79.7 | 95.8 | 87.9 | 89.2 | 88.2 | 79.8 | 69.9 | - | - | - | - |
451
+ | `mid_2_final` | 88.5 | 79.7 | 95.6 | 87.8 | 88.9 | 89.6 | 92.3 | 77.3 | - | - | - | - |
452
+ | `mid_3_final` | 88.0 | 79.5 | 95.5 | 87.5 | 89.1 | 87.8 | 91.7 | 75.4 | - | - | - | - |
453
+
454
+ ### This Repository: Agentic and Long-Context Results by Stage
455
+
456
+ | Revision | SWE-Bench Verified | Terminal-Bench | GDPval (acc@75%) | Tau3 Banking | BrowseComp+ | Toolathlon | Apex Agents | LongBench-v2 | LCR |
457
+ | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
458
+ | `mid_3_final` | - | - | 26.4 | - | 56.0 | - | 5.7 | - | - |
459
+
460
+
461
+
462
+
463
+ ## Datasets and Mixtures
464
+
465
+ K2-Horizon training is organized around transparent data releases:
466
+
467
+ - Pretraining data: [IFM/K2-Horizon-Pretrain-Data](https://huggingface.co/datasets/IFM/K2-Horizon-Pretrain-Data), derived from the TxT360 lineage.
468
+ - Midtraining data: [IFM/K2-Horizon-Midtrain-Data](https://huggingface.co/datasets/IFM/K2-Horizon-Midtrain-Data), following the TxT360-Midas reasoning and long-context release pattern.
469
+ - The public data-preparation lineage is maintained in [LLM360/TxT360](https://github.com/LLM360/TxT360).
470
+
471
+ ## Source Code
472
+
473
+ - [LLM360/xllm](https://github.com/LLM360/xllm) - Training framework and Hugging Face/vLLM bridges. Per-stage training commits are linked in the provenance table.
474
+ - [LLM360/Eval360-V2 at `f5081bfb`](https://github.com/LLM360/Eval360-V2/commit/f5081bfba9ef8e7b380f5bd85ed1cf61a91f90b0) - Evaluation harness revision reviewed against the release benchmark workbooks.
475
+ - [LLM360/agent-evals at `f3788399`](https://github.com/LLM360/agent-evals/commit/f3788399a974e49121984f11556138f23f907cee) - Agentic benchmark harness, Slurm launchers, and serving profiles used to reconcile the agentic release results.
476
+ - [vLLM PR #53806 at `d9fd5f11`](https://github.com/vllm-project/vllm/commit/d9fd5f11423a1a5628fe29e7296ceb9de91aac3c) - Native K2-Horizon architecture plus built-in reasoning and tool parsers used by the serving example.
477
+ - [LLM360/Inference360 at `a7ee94f9`](https://github.com/LLM360/Inference360/commit/a7ee94f9ad9a561e65a67ede22d4e7a2c8428b57) - Serving-image and deployment-validation references.
478
+ - [LLM360/sglang at `ffb41d77`](https://github.com/LLM360/sglang/commit/ffb41d77d8b96b8a953351cb4d66d6bf4ed061a7) - SGLang serving base used by the hash-guarded K2-Horizon namespace migration.
479
+ - [LLM360/TxT360](https://github.com/LLM360/TxT360) - Public data-preparation and source-data lineage reference.
480
+
481
+ ## Intended Use
482
+
483
+ K2-Horizon-32B is intended for open research on foundation models, transparent evaluation, staged checkpoint analysis, downstream fine-tuning, and reproducibility studies. It is suitable for researchers and developers who want to inspect training-stage behavior, serve a model privately, compare model sizes, or build downstream adaptations.
484
+
485
+ ## Limitations and Safety
486
+
487
+ - This is a base checkpoint family and may produce inaccurate, biased, unsafe, or hallucinated content.
488
+ - The model is not optimized for moderation, refusal behavior, or production assistant safety.
489
+ - Long-context behavior depends on serving stack, prompt construction, retrieval quality, and KV-cache configuration.
490
+ - Tool-use and agentic results depend heavily on parser format, prompt template, tool schema, and execution harness.
491
+ - The model family is documented primarily with English-language evaluations; additional multilingual evaluation should be performed before broad multilingual claims.
492
+ - Users are responsible for complying with the model license and for validating deployments in their own risk domain.
493
+
494
+ ## Citation
495
+
496
+ Please cite this model as:
497
+
498
+ ```bibtex
499
+ @misc{ifmk2horizon32b2026,
500
+ title = {K2-Horizon Model Family: K2-Horizon-32B},
501
+ author = {IFM Team},
502
+ year = {2026},
503
+ url = {https://huggingface.co/IFM/K2-Horizon-32B},
504
+ }
505
+ ```
506
+
507
+ ## Contact
508
+
509
+ For questions about this release, contact the IFM / K2-Horizon team through the model repository or the IFM organization.
README.md CHANGED
@@ -18,506 +18,158 @@ tags:
18
 
19
  # K2-Horizon-32B
20
 
21
- [Training Code](https://github.com/LLM360/xllm) - [Evaluation Code](https://github.com/LLM360/Eval360-V2) - [Pretraining Data](https://huggingface.co/datasets/IFM/K2-Horizon-Pretrain-Data) - [Midtraining Data](https://huggingface.co/datasets/IFM/K2-Horizon-Midtrain-Data)
 
 
22
 
23
- K2-Horizon-32B is a large dense base model in the IFM K2-Horizon family.
 
24
 
25
- K2-Horizon is an open-weight IFM model family built for transparent foundation-model research, staged checkpoint analysis, and practical deployment. The series spans compact dense models for local experimentation, dense mid-size and large models for high-quality research workloads, and sparse expert models for higher-capacity serving.
26
 
27
- All model cards in this family intentionally share the same structure and family-level reference material. Each repository focuses on one model size, but the card also describes the full release series so users can compare architectures, context length, serving requirements, and benchmark behavior before selecting a model.
28
 
29
- The repositories provide base/pretraining and staged midtraining revisions, making it possible to study capability changes across training phases instead of evaluating only one checkpoint. The `main` branch contains the default checkpoint, while stable stage tags such as `base_final`, `mid_1_final`, and `mid_4_final` identify specific model states for reproducible use.
 
 
30
 
 
31
 
32
- ## Model Series Overview
 
 
 
 
33
 
34
- K2-Horizon is released as a family of checkpoints that share the same post-training recipe, release process, and user-facing deployment guidance while covering dense, MoE, and MoVA configurations. The table below summarizes the public family view; individual repositories contain the files and branches for one model size.
35
 
36
- | Model | Architecture | Stored parameters | Active parameters/token | Context length | Vocab size | Intended use |
37
- | --- | --- | --- | --- | --- | --- | --- |
38
- | K2-Horizon-0.9B | K2HorizonForCausalLM; dense decoder-only | 0.9B | 0.9B | 8,192 | 64,256 | Lightweight experimentation, local development, evaluation dry runs |
39
- | K2-Horizon-3.7B | XllmForCausalLM; dense decoder-only | 5.06B | 5.06B | 524,288 | 250,624 | Efficient research, evaluation, and single-node serving |
40
- | K2-Horizon-7B | XllmForCausalLM; dense decoder-only | 9.00B | 9.00B | 524,288 | 250,624 | General research, fine-tuning, and cost-conscious deployment |
41
- | K2-Horizon-32B | K2HorizonForCausalLM; dense decoder-only | 34.78B | 34.78B | 524,288 | 250,624 | Stronger long-context and reasoning experiments |
42
- | K2-Horizon-MoVA-36B-A4B | K2HorizonForCausalLM; MoVA + MoE | 37.44B | 5.95B | 524,288 | 250,624 | Multistage research and production-style serving experiments |
43
- | K2-Horizon-375B | XllmForCausalLM; sparse MoE | 379.17B | 26.67B | 524,288 | 250,624 | Frontier-scale open research, long-context evaluation, and high-capacity serving |
 
 
44
 
45
- Tokenizer files are distributed with each model repository. The compact K2-Horizon-0.9B model comes from the IFM Mobile line and uses a 64,256-token vocabulary. The 3.7B, 7B, 32B, 36B, and 375B models use a 250,624-token vocabulary.
46
 
47
- The native 0.9B `main`, 32B `mid_4`, and 36B `main`/`mid_4` revisions publish `K2HorizonForCausalLM`, `model_type: k2_horizon`, and matching `configuration_k2_horizon.py` and `modeling_k2_horizon.py` modules. The deployment preflights below validate that public contract before loading weights.
 
 
 
 
 
 
48
 
49
- ## This Repository
50
 
51
- | Field | Value |
52
- | --- | --- |
53
- | Model name | K2-Horizon-32B |
54
- | Repository | IFM/K2-Horizon-32B |
55
- | Model family | K2-Horizon |
56
- | Architecture class | K2HorizonForCausalLM |
57
- | Classification | Dense |
58
- | Stored parameters | 32.21B core; 34.78B including embeddings |
59
- | Active parameters per token | 32.21B core; 34.78B including embeddings |
60
- | Context length | 512K tokens |
61
- | Transformer layers | 64 |
62
- | Hidden size | 5,120 |
63
- | Dense / expert intermediate size | 26,624 / 0 |
64
- | Attention heads / KV heads | 64 / 8 |
65
- | Dense attention / sparse attention blocks | 64 / 0 |
66
- | Dense FFN / sparse FFN blocks | 64 / 0 |
67
- | MoE experts / active experts | 0 / 0 |
68
- | MoVA count / active values | 0 / 0 |
69
- | Vocab size | 250,624 |
70
- | Tokenizer metadata | Hugging Face tokenizer files; vocab size 250,624 |
71
- | Checkpoint storage dtype | float32 (FP32) |
72
- | Checkpoint config dtype metadata | float32 |
73
- | Evaluation and sample dtype | bfloat16 (BF16) |
74
- | Shard/index summary | 64 shards |
75
 
76
- ## Checkpoint Revisions
77
 
78
- Each repository uses branches for model stages and stable tags for specific checkpoints. Pin a revision tag when reproducibility matters; use `main` for the default model checkpoint.
 
 
79
 
80
- | Stage | Branch | Revision tag | Max context | Description |
81
- | --- | --- | --- | --- | --- |
82
- | Base / pretraining | `pretrain` | `base_final` | 8K tokens | Base model checkpoint |
83
- | Midtraining 1 | `mid_1` | `mid_1_final` | 32K tokens | Midtraining 1 checkpoint |
84
- | Midtraining 2 | `mid_2` | `mid_2_final` | 131,072 tokens | Midtraining 2 checkpoint |
85
- | Midtraining 3 | `mid_3` | `mid_3_final` | 512K tokens | Midtraining 3 checkpoint |
86
- | Midtraining 4 | `mid_4` | `mid_4_final` | 512K tokens | Midtraining 4 checkpoint |
87
- | Default | `main` | `main` | 512K tokens | Default release view of `mid_4_final` |
88
 
89
- Example revision pinning:
90
 
91
- <details>
92
- <summary>Show revision pinning example</summary>
93
 
94
- ```python
95
- # Validated with Python 3.14,
96
- # Transformers 5.15.0, and
97
- # Safetensors 0.8.0.
98
- from transformers import AutoModelForCausalLM, AutoTokenizer
99
-
100
- model_id = "IFM/K2-Horizon-32B"
101
- revision = "mid_4_final"
102
-
103
- tokenizer = AutoTokenizer.from_pretrained(model_id, revision=revision, trust_remote_code=True)
104
- model = AutoModelForCausalLM.from_pretrained(
105
- model_id,
106
- revision=revision,
107
- device_map="auto",
108
- dtype="bfloat16",
109
- low_cpu_mem_usage=True,
110
- trust_remote_code=True,
111
- )
112
- ```
113
-
114
- </details>
115
-
116
-
117
-
118
- ## Training Provenance
119
-
120
- Each row identifies the last W&B process record associated with the selected checkpoint, together with its Slurm job and exact xLLM source revision. A training stage can span multiple W&B process records when checkpointed training is resumed.
121
-
122
- | Stage | Revision | Checkpoint context | xLLM source | W&B last run | Slurm job | Training nodes |
123
- | --- | --- | --- | --- | --- | --- | --- |
124
- | Base / pretraining | `base_final` | 8K tokens | [`ad6dac16`](https://github.com/LLM360/xllm/commit/ad6dac16031ae74d3e02c10bf3f37384815503a2) | [`k2v3-32b/5ptu101d`](https://wandb.ai/mbzuai-llm/k2v3-32b/runs/5ptu101d) | `443488` | 152 |
125
- | Midtraining 1 | `mid_1_final` | 32K tokens | [`b69a6b2e`](https://github.com/LLM360/xllm/commit/b69a6b2ed17091dfee8af68a570f78816f765bad) | [`k2v3_midtrain/6zcj31kj`](https://wandb.ai/mbzuai-llm/k2v3_midtrain/runs/6zcj31kj) | `498822` | 152 |
126
- | Midtraining 2 | `mid_2_final` | 131,072 tokens | [`9ab31836`](https://github.com/LLM360/xllm/commit/9ab3183694cbf36cf77a5c60761576435f550433) | [`k2v3_midtrain/4lo14vpx`](https://wandb.ai/mbzuai-llm/k2v3_midtrain/runs/4lo14vpx) | `968789` | 152 |
127
- | Midtraining 3 | `mid_3_final` | 512K tokens | [`9ab31836`](https://github.com/LLM360/xllm/commit/9ab3183694cbf36cf77a5c60761576435f550433) | [`k2v3_midtrain/4753a9v1`](https://wandb.ai/mbzuai-llm/k2v3_midtrain/runs/4753a9v1) | `974704` | 152 |
128
- | Midtraining 4 | `mid_4_final` | 512K tokens | [`5494c84c`](https://github.com/LLM360/xllm/commit/5494c84cc7a2a66e5d6439bf9aa07454097ce9be) | [`k2v3_midtrain/lagg1h7w`](https://wandb.ai/mbzuai-llm/k2v3_midtrain/runs/lagg1h7w) | `1189061` | 152 |
129
-
130
-
131
-
132
- ## Training Loss
133
-
134
- The chart reconstructs the release checkpoint lineage for Pretraining, Midtraining 1, Midtraining 2, Midtraining 3, Midtraining 4. Training loss is the next-token prediction objective; lower values indicate that the model assigns greater probability to the observed next token. Training loss is not a validation score and should not be compared across different tokenizers or data mixtures without additional controls.
135
-
136
- ![K2-Horizon-32B training loss versus cumulative training tokens](./assets/k2-horizon-32b-training-loss-vs-tokens.png)
137
-
138
- Each panel combines the W&B process records that contribute to the release checkpoint. Faint lines show sampled raw training loss; bold lines show an unpadded centered moving average with a raised-cosine taper over the final half-window. The final sample retains 20% of its base weight, limiting right-edge bias without hiding the raw tail. Checkpoint restart overlap is replaced by the later process record.
139
-
140
-
141
- ## Deployment Guide
142
-
143
- These are base checkpoints. They can be served for research, evaluation, retrieval-augmented generation experiments, tool-use research, and downstream adaptation. They are not instruction-aligned assistants by default, so production deployments should add application-level safety filters, system prompting, and task-specific validation.
144
-
145
- All reported K2-Horizon evaluation used BF16. Some released checkpoint shards and configuration metadata remain FP32; the examples below explicitly load or serve them as BF16 to match the evaluation runtime and reduce accelerator memory usage.
146
-
147
- ### Validated Independent Dependency Versions
148
-
149
- Use a separate Python environment for every workflow. Direct Transformers loading, xLLM conversion, vLLM, and the pinned SGLang production revision have independent dependency contracts. Do not install one row into another row's environment. Versions intentionally differ when a framework or remote-model contract requires them.
150
 
151
- | Workflow | Python | PyTorch | CUDA | Transformers | Safetensors | Attention kernel | Framework revision |
152
- | --- | --- | --- | --- | --- | --- | --- | --- |
153
- | Direct Transformers loading | 3.14 | 2.13.0 | 12.6 | 5.15.0 | 0.8.0 | PyTorch SDPA 2.13.0 | Transformers 5.15.0 remote code |
154
- | xLLM checkpoint conversion | 3.12 | 2.8.0 | 12.8 | 4.57.3 | 0.8.0 | FlashAttention 2.8.3.post1 | xLLM `7cfa3b2c` |
155
- | vLLM serving | 3.12 | 2.13.0 | 12.9 | 5.16.1 | 0.8.0 | FlashInfer 0.6.17 | vLLM 0.26.1rc1.dev1212 source `d9fd5f11` (PR #53806) |
156
- | SGLang serving | 3.12 | 2.9.1 | 12.8 (CUDA Python 12.9) | 5.3.0 | 0.8.0 | FA3 (sglang-kernel 0.4.1); FlashInfer 0.6.7.post2 available | SGLang `ffb41d77` (stable-only metadata) |
157
-
158
- ### Inference Parameter Starting Points
159
-
160
- K2-Horizon does not use one family-wide sampling preset. The values below are operational baselines: temperature 0 is the validated deterministic serving comparison, while sampled settings are conservative starting points that should be tuned on application prompts. Benchmark reproduction must use the decoding configuration attached to that benchmark.
161
-
162
- | Use case | Temperature | Top-p | Max new tokens | Notes |
163
- | --- | --- | --- | --- | --- |
164
- | Checkpoint smoke test and deterministic evaluation | 0.0 | 1.0 | 512-4,096 | Greedy decoding is the reproducible baseline used by serving comparisons. |
165
- | Base-model continuation | 0.6 | 0.95 | 1,024-4,096 | A conservative sampling baseline; tune on a held-out prompt set. |
166
- | Long-context continuation or summarization | 0.2 | 0.9 | 2,048-8,192 | Start with one request and increase context only after KV-cache capacity checks. |
167
- | Reasoning and tool-call validation | 0.0 | 1.0 | 4,096 | Use a compatible chat template and the K2Horizon parser stack below. |
168
-
169
- ### Transformers
170
-
171
- The selected default checkpoint is loaded with Transformers 5.15.0 and PyTorch 2.13.0 on CUDA 12.6. Select the corresponding PyTorch build for your accelerator when that CUDA runtime is unavailable. The selected default checkpoint uses the self-contained native K2 remote implementation. Its saved Transformers 5.13.0 contract is source-compatible with the newer stable 5.15.0 release, and it does not import xLLM native extensions.
172
-
173
- <details>
174
- <summary>Show Transformers installation commands</summary>
175
-
176
- ```bash
177
- python -m pip install "torch==2.13.0" \
178
- --index-url "https://download.pytorch.org/whl/cu126"
179
- python -m pip install \
180
- "transformers==5.15.0" \
181
- "safetensors==0.8.0" \
182
- "accelerate==1.14.0"
183
- ```
184
-
185
- </details>
186
-
187
- <details>
188
- <summary>Show Transformers inference example</summary>
189
-
190
- ```python
191
- from transformers import AutoModelForCausalLM, AutoTokenizer
192
-
193
- MODEL_ID = "IFM/K2-Horizon-32B"
194
- REVISION = "mid_4"
195
-
196
- tokenizer = AutoTokenizer.from_pretrained(
197
- MODEL_ID,
198
- revision=REVISION,
199
- trust_remote_code=True,
200
- )
201
- model = AutoModelForCausalLM.from_pretrained(
202
- MODEL_ID,
203
- revision=REVISION,
204
- device_map="auto",
205
- dtype="bfloat16",
206
- low_cpu_mem_usage=True,
207
- trust_remote_code=True,
208
- )
209
-
210
- prompt = "Explain why long-context evaluation is difficult."
211
- inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
212
- inputs.pop("token_type_ids", None)
213
- outputs = model.generate(
214
- **inputs,
215
- max_new_tokens=512,
216
- temperature=0.7,
217
- top_p=0.9,
218
- do_sample=True,
219
- )
220
- print(tokenizer.decode(outputs[0], skip_special_tokens=True))
221
- ```
222
-
223
- </details>
224
-
225
- ### xLLM
226
-
227
- xLLM provides the training framework, checkpoint converter, serving bridges, and runtime kernels used by the XLLM-based K2-Horizon repositories. For checkpoint conversion, parity work, or loading a legacy 36B `XllmForCausalLM` stage that imports xLLM MoVA kernels, use the isolated legacy contract and reviewed bridge revision [`7cfa3b2c`](https://github.com/LLM360/xllm/commit/7cfa3b2c61fad3b2ef48f7f7b497ef360087c72f):
228
-
229
- <details>
230
- <summary>Show xLLM setup and conversion commands</summary>
231
-
232
- ```bash
233
- git clone https://github.com/LLM360/xllm.git
234
- cd xllm
235
- git checkout 7cfa3b2c61fad3b2ef48f7f7b497ef360087c72f
236
-
237
- python -m pip install "torch==2.8.0" \
238
- --index-url "https://download.pytorch.org/whl/cu128"
239
- export XLLM_BUILD_ROOT="${XLLM_BUILD_ROOT:-$PWD/.xllm-build}"
240
- export TMPDIR="$XLLM_BUILD_ROOT/tmp"
241
- export PIP_CACHE_DIR="$XLLM_BUILD_ROOT/pip-cache"
242
- mkdir -p "$TMPDIR" "$PIP_CACHE_DIR"
243
- python -m pip install packaging ninja
244
- python -m pip install "https://github.com/Dao-AILab/flash-attention/releases/download/v2.8.3.post1/flash_attn-2.8.3.post1+cu12torch2.8cxx11abiTRUE-cp312-cp312-linux_x86_64.whl"
245
- python -m pip install -r requirements.txt
246
- python -m pip install -e . --no-build-isolation \
247
- --config-settings editable_mode=compat
248
- python -m pip install \
249
- "transformers==4.57.3" \
250
- "safetensors==0.8.0" \
251
- accelerate fire
252
-
253
- python xllm_bridges/huggingface/xllm_to_hf_main.py --help
254
- ```
255
 
256
- </details>
257
-
258
- The converter requires an original xLLM distributed checkpoint and tokenizer. Released Hugging Face revisions are already converted. On K2-Horizon-32B, `mid_4` uses the native Transformers 5 contract above; `pretrain` through `mid_3` use the pure Transformers 4.57.6/SDPA direct contract, without xLLM. The xLLM row remains the converter contract. Pinning a revision does not make runtime contracts interchangeable.
259
-
260
- ### vLLM
261
-
262
- The example pins [vLLM PR #53806](https://github.com/vllm-project/vllm/pull/53806) at [`d9fd5f11`](https://github.com/vllm-project/vllm/commit/d9fd5f11423a1a5628fe29e7296ceb9de91aac3c). That source registers `K2HorizonForCausalLM` plus the built-in `k2_horizon` reasoning and tool parsers. The command uses vLLM's `vllm` model implementation for this checkpoint contract.
263
-
264
- <details>
265
- <summary>Show vLLM setup and serving commands</summary>
266
-
267
- ```bash
268
- git clone --filter=blob:none --no-checkout \
269
- https://github.com/vllm-project/vllm.git
270
- cd vllm
271
- git fetch origin \
272
- pull/53806/head:refs/remotes/origin/pr-53806
273
- git checkout --detach d9fd5f11423a1a5628fe29e7296ceb9de91aac3c
274
- test "$(git rev-parse HEAD)" = "d9fd5f11423a1a5628fe29e7296ceb9de91aac3c"
275
-
276
- python3.12 -m venv .venv
277
- source .venv/bin/activate
278
- python -m pip install --upgrade pip uv
279
- export UV_LINK_MODE=copy
280
- VLLM_USE_PRECOMPILED=1 uv pip install --upgrade --editable . \
281
- --torch-backend=auto
282
- uv pip install \
283
- "transformers==5.16.1" \
284
- "safetensors==0.8.0"
285
- python -m pip check
286
-
287
- python - <<'PY'
288
- from vllm import ModelRegistry
289
- from vllm.reasoning import ReasoningParserManager
290
- from vllm.tool_parsers import ToolParserManager
291
-
292
- assert "K2HorizonForCausalLM" in ModelRegistry.get_supported_archs()
293
- assert ReasoningParserManager.get_reasoning_parser("k2_horizon") is not None
294
- assert ToolParserManager.get_tool_parser("k2_horizon") is not None
295
- PY
296
-
297
- export MODEL_ID="IFM/K2-Horizon-32B"
298
- export MODEL_REVISION="mid_4"
299
- export TENSOR_PARALLEL_SIZE=2
300
- export MAX_MODEL_LEN=131072
301
-
302
- vllm serve "$MODEL_ID" \
303
- --revision "$MODEL_REVISION" \
304
  --model-impl vllm \
305
- --tensor-parallel-size "$TENSOR_PARALLEL_SIZE" \
306
  --trust-remote-code \
307
  --dtype bfloat16 \
308
- --served-model-name "$MODEL_ID" \
309
- --max-model-len "$MAX_MODEL_LEN" \
310
  --reasoning-parser k2_horizon \
311
  --enable-auto-tool-choice \
312
  --tool-call-parser k2_horizon
313
  ```
314
 
315
- </details>
316
-
317
- The source checkout is immutable at `d9fd5f11423a1a5628fe29e7296ceb9de91aac3c`. The command serves `mid_4`; the repository's longest checkpoint configuration reports 524,288 tokens, while this example starts at 131,072 tokens. Increase context and concurrency only after measuring KV-cache capacity. The preflight fails immediately if the native architecture or either Horizon parser registration is absent.
318
-
319
- ### SGLang
320
-
321
- Native K2 Horizon support is provided by
322
- [sgl-project/sglang#37654](https://github.com/sgl-project/sglang/pull/37654).
323
- Use a `lmsysorg/sglang:dev` image built after that PR is merged. Once support is
324
- included in a tagged SGLang release, use the corresponding versioned image.
325
-
326
- <details>
327
- <summary>Show the SGLang serving command</summary>
328
-
329
- ```bash
330
- docker run --gpus all \
331
- --shm-size 32g \
332
- -p 30000:30000 \
333
- -v ~/.cache/huggingface:/root/.cache/huggingface \
334
- --ipc=host \
335
- lmsysorg/sglang:dev \
336
- python3 -m sglang.launch_server \
337
- --model-path "IFM/K2-Horizon-32B" \
338
- --revision main \
339
- --tp 2 \
340
- --dtype bfloat16 \
341
- --context-length 131072 \
342
- --attention-backend fa3 \
343
- --reasoning-parser k2_horizon \
344
- --tool-call-parser k2_horizon \
345
- --mem-fraction-static 0.85 \
346
- --host 0.0.0.0 \
347
- --port 30000
348
- ```
349
-
350
- </details>
351
-
352
- This uses SGLang's native `K2HorizonForCausalLM` implementation; no
353
- `--trust-remote-code`, source patch, or external parser plugin is required. The
354
- 131,072-token limit is a conservative starting point; increase it only after
355
- measuring KV-cache capacity.
356
-
357
- ### Reasoning and Tool Parsers
358
 
359
- Parser configuration is part of the deployment contract. The canonical K2-Horizon format uses `<ifm|...>` reasoning and tool tokens; test streaming and non-streaming responses before exposing an OpenAI-compatible endpoint.
360
-
361
- | Goal | vLLM guidance | SGLang guidance | When to use |
362
- | --- | --- | --- | --- |
363
- | Plain text generation | Do not enable a reasoning or tool parser. | Do not enable a reasoning or tool parser. | Base-model evaluation, completion-style generation, and checkpoint smoke tests. |
364
- | Canonical K2-Horizon reasoning | Use the built-in `--reasoning-parser k2_horizon`. | Use `--reasoning-parser k2_horizon`. | Checkpoints and chat templates using `<ifm|think>`, `<ifm|think_fast>`, or `<ifm|think_faster>`. |
365
- | Canonical K2-Horizon tool calls | Use `--enable-auto-tool-choice --tool-call-parser k2_horizon`. | Use `--tool-call-parser k2_horizon`. | XML, typed-XML, or JSON calls wrapped in `<ifm|tool_call>`. |
366
- | Legacy K2 reasoning traces | Use the legacy parser only in a compatibility image that registers it. | Use `--reasoning-parser k2_horizon_legacy`. | Older traces using `<think>`, `<think_fast>`, or `<think_faster>` instead of canonical IFM tokens. |
367
- | Mixed tool-call corpora | Use `multi_format` only in a build that includes and tests that parser. | Use `--tool-call-parser multi_format`. | Evaluation corpora that intentionally mix K2, GLM, or JSON tool-call dialects. |
368
-
369
- PR #53806 registers both Horizon parsers in-tree; no external parser plugin is required.
370
 
371
- For OpenAI-compatible requests, select reasoning effort through chat-template kwargs:
372
 
373
- <details>
374
- <summary>Show OpenAI-compatible request example</summary>
 
375
 
376
  ```python
377
  from openai import OpenAI
378
 
379
- client = OpenAI(base_url="http://localhost:8000/v1", api_key="unused")
380
  response = client.chat.completions.create(
381
  model="IFM/K2-Horizon-32B",
382
  messages=[{"role": "user", "content": "Explain the result step by step."}],
383
- temperature=0,
384
- max_tokens=4096,
 
385
  extra_body={"chat_template_kwargs": {"reasoning_effort": "high"}},
386
  )
387
- print(response.choices[0].message)
 
 
388
  ```
389
 
390
- </details>
391
-
392
- ### Other Serving Frameworks
393
-
394
- Text Generation Inference, TensorRT-LLM, llama.cpp, Ollama, and LM Studio may require model-specific conversion, quantization, or custom architecture support. Validate tokenizer behavior, remote-code requirements, attention implementation, and long-context behavior before publishing service results.
395
-
396
-
397
- ## Hardware Planning
398
-
399
- The table below gives capacity-planning starting points for self-hosted inference. Weight memory uses the parameter count including input and output embeddings. On-disk FP32 shards and dtype conversion can require substantially more host RAM during loading than the final BF16 GPU footprint. KV-cache estimates use BF16 keys and values for one request at the smaller of the model maximum and 128K tokens; batching, allocator overhead, activations, CUDA graphs, and framework workspaces require additional memory.
400
-
401
- | Model | Stored params | Active params/token | BF16 weight memory | FP32 weight memory | BF16 KV cache / request | Starting TP | Recommended starting point |
402
- | --- | --- | --- | --- | --- | --- | --- | --- |
403
- | K2-Horizon-0.9B | 0.9B | 0.9B | 2.0 GiB | 4.0 GiB | 0.4 GiB @ 8K tokens | 1 | 1 GPU with 16 GiB is a practical starting point for the model's 8K context; allow additional memory for batching. |
404
- | K2-Horizon-3.7B | 5.06B | 5.06B | 9.4 GiB | 18.8 GiB | 18.0 GiB @ 128K tokens | 1 | 1 GPU with 24 GiB can serve short contexts in BF16; use 48-80 GiB for larger KV caches and 128K-class requests. |
405
- | K2-Horizon-7B | 9.00B | 9.00B | 16.8 GiB | 33.5 GiB | 18.0 GiB @ 128K tokens | 1 | 1 GPU with 40-48 GiB is suitable for short-context BF16 serving; 80 GiB is the practical starting point for 128K-class requests. |
406
- | K2-Horizon-32B | 34.78B | 34.78B | 64.8 GiB | 129.6 GiB | 32.0 GiB @ 128K tokens | 2-4 | 1x 80 GiB fits BF16 weights only at short context; start with 2x 80 GiB for 128K requests and 4x 80 GiB for larger context or throughput. |
407
- | K2-Horizon-MoVA-36B-A4B | 37.44B | 5.95B | 69.7 GiB | 139.5 GiB | 24.0 GiB @ 128K tokens | 2-4 | Use at least 256 GiB of host RAM to load the current 139.5 GiB FP32 shard set. Start with 2x 80 GiB GPUs for BF16 weight sharding, or 1x H200 141 GiB for short single-request validation; use 4x 80 GiB for 128K-class requests. |
408
- | K2-Horizon-375B | 379.17B | 26.67B | 706.3 GiB | 1.38 TiB | 30.5 GiB @ 128K tokens | 8 H200 or 16x 80 GiB | The full 512K profile is validated on 8x H200 141 GiB GPUs at TP=8 and 0.92 memory utilization; use at least 16x 80 GiB GPUs on lower-memory hardware. |
409
-
410
- ## Evaluation
411
-
412
- Benchmark values are reported as percentages unless otherwise noted. A dash means the metric was not reported for that model or revision in the release evaluation records. The family tables below use each model's latest listed midtraining release checkpoint.
413
-
414
- ### Family Evaluation: Knowledge and Instruction Following
415
-
416
- | Model | Revision | IFEval | MMLU-Pro | MMLU | BBH |
417
- | --- | --- | --- | --- | --- | --- |
418
- | K2-Horizon-0.9B | `mid_2_final` | 43.1 | 40.3 | 44.4 | 43.8 |
419
- | K2-Horizon-3.7B | `mid_4_final` | 85.7 | 73.0 | 80.7 | 84.4 |
420
- | K2-Horizon-7B | `mid_4_final` | 89.9 | 75.7 | 83.3 | 87.8 |
421
- | K2-Horizon-32B | `mid_4_final` | 88.0 | 79.5 | 87.5 | 89.1 |
422
- | K2-Horizon-MoVA-36B-A4B | `mid_4_final` | 89.6 | 79.2 | 87.3 | 88.6 |
423
- | K2-Horizon-375B | `mid_4_final` | 92.1 | 82.6 | 89.5 | 87.5 |
424
-
425
- ### Family Evaluation: STEM, Reasoning, and Coding
426
-
427
- | Model | Revision | AIME26 | GPQA-Diamond | GSM8K | MBPP |
428
- | --- | --- | --- | --- | --- | --- |
429
- | K2-Horizon-0.9B | `mid_2_final` | 12.3 | 27.8 | 53.1 | 53.2 |
430
- | K2-Horizon-3.7B | `mid_4_final` | 88.2 | 73.3 | 92.3 | 86.4 |
431
- | K2-Horizon-7B | `mid_4_final` | 87.6 | 73.9 | 95.1 | 91.0 |
432
- | K2-Horizon-32B | `mid_4_final` | 91.7 | 75.4 | 95.5 | 87.8 |
433
- | K2-Horizon-MoVA-36B-A4B | `mid_4_final` | 92.7 | 75.4 | 95.2 | 87.2 |
434
- | K2-Horizon-375B | `mid_4_final` | 92.5 | 84.9 | 95.1 | 93.8 |
435
-
436
- ### Family Evaluation: Agentic and Long-Context Tasks
437
-
438
- | Model | Revision | SWE-Bench Verified (avg@3) | Terminal-Bench 2.1 (avg@3) | GDPval (acc@75%) | Tau3 Banking | BrowseComp+ (acc@1) | Apex Agents (pass@1) | WildClawBench | LCR |
439
- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
440
- | K2-Horizon-7B | `mid_4_final` | 57.5 | 28.1 | 34.5 | 10.4 | 52.2 | 6.0 | 23.9 | - |
441
- | K2-Horizon-375B | `mid_4_final` | 67.8 | 38.2 | 39.6 | 11.4 | 58.1 | 13.8 | 34.8 | 56.0 |
442
-
443
- Agentic results are joined only to exact selected release checkpoints. SWE-Bench Verified and Terminal-Bench 2.1 report three-run averages where available; GDPval reports accuracy at 75 percent; BrowseComp+ reports accuracy at one; Apex Agents reports pass at one. Fractional workbook values are converted to percentages. When a source cell contains multiple reported aggregates, the first aggregate is shown unless the cell contains only three slash-separated trial values, in which case their mean is reported. A dash means the exact release checkpoint has no reported result for that benchmark.
444
-
445
- ### Family Evaluation: Advanced Research Benchmarks
446
-
447
- | Model | Revision | MCP Atlas | HLE | SciCode | OmniScience Accuracy | OmniScience Non-Hallucination | CritPT |
448
- | --- | --- | --- | --- | --- | --- | --- | --- |
449
- | K2-Horizon-7B | `mid_4_final` | 53.6 | 13.8 | - | - | 43.7 | - |
450
- | K2-Horizon-375B | `mid_4_final` | 59.0 | 21.2 | 40.3 | 20.6 | 49.2 | 5.1 |
451
-
452
- These results use exact final-stage checkpoint records. Benchmark availability differs by model, so unreported cells remain `-`.
453
-
454
- ### This Repository: Base / Pretraining Snapshot
455
-
456
- | Revision | ArabicMMLU | ARC-C | BBH | GPQA-Diamond-CoT | GSM8K | MMLU | MMLU-Pro | HumanEval | MBPP | IFEval |
457
- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
458
- | `base_final` | 73.5 | 69.8 | 84.7 | 18.2 | 86.0 | 78.9 | 57.9 | 64.0 | 68.2 | 27.5 |
459
-
460
- ### This Repository: Midtraining Snapshot
461
-
462
- | Revision | IFEval avg | MMLU-Pro | GSM8K | MMLU | BBH | MBPP | AIME26 | GPQA-Diamond | LongBench-v2 | LCR | SWE-Bench Verified | Terminal Bench 2 |
463
- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
464
- | `mid_1_final` | 89.6 | 79.7 | 95.8 | 87.9 | 89.2 | 88.2 | 79.8 | 69.9 | - | - | - | - |
465
- | `mid_2_final` | 88.5 | 79.7 | 95.6 | 87.8 | 88.9 | 89.6 | 92.3 | 77.3 | - | - | - | - |
466
- | `mid_3_final` | 88.0 | 79.5 | 95.5 | 87.5 | 89.1 | 87.8 | 91.7 | 75.4 | - | - | - | - |
467
-
468
- ### This Repository: Agentic and Long-Context Results by Stage
469
-
470
- | Revision | SWE-Bench Verified | Terminal-Bench | GDPval (acc@75%) | Tau3 Banking | BrowseComp+ | Toolathlon | Apex Agents | LongBench-v2 | LCR |
471
- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
472
- | `mid_3_final` | - | - | 26.4 | - | 56.0 | - | 5.7 | - | - |
473
-
474
-
475
-
476
-
477
- ## Datasets and Mixtures
478
-
479
- K2-Horizon training is organized around transparent data releases:
480
-
481
- - Pretraining data: [IFM/K2-Horizon-Pretrain-Data](https://huggingface.co/datasets/IFM/K2-Horizon-Pretrain-Data), derived from the TxT360 lineage.
482
- - Midtraining data: [IFM/K2-Horizon-Midtrain-Data](https://huggingface.co/datasets/IFM/K2-Horizon-Midtrain-Data), following the TxT360-Midas reasoning and long-context release pattern.
483
- - The public data-preparation lineage is maintained in [LLM360/TxT360](https://github.com/LLM360/TxT360).
484
 
485
- ## Source Code
486
 
487
- - [LLM360/xllm](https://github.com/LLM360/xllm) - Training framework and Hugging Face/vLLM bridges. Per-stage training commits are linked in the provenance table.
488
- - [LLM360/Eval360-V2 at `f5081bfb`](https://github.com/LLM360/Eval360-V2/commit/f5081bfba9ef8e7b380f5bd85ed1cf61a91f90b0) - Evaluation harness revision reviewed against the release benchmark workbooks.
489
- - [LLM360/agent-evals at `f3788399`](https://github.com/LLM360/agent-evals/commit/f3788399a974e49121984f11556138f23f907cee) - Agentic benchmark harness, Slurm launchers, and serving profiles used to reconcile the agentic release results.
490
- - [vLLM PR #53806 at `d9fd5f11`](https://github.com/vllm-project/vllm/commit/d9fd5f11423a1a5628fe29e7296ceb9de91aac3c) - Native K2-Horizon architecture plus built-in reasoning and tool parsers used by the serving example.
491
- - [LLM360/Inference360 at `a7ee94f9`](https://github.com/LLM360/Inference360/commit/a7ee94f9ad9a561e65a67ede22d4e7a2c8428b57) - Serving-image and deployment-validation references.
492
- - [LLM360/sglang at `ffb41d77`](https://github.com/LLM360/sglang/commit/ffb41d77d8b96b8a953351cb4d66d6bf4ed061a7) - SGLang serving base used by the hash-guarded K2-Horizon namespace migration.
493
- - [LLM360/TxT360](https://github.com/LLM360/TxT360) - Public data-preparation and source-data lineage reference.
494
 
495
- ## Intended Use
 
 
 
 
496
 
497
- K2-Horizon-32B is intended for open research on foundation models, transparent evaluation, staged checkpoint analysis, downstream fine-tuning, and reproducibility studies. It is suitable for researchers and developers who want to inspect training-stage behavior, serve a model privately, compare model sizes, or build downstream adaptations.
 
 
 
 
498
 
499
- ## Limitations and Safety
500
 
501
- - This is a base checkpoint family and may produce inaccurate, biased, unsafe, or hallucinated content.
502
- - The model is not optimized for moderation, refusal behavior, or production assistant safety.
503
- - Long-context behavior depends on serving stack, prompt construction, retrieval quality, and KV-cache configuration.
504
- - Tool-use and agentic results depend heavily on parser format, prompt template, tool schema, and execution harness.
505
- - The model family is documented primarily with English-language evaluations; additional multilingual evaluation should be performed before broad multilingual claims.
506
- - Users are responsible for complying with the model license and for validating deployments in their own risk domain.
507
 
508
  ## Citation
509
 
510
- Please cite this model as:
511
-
512
  ```bibtex
513
- @misc{ifmk2horizon32b2026,
514
- title = {K2-Horizon Model Family: K2-Horizon-32B},
515
- author = {IFM Team},
516
- year = {2026},
517
- url = {https://huggingface.co/IFM/K2-Horizon-32B},
518
  }
519
- ```
520
-
521
- ## Contact
522
-
523
- For questions about this release, contact the IFM / K2-Horizon team through the model repository or the IFM organization.
 
18
 
19
  # K2-Horizon-32B
20
 
21
+ > [!Note]
22
+ > This repository contains the weights and configuration for K2-Horizon-32B in the Hugging Face Transformers format.
23
+ > These are base and midtrained checkpoints, not an instruction-aligned assistant. They load with Transformers, vLLM, and SGLang.
24
 
25
+ > [!Tip]
26
+ > This card is the short version. Architecture tables, checkpoint provenance, pinned dependency versions, full serving commands, hardware planning, and every evaluation table live in the [Technical Appendix](APPENDIX.md).
27
 
28
+ [Training Code](https://github.com/LLM360/xllm) · [Evaluation Code](https://github.com/LLM360/Eval360-V2) · [Pretraining Data](https://huggingface.co/datasets/IFM/K2-Horizon-Pretrain-Data) · [Midtraining Data](https://huggingface.co/datasets/IFM/K2-Horizon-Midtrain-Data) · [Technical Appendix](APPENDIX.md)
29
 
30
+ K2-Horizon-32B is the large dense member of the K2-Horizon family: a 32B decoder-only model with a 512K context window. It is released fully open, with weights at every training stage, the data, the training code, and the evaluation harness.
31
 
32
+ <p align="center">
33
+ <img src="assets/k2-horizon-32b-benchmarks.png" alt="K2-Horizon-32B benchmark results against open MoE, dense, and closed models" width="100%">
34
+ </p>
35
 
36
+ ## K2-Horizon-32B Highlights
37
 
38
+ - **Strong dense baseline.** A 32B dense model evaluated on the same agentic, coding, and reasoning benchmarks as the rest of the family (see [Benchmark Results](#benchmark-results)).
39
+ - **Straightforward serving.** 32B dense, no expert routing. Two 80 GiB GPUs serve it in BF16 at TP=2.
40
+ - **512K context.** Native 524,288-token context from the midtraining stages onward.
41
+ - **Staged checkpoints.** Pretrained, four intermediate midtrained checkpoints, and the final `main` checkpoint are all released, so capability changes can be studied across training rather than at a single checkpoint.
42
+ - **Fully open.** Pretraining data and recipe for midtraining data, the training code, per-stage W&B runs, and the evaluation code are all public.
43
 
44
+ ## Model Overview
45
 
46
+ <!-- - Type: Causal Language Model, dense decoder-only (`K2HorizonForCausalLM`)
47
+ - Training Stage: Pretraining and four midtraining stages
48
+ - Number of Parameters: 32.21B (34.78B including embeddings)
49
+ - Number of Layers: 64
50
+ - Hidden Dimension: 5,120
51
+ - Attention Heads: 64 for Q, 8 for KV
52
+ - Feed-Forward Intermediate Dimension: 26,624
53
+ - Vocabulary: 250,624
54
+ - Context Length: 524,288 tokens
55
+ - Checkpoint dtype: FP32 on disk; evaluated and served in BF16 -->
56
 
57
+ Checkpoint revisions:
58
 
59
+ | Revision tag | Stage | Max context |
60
+ | --- | --- | --- |
61
+ | `main` | Default release (same as `mid_4_final`) | 512K |
62
+ | `mid_4_final` / `mid_3_final` | Midtraining 4 / 3 | 512K |
63
+ | `mid_2_final` | Midtraining 2 | 128K |
64
+ | `mid_1_final` | Midtraining 1 | 32K |
65
+ | `base_final` | Base / pretraining | 8K |
66
 
67
+ ## Benchmark Results
68
 
69
+ The chart at the top of this card shows K2-Horizon-32B against the four highest-scoring models it beats on each benchmark. The table below lists every comparison model on every benchmark.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
 
71
+ ### Full Results
72
 
73
+ <!-- TABLE:START -->
74
+ <div style="font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;margin:0 auto;padding:8px 0 16px;overflow-x:auto"><table style="display:table;width:100%;table-layout:fixed;border-collapse:collapse;font-size:12px;margin:0"><thead><tr><th style="width:30%;border-bottom:none"></th><th colspan="1" style="padding:6px 4px 2px;text-align:center;font-size:11px;font-weight:600;letter-spacing:0.04em;text-transform:uppercase;opacity:0.65;border-bottom:1px solid rgba(128,128,128,0.25)"></th><th colspan="3" style="padding:6px 4px 2px;text-align:center;font-size:11px;font-weight:600;letter-spacing:0.04em;text-transform:uppercase;opacity:0.65;border-bottom:1px solid rgba(128,128,128,0.25)">Open-weight dense models</th></tr><tr><th style="padding:10px 6px;text-align:left;border-bottom:2px solid #2450D6"></th><th style="padding:10px 3px;text-align:center;font-weight:600;border-bottom:2px solid #2450D6;color:#2450D6;font-size:12.5px;line-height:1.2;width:17.50%;overflow-wrap:anywhere;background:rgba(36,80,214,0.08);">K2-Horizon-32B</th><th style="padding:10px 3px;text-align:center;font-weight:600;border-bottom:2px solid #2450D6;color:#2450D6;font-size:12.5px;line-height:1.2;width:17.50%;overflow-wrap:anywhere;">Qwen3.8-27B</th><th style="padding:10px 3px;text-align:center;font-weight:600;border-bottom:2px solid #2450D6;color:#2450D6;font-size:12.5px;line-height:1.2;width:17.50%;overflow-wrap:anywhere;">Muse Glimmer-30B</th><th style="padding:10px 3px;text-align:center;font-weight:600;border-bottom:2px solid #2450D6;color:#2450D6;font-size:12.5px;line-height:1.2;width:17.50%;overflow-wrap:anywhere;">IBM Granite 4.2 30B</th></tr></thead><tbody><tr><td style="padding:7px 4px 7px 10px;border-bottom:1px solid rgba(128,128,128,0.15);vertical-align:middle;font-size:12.5px;font-weight:600"># Params</td><td style="padding:6px 2px;text-align:center;border-bottom:1px solid rgba(128,128,128,0.15);vertical-align:middle;font-size:12.5px;line-height:1.2;background:rgba(36,80,214,0.08);">32B</td><td style="padding:6px 2px;text-align:center;border-bottom:1px solid rgba(128,128,128,0.15);vertical-align:middle;font-size:12.5px;line-height:1.2;">27B</td><td style="padding:6px 2px;text-align:center;border-bottom:1px solid rgba(128,128,128,0.15);vertical-align:middle;font-size:12.5px;line-height:1.2;">30B</td><td style="padding:6px 2px;text-align:center;border-bottom:1px solid rgba(128,128,128,0.15);vertical-align:middle;font-size:12.5px;line-height:1.2;">30B</td></tr><tr><td style="padding:7px 4px 7px 10px;border-bottom:1px solid rgba(128,128,128,0.15);vertical-align:middle;font-size:12.5px;font-weight:600"># Activated params</td><td style="padding:6px 2px;text-align:center;border-bottom:1px solid rgba(128,128,128,0.15);vertical-align:middle;font-size:12.5px;line-height:1.2;background:rgba(36,80,214,0.08);">32B</td><td style="padding:6px 2px;text-align:center;border-bottom:1px solid rgba(128,128,128,0.15);vertical-align:middle;font-size:12.5px;line-height:1.2;">27B</td><td style="padding:6px 2px;text-align:center;border-bottom:1px solid rgba(128,128,128,0.15);vertical-align:middle;font-size:12.5px;line-height:1.2;">30B</td><td style="padding:6px 2px;text-align:center;border-bottom:1px solid rgba(128,128,128,0.15);vertical-align:middle;font-size:12.5px;line-height:1.2;">30B</td></tr><tr><td style="padding:7px 4px 7px 10px;border-bottom:1px solid rgba(128,128,128,0.15);vertical-align:middle;font-size:12.5px;font-weight:600">Architecture</td><td style="padding:6px 2px;text-align:center;border-bottom:1px solid rgba(128,128,128,0.15);vertical-align:middle;font-size:12.5px;line-height:1.2;background:rgba(36,80,214,0.08);">Dense</td><td style="padding:6px 2px;text-align:center;border-bottom:1px solid rgba(128,128,128,0.15);vertical-align:middle;font-size:12.5px;line-height:1.2;">Dense</td><td style="padding:6px 2px;text-align:center;border-bottom:1px solid rgba(128,128,128,0.15);vertical-align:middle;font-size:12.5px;line-height:1.2;">Dense</td><td style="padding:6px 2px;text-align:center;border-bottom:1px solid rgba(128,128,128,0.15);vertical-align:middle;font-size:12.5px;line-height:1.2;">Dense</td></tr><tr><td colspan="5" style="padding:6px 10px;font-weight:600;font-size:12.5px;color:#2450D6;border-bottom:1px solid rgba(36,80,214,0.25);background:rgba(36,80,214,0.12)">Agents</td></tr><tr><td style="padding:6px 4px 6px 10px;border-bottom:1px solid rgba(128,128,128,0.15);vertical-align:middle"><div style="font-size:12.5px;font-weight:600;line-height:1.2;color:inherit">tau3-Banking</div><div style="margin-top:2px;font-size:10px;opacity:0.65">Agentic tool use</div></td><td style="padding:6px 2px;text-align:center;border-bottom:1px solid rgba(128,128,128,0.15);vertical-align:middle;font-size:12.5px;line-height:1.2;background:rgba(36,80,214,0.08);">22.5</td><td style="padding:6px 2px;text-align:center;border-bottom:1px solid rgba(128,128,128,0.15);vertical-align:middle;font-size:12.5px;line-height:1.2;"><strong>48.0</strong></td><td style="padding:6px 2px;text-align:center;border-bottom:1px solid rgba(128,128,128,0.15);vertical-align:middle;font-size:12.5px;line-height:1.2;">23.5</td><td style="padding:6px 2px;text-align:center;border-bottom:1px solid rgba(128,128,128,0.15);vertical-align:middle;font-size:12.5px;line-height:1.2;">14.4</td></tr><tr><td colspan="5" style="padding:6px 10px;font-weight:600;font-size:12.5px;color:#2450D6;border-bottom:1px solid rgba(36,80,214,0.25);background:rgba(36,80,214,0.12)">Coding</td></tr><tr><td style="padding:6px 4px 6px 10px;border-bottom:1px solid rgba(128,128,128,0.15);vertical-align:middle"><div style="font-size:12.5px;font-weight:600;line-height:1.2;color:inherit">Terminal-Bench 2.1</div><div style="margin-top:2px;font-size:10px;opacity:0.65">Agentic terminal use</div></td><td style="padding:6px 2px;text-align:center;border-bottom:1px solid rgba(128,128,128,0.15);vertical-align:middle;font-size:12.5px;line-height:1.2;background:rgba(36,80,214,0.08);">36.6</td><td style="padding:6px 2px;text-align:center;border-bottom:1px solid rgba(128,128,128,0.15);vertical-align:middle;font-size:12.5px;line-height:1.2;"><strong>79.8</strong></td><td style="padding:6px 2px;text-align:center;border-bottom:1px solid rgba(128,128,128,0.15);vertical-align:middle;font-size:12.5px;line-height:1.2;">51.7</td><td style="padding:6px 2px;text-align:center;border-bottom:1px solid rgba(128,128,128,0.15);vertical-align:middle;font-size:12.5px;line-height:1.2;">26.6</td></tr><tr><td style="padding:6px 4px 6px 10px;border-bottom:1px solid rgba(128,128,128,0.15);vertical-align:middle"><div style="font-size:12.5px;font-weight:600;line-height:1.2;color:inherit">SciCode</div><div style="margin-top:2px;font-size:10px;opacity:0.65">Scientific coding</div></td><td style="padding:6px 2px;text-align:center;border-bottom:1px solid rgba(128,128,128,0.15);vertical-align:middle;font-size:12.5px;line-height:1.2;background:rgba(36,80,214,0.08);">30.2</td><td style="padding:6px 2px;text-align:center;border-bottom:1px solid rgba(128,128,128,0.15);vertical-align:middle;font-size:12.5px;line-height:1.2;"><strong>44.7</strong></td><td style="padding:6px 2px;text-align:center;border-bottom:1px solid rgba(128,128,128,0.15);vertical-align:middle;font-size:12.5px;line-height:1.2;">43.6</td><td style="padding:6px 2px;text-align:center;border-bottom:1px solid rgba(128,128,128,0.15);vertical-align:middle;font-size:12.5px;line-height:1.2;">36.6</td></tr><tr><td colspan="5" style="padding:6px 10px;font-weight:600;font-size:12.5px;color:#2450D6;border-bottom:1px solid rgba(36,80,214,0.25);background:rgba(36,80,214,0.12)">Scientific Reasoning</td></tr><tr><td style="padding:6px 4px 6px 10px;border-bottom:1px solid rgba(128,128,128,0.15);vertical-align:middle"><div style="font-size:12.5px;font-weight:600;line-height:1.2;color:inherit">Humanity's Last Exam (without tools)</div><div style="margin-top:2px;font-size:10px;opacity:0.65">Expert-level reasoning</div></td><td style="padding:6px 2px;text-align:center;border-bottom:1px solid rgba(128,128,128,0.15);vertical-align:middle;font-size:12.5px;line-height:1.2;background:rgba(36,80,214,0.08);">22.8</td><td style="padding:6px 2px;text-align:center;border-bottom:1px solid rgba(128,128,128,0.15);vertical-align:middle;font-size:12.5px;line-height:1.2;"><strong>33.9</strong></td><td style="padding:6px 2px;text-align:center;border-bottom:1px solid rgba(128,128,128,0.15);vertical-align:middle;font-size:12.5px;line-height:1.2;">22.0</td><td style="padding:6px 2px;text-align:center;border-bottom:1px solid rgba(128,128,128,0.15);vertical-align:middle;font-size:12.5px;line-height:1.2;">11.2</td></tr><tr><td style="padding:6px 4px 6px 10px;border-bottom:1px solid rgba(128,128,128,0.15);vertical-align:middle"><div style="font-size:12.5px;font-weight:600;line-height:1.2;color:inherit">GPQA Diamond</div><div style="margin-top:2px;font-size:10px;opacity:0.65">Graduate-level science QA</div></td><td style="padding:6px 2px;text-align:center;border-bottom:1px solid rgba(128,128,128,0.15);vertical-align:middle;font-size:12.5px;line-height:1.2;background:rgba(36,80,214,0.08);">82.3</td><td style="padding:6px 2px;text-align:center;border-bottom:1px solid rgba(128,128,128,0.15);vertical-align:middle;font-size:12.5px;line-height:1.2;"><strong>90.5</strong></td><td style="padding:6px 2px;text-align:center;border-bottom:1px solid rgba(128,128,128,0.15);vertical-align:middle;font-size:12.5px;line-height:1.2;">83.5</td><td style="padding:6px 2px;text-align:center;border-bottom:1px solid rgba(128,128,128,0.15);vertical-align:middle;font-size:12.5px;line-height:1.2;">64.4</td></tr><tr><td style="padding:6px 4px 6px 10px;border-bottom:1px solid rgba(128,128,128,0.15);vertical-align:middle"><div style="font-size:12.5px;font-weight:600;line-height:1.2;color:inherit">CritPt</div><div style="margin-top:2px;font-size:10px;opacity:0.65">Frontier physics reasoning</div></td><td style="padding:6px 2px;text-align:center;border-bottom:1px solid rgba(128,128,128,0.15);vertical-align:middle;font-size:12.5px;line-height:1.2;background:rgba(36,80,214,0.08);">1.4</td><td style="padding:6px 2px;text-align:center;border-bottom:1px solid rgba(128,128,128,0.15);vertical-align:middle;font-size:12.5px;line-height:1.2;"><strong>5.4</strong></td><td style="padding:6px 2px;text-align:center;border-bottom:1px solid rgba(128,128,128,0.15);vertical-align:middle;font-size:12.5px;line-height:1.2;">2.6</td><td style="padding:6px 2px;text-align:center;border-bottom:1px solid rgba(128,128,128,0.15);vertical-align:middle;font-size:12.5px;line-height:1.2;">0.3</td></tr><tr><td colspan="5" style="padding:6px 10px;font-weight:600;font-size:12.5px;color:#2450D6;border-bottom:1px solid rgba(36,80,214,0.25);background:rgba(36,80,214,0.12)">General</td></tr><tr><td style="padding:6px 4px 6px 10px;border-bottom:1px solid rgba(128,128,128,0.15);vertical-align:middle"><div style="font-size:12.5px;font-weight:600;line-height:1.2;color:inherit">AA-LCR</div><div style="margin-top:2px;font-size:10px;opacity:0.65">Long-context reasoning</div></td><td style="padding:6px 2px;text-align:center;border-bottom:1px solid rgba(128,128,128,0.15);vertical-align:middle;font-size:12.5px;line-height:1.2;background:rgba(36,80,214,0.08);">65.3</td><td style="padding:6px 2px;text-align:center;border-bottom:1px solid rgba(128,128,128,0.15);vertical-align:middle;font-size:12.5px;line-height:1.2;">77.3</td><td style="padding:6px 2px;text-align:center;border-bottom:1px solid rgba(128,128,128,0.15);vertical-align:middle;font-size:12.5px;line-height:1.2;"><strong>80.0</strong></td><td style="padding:6px 2px;text-align:center;border-bottom:1px solid rgba(128,128,128,0.15);vertical-align:middle;font-size:12.5px;line-height:1.2;">46.7</td></tr><tr><td style="padding:6px 4px 6px 10px;border-bottom:1px solid rgba(128,128,128,0.15);vertical-align:middle"><div style="font-size:12.5px;font-weight:600;line-height:1.2;color:inherit">AA-Omniscience Accuracy</div><div style="margin-top:2px;font-size:10px;opacity:0.65">Factual accuracy</div></td><td style="padding:6px 2px;text-align:center;border-bottom:1px solid rgba(128,128,128,0.15);vertical-align:middle;font-size:12.5px;line-height:1.2;background:rgba(36,80,214,0.08);">16.8</td><td style="padding:6px 2px;text-align:center;border-bottom:1px solid rgba(128,128,128,0.15);vertical-align:middle;font-size:12.5px;line-height:1.2;">15.6</td><td style="padding:6px 2px;text-align:center;border-bottom:1px solid rgba(128,128,128,0.15);vertical-align:middle;font-size:12.5px;line-height:1.2;"><strong>27.0</strong></td><td style="padding:6px 2px;text-align:center;border-bottom:1px solid rgba(128,128,128,0.15);vertical-align:middle;font-size:12.5px;line-height:1.2;">10.1</td></tr><tr><td style="padding:6px 4px 6px 10px;border-bottom:1px solid rgba(128,128,128,0.15);vertical-align:middle"><div style="font-size:12.5px;font-weight:600;line-height:1.2;color:inherit">AA-Omniscience Non-Hallucination</div><div style="margin-top:2px;font-size:10px;opacity:0.65">Non-hallucination rate</div></td><td style="padding:6px 2px;text-align:center;border-bottom:1px solid rgba(128,128,128,0.15);vertical-align:middle;font-size:12.5px;line-height:1.2;background:rgba(36,80,214,0.08);">58.3</td><td style="padding:6px 2px;text-align:center;border-bottom:1px solid rgba(128,128,128,0.15);vertical-align:middle;font-size:12.5px;line-height:1.2;">69.7</td><td style="padding:6px 2px;text-align:center;border-bottom:1px solid rgba(128,128,128,0.15);vertical-align:middle;font-size:12.5px;line-height:1.2;">18.1</td><td style="padding:6px 2px;text-align:center;border-bottom:1px solid rgba(128,128,128,0.15);vertical-align:middle;font-size:12.5px;line-height:1.2;"><strong>74.4</strong></td></tr></tbody></table></div>
75
+ <!-- TABLE:END -->
76
 
77
+ Scores in %. Bold marks the best score in each row. Sections follow the [Artificial Analysis Intelligence Index](https://artificialanalysis.ai/methodology/intelligence-benchmarking) categories. Baseline scores are from Artificial Analysis; Muse Glimmer-30B at high reasoning effort, other open models in their reasoning mode. K2-Horizon family tables, per-stage results, and the evaluation setup are in the [Technical Appendix](APPENDIX.md#evaluation).
 
 
 
 
 
 
 
78
 
79
+ ## Quickstart
80
 
81
+ ### Serving
 
82
 
83
+ > [!Important]
84
+ > Use the pinned framework revisions in the [Technical Appendix](APPENDIX.md#deployment-guide) until native K2-Horizon support lands in a tagged vLLM or SGLang release. The commands below are the short form.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
 
86
+ vLLM (source at [PR #53806](https://github.com/vllm-project/vllm/pull/53806), commit `d9fd5f11`):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
 
88
+ ```shell
89
+ vllm serve IFM/K2-Horizon-32B \
90
+ --revision main \
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
  --model-impl vllm \
92
+ --tensor-parallel-size 2 \
93
  --trust-remote-code \
94
  --dtype bfloat16 \
95
+ --max-model-len 131072 \
 
96
  --reasoning-parser k2_horizon \
97
  --enable-auto-tool-choice \
98
  --tool-call-parser k2_horizon
99
  ```
100
 
101
+ SGLang, from a source checkout that includes [sgl-project/sglang#37654](https://github.com/sgl-project/sglang/pull/37654). This is the recipe validated on 2× H200 in the [SGLang K2 Horizon cookbook](https://github.com/sgl-project/sglang/pull/37655):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
102
 
103
+ ```shell
104
+ python3 -m sglang.launch_server \
105
+ --model-path IFM/K2-Horizon-32B \
106
+ --revision main \
107
+ --tp 2 \
108
+ --dtype bfloat16 \
109
+ --attention-backend fa3 \
110
+ --reasoning-parser k2_horizon \
111
+ --tool-call-parser k2_horizon \
112
+ --host 0.0.0.0 --port 30000
113
+ ```
114
 
115
+ ### API Usage
116
 
117
+ > [!Tip]
118
+ > Recommended settings: `reasoning_effort="high"`, `temperature=1.0`, `top_p=0.95`, and at least 32,768 output tokens.
119
+ > Reasoning depth is selected per request through `chat_template_kwargs`. Thinking is returned in `reasoning_content` and the answer in `content`.
120
 
121
  ```python
122
  from openai import OpenAI
123
 
124
+ client = OpenAI(base_url="http://localhost:30000/v1", api_key="EMPTY")
125
  response = client.chat.completions.create(
126
  model="IFM/K2-Horizon-32B",
127
  messages=[{"role": "user", "content": "Explain the result step by step."}],
128
+ temperature=1.0,
129
+ top_p=0.95,
130
+ max_tokens=32768,
131
  extra_body={"chat_template_kwargs": {"reasoning_effort": "high"}},
132
  )
133
+ message = response.choices[0].message
134
+ print("Reasoning:", getattr(message, "reasoning_content", None))
135
+ print("Answer:", message.content)
136
  ```
137
 
138
+ ### Transformers
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
139
 
140
+ Validated with Transformers 5.15.0, PyTorch 2.13.0, Safetensors 0.8.0.
141
 
142
+ ```python
143
+ from transformers import AutoModelForCausalLM, AutoTokenizer
 
 
 
 
 
144
 
145
+ model_id = "IFM/K2-Horizon-32B"
146
+ tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
147
+ model = AutoModelForCausalLM.from_pretrained(
148
+ model_id, device_map="auto", dtype="bfloat16", low_cpu_mem_usage=True, trust_remote_code=True
149
+ )
150
 
151
+ inputs = tokenizer("Explain why long-context evaluation is difficult.", return_tensors="pt").to(model.device)
152
+ inputs.pop("token_type_ids", None)
153
+ outputs = model.generate(**inputs, max_new_tokens=32768, temperature=1.0, top_p=0.95, do_sample=True)
154
+ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
155
+ ```
156
 
157
+ ## Best Practices
158
 
159
+ 1. **Reasoning effort: always `high`.** All reported results use high reasoning effort. Pass `{"chat_template_kwargs": {"reasoning_effort": "high"}}` on every request; `medium` and `low` trade accuracy for speed and are not recommended for evaluation.
160
+ 2. **Sampling parameters.** `temperature=1.0`, `top_p=0.95`.
161
+ 3. **Output length.** Allow at least 32,768 output tokens so reasoning is never cut off. Truncated reasoning is a failed response, not a shorter one.
162
+ 4. **Serving.** Use the validated SGLang recipe above: BF16, TP=2, FlashAttention-3. Full recipes for every K2-Horizon size, with measured H200 latency and throughput, are in the [SGLang cookbook](https://github.com/sgl-project/sglang/pull/37655).
163
+ 5. **Parsers.** Enable the `k2_horizon` reasoning parser for chat, and add the `k2_horizon` tool-call parser for agent use. Leave both off for plain completion-style generation.
164
+ 6. **Revisions.** Pin a revision tag when reproducibility matters. `main` and `mid_4` use the native Transformers 5 contract; `pretrain` through `mid_3` use the plain Transformers 4.57 contract described in the [appendix](APPENDIX.md#xllm).
165
 
166
  ## Citation
167
 
 
 
168
  ```bibtex
169
+ @misc{k2horizon2026,
170
+ title = {Introducing K2 Horizon: Frontier Performance, Radically Open},
171
+ author = {{IFM Team}},
172
+ year = {2026},
173
+ url = {https://ifm.ai/blog/k2/},
174
  }
175
+ ```
 
 
 
 
assets/k2-horizon-32b-benchmarks.png ADDED

Git LFS Details

  • SHA256: e9bb6004320f0a43ca9ad4ee6951e5f4e5c7e1f6f893238ad046d1e15ce2e68e
  • Pointer size: 132 Bytes
  • Size of remote file: 1.12 MB