Image-Text-to-Text
Transformers
Safetensors
English
French
qwen3_5
reranker
cross-encoder
multimodal
text-ranking
document-reranking
vidore
beir
conversational
🇪🇺 Region: EU
Instructions to use lightonai/LightOn-rerank-LW-2B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use lightonai/LightOn-rerank-LW-2B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="lightonai/LightOn-rerank-LW-2B") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("lightonai/LightOn-rerank-LW-2B") model = AutoModelForMultimodalLM.from_pretrained("lightonai/LightOn-rerank-LW-2B", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use lightonai/LightOn-rerank-LW-2B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "lightonai/LightOn-rerank-LW-2B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "lightonai/LightOn-rerank-LW-2B", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/lightonai/LightOn-rerank-LW-2B
- SGLang
How to use lightonai/LightOn-rerank-LW-2B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "lightonai/LightOn-rerank-LW-2B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "lightonai/LightOn-rerank-LW-2B", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "lightonai/LightOn-rerank-LW-2B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "lightonai/LightOn-rerank-LW-2B", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use lightonai/LightOn-rerank-LW-2B with Docker Model Runner:
docker model run hf.co/lightonai/LightOn-rerank-LW-2B
Model card edits: hero image, nDCG@10 table headers, BEIR results section, decontaminated wording
Browse files- .gitattributes +1 -0
- README.md +24 -22
- rerank.png +3 -0
.gitattributes
CHANGED
|
@@ -34,3 +34,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
rerank.png filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -40,6 +40,10 @@ tags:
|
|
| 40 |
<a href="https://huggingface.co/lightonai/LightOn-rerank-LW-4B">LW-4B</a>
|
| 41 |
</p>
|
| 42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
---
|
| 44 |
|
| 45 |
## About the LightOn-rerank family
|
|
@@ -50,16 +54,16 @@ The models are built on Qwen3.5 vision-language backbones (hybrid linear + full
|
|
| 50 |
|
| 51 |
The family comes in two scoring flavours × three sizes (0.8B / 2B / 4B):
|
| 52 |
|
| 53 |
-
- **PW (pointwise)**
|
| 54 |
-
- **LW (listwise)**
|
| 55 |
|
| 56 |
-
**LightOn-rerank-LW-2B** is the best 2B-class model of the family. Putting 4 candidates in a single forward pass lets documents attend to each other, which fixes the discriminative weakness of independent per-candidate scoring: +0.03
|
| 57 |
|
| 58 |
## Results
|
| 59 |
|
| 60 |
-
**ViDoRe V3** (visual document reranking, 8 domains × EN/FR queries),
|
| 61 |
|
| 62 |
-
| Model | Params | Scoring | ViDoRe V3 overall @10 |
|
| 63 |
|---|---|---|---|
|
| 64 |
| [LightOn-rerank-LW-4B](https://huggingface.co/lightonai/LightOn-rerank-LW-4B) | 4.5B | listwise | 0.6469 |
|
| 65 |
| *Qwen3-VL-Reranker-8B* | *8B* | *pointwise (pooling)* | *0.6423* |
|
|
@@ -71,7 +75,7 @@ The family comes in two scoring flavours × three sizes (0.8B / 2B / 4B):
|
|
| 71 |
| [LightOn-rerank-LW-0.8B](https://huggingface.co/lightonai/LightOn-rerank-LW-0.8B) | 0.85B | listwise | 0.5825 |
|
| 72 |
| [LightOn-rerank-PW-0.8B](https://huggingface.co/lightonai/LightOn-rerank-PW-0.8B) | 0.85B | pointwise | 0.4820 |
|
| 73 |
|
| 74 |
-
### ViDoRe V3 detail (
|
| 75 |
|
| 76 |
| Domain | EN @5 | EN @10 | FR @5 | FR @10 |
|
| 77 |
|---|---|---|---|---|
|
|
@@ -85,31 +89,30 @@ The family comes in two scoring flavours × three sizes (0.8B / 2B / 4B):
|
|
| 85 |
| physics | 0.4596 | 0.4884 | 0.4706 | 0.4988 |
|
| 86 |
| **mean** | **0.6246** | **0.6401** | **0.5949** | **0.6131** |
|
| 87 |
|
| 88 |
-
Overall @10: **0.6266** (EN 0.6401 / FR 0.6131)
|
| 89 |
|
| 90 |
-
###
|
| 91 |
|
| 92 |
-
|
| 93 |
-
|---|---|---|
|
| 94 |
-
| ViDoRe V2, mean NDCG@10 (ColQwen2.5 first stage) | 0.8583 | jina-reranker-m0: 0.8596; MonoQwen2-VL-v0.1: 0.8454 |
|
| 95 |
-
| BEIR 15 datasets, clean mean NDCG@10 (jina-embeddings-v3 first stage) | 0.5433 | jina-reranker-m0: 0.5677; Qwen3-VL-Reranker-2B: 0.5025 |
|
| 96 |
-
| BEIR 15 datasets, clean mean NDCG@10 (BM25 first stage) | 0.5040 | jina-reranker-m0: 0.5397; Qwen3-VL-Reranker-2B: 0.4815 |
|
| 97 |
|
| 98 |
-
|
|
|
|
|
|
|
|
|
|
| 99 |
|
| 100 |
## Model Details
|
| 101 |
|
| 102 |
-
- **Model type:** multimodal cross-encoder reranker
|
| 103 |
- **Base model:** [Qwen/Qwen3.5-2B](https://huggingface.co/Qwen/Qwen3.5-2B) (Qwen3.5 hybrid linear + full attention VLM)
|
| 104 |
- **Parameters:** ≈2.2B (bfloat16, 4.4 GB)
|
| 105 |
-
- **Inputs:** query (text) + candidate document(s)
|
| 106 |
-
- **Fine-tuning:** joint text+vision LoRA (r=32, α=32, rsLoRA
|
| 107 |
- **Data:** gold ranking permutations built from labelled pos/hard-neg structure (no teacher): 107k text groups (NQ, TriviaQA, MSMARCO) + 106k visual query–page groups (ColPali-family hard negatives at ranks [0, 5, 10])
|
| 108 |
- **Languages:** English (training), French (zero-shot transfer)
|
| 109 |
- **Requirements:** `transformers >= 5.4.0` (`qwen3_5` architecture)
|
| 110 |
- **Internal experiment ID:** `exp34full`
|
| 111 |
|
| 112 |
-
## Usage
|
| 113 |
|
| 114 |
The model ranks **4 candidates per prompt** by generating a permutation string such as `[2] > [1] > [4] > [3]`. Candidate pools larger than 4 are ranked with a sliding window (window 4, stride 2) moving from the bottom of the list to the top, so the best candidates bubble up to the front. If a generation cannot be parsed, fall back to the input order (observed fallback rate in our evals: ≈0.01%).
|
| 115 |
|
|
@@ -122,7 +125,7 @@ model_id = "lightonai/LightOn-rerank-LW-2B"
|
|
| 122 |
model = AutoModelForImageTextToText.from_pretrained(
|
| 123 |
model_id,
|
| 124 |
dtype=torch.bfloat16,
|
| 125 |
-
attn_implementation="flash_attention_2", # optional
|
| 126 |
device_map="cuda",
|
| 127 |
).eval()
|
| 128 |
processor = AutoProcessor.from_pretrained(model_id)
|
|
@@ -197,12 +200,11 @@ If a window has fewer than 4 candidates, pad it by repeating the last candidate
|
|
| 197 |
|
| 198 |
- Cross-document attention is the key architectural ingredient: a listwise loss over *independently scored* documents regressed vision performance in our ablations, while generative listwise (all 4 documents in one prompt) improves it.
|
| 199 |
- Training data is English-only. French works zero-shot (the backbone is multilingual) but is slightly behind English on average.
|
| 200 |
-
-
|
| 201 |
-
- BEIR contamination flag: NQ and MSMARCO are part of the text training data; headline text figures use clean means that exclude them.
|
| 202 |
|
| 203 |
## The LightOn-rerank family
|
| 204 |
|
| 205 |
-
| Model | Backbone | Scoring | ViDoRe V3 @10 |
|
| 206 |
|---|---|---|---|
|
| 207 |
| [LightOn-rerank-PW-0.8B](https://huggingface.co/lightonai/LightOn-rerank-PW-0.8B) | Qwen3.5-0.8B | pointwise | 0.4820 |
|
| 208 |
| [LightOn-rerank-LW-0.8B](https://huggingface.co/lightonai/LightOn-rerank-LW-0.8B) | Qwen3.5-0.8B | listwise | 0.5825 |
|
|
|
|
| 40 |
<a href="https://huggingface.co/lightonai/LightOn-rerank-LW-4B">LW-4B</a>
|
| 41 |
</p>
|
| 42 |
|
| 43 |
+
<div align="center">
|
| 44 |
+
<img src="rerank.png" alt="Reranking: the second stage that puts the best text and image candidates on top" width="560">
|
| 45 |
+
</div>
|
| 46 |
+
|
| 47 |
---
|
| 48 |
|
| 49 |
## About the LightOn-rerank family
|
|
|
|
| 54 |
|
| 55 |
The family comes in two scoring flavours × three sizes (0.8B / 2B / 4B):
|
| 56 |
|
| 57 |
+
- **PW (pointwise)**: each candidate is scored independently. The model judges whether the document answers the query, and the score is `logit("Yes") − logit("No")`. One forward pass per candidate and no generation, so it is simple to serve (vLLM-compatible) and embarrassingly parallel.
|
| 58 |
+
- **LW (listwise)**: generative listwise ranking, where 4 candidates are placed in a single prompt and the model generates a permutation (`[2] > [4] > [1] > [3]`). Larger candidate pools are ranked with a sliding window (window 4, stride 2, bottom-to-top). Cross-document attention makes LW markedly stronger on hard visual reranking, and unlike pointwise scoring it keeps improving with backbone size.
|
| 59 |
|
| 60 |
+
**LightOn-rerank-LW-2B** is the best 2B-class model of the family. Putting 4 candidates in a single forward pass lets documents attend to each other, which fixes the discriminative weakness of independent per-candidate scoring: +0.03 nDCG@10 on ViDoRe V3 over the pointwise sibling with identical backbone and negatives, winning 14 of 16 splits.
|
| 61 |
|
| 62 |
## Results
|
| 63 |
|
| 64 |
+
**ViDoRe V3** (visual document reranking, 8 domains × EN/FR queries), overall nDCG@10, ColQwen2.5-v0.2 first stage, retrieve 100 / rerank 100. All models, including baselines, were re-evaluated under this same two-stage protocol, so numbers are mutually comparable but not comparable to vendor-reported end-to-end results.
|
| 65 |
|
| 66 |
+
| Model | Params | Scoring | ViDoRe V3 overall nDCG@10 |
|
| 67 |
|---|---|---|---|
|
| 68 |
| [LightOn-rerank-LW-4B](https://huggingface.co/lightonai/LightOn-rerank-LW-4B) | 4.5B | listwise | 0.6469 |
|
| 69 |
| *Qwen3-VL-Reranker-8B* | *8B* | *pointwise (pooling)* | *0.6423* |
|
|
|
|
| 75 |
| [LightOn-rerank-LW-0.8B](https://huggingface.co/lightonai/LightOn-rerank-LW-0.8B) | 0.85B | listwise | 0.5825 |
|
| 76 |
| [LightOn-rerank-PW-0.8B](https://huggingface.co/lightonai/LightOn-rerank-PW-0.8B) | 0.85B | pointwise | 0.4820 |
|
| 77 |
|
| 78 |
+
### ViDoRe V3 detail (nDCG, ColQwen2.5 first stage, rerank-100, sliding window 4/2)
|
| 79 |
|
| 80 |
| Domain | EN @5 | EN @10 | FR @5 | FR @10 |
|
| 81 |
|---|---|---|---|---|
|
|
|
|
| 89 |
| physics | 0.4596 | 0.4884 | 0.4706 | 0.4988 |
|
| 90 |
| **mean** | **0.6246** | **0.6401** | **0.5949** | **0.6131** |
|
| 91 |
|
| 92 |
+
Overall nDCG@10: **0.6266** (EN 0.6401 / FR 0.6131), the best 2B-class result under this protocol (+0.033 over the official Qwen3-VL-Reranker-2B, +0.035 over jina-reranker-m0). On the easier ViDoRe V2 benchmark (same protocol), mean nDCG@10 is **0.8583**, in the same range as jina-reranker-m0 (0.8596) and above MonoQwen2-VL-v0.1 (0.8454).
|
| 93 |
|
| 94 |
+
### BEIR results (text reranking)
|
| 95 |
|
| 96 |
+
15 datasets, nDCG@10, retrieve 100 / rerank 100, all models re-evaluated under the same protocol. The decontaminated mean excludes NQ and MSMARCO (present in the training data).
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
|
| 98 |
+
| First stage | LightOn-rerank-LW-2B | jina-reranker-m0 | Qwen3-VL-Reranker-2B |
|
| 99 |
+
|---|---|---|---|
|
| 100 |
+
| jina-embeddings-v3 (decontaminated mean) | 0.5433 | **0.5677** | 0.5025 |
|
| 101 |
+
| BM25 (decontaminated mean) | 0.5040 | **0.5397** | 0.4815 |
|
| 102 |
|
| 103 |
## Model Details
|
| 104 |
|
| 105 |
+
- **Model type:** multimodal cross-encoder reranker (**generative listwise**: 4 candidates per prompt, ranked by generating a permutation; sliding window (4, stride 2) for larger pools)
|
| 106 |
- **Base model:** [Qwen/Qwen3.5-2B](https://huggingface.co/Qwen/Qwen3.5-2B) (Qwen3.5 hybrid linear + full attention VLM)
|
| 107 |
- **Parameters:** ≈2.2B (bfloat16, 4.4 GB)
|
| 108 |
+
- **Inputs:** query (text) + candidate document(s): text passage **or** page image
|
| 109 |
+
- **Fine-tuning:** joint text+vision LoRA (r=32, α=32, rsLoRA, merged into the released weights), mixed-modality batches (2 text + 2 vision groups per micro-batch), vision loss weight 1.3, lr 5e-5, warmup 30%, 1 epoch (419 steps)
|
| 110 |
- **Data:** gold ranking permutations built from labelled pos/hard-neg structure (no teacher): 107k text groups (NQ, TriviaQA, MSMARCO) + 106k visual query–page groups (ColPali-family hard negatives at ranks [0, 5, 10])
|
| 111 |
- **Languages:** English (training), French (zero-shot transfer)
|
| 112 |
- **Requirements:** `transformers >= 5.4.0` (`qwen3_5` architecture)
|
| 113 |
- **Internal experiment ID:** `exp34full`
|
| 114 |
|
| 115 |
+
## Usage: generative listwise reranking
|
| 116 |
|
| 117 |
The model ranks **4 candidates per prompt** by generating a permutation string such as `[2] > [1] > [4] > [3]`. Candidate pools larger than 4 are ranked with a sliding window (window 4, stride 2) moving from the bottom of the list to the top, so the best candidates bubble up to the front. If a generation cannot be parsed, fall back to the input order (observed fallback rate in our evals: ≈0.01%).
|
| 118 |
|
|
|
|
| 125 |
model = AutoModelForImageTextToText.from_pretrained(
|
| 126 |
model_id,
|
| 127 |
dtype=torch.bfloat16,
|
| 128 |
+
attn_implementation="flash_attention_2", # optional, remove if flash-attn is not installed
|
| 129 |
device_map="cuda",
|
| 130 |
).eval()
|
| 131 |
processor = AutoProcessor.from_pretrained(model_id)
|
|
|
|
| 200 |
|
| 201 |
- Cross-document attention is the key architectural ingredient: a listwise loss over *independently scored* documents regressed vision performance in our ablations, while generative listwise (all 4 documents in one prompt) improves it.
|
| 202 |
- Training data is English-only. French works zero-shot (the backbone is multilingual) but is slightly behind English on average.
|
| 203 |
+
- BEIR contamination flag: NQ and MSMARCO are part of the text training data; headline text figures use decontaminated means that exclude them.
|
|
|
|
| 204 |
|
| 205 |
## The LightOn-rerank family
|
| 206 |
|
| 207 |
+
| Model | Backbone | Scoring | ViDoRe V3 overall nDCG@10 |
|
| 208 |
|---|---|---|---|
|
| 209 |
| [LightOn-rerank-PW-0.8B](https://huggingface.co/lightonai/LightOn-rerank-PW-0.8B) | Qwen3.5-0.8B | pointwise | 0.4820 |
|
| 210 |
| [LightOn-rerank-LW-0.8B](https://huggingface.co/lightonai/LightOn-rerank-LW-0.8B) | Qwen3.5-0.8B | listwise | 0.5825 |
|
rerank.png
ADDED
|
Git LFS Details
|