Model guide
Phi-4 Mini Instruct
Phi-4 Mini Instruct is a compact multilingual text assistant for instruction-following tasks under a smaller memory budget. It is not the separate Mini Reasoning checkpoint or a multimodal Phi model. Try structured extraction or a short code explanation, then check whether the answer obeys all of your constraints.
At a glance
- Parameters
- 3.8B
- Accepts
- Text
- Returns
- Text
- Published context limit
- 131,072 tokens
- Model format
- safetensors · GGUF
- Software and download hosts
- Ollama · MLX. Follow the exact setup below; this list does not establish support for every format, input type or software version.
- Suggested compression
- Q4_K_M
- Model-weight download
- Q4_K_M weights · 2.49 GBbartowski (community conversion)microsoft_Phi-4-mini-instruct-Q4_K_M.gguf
- Languages
- Arabic · Chinese · Czech · Danish · Dutch · English · Finnish · French · German · Hebrew · Hungarian · Italian · Japanese · Korean · Norwegian · Polish · Portuguese · Russian · Spanish · Swedish · Thai · Turkish · Ukrainian
- License
- MIT
Will it fit?
Phi-4 Mini Instruct · Q4_K_M download. Fit depends on your computer, the app you run it in and the conversation length you need.
Check on your computerBest for
- Extract known fields from a short multilingual note. If your app needs function calls, separately inspect the function name and arguments it receives.
Choose something else when
- A correctly formatted text reply cannot verify that a connected tool ran.
First setup
Check a representative task
Check compact instruction following with a record whose missing field is deliberate.
Use only this note. Return a JSON object with exactly these keys: item, quantity, due_date, tracking_number. Use a string for item, an integer for quantity, an ISO YYYY-MM-DD string for due_date, and null for a missing tracking_number. Do not add Markdown or commentary.
Note: Order R-17 contains three replacement keyboards. Delivery is due on 12 November 2026. No tracking number has been issued.
Check the result: Parse the result as JSON. It should contain exactly the four requested keys, with item="replacement keyboards" (equivalent wording is acceptable), quantity=3 as a number, due_date="2026-11-12", and tracking_number=null. Reject extra prose, a quoted quantity or a fabricated tracking number.
Correct JSON in this exercise does not establish API-level structured-output enforcement or native tool calling.
This creates a 4,096-token copy of phi4-mini named phi-4-mini-instruct-short-context. Save the following as a file named Modelfile in your working folder:
FROM phi4-mini
PARAMETER num_ctx 4096
Then run these commands from that folder:
ollama pull phi4-mini
ollama create phi-4-mini-instruct-short-context -f ./Modelfile
ollama run phi-4-mini-instruct-short-context
Run the task check. While the model is loaded, run ollama ps in another terminal and check CONTEXT and PROCESSOR.
The recorded Ollama package is Q4_K_M: 2.49 GB of model weights. Use Ollama 0.40.18 or a supporting newer release. A Hugging Face GGUF or MLX checkpoint is a separate representation; choose the matching source and runner in the memory calculator.
See Ollama context settings and the Modelfile instructions.
Open LM Studio’s Discover tab, search for bartowski/microsoft_Phi-4-mini-instruct-GGUF, and download microsoft_Phi-4-mini-instruct-Q4_K_M.gguf (Q4_K_M, 2.49 GB). See the download files. Select the file in Chat, set context to 4,096, then load it. Run the task check. If it will not load, open LM Studio Model Will Not Load.
Open a terminal in the extracted llama.cpp release folder. On Windows, replace ./llama-server below with .\llama-server.exe:
./llama-server -hf bartowski/microsoft_Phi-4-mini-instruct-GGUF -hff microsoft_Phi-4-mini-instruct-Q4_K_M.gguf -c 4096 --host 127.0.0.1 --port 8080
The server downloads the selected model. Wait for the model to load, then open the local chat at http://127.0.0.1:8080. Run the task check and inspect the result against its acceptance criteria. Keep the server terminal open; press Ctrl+C there to stop the server. The file list identifies the exact download. If the command fails: Unknown architecture? Update the runner. Allocation failed? Retry with less context or a smaller weight file.
Load the model, start a fresh chat and time your usual prompt. Record time until the first useful word and time until the full answer. Note the processor, context and output length when comparing another run.
