Instructions to use batiai/Qwen3-Reranker-4B-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use batiai/Qwen3-Reranker-4B-GGUF with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="batiai/Qwen3-Reranker-4B-GGUF", filename="Qwen3-Reranker-4B-Q6_K.gguf", )
llm.create_chat_completion( messages = "No input example has been defined for this model task." )
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use batiai/Qwen3-Reranker-4B-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 batiai/Qwen3-Reranker-4B-GGUF:Q6_K # Run inference directly in the terminal: llama cli -hf batiai/Qwen3-Reranker-4B-GGUF:Q6_K
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf batiai/Qwen3-Reranker-4B-GGUF:Q6_K # Run inference directly in the terminal: llama cli -hf batiai/Qwen3-Reranker-4B-GGUF:Q6_K
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 batiai/Qwen3-Reranker-4B-GGUF:Q6_K # Run inference directly in the terminal: ./llama-cli -hf batiai/Qwen3-Reranker-4B-GGUF:Q6_K
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 batiai/Qwen3-Reranker-4B-GGUF:Q6_K # Run inference directly in the terminal: ./build/bin/llama-cli -hf batiai/Qwen3-Reranker-4B-GGUF:Q6_K
Use Docker
docker model run hf.co/batiai/Qwen3-Reranker-4B-GGUF:Q6_K
- LM Studio
- Jan
- Ollama
How to use batiai/Qwen3-Reranker-4B-GGUF with Ollama:
ollama run hf.co/batiai/Qwen3-Reranker-4B-GGUF:Q6_K
- Unsloth Studio
How to use batiai/Qwen3-Reranker-4B-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 batiai/Qwen3-Reranker-4B-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 batiai/Qwen3-Reranker-4B-GGUF to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for batiai/Qwen3-Reranker-4B-GGUF to start chatting
- Pi
How to use batiai/Qwen3-Reranker-4B-GGUF with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf batiai/Qwen3-Reranker-4B-GGUF:Q6_K
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": "batiai/Qwen3-Reranker-4B-GGUF:Q6_K" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use batiai/Qwen3-Reranker-4B-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 batiai/Qwen3-Reranker-4B-GGUF:Q6_K
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 batiai/Qwen3-Reranker-4B-GGUF:Q6_K
Run Hermes
hermes
- Atomic Chat new
- OpenClaw new
How to use batiai/Qwen3-Reranker-4B-GGUF with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf batiai/Qwen3-Reranker-4B-GGUF:Q6_K
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 "batiai/Qwen3-Reranker-4B-GGUF:Q6_K" \ --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 batiai/Qwen3-Reranker-4B-GGUF with Docker Model Runner:
docker model run hf.co/batiai/Qwen3-Reranker-4B-GGUF:Q6_K
- Lemonade
How to use batiai/Qwen3-Reranker-4B-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull batiai/Qwen3-Reranker-4B-GGUF:Q6_K
Run and chat with the model
lemonade run user.Qwen3-Reranker-4B-GGUF-Q6_K
List all available models
lemonade list
llm.create_chat_completion(
messages = "No input example has been defined for this model task."
)Qwen3-Reranker-4B GGUF — Quantized by BatiAI
GGUF quantizations of Qwen/Qwen3-Reranker-4B — the quality tier of the Qwen3 reranker family (747 K downloads on HF). Part of BatiAI's on-device RAG stack for BatiFlow.
What is a reranker?
RAG pipeline: embedding (coarse retrieve) → reranker (precise scoring) → LLM (answer).
A reranker takes (query, candidate_document) and returns a relevance score. It's the "second pass" after vector search — turns "probably relevant" candidates into an ordered top-K that the LLM can use confidently.
When to pick 4B vs 0.6B?
| Use case | Pick |
|---|---|
| Desktop Mac / enough RAM | 4B — higher ranking accuracy, ~7 % better nDCG@10 on MTEB Retrieval |
| Edge / low-RAM / batch reranking at scale | 0.6B — 5× smaller, close-to-SOTA on most tasks |
Both from the same Qwen3-Reranker family — same architecture, same training recipe, different size.
Quick Start (llama.cpp)
./llama-cli -m Qwen3-Reranker-4B-Q6_K.gguf \
--chat-template-file chat-template.jinja \
-p "<query>weather in Seoul</query><doc>Seoul had rain yesterday</doc>"
See Qwen3-Reranker usage for production integration.
Note: Ollama doesn't have a native reranker endpoint yet, so this GGUF is intended for direct llama.cpp integration or tools like LangChain / LlamaIndex.
Available Quantizations
| File | Quant | Size | Recommended |
|---|---|---|---|
Qwen3-Reranker-4B-Q6_K.gguf |
Q6_K | 3.1 GB | balanced (recommended default) |
Qwen3-Reranker-4B-Q8_0.gguf |
Q8_0 | 4.0 GB | near-lossless |
Reranker scores are sensitive to quantization — Q6_K is the recommended minimum. Avoid IQ3/IQ4 for ranking quality.
Quality Verification (measured)
Ran 40 (query, positive, negative) triples — 20 EN + 20 KO — twice:
- Easy — off-topic negatives
- Hard — topically-close negatives
| Test | Q6_K | Q8_0 |
|---|---|---|
| Pairwise accuracy (easy) | 100 % | 100 % |
| Pairwise accuracy (hard) | 100 % | 100 % |
| Mean score margin (hard) | 0.650 | 0.672 |
Pearson correlation Q6_K ↔ Q8_0: r = 0.998 on hard test → essentially no quantization drift.
Note on margin vs 0.6B: 4B shows a slightly tighter margin (pos - neg gap) on hard negatives than the 0.6B variant. This reflects more calibrated scoring rather than worse quality — both hit 100 % pairwise accuracy.
Full bench reports and reproducible script in the BatiAI pipeline repo.
Why Qwen3-Reranker?
- SOTA among open rerankers — top of MTEB reranking benchmarks
- Multilingual — en / ko / ja / zh
- Apache 2.0 — commercial-friendly
Why BatiAI?
- Quantized directly from Alibaba's BF16 safetensors
- BatiAI-signed —
general.author: BatiAI,general.url: https://flow.bati.ai - Part of a full on-device RAG stack
Technical Details
- Original Model: Qwen/Qwen3-Reranker-4B
- Architecture: Qwen3 Causal LM (cross-encoder scorer)
- Parameters: 4 B
- Context: 32 K
- License: Apache 2.0
- Quantized with: llama.cpp build
bafae2765
BatiAI's RAG Stack
| Role | Model | HF |
|---|---|---|
| Reranker (0.6 B) | Qwen3-Reranker-0.6B | batiai/Qwen3-Reranker-0.6B-GGUF |
| Reranker (4 B) | Qwen3-Reranker-4B | this repo |
| VL Embedding (2 B) | Qwen3-VL-Embedding-2B | batiai/Qwen3-VL-Embedding-2B-GGUF |
| Chat LLM (35 B-A3B) | Qwen3.6-35B-A3B | batiai/Qwen3.6-35B-A3B-GGUF |
License
Mirrors upstream Qwen Apache 2.0. Commercial use permitted.
- Downloads last month
- 146
6-bit
8-bit
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="batiai/Qwen3-Reranker-4B-GGUF", filename="", )