Skip to main content

Model guide

Phi-3 Mini 3.8B Instruct

Phi-3 Mini 4K Instruct is a compact text model for short instructions, extraction and bounded reasoning tasks. The 4K suffix matters: this is not the separate long-context Phi-3 download. Keep both your input and the generated answer inside that window when deciding whether it suits an older Phi-based application.

3.8BText chat4,096 token contextView the model card →

At a glance

Parameters
3.8B
Accepts
Text
Returns
Text
Published context limit
4,096 tokens
Model format
safetensors · GGUF · ONNX
Software and download hosts
Ollama · Transformers. Follow the exact setup below; this list does not establish support for every format, input type or software version.
Suggested compression
Q4
Model-weight download
Q4 weights · 2.39 GBmicrosoft (model publisher)Phi-3-mini-4k-instruct-q4.gguf
Languages
English
License
MIT

Will it fit?

Phi-3 Mini 3.8B Instruct · Q4 download. Fit depends on your computer, the app you run it in and the conversation length you need.

Check on your computer

Best for

  • Run a short packing arithmetic problem within a 4,096-token window. Leave room for the reply as well as the prompt.

Choose something else when

  • Choose another Phi-3 variant or divide the material if the prompt alone approaches 4,096 tokens.

First setup

Check a representative task

Check a bounded arithmetic instruction within the short context.

A box holds 6 folders. You have 23 folders. What is the minimum number of boxes, and how many empty folder spaces remain? Give the two numbers and one sentence explaining them.

Check the result: You need 4 boxes, leaving 1 empty space. Three boxes hold only 18 folders.

This creates a 4,096-token copy of phi3:mini named phi-3-mini-4k-instruct-short-context. Save the following as a file named Modelfile in your working folder:

FROM phi3:mini
PARAMETER num_ctx 4096

Then run these commands from that folder:

ollama pull phi3:mini
ollama create phi-3-mini-4k-instruct-short-context -f ./Modelfile
ollama run phi-3-mini-4k-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_0: 2.18 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.

Other models for this task