Phi-4 review, pricing and limits

Microsoft's 14B open-source instruct model that outperforms GPT-4o on GPQA Diamond and MATH at a fraction of the parameter count, designed for cost-effective reasoning and STEM tasks.

  • ga
  • open source
  • instruct
  • Phi-4 family
checked

Phi-4 fits teams building STEM tutoring, math reasoning, or code-explanation tools on a tight budget who don't need multi-turn chat or tool calling. It replaces GPT-4o for narrow academic reasoning at a fraction of the compute cost, though throughput of 26.2 t/s on Azure trails most models its size. Skip it for function calling or long documents.

Phi-4 is Microsoft's open-source small language model that scores 56.1% on GPQA Diamond, beating GPT-4o on graduate-level STEM reasoning despite having far fewer parameters. Trained under the MIT license on synthetic textbook-style data, it targets math, coding, and academic reasoning rather than general-purpose or multimodal tasks.

Where it sits

  • $0.084/M$ per 1M tokensBlended price (3:1)Lower is better#4 / 61peer median $1.71/Mvendor price, checked by HokAI
  • 26 tok/stokens/sOutput speedHigher is better#36 / 36peer median 90 tok/scited: Artificial Analysis
  • --% solvedSWE-bench VerifiedHigher is better-- / 28peer median 78.3%per source, see benchmark scores
  • 56.1%% correctGPQA DiamondHigher is better#42 / 44peer median 88.3%per source, see benchmark scores

Cheaper than 95% of the 61 GA models with a published price, in the bottom third on GPQA Diamond (rank 42 of 44), and one of 21 that document a zero-data-retention option.

Ranks are against GA models on HokAI that publish the same figure; ties share a rank.

Provider: Microsoft · Family: Phi-4

More about Microsoft on HokAI

Context window: 16,384 tokens · Max output: 16,384

Input modalities: text · Output: text

About Phi-4

Phi-4 is a 14-billion parameter small language model from Microsoft Research, released December 12, 2024 via Azure AI Foundry and made publicly available on Hugging Face on January 9, 2025. The architecture is a dense Transformer with no mixture-of-experts routing, fine-tuned for instruction following using supervised fine-tuning (SFT) and direct preference optimization (DPO). Microsoft trained it on a curated pipeline of high-quality synthetic data generated by stronger models, filtered public web text, and licensed academic and educational sources, targeting graduate-level academic reasoning typically associated with much larger models. Within the Phi family, Phi-4 at 14B is the largest instruct model; later variants include Phi-4-mini (3.8B, February 2025), Phi-4-multimodal (5.6B, March 2025), Phi-4-reasoning (14B chain-of-thought, April 2025), and Phi-4-reasoning-vision (15B, March 2026).

Microsoft's December 2024 technical report places Phi-4 at 84.8% on MMLU (academic multitask), 82.6% on HumanEval (Python coding), and 80.4% on MATH (competition mathematics). Against Qwen-2.5-14B-Instruct, the closest competing 14B instruct model at release, Phi-4 wins on 9 of 12 benchmarks in the technical report's comparison table. On Artificial Analysis's composite Intelligence Index, Phi-4 scores 10 against a peer average of 12, suggesting it is tuned for narrow academic reasoning rather than broad general-purpose ability. The model generates output at 26.2 tokens per second on Azure and 54.8 tokens per second on DeepInfra, below average for non-reasoning models at its size tier.

The context window is 16,384 tokens (roughly 12,000 words), with maximum output also capped at 16,384 tokens combined with input. This is well below several current alternatives with far larger windows, including GPT-4o Mini and Phi-4-mini-instruct. For single-turn reasoning, coding sessions, and short-document Q&A, the window is adequate; teams processing full research papers, running long multi-turn chats, or building RAG pipelines over large document chunks will hit the ceiling routinely. There is no extended-context tier or sliding-window option for the base model.

