alt.freeweights.phi / Phi-4-mini-reasoning
From: microsoft <huggingface.co/microsoft>Newsgroups: alt.freeweights.phiSubject:

Phi-4-mini-reasoning

Date: 2026-11-14Commit: 0e3b1e2Signed: 2DC28CC7B26A283B ✓

Text generation model with 3.8B parameters. Safetensors weights, 7.69 GB in all. Published by microsoft under MIT.

3.8B params7.69GBPhi-4-mini-reasoningsafetensorspermissive
FactsParams3.8BSize7.69 GBFormatssafetensorsTasktext generationLicenseMITFrom sourcepermissive
$ fw get microsoft/Phi-4-mini-reasoning
# manifest sha256 60a1a1c2cab9… · 7.69 GB · 20 files
$ fw verify ./Phi-4-mini-reasoning microsoft/Phi-4-mini-reasoning
From sourceHosted (signed)microsoft/Phi-4-mini-reasoningLast check: 2026-11-14 21:23 UTC

Get help: custom fine-tune or private deploy. We review your setup before we quote.

Works with

Overview

Size
7.69 GB
Weights
7.67 GB (safetensors)
Parameters
3.8B
Formats
safetensors
Task
text generation
License
MIT (permissive)
Files
20, each with a sha256
Publisher
microsoft
Added
2026-11-14
Section
alt.freeweights.phi
Lineage

Original release from the publisher.

Where these bytes come from
Publisher at the pinned commit→You

Sources are tried in order. A file counts only when its size and sha256 match the manifest. Sources are checked when you ask for them, not on a timer.

Sources
BadgeHostLast checkResult
From sourcehuggingface.co2026-11-14 21:23 UTCpassed

Model card

From the publisher at commit 0e3b1e2. Shown as plain text with links; images open at the publisher.

Model Summary#

Phi-4-mini-reasoning is a lightweight open model built upon synthetic data with a focus on high-quality, reasoning dense data further finetuned for more advanced math reasoning capabilities. The model belongs to the Phi-4 model family and supports 128K token context length.

📰 Phi-4-mini-reasoning Blog, and Developer Article

📖 Phi-4-mini-reasoning Technical Report | HF paper

👩‍🍳 Phi Cookbook

🏡 Phi Portal

🖥️ Try It Azure

🎉Phi-4 models: [Phi-4-reasoning] | [multimodal-instruct | onnx]; [mini-instruct | onnx]

Intended Uses#

Primary Use Cases#

Phi-4-mini-reasoning is designed for multi-step, logic-intensive mathematical problem-solving tasks under memory/compute constrained environments and latency bound scenarios. Some of the use cases include formal proof generation, symbolic computation, advanced word problems, and a wide range of mathematical reasoning scenarios. These models excel at maintaining context across steps, applying structured logic, and delivering accurate, reliable solutions in domains that require deep analytical thinking.

Use Case Considerations#

This model is designed and tested for math reasoning only. It is not specifically designed or evaluated for all downstream purposes. Developers should consider common limitations of language models, as well as performance difference across languages, 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 but not limited to privacy, trade compliance laws, etc.) that are relevant to their 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.

Release Notes#

This release of Phi-4-mini-reasoning addresses user feedback and market demand for a compact reasoning model. It is a compact transformer-based language model optimized for mathematical reasoning, built to deliver high-quality, step-by-step problem solving in environments where computing or latency is constrained. The model is fine-tuned with synthetic math data from a more capable model (much larger, smarter, more accurate, and better at following instructions), which has resulted in enhanced reasoning performance. Phi-4-mini-reasoning balances reasoning ability with efficiency, making it potentially suitable for educational applications, embedded tutoring, and lightweight deployment on edge or mobile systems. If a critical issue is identified with Phi-4-mini-reasoning, it should be promptly reported through the MSRC Researcher Portal or secure@microsoft.com

Model Quality#

To understand the capabilities, the 3.8B parameters Phi-4-mini-reasoning model was compared with a set of models over a variety of reasoning benchmarks. A high-level overview of the model quality is as follows:

ModelAIMEMATH-500GPQA Diamond
o1-mini*63.690.060.0
DeepSeek-R1-Distill-Qwen-7B53.391.449.5
DeepSeek-R1-Distill-Llama-8B43.386.947.3
Bespoke-Stratos-7B*20.082.037.8
OpenThinker-7B*31.383.042.4
Llama-3.2-3B-Instruct6.744.425.3
Phi-4-Mini (base model, 3.8B)10.071.836.9
Phi-4-mini-reasoning (3.8B)57.594.652.0

