Phi-4 reasoning benchmark illustration
Open Weights · Microsoft

Phi-4

Microsoft’s 14B MIT-licensed reasoner — the best reasoning per parameter in its class, sized for a single consumer GPU.

Params14B (dense)
Context16K
LicenseMIT (open weights)
ReleasedDecember 2024
Price / 1MFree (self-host) · rarely priced on APIs
ModalityText

What it is and who makes it

Phi-4 is Microsoft’s 14B open-weights model, released in December 2024 as the flagship of the Phi “small but mighty” family. MIT license, text-only, 16K context on the original release. The pitch was simple and Microsoft mostly delivered: train a small model on heavily curated, reasoning-dense data and watch it punch far above its parameter count on math and STEM.

Architecture and what’s under the hood

Phi-4 is a dense 14B decoder-only transformer trained on a synthetic-heavy, curated corpus Microsoft describes as “data-centric” — large volumes of synthetic reasoning traces, filtered web data, and academic-quality text, rather than raw crawled sludge. Grouped-query attention, the Phi tokenizer, and heavy post-training on reasoning. That recipe is why GPQA and MATH scores look anomalous for 14B. Context is 16K on the original release, which is genuinely short by 2026 standards; later family members (Phi-4-mini, Phi-4-multimodal, Phi-4 reasoning variants) extended the line. Training-token composition isn’t fully public, so treat details as approximate as of Nov 2026.

Strengths

  • Absurd reasoning per parameter. MMLU ~80 and MATH ~80 for 14B parameters and MIT license — that’s the whole story.
  • MIT license. The most permissive license in the open-weights world. No acceptable-use appendix, no attribution, no caps.
  • Runs on one consumer GPU. ~9GB at 4-bit — fits an RTX 3060-class card, streams nicely on Apple Silicon.
  • Strong STEM and math. It was literally trained to be good at it; it shows.

Weaknesses and failure modes

  • 16K context (original release). Painfully short for long documents or codebases. Later variants extend this, but the base model is cramped.
  • English-centric. Multilingual coverage is thin; non-English tasks degrade quickly.
  • Narrow knowledge breadth. Curated STEM data means it’s weaker on broad world knowledge and pop culture than bigger generalists.
  • Dated base model. A Dec 2024 release; newer small models have closed some of the gap.

Best for / avoid for

Best for: math and STEM tutoring, structured reasoning, code assistance on short contexts, offline/air-gapped reasoning, fine-tuning bases, and anywhere a 14B-class model with a MIT license is a hard requirement.

Avoid for: long-document work (16K is tight), multilingual products, broad open-domain chat, and long-horizon agentic tool use.

Variants and family

  • Phi-4-mini (3.8B) — phone-class sibling, surprisingly capable for its size.
  • Phi-4-multimodal (5.6B) — vision + speech in one small model; see the atlas.
  • Phi-4 reasoning / reasoning-plus — reasoning-tuned refreshes with longer chains of thought; check current availability.

Pricing, access and how to run it

Weights on Hugging Face (microsoft/phi-4) and on Azure AI Foundry; it’s rarely priced as a hosted API since the whole point is self-hosting. OpenRouter occasionally lists it; check current availability. OpenRouter example:

curl https://openrouter.ai/api/v1/chat/completions \
  -H "Authorization: Bearer $OPENROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "microsoft/phi-4",
    "messages": [{"role": "user", "content": "Solve: integral of x*sin(x) dx."}]
  }'

Local with Ollama:

ollama run phi4

LM Studio: search “phi-4” — GGUF builds are abundant. vLLM:

vllm serve microsoft/phi-4 \
  --max-model-len 16384

Benchmarks snapshot

Approximate, as of Nov 2026:

BenchmarkPhi-4 (approx.)
MMLU~80
GPQA (diamond)~56
MATH~80

These numbers were stunning at release — a 14B matching models 5–10x its size on math. Independent replication broadly confirms the reasoning claims while noting weaker open-domain chat quality and short context. Newer 14B-class entrants compete hard now; Phi-4 remains a reference point for data quality over scale.

How it stacks up

vs Qwen 3 4B: Qwen 3 4B is smaller, newer, multilingual and hybrid-thinking, and it’s Apache 2.0. Phi-4 is bigger and clearly stronger on STEM/math at 14B scale, but its context is shorter and its English-centrism is real. Pick Qwen 3 4B for breadth and multilingual; pick Phi-4 for pure math and STEM reasoning per GPU-hour.

vs Gemma 3 12B: Gemma 3 12B is multimodal with a bigger ecosystem and Google backing, but carries the Gemma license and trails on math. Phi-4 is MIT, stronger on reasoning benchmarks, weaker on vision and breadth. Pick Gemma for vision and ecosystem; pick Phi-4 for MIT licensing and STEM.

How it behaves in practice

Phi-4 shines when the problem is well-posed: a proof, a derivation, a tight coding task with clear constraints. Vague open-ended prompts expose its knowledge gaps fast — it will confidently produce a structured, wrong answer if the question drifts outside STEM. Few-shot prompting helps disproportionately, since the model was trained on synthetic chains of reasoning; showing it one clean exemplar lifts output reliability noticeably. Watch the 16K ceiling: long chats silently overflow, and there’s no graceful truncation — manage context explicitly in your app. For fine-tuning, it’s an unusually good base at this size, and MIT licensing means your derivatives are clean too. If you need longer context today, evaluate the later Phi-4 reasoning variants rather than the base checkpoint.

PeaBox fit

Phi-4 is the model we fine-tune when a client wants reasoning on their own hardware with zero license conversations. MIT means legal never blinks, and the 14B footprint means it runs on the machines we actually have. We use it for offline math/code assistants and as a sanity baseline in our reasoning evals — if a pipeline can’t beat Phi-4 on its target task, the pipeline needs rethinking, not more infrastructure.

The honest summary: Phi-4 is proof that data quality beats parameter count — MIT-licensed, 14B, MATH ~80, runs on a consumer GPU. Its short 16K context and English skew are real constraints, and newer small models are catching up. But as a self-hosted STEM reasoner with the cleanest possible license, it remains one of the best value picks in the open-weights world. Pair it with Phi-4-mini for edge cases and Phi-4-multimodal when vision shows up.

More from the atlas