Phi-2
by Microsoft · Dec 12, 2023
Phi-2 is an open-weight code model from Microsoft, released Dec 12, 2023. It has 2.8B parameters. It scores 96.2 on the Epoch Capabilities Index.
- Provider
- Microsoft
- Released
- Dec 12, 2023
- Type
- Code model
- Parameters
- 2.8B
- Context window
- —
- Max output
- —
- Input
- text
- Output
- text
- Weights
- Open weights
- License
- mit
- Knowledge cutoff
- —
- Status
- Open weights
- Training compute
- 2.3e+22 FLOP
- Training data
- 250B tokens/words
- HF downloads (30d)
- 186.6K
About Phi-2
Over the past few months, our Machine Learning Foundations team at Microsoft Research has released a suite of small language models (SLMs) called “Phi” that achieve remarkable performance on a variety of benchmarks. Our first model, the 1.3 billion parameter Phi-1(opens in new tab), achieved state-of-the-art performance on Python coding among existing SLMs (specifically on the HumanEval and MBPP benchmarks).
Phi-2 benchmarks
All benchmarks →- Epoch Capabilities Index96.2
- MMLU58.4%
- HellaSwag53.6%
Scores from the Epoch AI Benchmarking Hub (best reported setting). ECI = Epoch Capabilities Index.
How to run Phi-2
Phi-2 is an open-weight model published on Hugging Face as microsoft/phi-2. Run it locally with Ollama, LM Studio or llama.cpp (quantized GGUF builds), or serve it on GPUs with vLLM, SGLang or Hugging Face TGI. At 2.8B parameters it needs roughly 2 GB of memory at 4-bit quantization.
Phi-2 vs alternatives
- Phi-2 vs Qwen2.5-Coder (1.5B)
- Phi-2 vs Qwen2.5-Coder (7B)
- Phi-2 vs DeepSeek Coder 1.3B
- Phi-2 vs Code Llama-7B
- Phi-2 vs Stable Code 3B
- Phi-2 vs Llemma 7B
| Model | Provider | Released | Params | Context | Input $/1M | Output $/1M | ECI |
|---|---|---|---|---|---|---|---|
| Qwen2.5-Coder (1.5B)open | Alibaba (Qwen) | Sep 2024 | 1.5B | — | — | — | 89.1 |
| Qwen2.5-Coder (7B)open | Alibaba (Qwen) | Sep 2024 | 7.6B | — | — | — | 107.4 |
| DeepSeek Coder 1.3Bopen | DeepSeek | Nov 2023 | 1.3B | — | — | — | — |
| Code Llama-7Bopen | Meta | Aug 2023 | 6.7B | — | — | — | — |
| Stable Code 3Bopen | Stability AI | Jan 2024 | 2.8B | — | — | — | — |
| Llemma 7Bopen | EleutherAI | Oct 2023 | 7B | — | — | — | — |
| Granite 3.0 2Bopen | IBM | Oct 2024 | 2.6B | — | — | — | — |
| OpenELM-3Bopen | Apple | May 2024 | 3B | — | — | — | — |
More models from Microsoft
All Microsoft models →| Model | Released | Params | Context | Input $/1M | Output $/1M |
|---|---|---|---|---|---|
| Phi 4open | Dec 2024 | 15B | 16K | $0.07 | $0.14 |
| Phi-1.5open | Sep 2023 | 1.4B | — | — | — |
| Phi 4 Miniopen | Feb 2025 | 3.8B | 8K | $0.17 | $0.68 |
| Florence-2-baseopen | Jun 2024 | 232M | — | — | — |
| harrier-oss-v1-0.6bopen | Mar 2026 | 596M | — | — | — |
| harrier-oss-v1-270mopen | Mar 2026 | 268M | — | — | — |
| Phi-4-reasoning-vision-15Bopen | Jan 2026 | 15B | — | — | — |
| Phi-4-mini-reasoningopen | Apr 2025 | 3.8B | — | — | — |
Frequently asked questions
Who made Phi-2?
Phi-2 was developed by Microsoft (United States of America). It was released on Dec 12, 2023.
Is Phi-2 open source?
Yes. Phi-2's weights are publicly available under the mit license on Hugging Face (microsoft/phi-2), so you can download and run it yourself.
How many parameters does Phi-2 have?
Phi-2 has 2.8B parameters.
How does Phi-2 perform on benchmarks?
Phi-2 scores 58.4% on MMLU and 53.6% on HellaSwag.
Sources: epoch, huggingface · paper · huggingface. Last updated 2026-11-22.