Overall, the model with only 3.8B-param achieves a similar level of multilingual language understanding and reasoning ability as much larger models. However, it is still fundamentally limited by its size for certain tasks. The model simply does not have the capacity to store too much factual knowledge, therefore, users may experience factual incorrectness. However, it may be possible to resolve such weakness by augmenting Phi-4 with a search engine, particularly when using the model under RAG settings.

Usage#

Tokenizer#

Phi-4-mini-reasoning supports a vocabulary size of up to 200064 tokens. The tokenizer files already provide placeholder tokens that can be used for downstream fine-tuning, but they can also be extended up to the model's vocabulary size.

Input Formats#

Given the nature of the training data, the Phi-4-mini-instruct model is best suited for prompts using specific formats. Below are the two primary formats:

Chat format#

This format is used for general conversation and instructions:

<|system|>Your name is Phi, an AI math expert developed by Microsoft.<|end|><|user|>How to solve 3*x^2+4*x+5=1?<|end|><|assistant|>
Inference with transformers#

Phi-4-mini-reasoning has been integrated in the 4.51.3 version of transformers. The current transformers version can be verified with: pip list | grep transformers. Python 3.8 and 3.10 will work best. List of required packages:

flash_attn==2.7.4.post1
torch==2.5.1
transformers==4.51.3
accelerate==1.3.0

Phi-4-mini-reasoning is also available in Azure AI Studio

Example#

After obtaining the Phi-4-mini-instruct model checkpoints, users can use this sample code for inference.

import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
torch.random.manual_seed(0)

model_id = "microsoft/Phi-4-mini-reasoning"
model = AutoModelForCausalLM.from_pretrained(
    model_id,
    device_map="cuda",
    torch_dtype="auto",
    trust_remote_code=True,
)
tokenizer = AutoTokenizer.from_pretrained(model_id)

messages = [{
    "role": "user",
    "content": "How to solve 3*x^2+4*x+5=1?"
}]   
inputs = tokenizer.apply_chat_template(
    messages,
    add_generation_prompt=True,
    return_dict=True,
    return_tensors="pt",
)

outputs = model.generate(
    **inputs.to(model.device),
    max_new_tokens=32768,
    temperature=0.8,
    top_p=0.95,
    do_sample=True,
)
outputs = tokenizer.batch_decode(outputs[:, inputs["input_ids"].shape[-1]:])

print(outputs[0])

Training#

Model#
  • Architecture: Phi-4-mini-reasoning shares the same architecture as Phi-4-Mini, which has 3.8B parameters and is a dense decoder-only Transformer model. When compared with Phi-3.5-Mini, the major changes with Phi-4-Mini are 200K vocabulary, grouped-query attention, and shared input and output embedding.
  • Inputs: Text. It is best suited for prompts using the chat format.
  • Context length: 128K tokens
  • GPUs: 128 H100-80G
  • Training time: 2 days
  • Training data: 150B tokens
  • Outputs: Generated text
  • Dates: Trained in February 2024
  • Status: This is a static model trained on offline datasets with the cutoff date of February 2025 for publicly available data.
  • Supported languages: English
  • Release date: April 2025
Training Datasets#

The training data for Phi-4-mini-reasoning consists exclusively of synthetic mathematical content generated by a stronger and more advanced reasoning model, Deepseek-R1. The objective is to distill knowledge from this model. This synthetic dataset comprises over one million diverse math problems spanning multiple levels of difficulty (from middle school to Ph.D. level). For each problem in the synthetic dataset, eight distinct solutions (rollouts) were sampled, and only those verified as correct were retained, resulting in approximately 30 billion tokens of math content. The dataset integrates three primary components:

  1. a curated selection of high-quality, publicly available math questions and a part of the SFT(Supervised Fine-Tuning) data that was used to train the base Phi-4-Mini model;
  2. an extensive collection of synthetic math data generated by the Deepseek-R1 model, designed specifically for high-quality supervised fine-tuning and model distillation; and
  3. a balanced set of correct and incorrect answers used to construct preference data aimed at enhancing Phi-4-mini-reasoning's reasoning capabilities by learning more effective reasoning trajectories

Software#

Hardware#

Note that by default, the Phi-4-mini-reasoning model uses flash attention, which requires certain types of GPU hardware to run. We have tested on the following GPU types:

  • NVIDIA A100
  • NVIDIA H100

If you want to run the model on:

  • NVIDIA V100 or earlier generation GPUs: call AutoModelForCausalLM.from_pretrained() with attn_implementation="eager"

Safety Evaluation and Red-Teaming#

