# Phi 4

Phi 4 is a family of large language models developed by Microsoft Research, known for compact sizes and strong reasoning performance on public benchmarks. The models appear in multiple variants across AI leaderboards.

Phi 4 is a family of [large language models](https://www.wikiprompt.org/wiki/large-language-model) developed by Microsoft Research. The series is characterized by relatively compact model sizes compared to frontier systems, while aiming for competitive performance on reasoning, mathematics, and coding tasks. Multiple variants of Phi 4 have appeared on public LLM and media leaderboards, with at least four distinct configurations recorded in benchmark snapshots.

The first publicly documented Phi 4 model was released in late 2024, building on the earlier Phi-3 series. Microsoft positioned Phi 4 as a research-oriented model emphasizing data quality and synthetic data generation rather than sheer scale. The flagship variant, Phi-4 (14B), demonstrated strong results on standard reasoning benchmarks such as MATH and GSM8K, often outperforming larger models from other organizations.

## Model Variants and Benchmarks

Public leaderboards, including those hosted by [AI](https://www.wikiprompt.org/wiki/artificial-intelligence) evaluation platforms, list at least four Phi 4 variants. These include the base 14B model, a 14B instruction-tuned version, and smaller configurations (e.g., 7B and 3.8B) that trade some accuracy for lower computational requirements. In benchmark snapshots, the 14B instruction-tuned model consistently ranks among the top compact models, achieving scores comparable to models with 70B or more parameters on tasks like code generation (HumanEval) and logical deduction (ARC).

The models are trained using a [Transformer](https://www.wikiprompt.org/wiki/transformer) architecture with [multi-head attention](https://www.wikiprompt.org/wiki/multi-head-attention) and [positional encodings](https://www.wikiprompt.org/wiki/positional-encoding). Training employed a mix of curated web data, filtered code repositories, and synthetic datasets generated by larger teacher models. Microsoft has not disclosed full training details, but the approach aligns with [curriculum learning](https://www.wikiprompt.org/wiki/curriculum-learning) principles, gradually increasing task complexity.

## Technical Specifications

Phi 4 models use a dense, non-moe (mixture-of-experts) design, which simplifies deployment on standard hardware. The 14B variant has 14 billion parameters, a context window of 8,192 tokens, and supports [top-k](https://www.wikiprompt.org/wiki/top-k-sampling) and [top-p](https://www.wikiprompt.org/wiki/top-p-sampling) sampling for generation. The models are released under a permissive license (MIT for research and commercial use, with some restrictions on the 14B version).

Inference is optimized for both [Azure](https://www.wikiprompt.org/wiki/azure) cloud and local deployment. The models are compatible with popular frameworks like Hugging Face Transformers and vLLM. Microsoft reported that Phi 4 achieves a 2x speedup over Phi-3 on [AWS](https://www.wikiprompt.org/wiki/amazon-web-services) [Trainium](https://www.wikiprompt.org/wiki/aws-trainium) instances due to improved kernel fusion.

## Performance and Limitations

On public leaderboards, Phi 4 variants show strong performance in math and logic, but they lag behind frontier models from [OpenAI](https://www.wikiprompt.org/wiki/openai) and [Google DeepMind](https://www.wikiprompt.org/wiki/google-deepmind) on open-ended creative writing and nuanced instruction following. The models exhibit occasional hallucinations on factual queries, a common issue across the field. Microsoft has published [RLHF](https://www.wikiprompt.org/wiki/rlaif) (reinforcement learning from human feedback) data to improve alignment, but the models remain prone to generating plausible but incorrect answers on niche topics.

The 3.8B variant is notable for running on edge devices, including smartphones and embedded systems, though it requires quantization to fit within memory constraints. This makes Phi 4 a candidate for on-device [generative AI](https://www.wikiprompt.org/wiki/generative-ai) applications, similar to efforts by [Apple](https://www.wikiprompt.org/wiki/apple) and [Samsung Electronics](https://www.wikiprompt.org/wiki/samsung-electronics).

## Ecosystem and Adoption

Phi 4 has been integrated into [Microsoft](https://www.wikiprompt.org/wiki/microsoft)'s [Azure AI](https://www.wikiprompt.org/wiki/azure) Foundry and is available via API. Third-party platforms such as [Groq](https://www.wikiprompt.org/wiki/groq) and [SambaNova](https://www.wikiprompt.org/wiki/samba-nova) offer accelerated inference for the 14B model. The open weights have spurred community fine-tunes for specialized domains, including medical and legal reasoning, though these are not officially endorsed.

Researchers at [Stanford AI Lab](https://www.wikiprompt.org/wiki/stanford-ai-lab) and [Berkeley AI Research](https://www.wikiprompt.org/wiki/berkeley-ai-research) have cited Phi 4 in studies on data efficiency, noting that its performance suggests the importance of training data curation over raw parameter count. The model has also been used in [model pruning](https://www.wikiprompt.org/wiki/model-pruning) experiments, showing that up to 30% of weights can be removed with minimal accuracy loss.

## Future Directions

Microsoft has not announced a Phi 5, but the company continues to publish research on synthetic data generation and [loss functions](https://www.wikiprompt.org/wiki/loss-functions) that could inform future iterations. As of early 2025, Phi 4 remains a reference point for compact, high-performing models, and its variants are frequently used as baselines in academic papers on efficient [deep learning](https://www.wikiprompt.org/wiki/deep-learning).

The model family is part of a broader trend toward smaller, specialized models that can run on consumer hardware, challenging the assumption that scale is the only path to capability. Whether this approach will scale further remains an open question, but Phi 4 has demonstrated that carefully curated data can partially compensate for fewer parameters.

## See Also

- [Neural network](https://www.wikiprompt.org/wiki/neural-network)
- [Machine learning](https://www.wikiprompt.org/wiki/machine-learning)
- [Open panel](https://www.wikiprompt.org/wiki/open-panel)
- [Halcyon](https://www.wikiprompt.org/wiki/halcyon)

---
Source: https://www.wikiprompt.org/wiki/phi-4
License: CC BY-SA 4.0 (https://creativecommons.org/licenses/by-sa/4.0/)
Last updated: 2026-09-13T18:57:28.454511+00:00
