Instructions to use AtomicChat/Phi-4-mini-instruct-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use AtomicChat/Phi-4-mini-instruct-GGUF with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="AtomicChat/Phi-4-mini-instruct-GGUF", filename="Phi-4-mini-instruct-Q4_K_M.gguf", )
llm.create_chat_completion( messages = [ { "role": "user", "content": "What is the capital of France?" } ] ) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use AtomicChat/Phi-4-mini-instruct-GGUF with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf AtomicChat/Phi-4-mini-instruct-GGUF:UD-Q4_K_XL # Run inference directly in the terminal: llama cli -hf AtomicChat/Phi-4-mini-instruct-GGUF:UD-Q4_K_XL
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf AtomicChat/Phi-4-mini-instruct-GGUF:UD-Q4_K_XL # Run inference directly in the terminal: llama cli -hf AtomicChat/Phi-4-mini-instruct-GGUF:UD-Q4_K_XL
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf AtomicChat/Phi-4-mini-instruct-GGUF:UD-Q4_K_XL # Run inference directly in the terminal: ./llama-cli -hf AtomicChat/Phi-4-mini-instruct-GGUF:UD-Q4_K_XL
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf AtomicChat/Phi-4-mini-instruct-GGUF:UD-Q4_K_XL # Run inference directly in the terminal: ./build/bin/llama-cli -hf AtomicChat/Phi-4-mini-instruct-GGUF:UD-Q4_K_XL
Use Docker
docker model run hf.co/AtomicChat/Phi-4-mini-instruct-GGUF:UD-Q4_K_XL
- LM Studio
- Jan
- vLLM
How to use AtomicChat/Phi-4-mini-instruct-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "AtomicChat/Phi-4-mini-instruct-GGUF" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AtomicChat/Phi-4-mini-instruct-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/AtomicChat/Phi-4-mini-instruct-GGUF:UD-Q4_K_XL
- Ollama
How to use AtomicChat/Phi-4-mini-instruct-GGUF with Ollama:
ollama run hf.co/AtomicChat/Phi-4-mini-instruct-GGUF:UD-Q4_K_XL
- Unsloth Studio
How to use AtomicChat/Phi-4-mini-instruct-GGUF with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for AtomicChat/Phi-4-mini-instruct-GGUF to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for AtomicChat/Phi-4-mini-instruct-GGUF to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for AtomicChat/Phi-4-mini-instruct-GGUF to start chatting
- Pi
How to use AtomicChat/Phi-4-mini-instruct-GGUF with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf AtomicChat/Phi-4-mini-instruct-GGUF:UD-Q4_K_XL
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "AtomicChat/Phi-4-mini-instruct-GGUF:UD-Q4_K_XL" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use AtomicChat/Phi-4-mini-instruct-GGUF with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf AtomicChat/Phi-4-mini-instruct-GGUF:UD-Q4_K_XL
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default AtomicChat/Phi-4-mini-instruct-GGUF:UD-Q4_K_XL
Run Hermes
hermes
- Atomic Chat new
- OpenClaw new
How to use AtomicChat/Phi-4-mini-instruct-GGUF with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf AtomicChat/Phi-4-mini-instruct-GGUF:UD-Q4_K_XL
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "AtomicChat/Phi-4-mini-instruct-GGUF:UD-Q4_K_XL" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
- Docker Model Runner
How to use AtomicChat/Phi-4-mini-instruct-GGUF with Docker Model Runner:
docker model run hf.co/AtomicChat/Phi-4-mini-instruct-GGUF:UD-Q4_K_XL
- Lemonade
How to use AtomicChat/Phi-4-mini-instruct-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull AtomicChat/Phi-4-mini-instruct-GGUF:UD-Q4_K_XL
Run and chat with the model
lemonade run user.Phi-4-mini-instruct-GGUF-UD-Q4_K_XL
List all available models
lemonade list
forge: regenerate the model card
Browse files
README.md
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
license_link: https://huggingface.co/microsoft/Phi-4-mini-instruct/resolve/main/LICENSE
|
| 4 |
+
thumbnail: https://huggingface.co/AtomicChat/Phi-4-mini-instruct-GGUF/resolve/main/hero.png
|
| 5 |
+
base_model:
|
| 6 |
+
- microsoft/Phi-4-mini-instruct
|
| 7 |
+
base_model_relation: quantized
|
| 8 |
+
quantized_by: AtomicChat
|
| 9 |
+
pipeline_tag: text-generation
|
| 10 |
+
library_name: gguf
|
| 11 |
+
tags:
|
| 12 |
+
- atomic-chat
|
| 13 |
+
- phi
|
| 14 |
+
- phi4
|
| 15 |
+
- microsoft
|
| 16 |
+
- gguf
|
| 17 |
+
- llama.cpp
|
| 18 |
+
- quantized
|
| 19 |
+
---
|
| 20 |
+
|
| 21 |
+
<center>
|
| 22 |
+
|
| 23 |
+
<div style="display:flex; justify-content:center; align-items:center; gap:2%; max-width:560px; margin:0 auto;">
|
| 24 |
+
<a href="https://atomic.chat" style="flex:0 1 auto; min-width:0;"><img src="https://huggingface.co/AtomicChat/Phi-4-mini-instruct-GGUF/resolve/main/pill_atomic_v3.png" alt="Atomic Chat" style="width:100%; height:auto; max-width:186px;"></a>
|
| 25 |
+
<a href="https://discord.gg/8wGSsvmg4V" style="flex:0 1 auto; min-width:0;"><img src="https://huggingface.co/AtomicChat/Phi-4-mini-instruct-GGUF/resolve/main/pill_discord_v3.png" alt="Join Discord" style="width:100%; height:auto; max-width:184px;"></a>
|
| 26 |
+
<a href="https://github.com/AtomicBot-ai/Atomic-Chat" style="flex:0 1 auto; min-width:0;"><img src="https://huggingface.co/AtomicChat/Phi-4-mini-instruct-GGUF/resolve/main/pill_github_v3.png" alt="GitHub" style="width:100%; height:auto; max-width:141px;"></a>
|
| 27 |
+
</div>
|
| 28 |
+
|
| 29 |
+
<br/>
|
| 30 |
+
|
| 31 |
+
<img src="https://huggingface.co/AtomicChat/Phi-4-mini-instruct-GGUF/resolve/main/hero.png" alt="Phi 4 Mini" style="width:100%; max-width:100%; height:auto; margin-bottom:0.6em;"/>
|
| 32 |
+
|
| 33 |
+
<div style="display:flex; justify-content:center; gap:0.5em;">
|
| 34 |
+
<a href="https://huggingface.co/microsoft/Phi-4-mini-instruct"><strong>Base model: microsoft/Phi-4-mini-instruct</strong></a>
|
| 35 |
+
</div>
|
| 36 |
+
</center>
|
| 37 |
+
|
| 38 |
+
**Phi 4 Mini**, self-quantized to GGUF by [Atomic Chat](https://atomic.chat). Built straight from Microsoft's original weights with a per-tensor importance matrix, so this is not a repack of somebody else's files. Runs fully offline.
|
| 39 |
+
|
| 40 |
+
## Highlights
|
| 41 |
+
|
| 42 |
+
- **3.8B parameters**: the weights this repo quantizes.
|
| 43 |
+
- **Context length**: 131,072 tokens (128K), as published by Microsoft.
|
| 44 |
+
- **32 layers**: Dense decoder, hybrid sliding-window (262144) and global attention.
|
| 45 |
+
- **Full imatrix ladder**: every quant is calibrated with an importance matrix.
|
| 46 |
+
|
| 47 |
+
> [!NOTE]
|
| 48 |
+
> These GGUFs are **self-quantized from the original weights**, not a repack. The importance matrix keeps low-bit quants closer to the full-precision model.
|
| 49 |
+
|
| 50 |
+
> [!IMPORTANT]
|
| 51 |
+
> Always pass `--jinja` so the **Phi 4 Mini chat template** is applied. Without it the model can emit malformed turns.
|
| 52 |
+
|
| 53 |
+
## Model Overview
|
| 54 |
+
|
| 55 |
+
| Property | Value |
|
| 56 |
+
|---|---|
|
| 57 |
+
| Base model | `microsoft/Phi-4-mini-instruct` |
|
| 58 |
+
| Parameters | 3.8B |
|
| 59 |
+
| Layers | 32 |
|
| 60 |
+
| Sliding window | 262144 tokens |
|
| 61 |
+
| Context length | 131,072 tokens (128K) |
|
| 62 |
+
| Vocabulary | 200,064 |
|
| 63 |
+
| Modalities | Text |
|
| 64 |
+
| Architecture | Dense decoder, hybrid sliding-window (262144) and global attention, 24 attention heads over 8 KV heads, `Phi3ForCausalLM` |
|
| 65 |
+
| This repo | GGUF quants (imatrix). Quants: `Q4_K_M`, `UD-Q4_K_XL`, `Q5_K_M`, `Q6_K`, `Q8_0` |
|
| 66 |
+
|
| 67 |
+
## Choosing a quant
|
| 68 |
+
|
| 69 |
+
| Quant | Size | Notes |
|
| 70 |
+
|---|---|---|
|
| 71 |
+
| **`Q4_K_M`** | 2.5 GB | **Recommended default. Best balance of size, speed and quality.** |
|
| 72 |
+
| `UD-Q4_K_XL` | 2.6 GB | Dynamic. Embeddings and output kept at Q8_0 for higher quality at a Q4 footprint. |
|
| 73 |
+
| `Q5_K_M` | 2.8 GB | Higher quality, low loss. |
|
| 74 |
+
| `Q6_K` | 3.2 GB | Near lossless, noticeably lighter than Q8_0. |
|
| 75 |
+
| `Q8_0` | 4.1 GB | Effectively lossless, reference quality. |
|
| 76 |
+
|
| 77 |
+
> [!TIP]
|
| 78 |
+
> Pick the largest file that fits your (V)RAM with room for context. `Q4_K_M` or `UD-Q4_K_XL` is the sweet spot for most setups; `Q6_K` or `Q8_0` for maximum fidelity.
|
| 79 |
+
|
| 80 |
+
## Get started
|
| 81 |
+
|
| 82 |
+
Run Phi 4 Mini locally with:
|
| 83 |
+
|
| 84 |
+
- **[Atomic Chat](https://atomic.chat):** the easiest path. Open the app, search `AtomicChat/Phi-4-mini-instruct-GGUF`, pick a quant, hit **Use this model**.
|
| 85 |
+
- **llama.cpp:** `llama-server -hf AtomicChat/Phi-4-mini-instruct-GGUF:Q4_K_M --jinja -c 8192`
|
| 86 |
+
- **Ollama:** `ollama run hf.co/AtomicChat/Phi-4-mini-instruct-GGUF:Q4_K_M`
|
| 87 |
+
- **LM Studio / Jan:** search the repo id, download any quant.
|
| 88 |
+
|
| 89 |
+
## Best practices
|
| 90 |
+
|
| 91 |
+
| Parameter | Value |
|
| 92 |
+
|---|---|
|
| 93 |
+
| temperature | 0.0 |
|
| 94 |
+
|
| 95 |
+
Microsoft's recommended sampling configuration for `microsoft/Phi-4-mini-instruct`.
|
| 96 |
+
|
| 97 |
+
## Run in llama.cpp
|
| 98 |
+
|
| 99 |
+
```bash
|
| 100 |
+
git clone https://github.com/ggml-org/llama.cpp
|
| 101 |
+
cmake llama.cpp -B llama.cpp/build -DBUILD_SHARED_LIBS=OFF -DGGML_CUDA=ON
|
| 102 |
+
cmake --build llama.cpp/build --config Release -j --target llama-cli llama-server
|
| 103 |
+
```
|
| 104 |
+
|
| 105 |
+
```bash
|
| 106 |
+
./llama.cpp/build/bin/llama-server \
|
| 107 |
+
-hf AtomicChat/Phi-4-mini-instruct-GGUF:Q4_K_M \
|
| 108 |
+
--jinja -ngl 99 -c 8192 -fa on
|
| 109 |
+
```
|
| 110 |
+
|
| 111 |
+
## How these were made
|
| 112 |
+
|
| 113 |
+
1. Download `microsoft/Phi-4-mini-instruct` (original weights).
|
| 114 |
+
2. Convert to f16 GGUF with [llama.cpp](https://github.com/ggml-org/llama.cpp).
|
| 115 |
+
3. Build an importance matrix over our calibration corpus.
|
| 116 |
+
4. Quantize the ladder with `--imatrix`.
|
| 117 |
+
5. `UD-Q4_K_XL` additionally pins the token-embedding and output tensors to `Q8_0`.
|
| 118 |
+
|
| 119 |
+
## License
|
| 120 |
+
|
| 121 |
+
Original model by Microsoft, released under the MIT license. Full terms: [MIT](https://huggingface.co/microsoft/Phi-4-mini-instruct/resolve/main/LICENSE). Quantized by Atomic Chat.
|