The Phi-4 family of models has adopted a robust safety post-training approach. This approach leverages a variety of both open-source and in-house generated datasets. The overall technique employed to do the safety alignment is a combination of SFT, DPO (Direct Preference Optimization), and RLHF (Reinforcement Learning from Human Feedback) approaches by utilizing human-labeled and synthetic English-language datasets, including publicly available datasets focusing on helpfulness and harmlessness, as well as various questions and answers targeted to multiple safety categories.

Phi-4-Mini-Reasoning was developed in accordance with Microsoft's responsible AI principles. Potential safety risks in the model’s responses were assessed using the Azure AI Foundry’s Risk and Safety Evaluation framework, focusing on harmful content, direct jailbreak, and model groundedness. The Phi-4-Mini-Reasoning Model Card contains additional information about our approach to safety and responsible AI considerations that developers should be aware of when using this model.

Responsible AI Considerations#

Like other language models, the Phi family of models can potentially behave in ways that are unfair, unreliable, or offensive. Some of the limiting behaviors to be aware of include:

  • Quality of Service: The Phi models are trained primarily on English text and some additional multilingual text. Languages other than English will experience worse performance as well as performance disparities across non-English. English language varieties with less representation in the training data might experience worse performance than standard American English.
  • Multilingual performance and safety gaps: We believe it is important to make language models more widely available across different languages, but the Phi 4 models still exhibit challenges common across multilingual releases. As with any deployment of LLMs, developers will be better positioned to test for performance or safety gaps for their linguistic and cultural context and customize the model with additional fine-tuning and appropriate safeguards.
  • Representation of Harms & Perpetuation of Stereotypes: These models can over- or under-represent groups of people, erase representation of some groups, or reinforce demeaning or negative stereotypes. Despite safety post-training, these limitations may still be present due to differing levels of representation of different groups, cultural contexts, or prevalence of examples of negative stereotypes in training data that reflect real-world patterns and societal biases.
  • Inappropriate or Offensive Content: These models may produce other types of inappropriate or offensive content, which may make it inappropriate to deploy for sensitive contexts without additional mitigations that are specific to the case.
  • Information Reliability: Language models can generate nonsensical content or fabricate content that might sound reasonable but is inaccurate or outdated.
  • Election Information Reliability : The model has an elevated defect rate when responding to election-critical queries, which may result in incorrect or unauthoritative election critical information being presented. We are working to improve the model's performance in this area. Users should verify information related to elections with the election authority in their region.
  • Limited Scope for Code: The majority of Phi 4 training data is based in Python and uses common packages such as "typing, math, random, collections, datetime, itertools". If the model generates Python scripts that utilize other packages or scripts in other languages, it is strongly recommended that users manually verify all API uses.
  • Long Conversation: Phi 4 models, like other models, can in some cases generate responses that are repetitive, unhelpful, or inconsistent in very long chat sessions in both English and non-English languages. Developers are encouraged to place appropriate mitigations, like limiting conversation turns to account for the possible conversational drift.

Developers should apply responsible AI best practices, including mapping, measuring, and mitigating risks associated with their specific use case and cultural, linguistic context. Phi 4 family of models are general purpose models. As developers plan to deploy these models for specific use cases, they are encouraged to fine-tune the models for their use case and leverage the models as part of broader AI systems with language-specific safeguards in place. Important areas for consideration include:

  • Allocation: Models may not be suitable for scenarios that could have consequential impact on legal status or the allocation of resources or life opportunities (ex: housing, employment, credit, etc.) without further assessments and additional debiasing techniques.
  • High-Risk Scenarios: Developers should assess the suitability of using models in high-risk scenarios where unfair, unreliable or offensive outputs might be extremely costly or lead to harm. This includes providing advice in sensitive or expert domains where accuracy and reliability are critical (ex: legal or health advice). Additional safeguards should be implemented at the application level according to the deployment context.
  • Misinformation: Models may produce inaccurate information. Developers should follow transparency best practices and inform end-users they are interacting with an AI system. At the application level, developers can build feedback mechanisms and pipelines to ground responses in use-case specific, contextual information, a technique known as Retrieval Augmented Generation (RAG).
  • Generation of Harmful Content: Developers should assess outputs for their context and use available safety classifiers or custom solutions appropriate for their use case.
  • Misuse: Other forms of misuse such as fraud, spam, or malware production may be possible, and developers should ensure that their applications do not violate applicable laws and regulations.

License#

The model is licensed under the MIT license.

Trademarks#

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft’s Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party’s policies.

Appendix A: Benchmark Methodology#

