Model reference · open weights

phi-2

phi-2 is an open-weight language model from microsoft, listed in the AxForge catalogue. AxForge can bring it up on EU-owned hardware for you on request — with the licence handled where one is required.

LLMs microsoft 1 variants 1.5M downloads/mo
Request this model on EU hardware All served models Not on the shared API today — deployed on request.

About

What phi-2 is

Model Summary 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 less than 13 billion parameters. Our model hasn't been fine-tuned through reinforcement learning from human feedback. The intention behind crafting this open-source model is to provide the research community with a non-restricted small model to explore vital safety challenges, such as reducing toxicity, understanding societal biases, enhancing controllability, and more. How to Use Phi-2 has been integrated in the transformers version 4.37.0, please ensure that you are using a version equal or higher than it. Phi-2 is known for having an attention overflow issue (with FP16). If you are facing this issue, please enable/disable autocast on the PhiAttention.forward() function. Intended Uses Given the nature of the training data, the Phi-2 model is best suited for prompts using the QA format, the chat format, and the code format. QA Format: You can provide the prompt as a standalone question as follows: where the model generates the text after "." . To encourage the model to write more concise answers, you can also try the following QA format using "Instruct: \<prompt\\nOutput:" where the model generates the text after "Output:". Chat Format: where the model generates the text after the first "Bob:". Code Format: where the model generates the text after the comments. Notes: Phi-2 is intended for QA, chat, and code purposes. The model-generated text/code should be treated as a starting point rather than a definitive solution for potential use cases. Users should be cautious when employing these models in their applications. Direct adoption for production tasks without evaluation is out of scope of this project. As a result, the Phi-2 model has not been tested to ensure that it performs adequately for any production-level application. Please refe

Summarised from the published model card. Read the full card on the HuggingFace links below.

Specifications

What it is

Makermicrosoft
TypeLanguage models
Parameters (lead)2.8B
Variants1
Runs withtransformers
Released2023-12-13
Popularity1.5M downloads / month
Likes3,500
LicenceOpen weights

How it works

How language models work

Your prompttext / messagesTransformerattention over tokensNext-token loopgenerate + streamResponsetext · tool callsA language model reads your tokens and predicts the next one, again and again, streaming the reply back.

Variants

Sizes & precisions

Open weights ship in several sizes and precisions. One page, all the variants — pick the one that fits your GPU. VRAM figures are estimates from model size.

VariantParamsPrecisionVRAMFits 16 GBWeights
phi-22.8BBF16~6.4 GBWeights ↗

Using it via the API

Call it like any OpenAI endpoint

Once AxForge deploys phi-2 for you, it answers on the OpenAI-compatible API — the same base URL and keys as every other model. (phi-2 below is illustrative; you get the exact model name on deployment.)

$ curl -sS https://api.axforge.ai/v1/chat/completions \
  -H "Authorization: Bearer $AXFORGE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"phi-2","messages":[{"role":"user","content":"Hello"}]}'

Details

Languages, data & research

Languages

en

Tags

transformers safetensors phi text-generation nlp code en text-generation-inference endpoints_compatible deploy:sagemaker deploy:azure

Licence

Open weights

Open weights under mit — commercial use is permitted. Deploy it on AxForge EU hardware on request. Read the licence ↗

Sources

Weights & code

Want phi-2 on EU-owned hardware?

Request this model on EU hardware See what’s served now

Explore

More language models

© 2026 AxForge · EU-hosted AI infrastructure Pricing Docs Trust Privacy Terms