whatmodel.sh / Phi-2 (2.7B)

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.

40.2±0.6#570 of 743 LLMsfrom 19 benchmark results across 8 sources

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.

#modelscorewhereRAMreleased
678Llama 3.2 3B Instruct Meta40±1api $0.12/M +local~3.3GB2024-09
679Falcon-H1 3B Instruct TII40±3local~3.4GB2025-05
680Phi-2 (2.7B) Microsoft40±1local~4.7GB2023-12
681speechless-code-mistral-7b-v1.0 uukuguy40±1local~17GB2023-10
682Llama-3-Instruct-8B-SimPO-v0.2 Princeton NLP40±1local~6.7GB2024-07
more from Microsoft
273Phi-4-reasoning-plus 14B Microsoft58±1local~11GB2025-04
289Phi-4-reasoning 14B Microsoft57±1api $0.22/M +local~10GB2025-04
391Phi-4 14B Microsoft53±1api $0.087/M +local~11GB2024-12

see all LLMs · find the ones that fit your machine

$ 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.

testresultvs the others in its rundifficultycountswhy
HumanEval +249.4% ✎▁·▁▁▃▄▆▅█▃▁▁ beats 35/99easy · avg 77%▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 43%sharp · at its level · several runs
HumanEval+45.1% ✎▁·▁▁▁▃▄▄▄█▃▁ beats 37/99easy · avg 71%▇▇▇▇▇▇▇▇ 19%sharp · at its level
MBPP+54.2% ✎▁···▁▁▂▅▇█▆▂ beats 25/75easy · avg 66%▇▇ 3.8%at its level
MBPP55.0% ✎▁▁▁▄▅█▆▅▄▁▂▁ beats 46/86easy · avg 68%▇ 1.7%at its level
CRUXEval-I31.6% ✎▁··▁▅▂█▇▁··▁ beats 5/22medium · avg 52%▇ 1.1%at its level
CRUXEval-O33.5% ✎▁·▂▃▁█▁▂···▁ beats 4/22medium · avg 51%▇ 1.1%blunt · at its level
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.

testresultvs the others in its rundifficultycountswhy
AlpacaEval 2 length-controlled4.4% ✎▁▃▂▃▆▆█▆▄▄▁▁ beats 7/122medium · avg 36%▇▇▇ 7.4%sharp
AlpacaEval 1.0 win rate (vs text-davinci-003, GPT-4 judge)30.7% ✎▂▃·▆·▇▃▆█▆▄▂ beats 3/45very easy · avg 94%▇ 0.6%sharp · noisy
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.

testresultvs the others in its rundifficultycountswhy
GSM8K57.2% ✎▂▂▂▂▃▄▅▇██▆▄ beats 96/206easy · avg 73%▇ 2.7%sharp · at its level
other tests8 not in a task · 19% of its score
testresultvs the others in its rundifficultycountswhy
EvoEval (overall)31.8% ✎▂▂▃▄▄█▁▄▅▃▁▃ beats 16/42medium · avg 52%▇▇▇ 7.9%at its level
BIG-Bench Hard43.4% ✎▁▁▁▁▂▄▅▆█▃▃▁ beats 44/155medium · avg 65%▇▇ 4.7%sharp
ARC Challenge71.3% ✎▄▁▁▂▁▄█▇▃▃▃▂ beats 120/140easy · avg 85%▇ 2.3%sharp · at its level
MMLU52.7% ✎▁▁▁▁▁▂▂▅██▆▄ beats 60/215easy · avg 80%▇ 2.2%at its level
Open PT-LLM Leaderboard average (9 Portuguese tasks)36.5% ✎▃▁▁▁▃▁▁▁▂█▅▁ beats 45/276medium · avg 72%▇ 0.7%at its level · noisy
C-Eval23.4% ✎▃···▁▁▂▁▂▂▃█ beats 0/33medium · avg 59%▇ 0.7%at its level · noisy
Vectara hallucination leaderboard, 2025 dataset (HHEM-2.3, factual consistency rate)93.3% ✎▁▁▂▃▄▄█▆▃▂▂▁ beats 45/140very easy · avg 94%▇ 0.3%blunt · noisy
COPA90.2% ✎▅·▃·▃··█▃··▃ beats 7/8easy · avg 92%▇ 0.1%at its level · noisy

$ 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

  1. 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 | sh
    Windows
    irm https://llama.app/install.ps1 | iex

    other ways to install ↗

  2. Run Phi-2 (2.7B) · needs 4.9 GB memory, 1.79 GB download · from huggingface.co/TheBloke
    chat in the terminal
    llama cli -hf TheBloke/phi-2-GGUF:Q4_K_M
  3. 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

  1. Install LM Studio · Open the app once before using the lms command.

    download it (macOS / Windows / Linux) ↗

  2. Run Phi-2 (2.7B) · needs 4.9 GB memory, 1.79 GB download · from huggingface.co/TheBloke

    open in LM Studio ↗

  3. Or download it in the terminal
    lms get https://huggingface.co/TheBloke/phi-2-GGUF@Q4_K_M -y
  4. Then run lms ls to see its name, and lms chat followed by that name

Ollama

  1. Install Ollama

    download it (macOS / Windows) ↗

    Linux
    curl -fsSL https://ollama.com/install.sh | sh
  2. Run Phi-2 (2.7B) · needs 4.7 GB memory, 1.6 GB download · from ollama.com
    chat in the terminal
    ollama run phi:2.7b

MLX (Mac)

  1. Install MLX (Mac) · Apple silicon Macs only, text only.
    with uv
    uv tool install mlx-lm
    or
    pip install mlx-lm
  2. Run Phi-2 (2.7B) · needs 4.7 GB memory, 1.57 GB download, Mac only · from huggingface.co/jesusoctavioas
    chat in the terminal
    mlx_lm.chat --model jesusoctavioas/phi-2-mlx-4Bit
  3. 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

  1. 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