We include a brief word on methodology here - and in particular, how we think about optimizing prompts. In an ideal world, we would never change any prompts in our benchmarks to ensure it is always an apples-to-apples comparison when comparing different models. Indeed, this is our default approach, and is the case in the vast majority of models we have run to date. For all benchmarks, we consider using the same generation configuration such as max sequence length (32768), the same temperature for the fair comparison. Benchmark datasets We evaluate the model with three of the most popular math benchmarks where the strongest reasoning models are competing together. Specifically:

  • Math-500: This benchmark consists of 500 challenging math problems designed to test the model's ability to perform complex mathematical reasoning and problem-solving.
  • AIME 2024: The American Invitational Mathematics Examination (AIME) is a highly regarded math competition that features a series of difficult problems aimed at assessing advanced mathematical skills and logical reasoning.
  • GPQA Diamond: The Graduate-Level Google-Proof Q&A (GPQA) Diamond benchmark focuses on evaluating the model's ability to understand and solve a wide range of mathematical questions, including both straightforward calculations and more intricate problem-solving tasks.

Data Summary#

https://huggingface.co/microsoft/Phi-4-mini-reasoning/blob/main/data_summary_card.md

Files

20 files · 7.69 GBWeights 7.67 GB (safetensors). Sizes and sha256 from the signed manifest.
Hide all 20 files with their sha256
FileSizesha256
.gitattributes1.63 KB751462ceb349358a51bab5c06d723607e1b91a43954a5fd481b1dcfa17713bfa
CODE_OF_CONDUCT.md444 B9daeae709a0bd71bcfd1c96dc5822ecec5210327eff929da64b0ae7f8faf1444
LICENSE1.08 KBfa8235e5b48faca34e3ca98cf4f694ef08bd216d28b58071a1f85b1d50cb814d
NOTICE.md1.81 KBa3386cc7125ec75ed34d4f0a340c47782982095e251d322e01d8ecab22d87ba4
Phi-4-Mini-Reasoning.pdf655 KBf4a8d862e83d76d77e7a2d17ecb6edef792c0efdc61a1b4085bc44f7a748e6f5
README.md18.2 KB9bc87c9d622d4c93572a93397742df200fb769c1ab1b50ce7e950c5218dad776
SECURITY.md2.66 KB7b6976eec43edfa68b79a459dd089c56b7a395916dbf1a01bd11e6d86e12128f
SUPPORT.md1.24 KB149773411caf2c59cb1a6bfb2c6f070d1d054f1f018e7a80be319a8c384eeaf5
added_tokens.json249 Bd4f2aceb0f20b71dd1f4bcc7e052e4412946bf281840b8f83d39f259571af486
config.json2.56 KB2283ba68d420b7fddf4be894361142dfa34636c0a81e3af819cc1e660f128f6c
data_summary_card.md4.32 KB470514f8d8408e1254c9487401dc4d7d2edb4e08f0453f7bbfb5e01dbb976456
generation_config.json190 B9ec92557bbe49150eceaf0a429d5622d2eff8f56a51ea2ca9900e3794f6e2b39
merges.txt2.42 MB856ce61180bb689282eed6b3a6838bb1f438399be23aefe9d20eb379791fb4ad
model-00001-of-00002.safetensors4.90 GBa0c24f128e33afb9e406915229af56171e0a2353bc78c1ea1b5260a36b3e6707
model-00002-of-00002.safetensors2.77 GBb4bfcc826b3c637333c6bd24b0dfe38fffd45eff7f4718df454366e875a12415
model.safetensors.index.json16.3 KB613a98d5e5716ca96fa75931abedc9c5a5d95f488ce4d62df71e639fe3ac6c59
special_tokens_map.json587 Baff38493227d813e29fcf8406e8e90062f1f031aa47d589325e9c31d89ac7cc3
tokenizer.json15.5 MBf08ed885956f70d877a4d9078ec9e3119d8b68a8d579003e230be18cad66911c
tokenizer_config.json3.08 KBa8c82becd87806054deee49ad3e00322eafdd72f65b0b7dfd99a75c74f5df329
vocab.json3.91 MB6cb65a857824fa6615bb1782d95d882617a8bbce1da0317118586b36f39e98bd
VersionsEach time the pinned upstream commit or file list changed in this repo. Newest first.
Upstream commitDateContents
0e3b1e2d02 pinned now manifest updated, same commit2026-11-14 21:23 UTC20 files · 7.69 GB
0e3b1e2d022026-11-14 21:23 UTC20 files · 7.69 GB

Use it

