LLM Reference

Phi-2

Released
2023-12-12
Last refreshed
2026-06-15
Status
Researched 69d ago
Open sourceCommercial use: permittedCodingClassificationJSON / Tool use

Phi-2 is worth evaluating for coding, classification, and json / tool use when its provider route and context window match the workload.

Use it for

  • Teams evaluating coding, classification, and json / tool use
  • Workloads that can use a 2k context window
  • Buyers comparing 4 tracked provider routes

Do not use it for

  • Vision or document-understanding workloads
Specifications
Family
Phi-2
Released
2023-12-12
Context
2k
Parameters
2.7B
Architecture
Decoder Only
Specialization
general
Openness
Open source
License
MITOSI-approvedCommercial use: permitted
Weights
Unknown
Code
Unknown
Training
Fine-tuned
Created by

Advancing the state-of-the-art in AI and computing.

Redmond, Washington, United States
Founded 1991
Website
Pricing
Output / 1M
$0.070
Input / 1M
$0.070

Cheapest of 5 routes · Microsoft Foundry

About

Phi-2 is a compact language model by Microsoft endowed with 2.7 billion parameters and part of their Phi series. It shows formidable capabilities in reasoning and language understanding, outshining much larger models, even those with up to 25 times more parameters. Phi-2's training utilized a vast and diverse dataset of 1.4 trillion tokens, incorporating high-quality synthetic data and curated web content to bolster its common sense reasoning and general knowledge. Interestingly, despite lacking fine-tuning via reinforcement learning from human feedback (RLHF), it exhibits enhanced safety features and reduced bias. This makes Phi-2 a particularly useful asset in natural language processing research and development 127.

Phi-2 is an open-source model. The structured metadata tracks a 2k-token context window and structured outputs. This page tracks provider routes through Microsoft Foundry, Cloudflare Workers AI, Together AI, and 2 more, with the cheapest tracked route listed at $0.05 input and $0.25 output per 1M tokens. Headline tracked benchmarks include Google-Proof Q&A 41.2, HellaSwag 85.9, and HumanEval 59.7.

Top use-case fit: coding, agents, and build tasks

Coding

Q/$ A

1 relevant benchmark in the decision map.

Classification

Q/$ A

2 relevant benchmarks in the decision map.

JSON / Tool use

Included by capability and metadata signals in the decision map.

Provider price ladder

Compare all 5

Compare API pricing across 4 providers for input and output tokens, batch, and cached reads when available.

ProviderInput / 1MOutput / 1MRoute
Microsoft Foundry$0.070$0.070
Provisioned
Fireworks AI$0.100$0.100
Provisioned
Together AI$0.100$0.100
Serverless
Replicate API$0.050$0.250
Serverless

Available via routers & gateways(6)

Capabilities

Structured Outputs

Benchmark peer barsfor Coding

Benchmark scores(4)

Scores are benchmark-specific and are direction-aware: the same numeric gap can mean very different outcomes across suites. Use the leaderboard context and this model's provider route to decide whether the winning margin is meaningful for your workload.
BenchmarkScoreVersionEvaluationSource
Google-Proof Q&A41.2diamondObserved 2026-03-06research
HellaSwag85.910-shotObserved 2026-03-06research
HumanEval59.7pass@1Observed 2026-03-06research
Massive Multitask Language Understanding68.35-shotObserved 2026-03-06research

Migration checks

No linked migration route is available for this model yet.

Frequently asked questions

What is the context window of Phi-2?

Phi-2 has a context window of 2k tokens.

How much does Phi-2 cost?

Phi-2 pricing ranges from $0.05/1M to $0.10/1M input tokens depending on the provider.

When was Phi-2 released?

Phi-2 was released on 2023-12-12.

Which providers offer Phi-2?

Phi-2 is available from 5 providers: Microsoft Foundry, Cloudflare Workers AI, Together AI, Fireworks AI, Replicate API.

What benchmarks has Phi-2 been tested on?

Phi-2 has been evaluated on 4 benchmarks, including Google-Proof Q&A, HellaSwag, HumanEval, Massive Multitask Language Understanding.