The --hf-repo flag picks a quantisation for you, but some repositories use custom file names that no quant suffix matches. --hf-file is the escape hatch: name one exact file, and the server downloads that file.
Name the repo and the exact file
Start the server with both flags: --hf-repo microsoft/Phi-3-mini-4k-instruct-gguf --hf-file Phi-3-mini-4k-instruct-q4.gguf -c 4096. The file flag overrides the quant in --hf-repo, so the two together say exactly which file to fetch. Use it whenever a repo’s file names do not follow the usual quant pattern, or when two files share the same quant label.
llama-server \
--hf-repo microsoft/Phi-3-mini-4k-instruct-gguf \
--hf-file Phi-3-mini-4k-instruct-q4.gguf \
-c 4096
Copy the file name from the repository’s file list on Hugging Face, character for character — a typo gives you a download error, not a different file. For gated repositories, add --hf-token or set the HF_TOKEN environment variable.
Try it: four checks
| Check | What you should see | If you do not see it |
|---|---|---|
| File named | The –hf-file value matches a file in the repo | Copy it from the repo’s file list |
| Download succeeds | The server fetches the named file | Check the file name spelling and the token |
| Quant overridden | The named file loads, not the quant default | The file flag overrides –hf-repo |
| Server answers | The server starts and serves the model | Check the model path in the log |
Expected result. We checked the llama.cpp server README, which says –hf-file names a Hugging Face model file and, if specified, overrides the quant in –hf-repo. We did not download a model on this machine.
Limits
This guide covers the –hf-file flag only. The flag names a file; it does not verify checksums. We did not test any download ourselves.
