whatmodel.sh / Phi-2 (2.7B)
Phi-2 (2.7B)
↗ share
+ contribute
Phi-2 (2.7B) is an open-weights language model from Microsoft, released December 2023. Its published size is 2.78B parameters and a 2k-token context window. Licence: mit.
Catalogue identity notes
Phi-2 2.7B base model (December 2023); not Phi-3.
$ how it compares
The LLMs ranked either side of Phi-2 (2.7B), out of 828 with a score, then more from Microsoft.
| # | model | score | where | ||
|---|---|---|---|---|---|
| 640 | 39±1 | local | |||
| 641 | 39±4 | local | |||
| 642 | 39±1 | local | |||
| 643 | 39±1 | local | |||
| 644 | 39±1 | local | |||
| more from Microsoft | |||||
| 252 | 59±1 | local | |||
| 261 | 58±1 | api $0.22/M +local | |||
| 365 | 53±1 | api $0.087/M +local | |||
$ what it's good at
coding▁▁▁▃▆██▇▆▄▃▁ #374 of 458 · 72% of its score · 6 tests
Beats LFM2.5 8B-A1B, DeepSeek R1 Distill Qwen 7B, Qwen3.5 2B here, though they rank higher overall. Trails Qwen2.5 1.5B Instruct, WizardLM 13B V1.2, Granite 3B Code Instruct (2K) here, though they rank lower overall.
| test | result | vs the others in its run | counts |
|---|---|---|---|
| HumanEval +2 | 49.4% ✎ | ▁·▁▁▃▄▆▅█▃▁▁ beats 35/99 | 45% |
| HumanEval+ | 45.1% ✎ | ▁·▁▁▁▃▄▄▄█▃▁ beats 37/99 | 19% |
| MBPP+ | 54.2% ✎ | ▁···▁▁▂▅▇█▆▂ beats 25/75 | 3.6% |
| MBPP | 55.0% ✎ | ▁▁▁▄▅█▄▅▃▁▂▁ beats 42/81 | 1.5% |
| CRUXEval-I | 31.6% ✎ | ▁··▁▅▂█▇▁··▁ beats 5/22 | 1.1% |
| CRUXEval-O | 33.5% ✎ | ▁·▂▃▁█▁▂···▁ beats 4/22 | 1.0% |
chat & writing▁▃▁▃▅▄▅█▆▆▇▃ #389 of 393 * · 7.6% of its score · 2 tests
Trails Gemma 3 270M IT, SmolLM2 360M Instruct, Qwen1.5 1.8B Chat here, though they rank lower overall.
| test | result | vs the others in its run | counts |
|---|---|---|---|
| AlpacaEval 2 length-controlled | 4.4% ✎ | ▁▃▂▃▆▆█▆▄▄▁▁ beats 7/122 | 6.6% |
| AlpacaEval 1.0 win rate (vs text-davinci-003, GPT-4 judge) | 30.7% ✎ | ▂▃·▆·▇▃▆█▆▄▂ beats 3/45 | 1.0% |
math▁▂▃▅▆▅▄█▄▁▁▁ #281 of 398 * · 1.8% of its score · 1 test
Beats Molmo 2 8B, Llama 3.1 Nemotron 70B Instruct, GPT-4 (0613) here, though they rank higher overall. Trails DeepSeek R1 Distill Qwen 1.5B here, though they rank lower overall.
other tests8 not in a task · 18% of its score
| test | result | vs the others in its run | counts |
|---|---|---|---|
| EvoEval (overall) | 31.8% ✎ | ▂▂▃▄▄█▁▄▅▃▁▃ beats 16/42 | 7.6% |
| BIG-Bench Hard | 43.4% ✎ | ▁▁▁▁▂▄▅▅█▃▄▁ beats 31/129 | 4.5% |
| ARC Challenge | 71.3% ✎ | ▆▁▁▂▂▅▇█▄▃▃▂ beats 83/97 | 2.6% |
| MMLU | 52.7% ✎ | ▁▁▁▁▁▂▃▅█▃▆▃ beats 45/183 | 1.9% |
| C-Eval | 23.4% ✎ | ▃···▁▁▂▁▂▂▃█ beats 0/33 | 0.8% |
| Open PT-LLM Leaderboard average (9 Portuguese tasks) | 36.5% ✎ | ▃▁▁▁▃▁▁▁▂█▅▁ beats 45/276 | 0.6% |
| Vectara hallucination leaderboard, 2025 dataset (HHEM-2.3, factual consistency rate) | 93.3% ✎ | ▁▁▂▃▄▄█▆▃▂▂▁ beats 45/140 | 0.3% |
| COPA | 90.2% ✎ | ▅·▃·▃··█▃··▃ beats 7/8 | 0.1% |
$ where to run it
llama.cpp · recommended
version
- Install llama.cpp · Homebrew and winget installs name the commands llama-cli and llama-server instead.macOS / Linux
curl -LsSf https://llama.app/install.sh | shWindowsirm https://llama.app/install.ps1 | iex - Run Phi-2 (2.7B) · needs ~1.8 GB · from huggingface.co/TheBlokechat in the terminal
llama cli -hf TheBloke/phi-2-GGUF:Q4_K_M - Or start a local server and open the address it prints (http://localhost:9931)
llama serve -hf TheBloke/phi-2-GGUF:Q4_K_M
LM Studio
version
- Install LM Studio · Open the app once before using the lms command.
- Run Phi-2 (2.7B) · needs ~1.8 GB · from huggingface.co/TheBloke
- Or download it in the terminal
lms get https://huggingface.co/TheBloke/phi-2-GGUF@Q4_K_M -y - Then run lms ls to see its name, and lms chat followed by that name
Ollama
- Install Ollama
download it (macOS / Windows) ↗
Linuxcurl -fsSL https://ollama.com/install.sh | sh - Run Phi-2 (2.7B) · needs ~1.6 GB · from ollama.comchat in the terminal
ollama run phi:2.7b
MLX (Mac)
- Install MLX (Mac) · Apple silicon Macs only, text only.with uv
uv tool install mlx-lmorpip install mlx-lm - Run Phi-2 (2.7B) · needs ~1.6 GB, Mac only · from huggingface.co/jesusoctavioaschat in the terminal
mlx_lm.chat --model jesusoctavioas/phi-2-mlx-4Bit - Or start an OpenAI-compatible server at http://localhost:8080/v1
mlx_lm.server --model jesusoctavioas/phi-2-mlx-4Bit
Other ways to run it
- Run it as published · needs ~5.56 GB · from huggingface.co/microsoft (official)
uv run --with torch --with 'transformers<5' python -c "from transformers import pipeline; print(pipeline('text-generation', model='microsoft/phi-2')('Once upon a time', max_new_tokens=40)[0]['generated_text'])"
Official weights and documentation: huggingface.co/microsoft ↗
$ how the score was worked out · EvalPlus / EvalPerf published… 51%, Top Leaderboard Ranking = Top… 22%, MiniCPM: Unveiling the Potent… 16% and 5 more
Each result implies a score on its own, after adjusting for how hard its test is and who ran it. The score is their weighted average, with a small pull toward the middle for thinly tested models. Each test's weight is its counts column above; here it's added up by who ran the tests. How it works
$ improve this page
Use a short GitHub form or edit the data through a pull request. Every number needs a source; here's which ones we can use.
data updated · sources and licences · json