Phi-3-mini instruct (128k)
Phi-3-mini instruct (128k)
Version: 13
MicrosoftLast updated January 2025
Same Phi-3-mini model, but with a larger context size for RAG or few shot prompting.
Reasoning
Understanding
Low latency
The Phi-3-Mini-128K-Instruct is a 3.8 billion-parameter, lightweight, state-of-the-art open model trained using the Phi-3 datasets.
This dataset includes both synthetic data and filtered publicly available website data, with an emphasis on high-quality and reasoning-dense properties.
After initial training, the model underwent a post-training process that involved supervised fine-tuning and direct preference optimization to enhance its ability to follow instructions and adhere to safety measures.
When evaluated against benchmarks that test common sense, language understanding, mathematics, coding, long-term context, and logical reasoning, the Phi-3 Mini-128K-Instruct demonstrated robust and state-of-the-art performance among models with fewer than 13 billion parameters.

Resources

🏡 Phi-3 Portal

📰 Phi-3 Microsoft Blog

📖 Phi-3 Technical Report

🛠️ Phi-3 on Azure AI Studio

👩‍🍳 Phi-3 Cookbook

Model Architecture

Phi-3 Mini-128K-Instruct has 3.8B parameters and is a dense decoder-only Transformer model. The model is fine-tuned with Supervised fine-tuning (SFT) and Direct Preference Optimization (DPO) to ensure alignment with human preferences and safety guidelines.

Training Datasets

Our training data includes a wide variety of sources, totaling 4.9 trillion tokens, and is a combination of
  1. Publicly available documents filtered rigorously 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 (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 are focusing on the quality of data that could potentially improve the reasoning ability for the model, and we filter the publicly available documents to contain the correct level of knowledge. As an example, the result of a game in premier league in a particular day might be good training data for frontier models, but we need to remove such information to leave more model capacity for reasoning for the small size models. More details about data can be found in the Phi-3 Technical Report .

License

The model is licensed under the MIT license.

Intended Uses

Primary use cases The model is intended for broad commercial and research use in English. 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 code, math and logic)
Our 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 Our models are not specifically designed or evaluated for all downstream purposes. Developers should consider common limitations of language models 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 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.

Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines . Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.

Responsible AI Considerations

Like other language models, the Phi series 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. Languages other than English will experience worse performance. English language varieties with less representation in the training data might experience worse performance than standard American English.
  • 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 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 use 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: Majority of Phi-3 training data is based in Python and use 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, we strongly recommend users manually verify all API uses.
Developers should apply responsible AI best practices and are responsible for ensuring that a specific use case complies with relevant laws and regulations (e.g. privacy, trade, etc.). Important areas for consideration include:
  • 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 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.

Content Filtering

Prompts and completions are passed through a default configuration of Azure AI Content Safety classification models to detect and prevent the output of harmful content. Learn more about Azure AI Content Safety . Configuration options for content filtering vary when you deploy a model for production in Azure AI; learn more .
We report the results under completion format for Phi-3-Mini-128K-Instruct on standard open-source benchmarks measuring the model's reasoning ability (both common sense reasoning and logical reasoning). We compare to Mistral-7b-v0.1, Mixtral-8x7b, Gemma 7B, Llama-3-8B-Instruct, and GPT-3.5. All the reported numbers are produced with the exact same pipeline to ensure that the numbers are comparable. These numbers might differ from other published numbers due to slightly different choices in the evaluation. As is now standard, we use few-shot prompts to evaluate the models, at temperature 0.
The prompts and number of shots are part of a Microsoft internal tool to evaluate language models, and in particular we did no optimization to the pipeline for Phi-3.
More specifically, we do not change prompts, pick different few-shot examples, change prompt format, or do any other form of optimization for the model.
The number of k–shot examples is listed per-benchmark.
CategoryBenchmarkPhi-3-Mini-128K-InsGemma-7BMistral-7BMixtral-8x7BLlama-3-8B-InsGPT3.5-Turbo-1106
Popular aggregated benchmarkAGI Eval
5-shot
39.542.135.145.24248.4
MMLU
5-shot
69.763.661.770.566.571.4
BigBench Hard
3-shot
72.159.657.369.751.568.3
Language UnderstandingANLI
7-shot
52.348.747.155.257.358.1
HellaSwag
5-shot
70.549.858.570.471.178.8
ReasoningARC Challenge
10-shot
85.578.378.687.382.887.4
BoolQ
0-shot
77.16672.276.680.979.1
MedQA
2-shot
56.449.65062.260.563.4
OpenBookQA
10-shot
78.878.679.885.882.686
PIQA
5-shot
80.178.177.78675.786.6
GPQA
0-shot
29.72.9156.932.429.9
Social IQA
5-shot
74.765.574.675.973.968.3
TruthfulQA (MC2)
10-shot
64.852.15360.163.267.7
WinoGrande
5-shot
71.055.654.2626568.8
Factual KnowledgeTriviaQA
5-shot
57.872.375.282.267.785.8
MathGSM8K CoTT
8-shot
85.359.846.464.777.478.1
Code GenerationHumanEval
0-shot
60.434.128.037.860.462.2
MBPP
3-shot
70.051.550.860.267.777.8
Average66.456.056.464.465.570.3
Long Context: Phi-3 Mini-128K-Instruct supports 128K context length, therefore the model is capable of several long context tasks including long document/meeting summarization, long document QA.
BenchmarkPhi-3 Mini-128K-InstructMistral-7BMixtral 8x7BLLaMA-3-8B-Instruct
GovReport25.34.920.310.3
QMSum21.915.520.62.9
Qasper41.623.526.68.1
SQuALITY24.114.716.225
SummScreenFD16.89.311.35.1
Average25.913.619.010.3
We take a closer look at different categories across 100 public benchmark datasets at the table below:
CategoryPhi-3-Mini-128K-InstructGemma-7BMistral-7BMixtral 8x7BLlama-3-8B-InstructGPT-3.5-Turbo
Popular aggregated benchmark60.659.456.566.259.967.0
Reasoning69.460.362.868.169.671.7
Language understanding57.557.652.566.163.267.7
Code generation61.045.642.952.756.470.4
Math51.635.825.440.341.152.8
Factual knowledge35.846.749.858.643.163.4
Multilingual56.466.557.466.766.671.0
Robustness61.138.440.651.064.569.3
Overall, the model with only 3.8B-param achieves a similar level of language understanding and reasoning ability as much larger models. However, it is still fundamentally limited by its size for certain tasks. The model simply does not have the capacity to store too much world knowledge, which can be seen for example with low performance on TriviaQA. However, we believe such weakness can be resolved by augmenting Phi-3-Mini with a search engine.
Model Specifications
Context Length131072
LicenseMit
Training DataOct 2023
Last UpdatedJanuary 2025
Input TypeText
Output TypeText
PublisherMicrosoft
Languages1 Language