$ fw get microsoft/Phi-4-mini-reasoning
# manifest sha256 60a1a1c2cab9… · 7.69 GB · 20 files
$ fw verify ./Phi-4-mini-reasoning microsoft/Phi-4-mini-reasoning
fw.pyChecks the signature and every sha256, tries each source in order, resumes.
$ python3 fw.py get https://freeweights.allternit.com/manifests/microsoft/Phi-4-mini-reasoning.json --dir ./Phi-4-mini-reasoning $ python3 fw.py verify ./Phi-4-mini-reasoning ./microsoft__Phi-4-mini-reasoning.json
hfThe Hugging Face CLI with one setting. Same repo id.
$ HF_ENDPOINT=https://freeweights.allternit.com hf download microsoft/Phi-4-mini-reasoning --revision 0e3b1e2d02ee478a3743abe3f629e9c0cb722e0a --local-dir ./Phi-4-mini-reasoning
transformersLoad the weights in Python.
import os os.environ["HF_ENDPOINT"] = "https://freeweights.allternit.com" from transformers import AutoModelForCausalLM, AutoTokenizer tok = AutoTokenizer.from_pretrained("microsoft/Phi-4-mini-reasoning", revision="0e3b1e2d02ee478a3743abe3f629e9c0cb722e0a") model = AutoModelForCausalLM.from_pretrained("microsoft/Phi-4-mini-reasoning", revision="0e3b1e2d02ee478a3743abe3f629e9c0cb722e0a", device_map="auto")
vLLMServe an OpenAI-compatible API.
$ HF_ENDPOINT=https://freeweights.allternit.com vllm serve microsoft/Phi-4-mini-reasoning --revision 0e3b1e2d02ee478a3743abe3f629e9c0cb722e0a

License

Name
MIT License
Id
MIT
Class
Permissive
Redistribution
yes
Listing
Hosted (signed)
Decided
License as declared by the publisher. No person read it. 2026-11-14
Text in
LICENSE
Text sha256
fa8235e5b48faca34e3ca98cf4f694ef08bd216d28b58071a1f85b1d50cb814d
Terms gate
No extra terms beyond the license.

Read the license text

Licenses are checked against the license table. A custom license passes only after a person reads it.

Provenance

From: microsoft <huggingface.co/microsoft>Newsgroups: alt.freeweights.phiSubject: Phi-4-mini-reasoningDate: 2026-11-14Commit: 0e3b1e2Signed: 2DC28CC7B26A283B ✓
Upstream
microsoft/Phi-4-mini-reasoning
Pinned commit
0e3b1e2d02ee478a3743abe3f629e9c0cb722e0a
Manifest
Phi-4-mini-reasoning.json · .minisig
Manifest sha256
60a1a1c2cab91cdf9499315dd036b1bd2e2b3c10f28892f6c064be229d08fa8e
Signature
minisign, Ed25519, key 2DC28CC7B26A283B
Created
2026-11-14 21:23 UTC
Generator
freeweights-manifest/0.1.0
Takedowns
None.

How to verify

$ curl -O https://freeweights.allternit.com/manifests/microsoft/Phi-4-mini-reasoning.json $ curl -O https://freeweights.allternit.com/manifests/microsoft/Phi-4-mini-reasoning.json.minisig $ minisign -Vm Phi-4-mini-reasoning.json -P RWQ7KGqyx4zCLXtUFOqvfv8L3g+8fpKJ1FsuxPyOYMF+4KufbUxKq1Oq $ shasum -a 256 <file> # compare with the Files tab

A manifest whose signature fails must be rejected. A file whose size or sha256 does not match must be discarded. Verify a download

Model tree

6 models in the catalog name this one as their parent.

Quantizations
6
Get it
Download
$ HF_ENDPOINT=https://freeweights.allternit.com hf download microsoft/Phi-4-mini-reasoning
Open in Freeweights Studio

Pull, verify and run it in the Allternit app on Desktop, web or phone.

Signed manifest
minisign, key 2DC28CC7B26A283B. Phi-4-mini-reasoning.json. Provenance. Takedown history: none.

Variants

6 quantized or adapter builds of Phi-4-mini-reasoning. Each has its own license check and page.

From: BAAI <huggingface.co/BAAI>Subject: bunny-phi-2-siglip-lora
From: microsoft <huggingface.co/microsoft>Subject: MediPhi
From: microsoft <huggingface.co/microsoft>Subject: MediPhi-Clinical
From: microsoft <huggingface.co/microsoft>Subject: MediPhi-Guidelines
From: microsoft <huggingface.co/microsoft>Subject: MediPhi-Instruct
From: microsoft <huggingface.co/microsoft>Subject: MediPhi-MedCode