Microsoft/Dense
Phi-4-reasoning 14B
chatreasoningcodingThinkingDistilled
14B
Parameters
32K
Context length
8
Benchmarks
4
Quantizations
Architecture
Dense
Released
2025-04-01
Layers
40
KV Heads
10
Head Dim
128
Family
phi
Model Card
View on HuggingFacePhi-4-reasoning Model Card
Phi-4-reasoning Technical Report
Model Summary
| Developers | Microsoft Research |
| Description | Phi-4-reasoning is a state-of-the-art open-weight reasoning model finetuned from Phi-4 using supervised fine-tuning on a dataset of chain-of-thought traces and reinforcement learning. The supervised fine-tuning dataset includes a blend of synthetic prompts and high-quality filtered data from public domain websites, focused on math, science, and coding skills as well as alignment data for safety and Responsible AI. The goal of this approach was to ensure that small capable models were trained with data focused on high quality and advanced reasoning. |
| Architecture | Base model same as previously released Phi-4, 14B parameters, dense decoder-only Transformer model |
| Inputs | Text, best suited for prompts in the chat format |
| Context length | 32k tokens |
| GPUs | 32 H100-80G |
| Training time | 2.5 days |
| Training data | 16B tokens, ~8.3B unique tokens |
| Outputs | Generated text in response to the input. Model responses have two sections, namely, a reasoning chain-of-thought block followed by a summarization block |
| Dates | January 2025 – April 2025 |
| Status | Static model trained on an offline dataset with cutoff dates of March 2025 and earlier for publicly available data |
| Release date | April 30, 2025 |
| License | MIT |
Intended Use
| Primary Use Cases | Our model is designed to accelerate research on language models, for use as a building block for generative AI powered features. It provides uses for general purpose AI systems and applications (primarily in English) which require: |
- Memory/compute constrained environments.
- Latency bound scenarios.
- Reasoning and logic. | | Out-of-Scope Use Cases | This model is designed and tested for math reasoning only. 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, including the model’s focus on English. Review the Responsible AI Considerations section below for further guidance when choosing a 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. |
Usage
[!IMPORTANT]
To fully take advantage of the model's capabilities, inference must usetemperature=0.8,top_k=50,top_p=0.95, anddo_sample=True. For more complex queries, setmax_new_tokens=32768to allow for longer chain-of-thought (CoT).
Input Formats
Given the nature of the training data, always use ChatML template with the following system prompt for inference:
<|im_start|>system<|im_sep|>
You are Phi, a language model trained by Microsoft to help users. Your role as an assistant involves thoroughly exploring questions through a systematic thinking process before providing the final precise and accurate solutions. This requires engaging in a comprehensive cycle of analysis, summarizing, exploration, reassessment, reflection, backtracing, and iteration to develop well-considered thinking process. Please structure your response into two main sections: Thought and Solution using the specified format: <think> {Thought section} </think> {Solution section}. In the Thought section, detail your reasoning process in steps. Each step should include detailed considerations such as analysing questions, summarizing relevant findings, brainstorming new ideas, verifying the accuracy of the current steps, refining any errors, and revisiting previous steps. In the Solution section, based on various attempts, explorations, and reflections from the Thought section, systematically present the final solution that you deem correct. The Solution section should be logical, accurate, and concise and detail necessary steps needed to reach the conclusion. Now, try to solve the following question through the above guidelines:<|im_end|>
<|im_start|>user<|im_sep|>
What is the derivative of x^2?<|im_end|>
<|im_start|>assistant<|im_sep|>
With transformers
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("microsoft/Phi-4-reasoning")
model = AutoModelForCausalLM.from_pretrained("microsoft/Phi-4-reasoning", device_map="auto", torch_dtype="auto")
messages = [
{"role": "system", "content": "You are Phi, a language model trained by Microsoft to help users. Your role as an assistant involves thoroughly exploring questions through a systematic thinking process before providing the final precise and accurate solutions. This requires engaging in a comprehensive cycle of analysis, summarizing, exploration, reassessment, reflection, backtracing, and iteration to develop well-considered thinking process. Please structure your response into two main sections: Thought and Solution using the specified format: <think> {Thought section} </think> {Solution section}. In the Thought section, detail your reasoning process in steps. Each step should include detailed considerations such as analysing questions, summarizing relevant findings, brainstorming new ideas, verifying the accuracy of the current steps, refining any errors, and revisiting previous steps. In the Solution section, based on various attempts, explorations, and reflections from the Thought section, systematically present the final solution that you deem correct. The Solution section should be logical, accurate, and concise and detail necessary steps needed to reach the conclusion. Now, try to solve the following question through the above guidelines:"},
{"role": "user", "content": "What is the derivative of x^2?"},
]
inputs = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt")
...
Quantizations & VRAM
Q4_K_M4.5 bpw
8.4 GB
VRAM required
94%
Quality
Q6_K6.5 bpw
11.9 GB
VRAM required
97%
Quality
Q8_08 bpw
14.5 GB
VRAM required
100%
Quality
FP1616 bpw
28.5 GB
VRAM required
100%
Quality
Benchmarks (8)
Arena Elo1465
IFEval64.2
BBH49.4
MMLU-PRO40.8
BigCodeBench37.6
MATH19.6
MUSR13.1
GPQA11.5
Run with Ollama
$
ollama run phi4:14bGPUs that can run this model
At Q4_K_M quantization. Sorted by minimum VRAM.
NVIDIA RTX 3080 10GB
10 GB VRAM • 760 GB/s
NVIDIA
$429
Intel Arc B570
10 GB VRAM • 456 GB/s
INTEL
$219
NVIDIA GeForce RTX 3080
10 GB VRAM • 760 GB/s
NVIDIA
$699
AMD Radeon RX 6700
10 GB VRAM • 320 GB/s
AMD
AMD Radeon RX 6700M
10 GB VRAM • 320 GB/s
AMD
AMD Radeon RX 6750 GRE 10 GB
10 GB VRAM • 320 GB/s
AMD
NVIDIA P102-101
10 GB VRAM • 320 GB/s
NVIDIA
AMD Xbox Series X GPU
10 GB VRAM • 560 GB/s
AMD
NVIDIA CMP 170HX 10 GB
10 GB VRAM • 1560 GB/s
NVIDIA
NVIDIA CMP 50HX
10 GB VRAM • 560 GB/s
NVIDIA
NVIDIA CMP 90HX
10 GB VRAM • 760 GB/s
NVIDIA
AMD Xbox Series X 6nm GPU
10 GB VRAM • 560 GB/s
AMD
NVIDIA RTX 2080 Ti
11 GB VRAM • 616 GB/s
NVIDIA
$350
NVIDIA GTX 1080 Ti
11 GB VRAM • 484 GB/s
NVIDIA
$200
NVIDIA GeForce GTX 1080 Ti
11 GB VRAM • 484 GB/s
NVIDIA
NVIDIA GeForce RTX 2080 Ti
11 GB VRAM • 616 GB/s
NVIDIA
$225
NVIDIA RTX 5070
12 GB VRAM • 672 GB/s
NVIDIA
$549
NVIDIA RTX 4070 Ti
12 GB VRAM • 504 GB/s
NVIDIA
$799
NVIDIA RTX 4070 SUPER
12 GB VRAM • 504 GB/s
NVIDIA
$599
NVIDIA RTX 4070
12 GB VRAM • 504 GB/s
NVIDIA
$549
NVIDIA RTX 3080 Ti
12 GB VRAM • 912 GB/s
NVIDIA
$550
NVIDIA RTX 3080 12GB
12 GB VRAM • 912 GB/s
NVIDIA
$599
NVIDIA RTX 3060 12GB
12 GB VRAM • 360 GB/s
NVIDIA
$329
AMD RX 7700 XT
12 GB VRAM • 432 GB/s
AMD
$449
AMD RX 6700 XT
12 GB VRAM • 384 GB/s
AMD
$344
AMD RX 6750 XT
12 GB VRAM • 432 GB/s
AMD
$299
Intel Arc B580
12 GB VRAM • 456 GB/s
INTEL
$249
NVIDIA Tesla K40c
12 GB VRAM • 288 GB/s
NVIDIA
NVIDIA Tesla K40d
12 GB VRAM • 288 GB/s
NVIDIA
NVIDIA Tesla K40m
12 GB VRAM • 288 GB/s
NVIDIA
Find the best GPU for Phi-4-reasoning 14B
Build Hardware for Phi-4-reasoning 14B