Instructions to use Avifenesh/k2h-s1-final with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Avifenesh/k2h-s1-final with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Avifenesh/k2h-s1-final", 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("Avifenesh/k2h-s1-final", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Avifenesh/k2h-s1-final with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Avifenesh/k2h-s1-final" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Avifenesh/k2h-s1-final", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Avifenesh/k2h-s1-final
- SGLang
How to use Avifenesh/k2h-s1-final 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 "Avifenesh/k2h-s1-final" \ --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": "Avifenesh/k2h-s1-final", "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 "Avifenesh/k2h-s1-final" \ --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": "Avifenesh/k2h-s1-final", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Avifenesh/k2h-s1-final with Docker Model Runner:
docker model run hf.co/Avifenesh/k2h-s1-final
K2H S1 final (step 150)
A specialization stage on top of Avifenesh/k2h-r1a-final's run: continued training of IFM/K2-Horizon-MoVA-36B-A4B toward LLM inference and ML systems engineering. It keeps general skills, instruction following and tool calling level with the release, with large code gains. A tool-calling anchor in this stage recovers the BFCL drop that the longer stage-1 run showed at step 1000.
Published 2026-11-08. This checkpoint replaces k2h-r1a-final as the latest model of the project.
Model
- Base: IFM/K2-Horizon-MoVA-36B-A4B (36B total, about 4B active, MoE). Same architecture, tokenizer and chat template.
- Weights: bf16 safetensors. Load with
trust_remote_code=True. Context limit as the release (524,288). - Sampling as the base model card recommends: temperature 1.0, top_p 0.95.
Training
- Stage 1 (R1a, see k2h-r1a-final): 1,000 steps from the released weights, about 786M tokens of clean domain data, script-verified replay and a release KL anchor. This stage starts from its step 1000.
- Stage 2 (this model): 150 steps at sequence length 65,536, about 786k tokens per step, about 118M tokens.
- Trainer: xLLM, FSDP2, bf16, 3 GPUs, optimizer state offloaded to host memory.
- AdamW (0.9, 0.95), weight decay 0.06, gradient clip 1.0. Learning rate 5e-6 with 10 warmup steps, then linear decay to 0.1x over the last 50 steps.
- Data mix (sampling weights):
- 97%: the stage-1 mix, scaled: clean domain data (Avifenesh/k2h-corpus-domain-clean), script-verified replay (Avifenesh/k2h-replay-verified) and verified chat (Avifenesh/k2h-chat-reasoning-verified) as a release anchor (hinged KL(release || model) on reply tokens, tau 0.05, no cross-entropy), plus the math replay under both cross-entropy and the anchor.
- 2%: grounded outcome chat built from engineering receipts (setup, baseline and change, reasoning from the receipt's own evidence, the measured result), cross-entropy. Not published.
- 1%: a tool-calling anchor, KL only: 8,787 of the release's own replies to tool-use prompts taken from Team-ACE/ToolACE and glaiveai/glaive-function-calling-v2 (both Apache-2.0; prompts and tool lists only, answers dropped), decontaminated against every BFCL V4 file.
- The anchor reads the release's top-64 log-probabilities from a precomputed cache, so no teacher runs during training.
Evaluation
Paired per question against the release, same prompts and sampling. A checkpoint passes when no task in the family below drops significantly after Holm correction, pooled IFEval (two runs) is not more than 2 points down at p < 0.05, chat GSM8K is not more than 1.5 points down, and MMLU is not 1 point or more down at p < 0.05.
| Task | Release | Step 150 | p |
|---|---|---|---|
| IFEval prompt-strict, reasoning on, 2 runs pooled | 83.7 | 84.9 | 0.33 |
| GSM8K chat, reasoning on | 96.6 | 96.9 | 0.48 |
| MATH-500 chat, reasoning on | 98.2 | 98.0 | 1.0 |
| MMLU | 77.3 | 77.3 | 0.94 |
| ARC-Challenge | 57.6 | 57.8 | 0.88 |
| BoolQ | 88.4 | 88.1 | 0.39 |
| MBPP pass@1 | 65.2 | 72.2 | < 0.001 |
| HumanEval pass@1 | 53.1 | 68.9 | < 0.001 |
| BFCL V4 all live categories | 76.9 | 75.7 | 0.15 |
| BFCL V4 all non-live categories | 73.8 | 72.1 | 0.15 |
| BFCL V4 multi-turn | 55.9 | 52.3 | 0.54 |
| BFCL V4 live_multiple | 75.0 | 72.7 | 0.052 |
| BFCL V4 irrelevance | 87.5 | 85.4 | 0.27 |
| Held-out PR NLL (lower is better) | 1.520 | 1.269 |
Long context (RULER, 13 tasks, paired with the release; 24 samples per task at 32k and 64k, 8 at 128k):
| Length | Release | Step 150 | p |
|---|---|---|---|
| 32k | 90.4 | 86.8 | 0.066 |
| 64k | 87.2 | 81.3 | 0.26 |
| 128k | 76.3 | 81.6 | 0.064 |
None of the long-context differences is significant, but 32k and 64k point down in both measurements we ran. Treat long-context retrieval at 32k to 64k as possibly a few points weaker than the release.
Few-shot GSM8K (5-shot completion) drops 2.3 points (90.2 to 88.0, p = 0.01). Chat GSM8K and MATH-500 hold, so this reads as drift in the few-shot completion format, not in math.
Domain judgement: on held-out tuning experiments (predict whether a change helps, is neutral, hurts or breaks correctness, scored class-balanced), this model is level with the release. The outcome data in this stage did not improve it.
Compared with k2h-r1a-final (step 800 of stage 1): BFCL about the same, slightly higher IFEval (84.9 vs 84.7), HumanEval (68.9 vs 66.5) and MBPP (72.2 vs 70.6), lower PR NLL (1.269 vs 1.280); RULER level at 32k and 4.7 points lower at 64k (p = 0.02 paired). k2h-r1a-final, measured with the same 24-sample RULER, is 5.1 points below the release at 32k (p = 0.01); this model has no significant long-context drop against the release.
- Downloads last month
- 411
Model tree for Avifenesh/k2h-s1-final
Base model
IFM/K2-Horizon-MoVA-36B-A4B