llav-4b
Document relevance judge model
2 min readupdated
The llav 4B model acts as a binary classifier: it takes a question and a document as input and outputs the probability (yes/no) of whether the text is necessary evidence for an answer. It was created as a key component of the llavRAG search engine and is based on the Qwen3-Reranker-4B architecture (4.02 billion parameters). All LoRA adapters are merged into the base weights, so no extra modules are needed during inference. The model will be useful for researchers and developers building RAG (Retrieval-Augmented Generation) pipelines and text passage relevance evaluation systems.
Key features
- Specialization: Evaluates text passages for the presence of facts to answer multi-step questions.
- Probabilistic output: Returns probability via the logits of yes/no tokens using Platt scaling.
- Base model: Built on Qwen/Qwen3-Reranker-4B by the Alibaba Cloud team under the Apache-2.0 license.
- Weight volume: Model weights take up about 8 GB in bf16 format (model.safetensors file).
What you can do
- RAG integration: Use the model as a judge to evaluate documents in search and information retrieval pipelines.
- Candidate ranking: Filter and sort text fragments before sending them to the language model.
- Running via llvRAG: Use the tool for multi-round search paired with the llavrag package (Apple Silicon and NVIDIA GPUs are supported).
Example
import json, math
import torch
from huggingface_hub import snapshot_download
from transformers import AutoModelForCausalLM, AutoTokenizer
path = snapshot_download("llavapp/llav-4b")
device = "cuda" if torch.cuda.is_available() else "cpu"
tok = AutoTokenizer.from_pretrained(path)
model = AutoModelForCausalLM.from_pretrained(
path, torch_dtype=torch.float16 if device == "cuda" else torch.float32).to(device).eval()Read more
DetailsBenchmarks of the llavRAG system with this model on the fresh-2 test reach R@10 at 95.0 and AE@10 at 87.6.
Hardware requirements: A device with CUDA or Apple Silicon support (for example, tested on RTX 3060 12 GB and M5 Max 128 GB).
Limitations: Works only with English, is not intended for text generation, prompt safety checks, or content moderation tasks.










Comments