Phi-4
Microsoft's 14B-parameter open model for English math and reasoning, built for memory- or compute-limited setups and trained with synthetic textbook-style data. MIT licensed.
Overview
Phi-4 is a 14B-parameter dense decoder-only Transformer from Microsoft Research, released on December 12, 2024. Its open weights are MIT licensed. Its 9.8T training tokens extend the Phi-3 data with synthetic "textbook-like" text written to teach math and coding, plus acquired academic books and Q&A sets. Public data in the mix stops at June 2024.
The card aims it at English-language systems that need reasoning and logic on limited memory or compute. Microsoft reports 84.8 on MMLU and 82.6 on HumanEval, measured with OpenAI's simple-evals.
Choosing a variant: Phi-4 is the newer and larger of the two Phi models on Wiro, and the better fit for English math or code. For other languages use Phi-3.5 Mini Instruct, a 3.8B model with 23 listed languages; Phi-4's card says it is not intended for multilingual use.
What you can build
- Math tutors that work through a solution line by line. MATH shows the biggest gain over the earlier 14B Phi-3 in Microsoft's table, 80.4 against 44.6.
- Science study aids. Microsoft reports 56.1 on GPQA's graduate-level questions, against 31.2 for Phi-3.
- Python helpers for scripts that stick to common packages such as collections and itertools.
Inputs
Only the prompt is required; a system prompt can set the persona or answer format. Give a user_id and session_id to have earlier turns stored and replayed, or leave both blank so each request starts fresh.
Sampling is on by default at temperature 0.7 (range 0 to 5), top_p 0.95 and seed 123456. You can also set top_k, the repetition and length penalties, min_tokens and semicolon-separated stop_sequences. Quantization, also on by default, loads reduced-precision weights to save memory.
Outputs
Plain text. The sample answers the default Tower of London question with six numbered events, including Anne Boleyn's 1536 execution and the Princes in the Tower, each with a story idea.
Recommended settings
- Turn do_sample off for math and code, so each step takes the most likely token.
- Change the seed (default 123456) to get a different sampled answer.
- In long prompts, put the question first, since an over-long message is cut from the end.
- At the default max_tokens of 0, a prompt of up to 2,048 tokens gets up to 2,048 tokens of reply. Set it higher for long reports.
Limitations
- The checkpoint's 16K-token context has to hold the system prompt, stored history, new message and reply. Over the input limit, the oldest history goes first, then the end of the latest message.
- Languages other than English perform worse. Multilingual text is about 8% of the training data.
- Factual recall is weak: Microsoft reports 3.0 on SimpleQA, below Phi-3's 7.6. Pass source text in the prompt for factual answers.
- Most of its code training data is Python, so check calls to less common packages.
Safety & compliance
Phi-4 is MIT licensed. Microsoft says it was not designed or evaluated for every downstream purpose and asks developers to check accuracy and safety in their own setting. The card asks for further assessment before use in decisions on housing, employment or loans, and for safeguards around legal or health advice. End users should be told they are talking to an AI system.
API quick start
Run phi-4 with a single API call.
{
"prompt": "What are some interesting historical even…",
"user_id": "...",
"session_id": "...",
"system_prompt": "You are a helpful, respectful and honest …"
}curl -X POST "https://api.wiro.ai/v1/Run/microsoft/phi-4" \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_WIRO_API_KEY" \
--data-binary @- <<'JSON'
{
"prompt": "What are some interesting historical even…",
"user_id": "...",
"session_id": "...",
"system_prompt": "You are a helpful, respectful and honest …"
}
JSONOther models you might like
Explore similar llm & chat models.



