Phi-4-mini-instruct
Version: 1
Phi-4-mini-instruct is a lightweight open model built upon synthetic data and filtered publicly available websites - with a focus on high-quality, reasoning dense data. The model belongs to the Phi-4 model family and supports 128K token context length. The model underwent an enhancement process, incorporating both supervised fine-tuning and direct preference optimization to support precise instruction adherence and robust safety measures.
Phi-4-mini-instruct is a dense decoder-only Transformer model with 3.8B parameters, offering key improvements over Phi-3.5-Mini, including a 200K vocabulary, grouped-query attention, and shared embedding. It is designed for chat-completion prompts, generating text based on user input, with a context length of 128K tokens. This static model was trained on an offline dataset with a June 2024 data cutoff. It supports many languages, including Arabic, Chinese, Czech, Danish, Dutch, English, Finnish, French, German, Hebrew, Hungarian, Italian, Japanese, Korean, Norwegian, Polish, Portuguese, Russian, Spanish, Swedish, Thai, Turkish, Ukrainian.
The model is intended for broad multilingual commercial and research use. The model provides uses for general purpose AI systems and applications which require 1) memory/compute constrained environments; 2) latency bound scenarios; 3) strong reasoning (especially math and logic). The model is designed to accelerate research on language and multimodal models, for use as a building block for generative AI powered features.
Release Notes
This release of Phi-4-Mini is based on valuable user feedback from the Phi-3 series. The Phi-4-Mini model employed new architecture for efficiency, larger vocabulary for multilingual multimodal support, and better post-training techniques were used for instruction following, function calling, as well as additional data leading to substantial gains on key capabilities. It is anticipated that most use cases will benefit from this release, but users are encouraged to test in their particular AI applications. The enthusiastic support for the Phi-4 series is greatly appreciated. Feeedback on Phi-4-Mini is welcomed and crucial to the model’s evolution and improvement.Primary Use Cases
The model is intended for broad multilingual commercial and research use. The model provides uses for general purpose AI systems and applications which require 1) memory/compute constrained environments; 2) latency bound scenarios; 3) strong reasoning (especially math and logic). The model is designed to accelerate research on language and multimodal models, for use as a building block for generative AI powered features.Out-of-scope use cases
The model is not specifically designed or evaluated for all downstream purposes. Developers should consider common limitations of language models, as well as performance difference across languages, as they select use cases, and evaluate and mitigate for accuracy, safety, and fairness before using within a specific downstream use case, particularly for high-risk scenarios.Developers should be aware of and adhere to applicable laws or regulations (including but not limited to privacy, trade compliance laws, etc.) that are relevant to their use case. Nothing contained in this Model Card should be interpreted as or deemed a restriction or modification to the license the model is released under.
Data Overview
Phi-4-Mini’s training data includes a wide variety of sources, totaling 5 trillion tokens, and is a combination of 1) publicly available documents filtered for quality, selected high-quality educational data, and code; 2) newly created synthetic, “textbook-like” data for the purpose of teaching math, coding, common sense reasoning, general knowledge of the world (e.g., science, daily activities, theory of mind, etc.); 3) high quality chat format supervised data covering various topics to reflect human preferences on different aspects such as instruct-following, truthfulness, honesty and helpfulness. We focused on the quality of data that could potentially improve the reasoning ability for the model, and the publicly available documents were filtered to contain a preferred level of knowledge. As an example, the result of a game in premier league on a particular day might be good training data for frontier models, but such information was removed to leave more model capacity for reasoning for the model’s small size. More details about data can be found in the Phi-4-Mini technical report. The decontamination process involved normalizing and tokenizing the dataset, then generating and comparing n-grams between the target dataset and benchmark datasets. Samples with matching n-grams above a threshold were flagged as contaminated and removed from the dataset. A detailed contamination report was generated, summarizing the matched text, matching ratio, and filtered results for further analysis.Model Summary
Architecture: Phi-4-Mini has 3.8B parameters and is a dense decoder-only Transformer model. When compared with Phi-3.5-Mini, the major changes with Phi-4-Mini are 200K vocabulary, grouped-query attention, and shared embedding.Inputs: Text (best suited for chat-completion format prompts)
Outputs: Generated text in response to the input
Context Length: 128K tokens
GPUS: 512 A100-80G
Training Time: 21 days
Training Dates: Trained between November and December 2024
Status: This is a static model trained on an offline dataset with the cutoff date of June 2024 for publicly available data.
Supported Languages: Arabic, Chinese, Czech, Danish, Dutch, English, Finnish, French, German, Hebrew, Hungarian, Italian, Japanese, Korean, Norwegian, Polish, Portuguese, Russian, Spanish, Swedish, Thai, Turkish, Ukrainian
Release date: February 2025
Responsible AI Considerations
Like other language models, the Phi family of models can potentially behave in ways that are unfair, unreliable, or offensive. Some of the limiting behaviors to be aware of include:- Quality of Service: The Phi models are trained primarily on English text and some additional multilingual text. Languages other than English will experience worse performance as well as performance disparities across non-English. English language varieties with less representation in the training data might experience worse performance than standard American English.
- Multilingual performance and safety gaps: We believe it is important to make language models more widely available across different languages, but the Phi 4 models still exhibit challenges common across multilingual releases. As with any deployment of LLMs, developers will be better positioned to test for performance or safety gaps for their linguistic and cultural context and customize the model with additional fine-tuning and appropriate safeguards.
- Representation of Harms & Perpetuation of Stereotypes: These models can over- or under-represent groups of people, erase representation of some groups, or reinforce demeaning or negative stereotypes. Despite safety post-training, these limitations may still be present due to differing levels of representation of different groups, cultural contexts, or prevalence of examples of negative stereotypes in training data that reflect real-world patterns and societal biases.
- Inappropriate or Offensive Content: These models may produce other types of inappropriate or offensive content, which may make it inappropriate to deploy for sensitive contexts without additional mitigations that are specific to the case.
- Information Reliability: Language models can generate nonsensical content or fabricate content that might sound reasonable but is inaccurate or outdated.
- Limited Scope for Code: The majority of Phi 4 training data is based in Python and uses common packages such as "typing, math, random, collections, datetime, itertools". If the model generates Python scripts that utilize other packages or scripts in other languages, it is strongly recommended that users manually verify all API uses.
- Long Conversation: Phi 4 models, like other models, can in some cases generate responses that are repetitive, unhelpful, or inconsistent in very long chat sessions in both English and non-English languages. Developers are encouraged to place appropriate mitigations, like limiting conversation turns to account for the possible conversational drift.
- Inference of Sensitive Attributes: The Phi 4 models can sometimes attempt to infer sensitive attributes (such as personality characteristics, country of origin, gender, etc.) from the users’ voices when specifically asked to do so. Phi 4-multimodal-instruct is not designed or intended to be used as a biometric categorization system to categorize individuals based on their biometric data to deduce or infer their race, political opinions, trade union membership, religious or philosophical beliefs, sex life, or sexual orientation. This behavior can be easily and efficiently mitigated at the application level by a system message.
- Allocation: Models may not be suitable for scenarios that could have consequential impact on legal status or the allocation of resources or life opportunities (ex: housing, employment, credit, etc.) without further assessments and additional debiasing techniques.
- High-Risk Scenarios: Developers should assess the suitability of using models in high-risk scenarios where unfair, unreliable or offensive outputs might be extremely costly or lead to harm. This includes providing advice in sensitive or expert domains where accuracy and reliability are critical (ex: legal or health advice). Additional safeguards should be implemented at the application level according to the deployment context.
- Misinformation: Models may produce inaccurate information. Developers should follow transparency best practices and inform end-users they are interacting with an AI system. At the application level, developers can build feedback mechanisms and pipelines to ground responses in use-case specific, contextual information, a technique known as Retrieval Augmented Generation (RAG).
- Generation of Harmful Content: Developers should assess outputs for their context and use available safety classifiers or custom solutions appropriate for their use case.
- Misuse: Other forms of misuse such as fraud, spam, or malware production may be possible, and developers should ensure that their applications do not violate applicable laws and regulations.
Safety Approach
The Phi-4 family of models has adopted a robust safety post-training approach. This approach leverages a variety of both open-source and in-house generated datasets. The overall technique employed to do the safety alignment is a combination of SFT (Supervised Fine-Tuning), DPO (Direct Preference Optimization), and RLHF (Reinforcement Learning from Human Feedback) approaches by utilizing human-labeled and synthetic English-language datasets, including publicly available datasets focusing on helpfulness and harmlessness as well as various questions and answers targeted to multiple safety categories. For non-English languages, the existing datasets were extended via machine translation.Safety Evaluation and Red-Teaming
Various evaluation techniques including red teaming, adversarial conversation simulations, and multilingual safety evaluation benchmark datasets were leveraged to evaluate Phi-4 models’ propensity to produce undesirable outputs across multiple languages and risk categories. Several approaches were used to compensate for the limitations of one approach alone. Findings across the various evaluation methods indicate that safety post-training that was done as detailed in the Phi 3 Safety Post-Training paper had a positive impact across multiple languages and risk categories as observed by refusal rates (refusal to output undesirable outputs) and robustness to jailbreak techniques. Details on prior red team evaluations across Phi models can be found in the Phi 3 Safety Post-Training paper. For this release, initial insights from red teaming indicate that the models may at times be mistaken about which company created them; ad-hoc training data were added to correct this behavior. Another insight was that with function calling scenarios, the models could sometimes hallucinate function names or URL’s. Models may also be more susceptible to longer multi-turn jailbreak techniques across both English and non-English languages. These findings highlight the need for industry-wide investment in the development of high-quality safety evaluation datasets across multiple languages, including low resource languages, and risk areas that account for cultural nuances where those languages are spoken.Model Quality
To understand the capabilities, the 3.8B parameters Phi-4-Mini model was compared with a set of models over a variety of benchmarks using an internal benchmark platform (See Appendix A for benchmark methodology). A high-level overview of the model quality is as follows:Popular Aggregated Benchmarks
Phi-4 Mini-Ins | Phi-3.5-Mini-Ins | Llama-3.2-3B-Ins | Ministral-3B | Qwen2.5-3B-Ins | Qwen2.5-7B-Ins | Ministral-8B-2410 | Llama-3.1-8B-Ins | Llama-3.1-Tulu-3-8B | Gemma 2-9B-It | GPT-4o-mini-2024-07-18 | |
---|---|---|---|---|---|---|---|---|---|---|---|
Arena Hard | 32.8 | 34.4 | 17 | 26.9 | 32 | 55.5 | 37.3 | 25.7 | 42.7 | 43.7 | 75 |
BigBench Hard CoT (0-shot) | 70.4 | 63.1 | 55.4 | 51.2 | 56.2 | 72.4 | 53.3 | 63.4 | 55.5 | 65.7 | 80.4 |
MMLU (5-shot) | 67.3 | 65.5 | 61.8 | 60.8 | 65 | 72.6 | 63 | 68.1 | 65 | 71.3 | 77.2 |
MMLU-Pro (0-shot, CoT) | 52.8 | 34.4 | 39.2 | 35.3 | 44.7 | 56.2 | 36.6 | 44 | 40.9 | 50.1 | 62.8 |
Reasoning
Phi-4 Mini-Ins | Phi-3.5-Mini-Ins | Llama-3.2-3B-Ins | Ministral-3B | Qwen2.5-3B-Ins | Qwen2.5-7B-Ins | Ministral-8B-2410 | Llama-3.1-8B-Ins | Llama-3.1-Tulu-3-8B | Gemma 2-9B-It | GPT-4o-mini-2024-07-18 | |
---|---|---|---|---|---|---|---|---|---|---|---|
ARC Challenge (10-shot) | 83.7 | 47.4 | 76.1 | 80.3 | 82.6 | 90.1 | 82.7 | 83.1 | 79.4 | 89.8 | 93.5 |
BoolQ (2-shot) | 81.2 | 84.6 | 71.4 | 79.4 | 65.4 | 80 | 80.5 | 82.8 | 79 | 85.7 | 88.7 |
GPQA (0-shot, CoT) | 30.4 | 77.7 | 26.6 | 24.3 | 24.3 | 30.6 | 26.3 | 26.3 | 29.9 | 31 | 41.1 |
HellaSwag (5-shot) | 69.1 | 25.2 | 69 | 77.2 | 74.6 | 80.1 | 80.9 | 73.5 | 72.8 | 80.9 | 87.1 |
OpenBook QA (10-shot) | 79.2 | 72.2 | 72.6 | 79.8 | 77.6 | 86 | 80.2 | 84.8 | 79.8 | 89.6 | 90 |
PIQA (5-shot) | 77.6 | 81.2 | 68.2 | 78.3 | 77.2 | 80.8 | 76.2 | 81.2 | 83.2 | 83.7 | 88.7 |
Social IQA (5-shot) | 72.5 | 78.2 | 68.3 | 73.9 | 75.3 | 75.3 | 77.6 | 71.8 | 73.4 | 74.7 | 82.9 |
TruthfulQA (MC2) (10-shot) | 66.4 | 75.1 | 59.2 | 62.9 | 64.3 | 69.4 | 63 | 69.2 | 64.1 | 76.6 | 78.2 |
WinoGrande (5-shot) | 67 | 65.6 | 53.2 | 59.8 | 63.3 | 71.1 | 63.1 | 64.7 | 65.4 | 74 | 76.9 |
Multilingual
Phi-4 Mini-Ins | Phi-3.5-Mini-Ins | Llama-3.2-3B-Ins | Ministral-3B | Qwen2.5-3B-Ins | Qwen2.5-7B-Ins | Ministral-8B-2410 | Llama-3.1-8B-Ins | Llama-3.1-Tulu-3-8B | Gemma 2-9B-It | GPT-4o-mini-2024-07-18 | |
---|---|---|---|---|---|---|---|---|---|---|---|
Multilingual MMLU (5-shot) | 49.3 | 51.8 | 48.1 | 46.4 | 55.9 | 64.4 | 53.7 | 56.2 | 54.5 | 63.8 | 72.9 |
MGSM (0-shot CoT) | 63.9 | 47 | 49.6 | 44.6 | 53.5 | 64.5 | 58.3 | 56.7 | 58.6 | 75.1 | 81.7 |
Math
Phi-4 Mini-Ins | Phi-3.5-Mini-Ins | Llama-3.2-3B-Ins | Ministral-3B | Qwen2.5-3B-Ins | Qwen2.5-7B-Ins | Ministral-8B-2410 | Llama-3.1-8B-Ins | Llama-3.1-Tulu-3-8B | Gemma 2-9B-It | GPT-4o-mini-2024-07-18 | |
---|---|---|---|---|---|---|---|---|---|---|---|
GSM8K (8-shot, CoT) | 88.6 | 76.9 | 75.6 | 80.1 | 80.6 | 88.7 | 81.9 | 82.4 | 84.3 | 84.9 | 91.3 |
MATH (0-shot, CoT) | 64 | 49.8 | 46.7 | 41.8 | 61.7 | 60.4 | 41.6 | 47.6 | 46.1 | 51.3 | 70.2 |
Long Context
Phi-4 Mini-Ins | Phi-3.5-Mini-Ins | Llama-3.2-3B-Ins | Ministral-3B | Qwen2.5-3B-Ins | Qwen2.5-7B-Ins | Ministral-8B-2410 | Llama-3.1-8B-Ins | Llama-3.1-Tulu-3-8B | Gemma 2-9B-It | GPT-4o-mini-2024-07-18 | |
---|---|---|---|---|---|---|---|---|---|---|---|
Qasper | 40.4 | 41.9 | 33.4 | 35.3 | 32.1 | 38.1 | 37.4 | 37.2 | 35.4 | 13.9 | 39.8 |
SQuALITY | 22.8 | 25.3 | 25.7 | 25.5 | 25.3 | 23.8 | 24.9 | 26.2 | 26.7 | 23.6 | 23.8 |
Instruction Following
Phi-4 Mini-Ins | Phi-3.5-Mini-Ins | Llama-3.2-3B-Ins | Ministral-3B | Qwen2.5-3B-Ins | Qwen2.5-7B-Ins | Ministral-8B-2410 | Llama-3.1-8B-Ins | Llama-3.1-Tulu-3-8B | Gemma 2-9B-It | GPT-4o-mini-2024-07-18 | |
---|---|---|---|---|---|---|---|---|---|---|---|
IFEval | 70.1 | 50.6 | 68 | 47.5 | 59 | 69.5 | 52.5 | 74.1 | 77.3 | 73.2 | 80.1 |
Function Calling
Phi-4 Mini-Ins | Phi-3.5-Mini-Ins | Llama-3.2-3B-Ins | Ministral-3B | Qwen2.5-3B-Ins | Qwen2.5-7B-Ins | Ministral-8B-2410 | Llama-3.1-8B-Ins | Llama-3.1-Tulu-3-8B | Gemma 2-9B-It | GPT-4o-mini-2024-07-18 | |
---|---|---|---|---|---|---|---|---|---|---|---|
BFCL | 70.3 | 66.1 | 78.6 | 61.4 | 74.2 | 81.3 | 74 | 77 | 59.4 | 59.9 | 83.3 |
Code Generation
Phi-4 Mini-Ins | Phi-3.5-Mini-Ins | Llama-3.2-3B-Ins | Ministral-3B | Qwen2.5-3B-Ins | Qwen2.5-7B-Ins | Ministral-8B-2410 | Llama-3.1-8B-Ins | Llama-3.1-Tulu-3-8B | Gemma 2-9B-It | GPT-4o-mini-2024-07-18 | |
---|---|---|---|---|---|---|---|---|---|---|---|
HumanEval (0-shot) | 74.4 | 70.1 | 62.8 | 72 | 72 | 75 | 70.7 | 66.5 | 62.8 | 63.4 | 86.6 |
MBPP (3-shot) | 65.3 | 70 | 67.2 | 65.1 | 65.3 | 76.3 | 68.9 | 69.4 | 63.9 | 69.6 | 84.1 |
Overall | 63.5 | 60.5 | 56.2 | 56.9 | 60.1 | 67.9 | 60.2 | 62.3 | 60.9 | 65.0 | 75.5 |
Model Specifications
Context Length128000
Quality Index0.44
LicenseMit
Training DataJune 2024
Last UpdatedFebruary 2025
Input TypeText
Output TypeText
PublisherMicrosoft
Languages23 Languages
Related Models