Phi-4 processes text input only and generates text output only; no vision, audio, video, or PDF input is supported in the base model. Native function calling is not available in base Phi-4; Microsoft added it in Phi-4-mini and Phi-4-multimodal instead. Structured JSON output must be prompted manually rather than requested through a dedicated API parameter. Phi-4-multimodal-instruct (5.6B, March 2025) is the family member with vision, audio, and function calling, using a Mixture-of-LoRAs technique to route all three modalities through a shared frozen base model.

Weights are freely downloadable from Hugging Face at microsoft/phi-4 under the MIT license, in SafeTensors format for direct loading with the transformers library. GGUF-quantized variants are available from the bartowski and RedHatAI repositories, compatible with Ollama, LM Studio, llama.cpp, and vLLM. Azure AI Foundry provides managed serverless access, and the NVIDIA NGC Catalog also hosts the model for NIM deployment. The full model fits on a single consumer GPU when quantized, making self-hosting practical without specialized hardware.

Microsoft aligned Phi-4 using SFT combined with iterative DPO, drawing on public safety datasets plus in-house synthetic datasets targeting specific content-safety categories. Before release, Microsoft's internal AI Red Team (AIRT) ran qualitative safety assessments for both average-user and adversarial scenarios; the model declines requests for CSAM, weapons of mass destruction instructions, and similar clearly harmful content under Microsoft's Responsible AI standards. Phi-4 does not train on user API inputs; Azure retains inputs up to 30 days for abuse monitoring under standard enterprise terms, with zero-retention available for qualifying enterprise contracts. Training data has a knowledge cutoff of June 2024, with training completed between October and November 2024.

Pricing

$0.065 per 1M input tokens and $0.140 per 1M output tokens via Azure AI Foundry pay-as-you-go pricing. Self-hosted deployment through Ollama or vLLM costs nothing beyond electricity, since the MIT license permits free commercial use. DeepInfra and OpenRouter list comparable per-token rates for the same model.

What a real job costs

JobInputOutputTotal
Summarise a 20-page PDF$0.0019$0.0001$0.0021
Support reply$0.0001$0.0000$0.0002
One coding agent run$0.013$0.0028$0.016

Budgets: 20-page PDF = 30k in / 1k out · Support reply = 2k in / 300 out · Coding agent run = 200k in / 20k out. Computed from the vendor's per-token prices at render time; cached-input discounts are not applied.

Key Features

  • Outperforms GPT-4o on Math and Coding Benchmarks: Phi-4 scores 80.4% on MATH and 82.6% on HumanEval, beating GPT-4o on competition mathematics despite having roughly a quarter of the inferred parameter count.
  • MIT License for Full Commercial Use: Released under the MIT license, Phi-4 weights can be downloaded, fine-tuned, and deployed commercially with no royalties or usage restrictions beyond the license notice.
  • Local Deployment on a Single Consumer GPU: The full model runs locally with Q4_K_M quantization in 8.30 GB of VRAM, fitting on a single RTX 3080 or RTX 4080 without any cloud API cost.
  • Multiple GGUF Quantization Formats: GGUF builds covering Q4_0, Q4_K_M, Q5_K_M, Q8_0, and W8A8 come from the bartowski and RedHatAI Hugging Face repos, so quantization level can be matched to whatever hardware is on hand.

Pros

  • Beats GPT-4o on graduate-level reasoning and math benchmarks despite having a fraction of the parameter count.
  • MIT license removes the friction bigger vendors add: fine-tune, redistribute, and self-host commercially with zero royalty terms.
  • Fits on a single consumer GPU, so privacy-sensitive teams can run it without sending data to any external API.
  • One of the cheapest managed APIs available for a model of its reasoning class.

