Team Ai
Modelpublic

Voodisss/Qwen3-Reranker-4B-GGUF-llama_cpp

sourceHugging Faceapache-2.0updated 7mo agoView on Hugging Face
18likes5kdownloads
Model Card

Qwen3-Reranker-4B — GGUF (llama.cpp)

Working GGUF of Qwen/Qwen3-Reranker-4B for llama.cpp. Converted 2025-03-09 with the official convert_hf_to_gguf.py.

Other sizes: 0.6B · 4B (this) · 8B

Quantization quality comparison (Qwen3-Reranker-4B)

Benchmarked on MTEB AskUbuntuDupQuestions (361 queries) via llama-server /v1/rerank on RTX 3090. All quants produced from the same F16 source using llama-quantize.

QuantSizeNDCG@10MAP@10MRR@10Δ NDCG@10
F167.50 GB0.70030.55300.7711baseline
Q8_03.99 GB0.69850.55140.7670-0.3%
Q6_K3.08 GB0.70160.55480.7722+0.2%
Q5KM2.69 GB0.70090.55170.7699+0.1%
Q5_02.63 GB0.69950.55320.7676-0.1%
Q4KM2.33 GB0.70580.55960.7746+0.8%
Q4_02.21 GB0.69300.54260.7623-1.1%
Q3KM1.93 GB0.70400.55550.7828+0.5%
Q2_K1.55 GB0.66910.50790.7401-4.5%

Takeaway: All quants from Q80 down to Q3KM are within ±1% of F16 — pick based on your VRAM budget. Q4KM (2.33 GB) is the sweet spot: 3.2x smaller than F16 with no measurable quality loss. **Avoid Q2K** — it's the only quant with real degradation.

Does it work?

Yes. Most community GGUFs of Qwen3-Reranker produce garbage scores (4.5e-23) because they're missing reranker-specific tensors. See llama.cpp #16407. This one works:

Doc 0 (relevant):   relevance_score = 0.999966
Doc 1 (irrelevant): relevance_score = 0.000069

Quick start

bash
llama-server -m Qwen3-Reranker-4B-f16.gguf --reranking --pooling rank --embedding --port 8081
bash
curl http://localhost:8081/v1/rerank \
  -H "Content-Type: application/json" \
  -d '{
    "query": "employment termination notice period",
    "documents": [
      "The Labour Code requires 30 calendar days written notice.",
      "Corporate tax rates for small enterprises."
    ]
  }'

Use `/v1/rerank`, not /v1/embeddings. The embeddings endpoint returns zeros for reranker models.

What's different about this GGUF?

The official convert_hf_to_gguf.py detects Qwen3-Reranker and does things naive converters skip:

  • —Extracts cls.output.weight (the yes/no classifier) from lm_head
  • —Sets pooling_type = RANK metadata
  • —Bakes in the rerank chat template
  • —Sets classifier.output_labels = ["yes", "no"]

Without these, llama-server has nothing to compute scores from.

Known broken GGUFs

models.ini example

ini
[Qwen3-Reranker-4B-f16]
model = /path/to/Qwen3-Reranker-4B-f16.gguf
reranking = true
pooling = rank
embedding = true
ctx-size = 32768

For a full multi-model setup guide (embedding + reranking + chat on one server), see the [llama-server Qwen3 guide](https://gist.github.com/VooDisss/42bce4eb5c76d3c325633886c5e348ee).

Convert it yourself

bash
pip install huggingface_hub gguf torch safetensors sentencepiece
python -c "from huggingface_hub import snapshot_download; snapshot_download('Qwen/Qwen3-Reranker-4B', local_dir='Qwen3-Reranker-4B-src')"
python convert_hf_to_gguf.py --outtype f16 --outfile Qwen3-Reranker-4B-f16.gguf Qwen3-Reranker-4B-src/

License

Apache 2.0 — same as the original model.