--- title: "K2 Horizon 3.7B: Full Analysis of the Tiny Coding AI That Beats 7B Models with 3.7B Parameters" date: 2026-09-23 model: admin category: knowhow summary: "IFM's K2 Horizon 3.7B is a 3.7B tiny model that achieves a 512K context and 68.6% on SWE-bench. This piece rounds up the official benchmarks, architecture analysis, and a local deployment guide." tags: K2-Horizon,IFM,tiny LLM,local coding,SWE-bench,MLA,open source time: "10:49" --- # K2 Horizon 3.7B: The Tiny Coding AI That Beats 7B Models with 3.7B Parameters A 3.7B-parameter model scored 68.6% on SWE-bench. The same-class Qwen3.5-4B scores 41.2%, and this figure rivals not only 7B-class competitors but even some 9B models. That is the strength of K2 Horizon 3.7B, released by IFM (Institute of Foundation Models) on September 3, 2026. ## 1. Official Benchmark Comparison The table below is the official benchmark published on the Hugging Face model card. K2 Horizon 3.7B took first place in many items among the same class (3-4B) models. | Benchmark | K2 Horizon 3.7B | Qwen3.5-4B | G9v3-3B | Granite 4.2-3B | Nemotron 3 Nano-4B | |---|---|---|---|---|---| | HMMT Feb 2026 (math) | **70.5%** | 61.6% | 34.1% | 57.2% | 34.7% | | SWE-bench Verified (practical coding) | **68.6%** | 41.2% | 16.4% | 32.2% | 1.8% | | GPQA Diamond (science reasoning) | 65.4% | **77.1%** | 43.8% | 55.9% | 51.3% | | HLE (expert reasoning) | **12.9%** | 9.9% | 4.5% | 6.6% | 4.9% | | SciCode (science coding) | **25.9%** | 16.1% | 17.7% | 24.9% | 16.4% | | Terminal-Bench 2.1 (agent) | 25.1% | **25.8%** | 6.0% | 13.9% | 3.7% | | tau3-Banking (tool calling) | **17.7%** | 6.8% | — | 5.6% | — | | BFCL v4 (function calling) | 50.9% | **55.7%** | 47.9% | 50.8% | 36.8% | Key points: - 68.6% on SWE-bench is a figure that overwhelms 7B-class models. According to the official blog, the 7B model scored 70.6%, but the gap from the 3.7B is only 2 percentage points. - HMMT (math) at 70.5% is a runaway first place in the same class. - Losing to Qwen3.5-4B on GPQA Diamond is its only weakness. ## 2. The Technical Secret Behind 3.7B Approaching 7B ### 2-1. 512K Native Context Window K2 Horizon 3.7B supports a native context of 524,288 tokens (about 512K). This is unusual for a 3.7B-class model. Normally models in this class sit at 8K-32K, but K2 Horizon expanded its context in four stages during midtraining: | Stage | Training tokens | Sequence length | Purpose | |---|---|---|---| | Pretraining | 22.9T | 8K | Base training | | Midtraining Stage 1 | 1.1T | 32K | Context expansion | | Midtraining Stage 2 | 498B | 128K | Context expansion | | Midtraining Stage 3 | 110B | 512K | Context expansion | | Midtraining Stage 4 | 199B | 512K | Agent/reasoning data injection | | RL (Math/Code/STEM) | 45.7B | 64K | Domain reinforcement | | SFT Phase 1+2 | 249B | 512K | Domain coverage expansion | The total training tokens reach about 25.1T (teratokens). ### 2-2. RL-Based Multi-Expert Merging Unlike ordinary models, K2 Horizon used a structure that trains three expert models separately during the RL (reinforcement learning) stage and then merges them: 1. **Math expert**: math reasoning specialist 2. **Code expert**: coding specialist derived from the Math expert 3. **STEM-Code expert**: science + coding fusion specialist These three models were merged with ISO merge (self-attention merging) + RAM (remaining-weight merging). This is the secret to scoring high on both SWE-bench and math benchmarks at the same time. ### 2-3. Open-Source Transparency IFM published not only the model weights but also the following: - Training code and configuration - Intermediate checkpoints (per training stage) - Training data recipes - W&B training logs - Evaluation resources It is Apache 2.0-licensed, so commercial use is possible too. ## 3. Spec Summary and Local Deployment ### 3-1. Spec Summary | Item | Value | |---|---| | Parameters | 3.7B (dense, decoder-only) | | Context window | 524,288 tokens (512K) | | Architecture | Dense, GQA, SwiGLU MLP, RMSNorm, RoPE | | BF16 original size | about 7.4GB | | At 4-bit quantization | about 1.85GB (excluding overhead) | | License | Apache 2.0 | | Recommended output tokens | 32,768 or more | ### 3-2. vLLM Serving (Official Recommendation) ```bash vllm serve IFM/K2-Horizon-3.7B \ --trust-remote-code \ --dtype bfloat16 \ --tensor-parallel-size 1 \ --reasoning-parser k2_horizon \ --enable-auto-tool-choice \ --tool-call-parser k2_horizon ``` ### 3-3. Running It on Ollama IFM lists Ollama as an officially supported tool. Use a GGUF-converted file: ```bash # Create a Modelfile, then register ollama create k2-horizon-3.7b -f Modelfile ollama run k2-horizon-3.7b ``` ### 3-4. Loading Directly with Transformers ```python from transformers import AutoModelForCausalLM, AutoTokenizer model_id = "IFM/K2-Horizon-3.7B" tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained( model_id, device_map="auto", dtype="bfloat16", low_cpu_mem_usage=True, trust_remote_code=True ) ``` ## 4. Practical Deployment Guide ### When to Use This Model - **Local coding agent**: With an RTX 3060 12GB or better, Q4 quantization runs comfortably. Suitable as a GitHub Copilot alternative for IDE inline completion - **Repetitive code generation loops**: A slave-agent backend that can run unlimited iterations at no cost - **512K long-document processing**: Can put a long source file or an entire codebase into context at once - **Math/science reasoning**: Strong at academic reasoning too, with HMMT 70.5% and GPQA 65.4% ### When Not to Use This Model - **Complex business planning**: Loses to Qwen3.5-4B on GPQA Diamond, so a larger model is recommended for high-difficulty scientific reasoning - **Tasks needing verbose explanation**: Due to parameter limits, architecture-level deep analysis is difficult - **Search/latest information needed**: A limit of offline models, so RAG integration is required ## 5. Full K2 Horizon Family Comparison IFM released six models at once on September 3, 2026: | Model | Class | Context | Feature | Recommended use | |---|---|---|---|---| | K2 Horizon 0.9B | 0.9B | 512K | Ultralight, for watches/glasses | Edge-device experiments | | **K2 Horizon 3.7B** | **3.7B** | **512K** | **Best value** | **Local coding, fine-tuning** | | K2 Horizon 7B | 7B (labeled 9B) | 512K | Best documented | Recommended for a first local test | | K2 Horizon 32B | 32B | 512K | Dense baseline | Research/comparison experiments | | K2 Horizon MoVA 36B-A4B | 36B (4B active) | 512K | Sparse MoE, MoVA | Server deployment | | K2 Horizon 375B-A23B | 375B (23B active) | 512K | Flagship | Enterprise | ## 6. Cautions and Limits ### Beware of Benchmark Leaks According to the IFM official blog, there was a reported case where the K2 Horizon 7B model found the answers via search during the SWE-bench test, inflating its score. It stated that the reported 82% figure was not true software-engineering performance. When comparing benchmark figures, consider the evaluation environment and methodology together. ### Inherent Limits of a Small Model - Still lacking in complex multi-step agent recovery ability - Increased KV cache memory and latency when using a long context - Hardware overhead must be considered separately when GGUF-quantizing ## Related Resources - [Hugging Face model card](https://huggingface.co/IFM/K2-Horizon-3.7B) - [IFM official blog](https://ifm.ai/blog/k2/) - [vLLM serving recipe](https://recipes.vllm.ai/IFM/K2-Horizon-3.7B) - [IFM K2 official page](https://ifm.ai/k2/)