[论文解读] Phi-3 Technical Report: A Highly Capable Language Model Locally on Your Phone
Phi-3-mini 是一个3.8B参数的软件,训练于3.3T令牌,可以在手机上运行,并达到或接近比 Mixtral 8x7B 与 GPT-3.5 等更大模型的水平,且其后续变体(7B 与 14B)显示出更强的性能;性能来自一个以数据为中心的训练方案,结合筛选后的网页数据与合成数据,以及对安全与对话的对齐。
We introduce phi-3-mini, a 3.8 billion parameter language model trained on 3.3 trillion tokens, whose overall performance, as measured by both academic benchmarks and internal testing, rivals that of models such as Mixtral 8x7B and GPT-3.5 (e.g., phi-3-mini achieves 69% on MMLU and 8.38 on MT-bench), despite being small enough to be deployed on a phone. Our training dataset is a scaled-up version of the one used for phi-2, composed of heavily filtered publicly available web data and synthetic data. The model is also further aligned for robustness, safety, and chat format. We also provide parameter-scaling results with a 7B, 14B models trained for 4.8T tokens, called phi-3-small, phi-3-medium, both significantly more capable than phi-3-mini (e.g., respectively 75%, 78% on MMLU, and 8.7, 8.9 on MT-bench). To enhance multilingual, multimodal, and long-context capabilities, we introduce three models in the phi-3.5 series: phi-3.5-mini, phi-3.5-MoE, and phi-3.5-Vision. The phi-3.5-MoE, a 16 x 3.8B MoE model with 6.6 billion active parameters, achieves superior performance in language reasoning, math, and code tasks compared to other open-source models of similar scale, such as Llama 3.1 and the Mixtral series, and on par with Gemini-1.5-Flash and GPT-4o-mini. Meanwhile, phi-3.5-Vision, a 4.2 billion parameter model derived from phi-3.5-mini, excels in reasoning tasks and is adept at handling both single-image and text prompts, as well as multi-image and text prompts.
研究动机与目标
- 通过数据质量和定向后训练而非单纯扩展模型规模,证明小型语言模型也能实现高性能。
- 展示 Phi-3-mini 能在设备上运行(4K 上下文;128K 长上下文变体)并量化至 4 位以适配约 1.8GB。本地部署。
- 介绍 Phi-3-small 与 Phi-3-medium 作为更高容量的变体,并将它们的性能与更大基线进行对比。
- 描述数据集设计、两阶段预训练、后训练(SFT 与 DPO)及安全对齐流程。
提出的方法
- 使用隐藏维度为 3072、32 个注意力头、32 层的 Transformer 解码器;4K 上下文(通过 LongRope 的 128K 变体实现)。
- 在 3.3T 令牌上对 heavily filtered web 数据和合成数据进行训练,分两阶段(阶段1 常识性知识,阶段2 推理/小众技能)。
- 通过有监督微调(SFT)和直接偏好优化(DPO)进行后训练以实现安全、鲁棒性和对话风格的对齐。
- 将 Phi-3-mini 量化为 4 位,以实现约 1.8GB 的设备端部署;在标准基准上以 5-shot 或更少提示、固定评测流程进行评估。

实验结果
研究问题
- RQ1小型语言模型(参数<4B)在经数据最优方案和后训练对齐后,是否能达到更大模型的性能?
- RQ2在设备端 LLM 部署中,模型规模、数据质量与上下文长度之间存在哪些权衡?
- RQ3数据筛选加上 SFT 与 DPO 如何影响小型 LLM 的安全性、鲁棒性和指令执行能力?
- RQ4长上下文扩展(128K)对答案质量相对于标准 4K 上下文的影响如何?
主要发现
- phi-3-mini(3.8B)在 MMLU 获得 69%、在 MT-bench 获得 8.38,媲美 Mixtral 8x7B 与 GPT-3.5。
- phi-3-small(7B,预览)在 MMLU 获得 75%、在 MT-bench 获得 8.7。
- phi-3-medium(14B,预览)在 MMLU 获得 78%、在 MT-bench 获得 8.9。
- Long-context 版本的 phi-3-mini-128K 在保持与 4K 相似的质量的同时,能处理长上下文任务。
- 4 位量化的 phi-3-mini 能在 iPhone 14 的 A16 Bionic 上以 12+ 个 token/秒的速率运行。
- SFT 与 DPO 后训练降低有害响应并提升安全性、鲁棒性与推理能力。
- 使用数据最优方案来校准小模型的训练数据,表明数据质量可在一定程度上替代模型规模带来的性能提升。

更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。