Model Summary
608
8 commits
6 linked in READMEs
updated Dec 10, 2025
This repo provides the GGUF format for the Phi-3-Mini-4K-Instruct. The Phi-3-Mini-4K-Instruct is a 3.8B parameters, lightweight, state-of-the-art open model trained with the Phi-3 datasets that includes both synthetic data and the filtered publicly available websites data with a focus on high-quality and reasoning dense properties. The model belongs to the Phi-3 family with the Mini version in two variants 4K and 128K which is the context length (in tokens) it can support. The model has underwent a post-training process that incorporates both supervised fine-tuning and direct preference optimization to ensure precise instruction adherence and robust safety measures. When assessed against benchmarks testing common sense, language understanding, math, code, long context and logical reasoning, Phi-3 Mini-4K-Instruct showcased a robust and state-of-the-art performance among models with less than 13 billion parameters.
Resources and Technical Documentation:
This repo provides GGUF files for the Phi-3 Mini-4K-Instruct model.
| Name | Quant method | Bits | Size | Use case |
|---|---|---|---|---|
| Phi-3-mini-4k-instruct-q4.gguf | Q4_K_M | 4 | 2.2 GB | medium, balanced quality - recommended |
| Phi-3-mini-4k-instruct-fp16.gguf | None | 16 | 7.2 GB | minimal quality loss |
Primary use cases
The model is intended for commercial and research use in English. The model provides uses for applications which require
Our model is designed to accelerate research on language and multimodal models, for use as a building block for generative AI powered features.
Use case considerations
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 fariness 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. Nothing contained in this Model Card should be interpreted as or deemed a restriction or modification to the license the model is released under.
Given the nature of the training data, the Phi-3-Mini-4K-instruct model is best suited for prompts using the chat format as follows. You can provide the prompt as a question with a generic template as follow:
<|user|>\nQuestion <|end|>\n<|assistant|>
For example:
<|user|>
How to explain Internet for a medieval knight?<|end|>
<|assistant|>
where the model generates the text after "<|assistant|>" . In case of few-shots prompt, the prompt can be formatted as the following:
<|user|>
I am going to Paris, what should I see?<|end|>
<|assistant|>
Paris, the capital of France, is known for its stunning architecture, art museums, historical landmarks, and romantic atmosphere. Here are some of the top attractions to see in Paris:\n\n1. The Eiffel Tower: The iconic Eiffel Tower is one of the most recognizable landmarks in the world and offers breathtaking views of the city.\n2. The Louvre Museum: The Louvre is one of the world's largest and most famous museums, housing an impressive collection of art and artifacts, including the Mona Lisa.\n3. Notre-Dame Cathedral: This beautiful cathedral is one of the most famous landmarks in Paris and is known for its Gothic architecture and stunning stained glass windows.\n\nThese are just a few of the many attractions that Paris has to offer. With so much to see and do, it's no wonder that Paris is one of the most popular tourist destinations in the world."<|end|>
<|user|>
What is so great about #1?<|end|>
<|assistant|>
pip install huggingface-hub>=0.17.1
huggingface-cli login
huggingface-cli download microsoft/Phi-3-mini-4k-instruct-gguf Phi-3-mini-4k-instruct-q4.gguf --local-dir . --local-dir-use-symlinks False
curl -fsSL https://ollama.com/install.sh | sh
ollama run phi3
ModelfileAssuming that you have already downloaded GGUF files, here is how you can use them with Ollama:
huggingface-cli download microsoft/Phi-3-mini-4k-instruct-gguf Modelfile_q4 --local-dir /path/to/your/local/dir
ollama create phi3 -f Modelfile_q4
Now you can run the Phi-3-Mini-4k-Instruct model with Ollama using the following command:
ollama run phi3 "Your prompt here"
Replace "Your prompt here" with the actual prompt you want to use for generating responses from the model.
Assuming that you already have GGUF files downloaded. Here is how you can use the GGUF model with Llamafile:
wget https://github.com/Mozilla-Ocho/llamafile/releases/download/0.7.3/llamafile-0.7.3
<|user|>\nHow to explain Internet for a medieval knight?\n<|end|>\n<|assistant|>
./llamafile-0.7.3 -ngl 9999 -m Phi-3-mini-4k-instruct-q4.gguf --temp 0.6 -p "<|user|>\nHow to explain Internet for a medieval knight?\n<|end|>\n<|assistant|>"
./llamafile-0.7.3 -ngl 9999 -m Phi-3-mini-4k-instruct-q4.gguf
Your browser should open automatically and display a chat interface. (If it doesn't, just open your browser and point it at http://localhost:8080)
! CMAKE_ARGS="-DLLAMA_CUBLAS=on" pip install llama-cpp-python
from llama_cpp import Llama
llm = Llama(
model_path="./Phi-3-mini-4k-instruct-q4.gguf", # path to GGUF file
n_ctx=4096, # The max sequence length to use - note that longer sequence lengths require much more resources
n_threads=8, # The number of CPU threads to use, tailor to your system and the resulting performance
n_gpu_layers=35, # The number of layers to offload to GPU, if you have GPU acceleration available. Set to 0 if no GPU acceleration is available on your system.
)
prompt = "How to explain Internet to a medieval knight?"
# Simple inference example
output = llm(
f"<|user|>\n{prompt}<|end|>\n<|assistant|>",
max_tokens=256, # Generate up to 256 tokens
stop=["<|end|>"],
echo=True, # Whether to echo the prompt
)
print(output['choices'][0]['text'])
Like other language models, the Phi series models can potentially behave in ways that are unfair, unreliable, or offensive. Some of the limiting behaviors to be aware of include:
Developers should apply responsible AI best practices and are responsible for ensuring that a specific use case complies with relevant laws and regulations (e.g. privacy, trade, etc.). Important areas for consideration include:
Our training data includes a wide variety of sources, totaling 3.3 trillion tokens, and is a combination of
The model is licensed under the MIT license.
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.
https://huggingface.co/microsoft/Phi-3-mini-4k-instruct-gguf/blob/main/data_summary_card.md
Model Summary
608
8 commits
6 linked in READMEs
updated Dec 10, 2025
This repo provides the GGUF format for the Phi-3-Mini-4K-Instruct. The Phi-3-Mini-4K-Instruct is a 3.8B parameters, lightweight, state-of-the-art open model trained with the Phi-3 datasets that includes both synthetic data and the filtered publicly available websites data with a focus on high-quality and reasoning dense properties. The model belongs to the Phi-3 family with the Mini version in two variants 4K and 128K which is the context length (in tokens) it can support. The model has underwent a post-training process that incorporates both supervised fine-tuning and direct preference optimization to ensure precise instruction adherence and robust safety measures. When assessed against benchmarks testing common sense, language understanding, math, code, long context and logical reasoning, Phi-3 Mini-4K-Instruct showcased a robust and state-of-the-art performance among models with less than 13 billion parameters.
Resources and Technical Documentation:
This repo provides GGUF files for the Phi-3 Mini-4K-Instruct model.
| Name | Quant method | Bits | Size | Use case |
|---|---|---|---|---|
| Phi-3-mini-4k-instruct-q4.gguf | Q4_K_M | 4 | 2.2 GB | medium, balanced quality - recommended |
| Phi-3-mini-4k-instruct-fp16.gguf | None | 16 | 7.2 GB | minimal quality loss |
Primary use cases
The model is intended for commercial and research use in English. The model provides uses for applications which require
Our model is designed to accelerate research on language and multimodal models, for use as a building block for generative AI powered features.
Use case considerations
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 fariness 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. Nothing contained in this Model Card should be interpreted as or deemed a restriction or modification to the license the model is released under.
Given the nature of the training data, the Phi-3-Mini-4K-instruct model is best suited for prompts using the chat format as follows. You can provide the prompt as a question with a generic template as follow:
<|user|>\nQuestion <|end|>\n<|assistant|>
For example:
<|user|>
How to explain Internet for a medieval knight?<|end|>
<|assistant|>
where the model generates the text after "<|assistant|>" . In case of few-shots prompt, the prompt can be formatted as the following:
<|user|>
I am going to Paris, what should I see?<|end|>
<|assistant|>
Paris, the capital of France, is known for its stunning architecture, art museums, historical landmarks, and romantic atmosphere. Here are some of the top attractions to see in Paris:\n\n1. The Eiffel Tower: The iconic Eiffel Tower is one of the most recognizable landmarks in the world and offers breathtaking views of the city.\n2. The Louvre Museum: The Louvre is one of the world's largest and most famous museums, housing an impressive collection of art and artifacts, including the Mona Lisa.\n3. Notre-Dame Cathedral: This beautiful cathedral is one of the most famous landmarks in Paris and is known for its Gothic architecture and stunning stained glass windows.\n\nThese are just a few of the many attractions that Paris has to offer. With so much to see and do, it's no wonder that Paris is one of the most popular tourist destinations in the world."<|end|>
<|user|>
What is so great about #1?<|end|>
<|assistant|>
pip install huggingface-hub>=0.17.1
huggingface-cli login
huggingface-cli download microsoft/Phi-3-mini-4k-instruct-gguf Phi-3-mini-4k-instruct-q4.gguf --local-dir . --local-dir-use-symlinks False
curl -fsSL https://ollama.com/install.sh | sh
ollama run phi3
ModelfileAssuming that you have already downloaded GGUF files, here is how you can use them with Ollama:
huggingface-cli download microsoft/Phi-3-mini-4k-instruct-gguf Modelfile_q4 --local-dir /path/to/your/local/dir
ollama create phi3 -f Modelfile_q4
Now you can run the Phi-3-Mini-4k-Instruct model with Ollama using the following command:
ollama run phi3 "Your prompt here"
Replace "Your prompt here" with the actual prompt you want to use for generating responses from the model.
Assuming that you already have GGUF files downloaded. Here is how you can use the GGUF model with Llamafile:
wget https://github.com/Mozilla-Ocho/llamafile/releases/download/0.7.3/llamafile-0.7.3
<|user|>\nHow to explain Internet for a medieval knight?\n<|end|>\n<|assistant|>
./llamafile-0.7.3 -ngl 9999 -m Phi-3-mini-4k-instruct-q4.gguf --temp 0.6 -p "<|user|>\nHow to explain Internet for a medieval knight?\n<|end|>\n<|assistant|>"
./llamafile-0.7.3 -ngl 9999 -m Phi-3-mini-4k-instruct-q4.gguf
Your browser should open automatically and display a chat interface. (If it doesn't, just open your browser and point it at http://localhost:8080)
! CMAKE_ARGS="-DLLAMA_CUBLAS=on" pip install llama-cpp-python
from llama_cpp import Llama
llm = Llama(
model_path="./Phi-3-mini-4k-instruct-q4.gguf", # path to GGUF file
n_ctx=4096, # The max sequence length to use - note that longer sequence lengths require much more resources
n_threads=8, # The number of CPU threads to use, tailor to your system and the resulting performance
n_gpu_layers=35, # The number of layers to offload to GPU, if you have GPU acceleration available. Set to 0 if no GPU acceleration is available on your system.
)
prompt = "How to explain Internet to a medieval knight?"
# Simple inference example
output = llm(
f"<|user|>\n{prompt}<|end|>\n<|assistant|>",
max_tokens=256, # Generate up to 256 tokens
stop=["<|end|>"],
echo=True, # Whether to echo the prompt
)
print(output['choices'][0]['text'])
Like other language models, the Phi series models can potentially behave in ways that are unfair, unreliable, or offensive. Some of the limiting behaviors to be aware of include:
Developers should apply responsible AI best practices and are responsible for ensuring that a specific use case complies with relevant laws and regulations (e.g. privacy, trade, etc.). Important areas for consideration include:
Our training data includes a wide variety of sources, totaling 3.3 trillion tokens, and is a combination of
The model is licensed under the MIT license.
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.
https://huggingface.co/microsoft/Phi-3-mini-4k-instruct-gguf/blob/main/data_summary_card.md