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.
Score within the LMArena (text) comparison set only.
$ how it compares
The LLMs ranked either side of Phi-2 (2.7B), out of 897 with a score, then more from Microsoft.
| # | model | score | where | ||
|---|---|---|---|---|---|
| 678 | 40±1 | api $0.12/M +local | |||
| 679 | 40±3 | local | |||
| 680 | 40±1 | local | |||
| 681 | 40±1 | local | |||
| 682 | 40±1 | local | |||
| more from Microsoft | |||||
| 273 | 58±1 | local | |||
| 289 | 57±1 | api $0.22/M +local | |||
| 391 | 53±1 | api $0.087/M +local | |||
$ what it's good at
coding▁▁▁▃▆▇█▆▆▃▃▁ #388 of 474 · 70% of its score · 6 tests
Beats LFM2.5 8B-A1B, DeepSeek R1 Distill Qwen 7B, Tulu 2 70B 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 | 43% |
| HumanEval+ | 45.1% ✎ | ▁·▁▁▁▃▄▄▄█▃▁ beats 37/99 | 19% |
| MBPP+ | 54.2% ✎ | ▁···▁▁▂▅▇█▆▂ beats 25/75 | 3.8% |
| MBPP | 55.0% ✎ | ▁▁▁▄▅█▆▅▄▁▂▁ beats 46/86 | 1.7% |
| CRUXEval-I | 31.6% ✎ | ▁··▁▅▂█▇▁··▁ beats 5/22 | 1.1% |
| CRUXEval-O | 33.5% ✎ | ▁·▂▃▁█▁▂···▁ beats 4/22 | 1.1% |
chat & writing▁▃▁▃▅▄▆█▇▇▇▃ #401 of 405 * · 8.0% of its score · 2 tests
Trails Gemma 3 270M IT, SmolLM2 360M Instruct, Falcon 7B Instruct here, though they rank lower overall.
| test | result | vs the others in its run | counts |
|---|---|---|---|
| AlpacaEval 2 length-controlled | 4.4% ✎ | ▁▃▂▃▆▆█▆▄▄▁▁ beats 7/122 | 7.4% |
| AlpacaEval 1.0 win rate (vs text-davinci-003, GPT-4 judge) | 30.7% ✎ | ▂▃·▆·▇▃▆█▆▄▂ beats 3/45 | 0.6% |
math▁▁▃▅█▆▅█▄▁▁▁ #223 of 440 * · 2.7% of its score · 1 test
Beats MiniMax-M2.1, DeepSeek V3 (Dec '24), GPT-4o (2024-08-06) here, though they rank higher overall.
other tests8 not in a task · 19% of its score
| test | result | vs the others in its run | counts |
|---|---|---|---|
| EvoEval (overall) | 31.8% ✎ | ▂▂▃▄▄█▁▄▅▃▁▃ beats 16/42 | 7.9% |
| BIG-Bench Hard | 43.4% ✎ | ▁▁▁▁▂▄▅▆█▃▃▁ beats 44/155 | 4.7% |
| ARC Challenge | 71.3% ✎ | ▄▁▁▂▁▄█▇▃▃▃▂ beats 120/140 | 2.3% |
| MMLU | 52.7% ✎ | ▁▁▁▁▁▂▂▅██▆▄ beats 60/215 | 2.2% |
| Open PT-LLM Leaderboard average (9 Portuguese tasks) | 36.5% ✎ | ▃▁▁▁▃▁▁▁▂█▅▁ beats 45/276 | 0.7% |
| C-Eval | 23.4% ✎ | ▃···▁▁▂▁▂▂▃█ beats 0/33 | 0.7% |
| 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
Memory is what a version takes in GPU memory (or a Mac's unified memory) with an 8k-token conversation. With less, it runs partly from system RAM, more slowly. Enter your machine to see what runs at full speed.
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 4.9 GB memory, 1.79 GB download · 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 4.9 GB memory, 1.79 GB download · 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 4.7 GB memory, 1.6 GB download · 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 4.7 GB memory, 1.57 GB download, 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 8.7 GB memory, 5.56 GB download · 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'])"
Model repository and documentation: huggingface.co/microsoft ↗
$ how the score was worked out · EvalPlus / EvalPerf published… 49%, Top Leaderboard Ranking = Top… 23%, MiniCPM: Unveiling the Potent… 17% 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