Phi-3 Technical Report: A Highly Capable Language Model Locally on Your Phone

Marah I Abdin, Sam Ade Jacobs, Ammar Ahmad Awan, Jyoti Aneja, Ahmed Awadallah, Hany Awadalla, Nguyen Bach, Amit Bahree, Arash Bakhtiari, Harkirat S. Behl, Alon Benhaim, Misha Bilenko, Johan Bjorck, Sébastien Bubeck, Martin Cai, Caio César Teodoro Mendes, Weizhu Chen, Vishrav Chaudhary, Parul Chopra, Allie Del Giorno, Gustavo de Rosa, Matthew Dixon, Ronen Eldan, Dan Iter, Amit Garg, Abhishek Goswami, Suriya Gunasekar, Emman Haider, Junheng Hao, Russell J. Hewett, Jamie Huynh, Mojan Javaheripi, Xin Jin, Piero Kauffmann, Nikos Karampatziakis, Dongwoo Kim, Mahoud Khademi, Lev Kurilenko, James R. Lee, Yin Tat Lee, Yuanzhi Li, Chen Liang, Weishung Liu, Eric Lin, Zeqi Lin, Piyush Madan, Arindam Mitra, Hardik Modi, Anh Nguyen, Brandon Norick, Barun Patra, Daniel Perez-Becker, Thomas Portet, Reid Pryzant, Heyang Qin, Marko Radmilac, Corby Rosset, Sambudha Roy, Olatunji Ruwase, Olli Saarikivi, Amin Saied, Adil Salim, Michael Santacroce, Shital Shah, Ning Shang, Hiteshi Sharma, Xia Song, Masahiro Tanaka, Xin Wang, Rachel Ward, Guanhua Wang, Philipp A. Witte, Michael Wyatt, Can Xu, Jiahang Xu, Sonali Yadav, Fan Yang, Ziyi Yang, Donghan Yu, Chengruidong Zhang, Cyril Zhang, Jianwen Zhang, Li Lyna Zhang, Yi Zhang, Yue Zhang, Yunan Zhang, Xiren Zhou · DOI

Abstract

The Phi-3 family of models represents a significant shift in the development of Large Language Models (LLMs), prioritizing high-quality data curation over sheer parameter scale. By utilizing "textbook-quality" data, Microsoft has developed models like phi-3-mini (3.8B parameters) that rival the performance of much larger models such as GPT-3.5 and Mixtral 8x7B. This report details the methodology, architectural innovations, and performance benchmarks that allow these models to run natively on edge devices while maintaining state-of-the-art reasoning capabilities.

Introduction: Challenging the Scaling Laws

For several years, the AI industry has been guided by "scaling laws," which suggest that model performance is primarily a function of parameter count and the volume of training data. These laws typically assume a fixed data source, often consisting of raw, uncurated web crawls. While effective, this approach results in massive models that require significant cloud infrastructure to operate, limiting their utility for local, private, or offline applications.

The Phi-3 project challenges this paradigm by asking whether frontier-level reasoning can be achieved in a model small enough to fit on a smartphone by fundamentally changing the "data recipe." The result is a suite of models that demonstrate that quality often trumps quantity in the pursuit of efficient intelligence.

The Data-First Methodology

The core innovation of Phi-3 is its training methodology, which follows the "Textbooks Are All You Need" philosophy. Instead of training on the noisy breadth of the entire internet, the team focused on highly educational content. This was achieved through two primary channels:

  1. LLM-based Filtering: Larger, frontier models were used to identify and extract high-educational-value content from public web data, effectively "cleaning" the internet for the smaller model.
  2. Synthetic Data Generation: The team created "textbook-like" synthetic data designed to teach the model specific logical reasoning skills and niche technical knowledge that might be sparse in general web data.
Phi-3 models demonstrate a more efficient scaling law compared to traditional models like Llama-2, achieving lower MMLU error rates at significantly smaller parameter sizes.

By focusing on the "data optimal" regime, the researchers intentionally removed "low-reasoning" data—such as sports scores or celebrity gossip—to preserve the model's limited capacity for logic, math, and coding tasks.

Architectural Innovations

