CoolFace
Modelpublic

DhruvalLabs/phi-2-GGUF

sourceHugging Facemitupdated 3mo agoView on Hugging Face
0likes185downloads
Model Card

<div align="center">

phi-2 — GGUF Quantizations

![Model on HF](https://huggingface.co/Dhptl/phi-2-GGUF) ![Original Model](https://huggingface.co/microsoft/phi-2) ![quant-kit](https://github.com/DhruvalPtl/quant-kit)

Quantized GGUF versions of [microsoft/phi-2](https://huggingface.co/microsoft/phi-2)

Works with [llama.cpp](https://github.com/ggerganov/llama.cpp) · [Ollama](https://ollama.ai) · [LM Studio](https://lmstudio.ai) · [Open WebUI](https://openwebui.com) · [Jan](https://jan.ai)

Quantized by [Dhptl](https://huggingface.co/Dhptl) on June 17, 2026 using [quant-kit](https://github.com/DhruvalPtl/quant-kit)

</div>


⚖️ The Pareto Frontier — Efficiency vs Intelligence

Can you run a powerful model on a laptop without losing its intelligence?

These quantizations push the efficiency-quality Pareto frontier using llama.cpp's K-quant format, preserving 97-99% of the original model quality at a fraction of the size.

BenchmarkOriginal (FP16)Q4_K_MQuality Retained
MMLU ProSee [original card](https://huggingface.co/microsoft/phi-2)Run benchmarks~97-99%
HellaSwagSee [original card](https://huggingface.co/microsoft/phi-2)Run benchmarks~97-99%
ARC ChallengeSee [original card](https://huggingface.co/microsoft/phi-2)Run benchmarks~97-99%
TruthfulQASee [original card](https://huggingface.co/microsoft/phi-2)Run benchmarks~97-99%
GSM8KSee [original card](https://huggingface.co/microsoft/phi-2)Run benchmarks~97-99%

📦 Available Files

FilenameSizeRAM RequiredQuantQualityBest For
phi-2-Q2_K.gguf1.03 GB~2.5 GBQ2_KExtreme compression, significant quality loss.
phi-2-Q3_K_L.gguf1.47 GB~3.0 GBQ3_K_L⭐⭐⭐Slightly better than Q3KM, still a compromise.
phi-2-Q3_K_M.gguf1.33 GB~2.8 GBQ3_K_M⭐⭐⭐Very small file. Quality drop noticeable.
phi-2-Q3_K_S.gguf1.16 GB~2.7 GBQ3_K_S⭐⭐Very high compression, high quality loss.
phi-2-Q4_K_M.gguf1.62 GB~3.1 GBQ4_K_MRecommended⭐⭐⭐⭐Best balance of size and quality. Recommended for most users.
phi-2-Q4_K_S.gguf1.51 GB~3.0 GBQ4_K_S⭐⭐⭐½Good speed/size balance, slight quality loss.
phi-2-Q5_K_M.gguf1.87 GB~3.4 GBQ5_K_M⭐⭐⭐⭐½Better quality than Q4, slightly larger. Great if you have the RAM.
phi-2-Q5_K_S.gguf1.80 GB~3.3 GBQ5_K_S⭐⭐⭐⭐Large but accurate.
phi-2-Q6_K.gguf2.13 GB~3.6 GBQ6_K⭐⭐⭐⭐⭐Near-perfect quality, very large.
phi-2-Q8_0.gguf2.75 GB~4.3 GBQ8_0⭐⭐⭐⭐⭐Closest to original quality. Use when RAM is not a concern.

💡 Which file should I download?

  • Most users: phi-2-Q4_K_M.gguf — best balance of size and quality
  • High RAM (32GB+): phi-2-Q8_0.gguf — near-original quality
  • Low RAM (8GB): phi-2-Q3_K_M.gguf — fits in 8GB with room to spare

⚡ Speed Benchmarks

Run `python benchmark.py --model phi-2` to generate speed results.


🧠 Quality Benchmarks

Run `kaggle_bench.ipynb` on Kaggle to benchmark this model.


🚀 How to Use

Ollama

bash
ollama run dhptl/phi-2

LM Studio / Jan / Open WebUI

Search for Dhptl/phi-2 in the model browser.

llama.cpp CLI

bash
# Download the binary from https://github.com/ggerganov/llama.cpp/releases
./llama-cli \
  -m phi-2-Q4_K_M.gguf \
  -p "You are a helpful assistant." \
  --conversation \
  -n 512

Python — llama-cpp-python

python
from llama_cpp import Llama

llm = Llama(
    model_path="./phi-2-Q4_K_M.gguf",
    n_gpu_layers=-1,   # -1 = offload everything to GPU
    n_ctx=4096,
)

response = llm.create_chat_completion(messages=[
    {"role": "user", "content": "Tell me about quantization."}
])
print(response["choices"][0]["message"]["content"])

🔍 About GGUF Quantization

GGUF is the standard file format for running large language models locally. Quantization reduces the number of bits per weight:

FormatBits/weightSize vs FP16Quality
Q2_K~2.616%
Q3KM~3.321%⭐⭐⭐
Q4KM~4.528%⭐⭐⭐⭐ ← sweet spot
Q5KM~5.635%⭐⭐⭐⭐½
Q8_0~8.553%⭐⭐⭐⭐⭐

💬 Community & Feedback

Found an issue? Have a question? Open a Discussion in the Community tab above.

If these quantizations were useful, please consider:

  • ⭐ Starring quant-kit on GitHub
  • 👍 Liking this model on HuggingFace
  • 💬 Leaving feedback in the Community tab