microsoft / text-generation updated 7 months ago

phi-2

Phi-2 is a Transformer with 2.7 billion parameters. It was trained using the same data sources as Phi-1.5, augmented with a new data source that consists of various NLP synthetic texts and filtered websites (for safety and educational value). When assessed against benchmarks testing common sense, language understanding, and logical reasoning, Phi-2 showcased a nearly state-of-the-art performance among models with les...

Params
2.8 B
Context
2,048
Downloads 30d
771 K
Likes
3,498
Commercial use: allowed mit Not gated SAFETENSORS 1 languages View on Hugging Face ↗

Download history

daily snapshots · 10 days
897 K738 K
Jul 28Jul 31Aug 3Aug 6

Can you run it?

Estimated VRAM at 8K context unless noted. Pick your hardware to see the verdict per quantization.

FileQuantSizeEst. VRAMVerdict on RTX 4090 · 24 GB
model.safetensors f16 5.6 GB 7.0 GB ✅ Runs comfortably
Estimate: file size × 1.1 + KV cache at 8K + 0.5 GB overhead. Not a benchmark — how we calculate this.

Run it

copy-paste, exact tags checked against the Hub
~ · curl · api/v1
$ curl -s https://aimodelscomparison.com/api/v1/models/phi-2
{
  "hf_id": "microsoft/phi-2",
  "params_b": 2.78,
  "context_length": 2048,
  "license": { "id": "mit", "commercial": "yes" },
  "downloads_30d": 771396,
  "vram_estimates": [
    { "quant": "f16", "gb": 7.0 }
  ],
  "updated_at": "2026-07-28T18:03:48Z"
}
est. VRAM —on RTX 4090 · 24 GBJSON API →

Specifications

Architecture
PhiForCausalLM
Parameters
2.8 B
Tensor type
F16
Context length
2,048
Vocabulary
51,200
Layers / heads
32 / 32
Licence
mit
First seen on the Hub
2023-12-13
Training datasets
undisclosed
Added to our catalog
2026-07-28