Instructions to use IFM/K2-Horizon-32B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use IFM/K2-Horizon-32B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="IFM/K2-Horizon-32B", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("IFM/K2-Horizon-32B", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use IFM/K2-Horizon-32B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "IFM/K2-Horizon-32B" # 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-32B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/IFM/K2-Horizon-32B
- SGLang
How to use IFM/K2-Horizon-32B 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-32B" \ --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-32B", "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-32B" \ --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-32B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use IFM/K2-Horizon-32B with Docker Model Runner:
docker model run hf.co/IFM/K2-Horizon-32B
⚡ Up to 5.1x faster K2-Horizon-32B inference with DSpark speculative decoding (55 --> 284 tokens/sec)
K2-Horizon-32B-DSpark
Model Link: https://huggingface.co/rasyosef/K2-Horizon-32B-DSpark
A lossless DSpark draft model for IFM/K2-Horizon-32B-NVFP4, trained with speculators (training code).
- 5.09× faster on math, 4.33× on RAG, and 3.75× on code (temperature 0)
- Mean acceptance length 4.12 (block size 8)
Usage
vllm serve IFM/K2-Horizon-32B-NVFP4 --port 8000 \
--trust-remote-code \
--reasoning-parser k2_horizon \
--max-model-len 32768 \
--speculative-config '{"model": "rasyosef/K2-Horizon-32B-DSpark", "num_speculative_tokens": 8}' \
--override-generation-config '{"temperature": 0}'
For tool use, add --enable-auto-tool-choice --tool-call-parser k2_horizon.
Details
- Qwen3-style, 4 layers, ~1B params, bfloat16, block size 8
- Hidden size 5120, MLP 8192, 40 query / 8 KV heads (head dim 128)
- First 3 layers sliding-window (512), last full attention
- Draft vocab 32,000 (from 250,624); aux hidden states from verifier layers 2/16/32/48/62
- 100,000 Open PerfectBlend prompts with verifier-generated responses, seq length 8192
- 3 epochs, lr 3e-4, cosine (4% warmup), loss
{"ce": 0.1, "tv": 0.9} - Trained on a single NVIDIA RTX PRO 6000 Blackwell Server Edition (96 GB)
Evaluation
RedHatAI/speculator_benchmarks, temperature 0, single NVIDIA RTX PRO 6000 Blackwell, concurrency 1.
Throughput (tokens/s)
Mean output throughput. Baseline is K2-Horizon-32B-NVFP4 without speculative decoding.
| subset | baseline (no drafter) | DSpark (this model) | speedup |
|---|---|---|---|
| math_reasoning | 55.8 | 284.2 | 5.09× |
| rag | 54.4 | 235.3 | 4.33× |
| HumanEval | 55.3 | 207.1 | 3.75× |
Acceptance at temperature 0
acceptance_length is mean tokens committed per verification step, including the bonus token (max 9.0 at block size 8).
| subset | acceptance_length | pos_0 | pos_1 | pos_2 | pos_3 | pos_4 | pos_5 | pos_6 | pos_7 |
|---|---|---|---|---|---|---|---|---|---|
| math_reasoning | 5.911 | 89.8% | 79.3% | 69.8% | 62.0% | 55.5% | 49.8% | 44.9% | 40.1% |
| rag | 4.926 | 82.4% | 67.8% | 57.6% | 48.2% | 42.4% | 37.1% | 31.6% | 25.5% |
| writing | 4.258 | 76.2% | 58.6% | 46.4% | 38.5% | 32.9% | 28.6% | 24.7% | 20.0% |
| HumanEval | 4.215 | 80.8% | 62.7% | 48.4% | 37.9% | 30.2% | 24.6% | 20.3% | 16.7% |
| question | 4.143 | 75.1% | 57.0% | 44.9% | 37.2% | 31.4% | 27.0% | 23.1% | 18.7% |
| qa | 4.112 | 75.9% | 58.7% | 47.1% | 37.8% | 29.6% | 23.9% | 20.8% | 17.4% |
| tool_call | 3.589 | 72.3% | 53.2% | 39.9% | 30.1% | 22.8% | 17.2% | 13.4% | 9.9% |
| translation | 3.014 | 67.2% | 45.8% | 31.2% | 21.2% | 14.6% | 10.0% | 6.9% | 4.5% |
| summarization | 2.716 | 66.9% | 42.1% | 26.6% | 16.5% | 9.6% | 5.5% | 2.9% | 1.4% |
Weighted across all subsets: 4.117 over 309,840 verification steps.
Limitations
Only works with K2-Horizon-32B; trained and evaluated against the NVFP4 checkpoint (the BF16 checkpoint was not tested). Sampling, concurrent load, and contexts beyond 8K tokens were not evaluated.
License
Apache 2.0