Model reference · open weights
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.
About
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
| Maker | microsoft |
|---|---|
| Type | Language models |
| Parameters (lead) | 2.8B |
| Variants | 1 |
| Runs with | transformers |
| Released | 2023-12-13 |
| Popularity | 1.5M downloads / month |
| Likes | 3,500 |
| Licence | Open weights |
How it works
Variants
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.
| Variant | Params | Precision | VRAM | Fits 16 GB | Weights |
|---|---|---|---|---|---|
| phi-2 | 2.8B | BF16 | ~6.4 GB | ✓ | Weights ↗ |
Using it via the API
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
Tags
Licence
Open weights under mit — commercial use is permitted. Deploy it on AxForge EU hardware on request. Read the licence ↗