File size: 3,311 Bytes
b2e54d9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
---
base_model: Qwen/Qwen3-Reranker-8B
library_name: gguf
license: apache-2.0
pipeline_tag: text-ranking
tags:
  - reranker
  - gguf
  - llama.cpp
  - qwen3
  - text-ranking
---

# Qwen3-Reranker-8B — GGUF (llama.cpp)

Working GGUF of [Qwen/Qwen3-Reranker-8B](https://huggingface.co/Qwen/Qwen3-Reranker-8B) for [llama.cpp](https://github.com/ggml-org/llama.cpp). Converted 2025-03-09 with the official `convert_hf_to_gguf.py`.

> **Other sizes:** [0.6B](https://huggingface.co/Voodisss/Qwen3-Reranker-0.6B-GGUF-llama_cpp) · [4B](https://huggingface.co/Voodisss/Qwen3-Reranker-4B-GGUF-llama_cpp) · [8B (this)](https://huggingface.co/Voodisss/Qwen3-Reranker-8B-GGUF-llama_cpp)

## Available files

| File                        | Quant | Size     | Description                                        |
| --------------------------- | ----- | -------- | -------------------------------------------------- |
| `Qwen3-Reranker-8B-F16.gguf`  | F16   | 14.10 GB | Full precision, no quality loss                    |
| `Qwen3-Reranker-8B-Q8_0.gguf` | Q8_0  | 7.49 GB  | 8-bit quantized, half the size |

## 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](https://github.com/ggml-org/llama.cpp/issues/16407). This one works:

```
Doc 0 (relevant):   relevance_score = 0.99XX
Doc 1 (irrelevant): relevance_score = 0.00XX
```

## Quick start

```bash
llama-server -m Qwen3-Reranker-8B-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

- [DevQuasar/Qwen.Qwen3-Reranker-4B-GGUF](https://huggingface.co/DevQuasar/Qwen.Qwen3-Reranker-4B-GGUF) — broken.

## models.ini example

```ini
[Qwen3-Reranker-8B-f16]
model = /path/to/Qwen3-Reranker-8B-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-8B', local_dir='Qwen3-Reranker-8B-src')"
python convert_hf_to_gguf.py --outtype f16 --outfile Qwen3-Reranker-8B-f16.gguf Qwen3-Reranker-8B-src/
```

## License

Apache 2.0 — same as the [original model](https://huggingface.co/Qwen/Qwen3-Reranker-8B).