Cons

  • Context window tops out at 16,384 tokens, versus 128K for GPT-4o Mini and Phi-4-mini-instruct, so long documents or long chat histories get truncated.
  • No native function calling or structured JSON mode in the base model; both arrived later in Phi-4-mini and Phi-4-multimodal, not in this release.
  • Artificial Analysis Intelligence Index score of 10, versus a peer average of 12, reflecting narrower general-purpose breadth outside core reasoning tasks.
  • Training data cutoff of June 2024, so the model has no knowledge of events from the second half of 2024 onward.

Benchmarks

  • MATH: 80.4% vendor-reported · 12 Dec 2024 — Competition maths problems, % solved.
  • MMLU: 84.8% vendor-reported · 12 Dec 2024 — General-knowledge exam across 57 subjects, % correct.
  • HumanEval: 82.6% vendor-reported · 12 Dec 2024 — Small programs that must pass hidden tests, % passing.
  • GPQA Diamond: 56.1% vendor-reported · 12 Dec 2024 — PhD-level science questions that are hard to search for, % correct.
  • AA Intelligence Index: 10 cited: Artificial Analysis · 20 Jun 2026 — Composite of 10 evaluations run by Artificial Analysis, 0 to 100.
  • AA blended price: $0.07/M cited: Artificial Analysis · 20 Jun 2026 — Price per 1M tokens at a 3:1 input to output blend, as listed by Artificial Analysis.
  • Output speed: 26 tok/s cited: Artificial Analysis · 20 Jun 2026 — Median tokens written per second as measured by Artificial Analysis.

A benchmark is an exam, not the job. Scores transfer unevenly between tasks, so weigh the one closest to your workload and read every figure with its source.

Frequently Asked Questions

How much does Phi-4 cost in 2026?

Via Azure AI Foundry, Phi-4 costs $0.065 per 1 million input tokens and $0.140 per 1 million output tokens, with no batch-tier discount published. DeepInfra and OpenRouter offer comparable rates from third-party hosts. Self-hosting through Ollama or vLLM removes per-token cost entirely, since the MIT license allows free commercial use, leaving only GPU electricity as an ongoing expense.

What do you get on Phi-4's free tier?

GitHub Models provides free access to Phi-4 for individual developers, rate-limited and meant for development and testing rather than production traffic. There is no separate free tier on Azure AI Foundry itself; production use there is billed per token. Running the MIT-licensed weights locally through Ollama or vLLM is free beyond the cost of the GPU running them.

What should you use instead of Phi-4?

GPT-4o Mini is the closest managed alternative, trading Phi-4's lower cost for a much larger context window and native tool calling. Phi-4-mini-instruct, Microsoft's own smaller sibling, keeps the MIT license and open weights while removing both of those gaps the base model has. Mistral Medium 3 is worth a look for teams that need broader multilingual coverage alongside strong reasoning scores.

Phi-4 or GPT-4o Mini: which should you pick?

Phi-4 edges out GPT-4o Mini on graduate-level reasoning, scoring 56.1% on GPQA Diamond in Microsoft's technical report against GPT-4o's 53.6%. GPT-4o Mini answers back with a much larger context window and native function calling, both of which base Phi-4 lacks entirely. Pick Phi-4 for narrow, low-cost STEM reasoning; pick GPT-4o Mini for anything involving tool use or long documents.

What does it take to start using Phi-4?

The fastest path is Azure AI Foundry: spin up a serverless endpoint and call it with any OpenAI-compatible SDK, no infrastructure to manage. For local use, pull the GGUF build with Ollama and run it directly on your own machine. Self-hosting the full model with Q4_K_M quantization needs about 8.30 GB of VRAM, so a single RTX 3080 or better handles it.

Top Alternatives

  • GPT-4o Mini: Pick GPT-4o Mini if you need a much larger context window or native function calling; pick Phi-4 if cost per reasoning token matters most.
  • Mistral Medium 3: Pick Phi-4 for stronger MMLU and GPQA scores at lower API cost; pick Mistral Medium 3 for broader multilingual coverage and function calling.

HokAI guides covering Phi-4

More AI Models on HokAI

Visit Phi-4 Official Page