The Phi-3 family includes several variants tailored for different use cases:

  • phi-3-mini (3.8B): Built on a standard transformer decoder architecture, it is designed for maximum compatibility with existing ecosystems like Llama-2. When quantized to 4-bits, it occupies only ~1.8GB of memory.
  • phi-3-small (7B): This model introduces Blocksparse Attention, which alternates between dense and sparse layers to optimize inference speed and KV cache efficiency. It also utilizes Maximal Update Parametrization (muP) for stable hyperparameter tuning.
  • phi-3.5-MoE: A Mixture of Experts model featuring 16 experts with top-2 routing. This allows for 42B total parameters with only 6.6B active parameters, balancing high capacity with computational speed.
  • phi-3.5-Vision (4.2B): This multimodal variant integrates a CLIP ViT-L/14 image encoder with the phi-3.5-mini backbone, using a dynamic cropping strategy to process high-resolution and multi-image inputs effectively.

Performance and Local Sovereignty

The performance of phi-3-mini is particularly notable. It achieved a score of 69% on MMLU and 8.38 on MT-bench, outperforming models twice its size and rivaling the capabilities of GPT-3.5. These benchmarks prove that high-quality AI does not require a constant cloud connection.

Phi-3-mini running natively on a mobile device, demonstrating its ability to perform complex tasks like poetry generation and local information retrieval with high throughput.

Running locally on an iPhone 14, the model can generate over 12 tokens per second. This "local sovereignty" ensures user privacy and enables AI utility in environments with limited connectivity.

Safety and Responsibility

To ensure the models are safe for general use, the team employed Supervised Fine-Tuning (SFT) and Direct Preference Optimization (DPO). These techniques significantly reduced harmful response rates across various categories, including cyber-security risks and hate speech, compared to the base pre-trained versions. The models were also subjected to extensive red-teaming to identify and mitigate potential biases.

Limitations and Future Outlook

Despite their reasoning prowess, the small size of Phi-3 models leads to certain trade-offs. They have less "memorization capacity" for raw facts compared to trillion-parameter models, leading to lower scores on trivia-heavy benchmarks like TriviaQA. The authors suggest that augmenting these models with Retrieval-Augmented Generation (RAG) or search engine integration is the best path forward for fact-heavy applications.

Additionally, while the 3.5 versions improved multilingual support, a performance gap remains between English and other languages. Future work will focus on expanding the high-quality data recipe to a broader range of languages and improving performance at the extreme ends of the 128K context window.

Summary updated

BibTeX
@misc{abdin2024phi,
  author = {Marah I Abdin and Sam Ade Jacobs and Ammar Ahmad Awan and Jyoti Aneja and Ahmed Awadallah and Hany Awadalla and Nguyen Bach and Amit Bahree and Arash Bakhtiari and Harkirat S. Behl and Alon Benhaim and Misha Bilenko and Johan Bjorck and Sébastien Bubeck and Martin Cai and Caio César Teodoro Mendes and Weizhu Chen and Vishrav Chaudhary and Parul Chopra and Allie Del Giorno and Gustavo de Rosa and Matthew Dixon and Ronen Eldan and Dan Iter and Amit Garg and Abhishek Goswami and Suriya Gunasekar and Emman Haider and Junheng Hao and Russell J. Hewett and Jamie Huynh and Mojan Javaheripi and Xin Jin and Piero Kauffmann and Nikos Karampatziakis and Dongwoo Kim and Mahoud Khademi and Lev Kurilenko and James R. Lee and Yin Tat Lee and Yuanzhi Li and Chen Liang and Weishung Liu and Eric Lin and Zeqi Lin and Piyush Madan and Arindam Mitra and Hardik Modi and Anh Nguyen and Brandon Norick and Barun Patra and Daniel Perez-Becker and Thomas Portet and Reid Pryzant and Heyang Qin and Marko Radmilac and Corby Rosset and Sambudha Roy and Olatunji Ruwase and Olli Saarikivi and Amin Saied and Adil Salim and Michael Santacroce and Shital Shah and Ning Shang and Hiteshi Sharma and Xia Song and Masahiro Tanaka and Xin Wang and Rachel Ward and Guanhua Wang and Philipp A. Witte and Michael Wyatt and Can Xu and Jiahang Xu and Sonali Yadav and Fan Yang and Ziyi Yang and Donghan Yu and Chengruidong Zhang and Cyril Zhang and Jianwen Zhang and Li Lyna Zhang and Yi Zhang and Yue Zhang and Yunan Zhang and Xiren Zhou},
  title = {{Phi-3 Technical Report: A Highly Capable Language Model Locally on Your Phone}},
  year = {2024},
  eprint = {2404.14219},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2404.14219},
}
Figure