Skip to content
llmmodels
Code modelOpen weights

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 →

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

Alternatives to Phi-2
ModelProviderReleasedParamsContextInput $/1MOutput $/1MECI
Qwen2.5-Coder (1.5B)openAlibaba (Qwen)Sep 20241.5B———89.1
Qwen2.5-Coder (7B)openAlibaba (Qwen)Sep 20247.6B———107.4
DeepSeek Coder 1.3BopenDeepSeekNov 20231.3B————
Code Llama-7BopenMetaAug 20236.7B————
Stable Code 3BopenStability AIJan 20242.8B————
Llemma 7BopenEleutherAIOct 20237B————
Granite 3.0 2BopenIBMOct 20242.6B————
OpenELM-3BopenAppleMay 20243B————

More models from Microsoft

All Microsoft models →
ModelReleasedParamsContextInput $/1MOutput $/1M
Phi 4openDec 202415B16K$0.07$0.14
Phi-1.5openSep 20231.4B———
Phi 4 MiniopenFeb 20253.8B8K$0.17$0.68
Florence-2-baseopenJun 2024232M———
harrier-oss-v1-0.6bopenMar 2026596M———
harrier-oss-v1-270mopenMar 2026268M———
Phi-4-reasoning-vision-15BopenJan 202615B———
Phi-4-mini-reasoningopenApr 20253.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.