ApX logoApX logo

Phi-4-Mini

Parameters

3.8B

Context Length

128K

Modality

Text

Architecture

Dense

License

MIT

Release Date

27 Feb 2025

Knowledge Cutoff

Jun 2024

System Requirements

VRAM requirements for different quantization methods and context sizes

1,024 tokens

9.62 GB VRAM

Consumer

1x RTX 4090

24GB VRAM

Datacenter

1x NVIDIA A100

80GB VRAM

Apple Silicon

1x Apple M3 Max

128GB VRAM

128,000 tokens

27.10 GB VRAM

Consumer

2x RTX 4090

24GB VRAM

Datacenter

1x NVIDIA A100

80GB VRAM

Apple Silicon

1x Apple M3 Max

128GB VRAM

Architecture Diagram

Input TokensToken EmbeddingPosition: RoPEHidden: 3.1k · Context: 128K · Vocab: 200.1kx 32 layersRMSNormPre-AttentionGrouped-Query Attention24Q / 8KV heads · SW: 262.1kHead dim: 128+RMSNormPre-FFNFeed-Forward NetworkSwishIntermediate: 8.2k+Final RMSNormOutput Logits

Evaluation Benchmarks

Rank

#137

BenchmarkScoreRank

General Knowledge

MMLU

0.673

32

Rankings

Overall Rank

#137

Coding Rank

-

About Phi-4-Mini

Microsoft Phi-4-Mini is a lightweight, open model from the Phi-4 family, engineered to operate efficiently in resource-constrained environments. This model is constructed from a combination of high-quality synthetic data and filtered public web content, with a particular emphasis on data dense in reasoning. Its core architecture is a dense, decoder-only Transformer, optimized with techniques such as grouped-query attention (GQA) and LongRoPE positional encoding to enhance inference speed and manage extended context lengths. The model incorporates an expanded vocabulary of 200,064 tokens, facilitating broad multilingual support.

Key advancements in Phi-4-Mini include an enhancement process that integrates supervised fine-tuning (SFT) and direct preference optimization (DPO), along with Reinforcement Learning from Human Feedback (RLHF) for robust instruction adherence and safety measures. This training methodology enables the model to exhibit strong reasoning capabilities, particularly in mathematical and logical tasks, and supports advanced functions such as function calling. The design prioritizes computational efficiency and low-latency performance, making it suitable for deployment in scenarios where memory and processing power are limited.

The intended use cases for Phi-4-Mini span general-purpose AI systems and applications that require strong reasoning in memory or compute-constrained environments, or those with latency-bound requirements. It is designed to accelerate research in language models and serve as a foundational building block for generative AI features. The model's compact size and optimized architecture allow for deployment on edge devices, including various mobile operating systems, by leveraging tools such as Microsoft Olive and the ONNX GenAI Runtime.

Technical Specifications

Attention

Attention Structure

Grouped-Query Attention

Attention Heads

24

Key-Value Heads

8

Attention Head Dimension

-

Position Embedding

ROPE

RoPE Theta

10,000

Sliding Window Attention

Yes

Sliding Window Size

262,144

Sliding Window Ratio

-

Linear Attention

-

Linear Attention Ratio

-

Normalization

RMS Normalization

Activation Function

Swish

Dimensions

Hidden Dimension Size

3,072

Number of Layers

32

FFN Intermediate Size (Dense)

8,192

Multi-Token Prediction Heads

-

Tokenizer

Vocabulary Size

200,064

About Phi-4

The Microsoft Phi-4 model family comprises small language models prioritizing efficient, high-capability reasoning. Its development emphasizes robust data quality and sophisticated synthetic data integration. This approach enables enhanced performance and on-device deployment capabilities.


Other Phi-4 Models