Reupload
PC Checker
Back home

Local AI · Microsoft Foundry Labs + Hugging Face

Phi-4: Microsoft's Powerful 14B Reasoning Model

Phi-4: Microsoft's Powerful 14B Reasoning Model

Photo: Shubham Dhage on Unsplash

Phi-4 is Microsoft's 14-billion-parameter small language model trained on 9.8 trillion tokens of curated synthetic and organic data, achieving exceptional performance on reasoning and mathematics benchmarks. Available in multiple sizes (14B, 3.8B mini, 5.6B multimodal), it runs locally on consumer hardware via Ollama, LM Studio, and other tools, with an MIT license enabling commercial use.

What Is Phi-4?

Phi-4 is Microsoft's 14-billion-parameter small language model trained on roughly 9.8 trillion tokens of synthetic "textbook-style" data combined with filtered public documents and curated academic material. The model is aligned using supervised fine-tuning and direct preference optimization, with a 16K-token context window.

Phi-4 is released under an MIT license, making it freely usable for commercial and research purposes. The model is engineered for reasoning, mathematics, and code generation in memory-constrained environments, achieving 84.8% on MMLU, 80.4% on MATH, and 82.6% on HumanEval.

Available Sizes and Variants

The Phi-4 family includes three main models:

  • Phi-4 (14B) - The flagship model optimized for complex reasoning and mathematical problem-solving, with a 16K-token context window.
  • Phi-4-mini (3.8B) - optimized for reasoning and 128K-context tasks. This model features a 200,000 word vocabulary allowing for increased multilingual support, grouped-query attention, built in function calling, improved instruction following, and shared embedding.
  • Phi-4-multimodal (5.6B) - unifying speech, vision, and text in a single architecture. It supports text, audio, and image as input, while returning text as output.

Additionally, Microsoft has released specialized reasoning variants optimized for advanced math and logical tasks.

Hardware Requirements

GPU-based inference (recommended):

  • Phi-4 (14B) at Q4_K_M requires approximately 9 GB of VRAM. At Q8 it needs approximately 14 GB. At FP16 it needs approximately 28 GB.
  • Phi-4-mini (3.8B) at Q4_K_M requires only about 2.5 GB - it fits in any GPU or runs CPU-only.
  • Recommended: 12 GB VRAM (RTX 4070, RTX 3060 12GB) running Q5_K_M for the best quality-to-performance ratio.

CPU-only inference:

  • Minimum: 16 GB system RAM for CPU-only inference.
  • Expect a fraction of GPU speed, which is fine for background or batch jobs but slow for interactive chat.

System RAM:

  • Windows 10/11, 16 GB RAM minimum (32 GB recommended).

Benchmark Highlights

Phi-4 achieves 84.8% on MMLU, 80.4% on MATH, and 82.6% on HumanEval. Of 13 benchmarks, Phi-4 outperforms Llama 3.3 70B (its most recent open weights competitor) on six and Qwen 2.5 on five.

Phi-4 outperforms Llama 3.3 70B, Qwen 2.5, and GPT-4o on GPQA (graduate level questions and answers) and MATH (competition-level math problems). On GPQA (graduate-level STEM questions) and MATH (math competitions), it even outscores its teacher model, GPT-40. It also scores higher at coding, as measured by HumanEval and HumanEval+, than any other open-weight model.

Phi-4 has a knowledge cutoff of June 2024. The model's training data includes information up to this date.

How to Run It Locally

Using Ollama (Recommended - Easiest):

Open your terminal and execute the command ollama run phi4. This command performs two actions: it downloads the model weights from the Ollama library and immediately launches an interactive chat session.

For Phi-4-mini, use: ollama run phi4-mini

Ollama handles GPU detection automatically on Windows. GPU is auto-detected on NVIDIA, AMD (ROCm), and Apple Silicon. Ollama defaults to Q4_K_M. On an 8GB GPU it will automatically offload overflow layers to CPU RAM.

Using LM Studio (GUI-based):

LM Studio 0.4.12 fully supports Phi-4 and Phi-4-mini on Windows 10 and 11. It provides a chat interface, model comparison, and a local server mode with a GUI - no command line required. Simply search for "Phi-4" in the Discover tab, click Download, then Run.

Other Supported Tools:

With tools like Ollama and LM Studio, you can run models like Qwen 3, Gemma 3, and DeepSeek-R1 on consumer hardware - and Phi-4 is widely available across other platforms including Jan, GPT4All, and Msty.

Best Use Cases

  • Mathematics and STEM reasoning - Phi-4 excels at solving math problems, analyzing scientific concepts, and working through multi-step logical proofs.
  • Code generation and debugging - Strong performance on coding benchmarks makes it ideal for software development assistance.
  • Local privacy-critical applications - Run AI entirely offline on your own hardware without sending data to cloud services.
  • Resource-constrained environments - Deploy on modest consumer GPUs (12GB VRAM) or even CPU-only systems.
  • Educational and research tools - Analyze documents, explain concepts, and generate learning materials with high reasoning quality.
  • Cost-effective inference at scale - After initial hardware investment, zero per-token costs for high-volume usage.

Note: Phi-4 is still fundamentally limited by its size for certain tasks, specifically in hallucinations around factual knowledge.

FAQ

Can I run Phi-4 on a laptop with 8 GB GPU VRAM?

Yes, but with CPU offloading. Phi-4 at Q4_K_M requires ~9 GB - about 1 GB over the limit of an RTX 4060 8GB. Ollama and llama.cpp handle the overflow automatically by keeping some layers in system RAM. The model runs but is ~50% slower than a 12 GB GPU.

What is the difference between Phi-4 and Phi-4-mini?

Phi-4 is 14B parameters while Phi-4-mini is 3.8B parameters, optimized for reasoning and 128K-context tasks. Phi-4-mini is more efficient but slightly less powerful, while Phi-4 provides stronger reasoning at the cost of higher VRAM requirements.

Is Phi-4 free to use commercially?

Yes. Phi-4 14B is released under MIT, a permissive open-source license that allows commercial use, modification and redistribution.

How fast is Phi-4 compared to cloud APIs?

Estimated tokens/sec are on the order of 20 tokens/sec on a mid-range GPU and up to 55 tokens/sec on high-end cards, assuming the quantization fully fits in VRAM. Speed varies by hardware; Ollama and LM Studio handle optimization automatically.

Wondering if your computer can run local AI?

Sources & credits

Original source: Microsoft Foundry Labs + Hugging Face