Image-Text-to-Text
Transformers
Safetensors
sentence-transformers
English
French
qwen3_5
reranker
cross-encoder
multimodal
text-ranking
document-reranking
vidore
beir
conversational
🇪🇺 Region: EU
Instructions to use lightonai/LightOn-rerank-PW-2B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use lightonai/LightOn-rerank-PW-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-PW-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-PW-2B") model = AutoModelForMultimodalLM.from_pretrained("lightonai/LightOn-rerank-PW-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]:])) - sentence-transformers
How to use lightonai/LightOn-rerank-PW-2B with sentence-transformers:
from sentence_transformers import CrossEncoder model = CrossEncoder("lightonai/LightOn-rerank-PW-2B") query = "Which planet is known as the Red Planet?" passages = [ "Venus is often called Earth's twin because of its similar size and proximity.", "Mars, known for its reddish appearance, is often referred to as the Red Planet.", "Jupiter, the largest planet in our solar system, has a prominent red spot.", "Saturn, famous for its rings, is sometimes mistaken for the Red Planet." ] scores = model.predict([(query, passage) for passage in passages]) print(scores) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use lightonai/LightOn-rerank-PW-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-PW-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-PW-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-PW-2B
- SGLang
How to use lightonai/LightOn-rerank-PW-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-PW-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-PW-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-PW-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-PW-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-PW-2B with Docker Model Runner:
docker model run hf.co/lightonai/LightOn-rerank-PW-2B
Model card edits: hero image, nDCG@10 table headers, BEIR results section, decontaminated wording
Browse files- .gitattributes +1 -0
- README.md +29 -25
- 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-PW-2B** is the pointwise flagship of the family: a single 2B model that is simultaneously competitive with dedicated text rerankers on BEIR and with vision-specialised rerankers on ViDoRe V2/V3
|
| 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,33 +89,34 @@ The family comes in two scoring flavours × three sizes (0.8B / 2B / 4B):
|
|
| 85 |
| physics | 0.4551 | 0.4851 | 0.4568 | 0.4927 |
|
| 86 |
| **mean** | **0.5906** | **0.6098** | **0.5676** | **0.5876** |
|
| 87 |
|
| 88 |
-
Overall @10: **0.5987** (EN 0.6098 / FR 0.5876).
|
| 89 |
|
| 90 |
-
###
|
| 91 |
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
|
| 95 |
-
|
|
| 96 |
-
|
|
|
|
|
| 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:** ~120k EN text queries (NQ, TriviaQA, MSMARCO) with mined hard negatives + ~118k visual query–page pairs with ColPali-family hard negatives (`dedup_120k_en_v3` + `ColPali_hard_neg_v2`)
|
| 108 |
- **Languages:** English (training), French (zero-shot transfer)
|
| 109 |
- **Requirements:** `transformers >= 5.4.0` (`qwen3_5` architecture)
|
| 110 |
- **Internal experiment ID:** `exp30`
|
| 111 |
|
| 112 |
-
## Usage
|
| 113 |
|
| 114 |
-
Each candidate is scored independently as `logit("Yes") − logit("No")` at the first generated position; sort candidates by descending score. The model was trained with a fixed system prompt and user template
|
| 115 |
|
| 116 |
```python
|
| 117 |
import torch
|
|
@@ -121,7 +126,7 @@ model_id = "lightonai/LightOn-rerank-PW-2B"
|
|
| 121 |
model = AutoModelForImageTextToText.from_pretrained(
|
| 122 |
model_id,
|
| 123 |
dtype=torch.bfloat16,
|
| 124 |
-
attn_implementation="flash_attention_2", # optional
|
| 125 |
device_map="cuda",
|
| 126 |
).eval()
|
| 127 |
processor = AutoProcessor.from_pretrained(model_id)
|
|
@@ -198,18 +203,17 @@ lp = {t.token: t.logprob for t in top}
|
|
| 198 |
score = lp.get("Yes", -100.0) - lp.get("No", -100.0)
|
| 199 |
```
|
| 200 |
|
| 201 |
-
Full-page document images can exceed 8k tokens
|
| 202 |
|
| 203 |
## Notes & limitations
|
| 204 |
|
| 205 |
-
- Pointwise scoring does not improve with backbone scale (the 4B pointwise model ties this one)
|
| 206 |
- Training data is English-only. French works zero-shot (the backbone is multilingual) but is slightly behind English on average.
|
| 207 |
-
-
|
| 208 |
-
- BEIR contamination flag: NQ and MSMARCO are part of the text training data; headline text figures use clean means that exclude them.
|
| 209 |
|
| 210 |
## The LightOn-rerank family
|
| 211 |
|
| 212 |
-
| Model | Backbone | Scoring | ViDoRe V3 @10 |
|
| 213 |
|---|---|---|---|
|
| 214 |
| [LightOn-rerank-PW-0.8B](https://huggingface.co/lightonai/LightOn-rerank-PW-0.8B) | Qwen3.5-0.8B | pointwise | 0.4820 |
|
| 215 |
| [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-PW-2B** is the pointwise flagship of the family: a single 2B model that is simultaneously competitive with dedicated text rerankers on BEIR and with vision-specialised rerankers on ViDoRe V2/V3, with none of the usual trade-off between the two modalities, and the serving simplicity of independent per-candidate scoring.
|
| 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)
|
| 79 |
|
| 80 |
| Domain | EN @5 | EN @10 | FR @5 | FR @10 |
|
| 81 |
|---|---|---|---|---|
|
|
|
|
| 89 |
| physics | 0.4551 | 0.4851 | 0.4568 | 0.4927 |
|
| 90 |
| **mean** | **0.5906** | **0.6098** | **0.5676** | **0.5876** |
|
| 91 |
|
| 92 |
+
Overall nDCG@10: **0.5987** (EN 0.6098 / FR 0.5876). On the easier ViDoRe V2 benchmark (same protocol), mean nDCG@10 is **0.8558**, in the same range as the strongest 2B-class baselines (jina-reranker-m0: 0.8596, MonoQwen2-VL-v0.1: 0.8454, Qwen3-VL-Reranker-2B: 0.8428).
|
| 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-PW-2B | jina-reranker-m0 | Qwen3-VL-Reranker-2B |
|
| 99 |
+
|---|---|---|---|
|
| 100 |
+
| jina-embeddings-v3 (decontaminated mean) | 0.5227 | **0.5677** | 0.5025 |
|
| 101 |
+
| BM25 (decontaminated mean) | 0.4968 | **0.5397** | 0.4815 |
|
| 102 |
|
| 103 |
+
On text it sits between the two strongest 2B baselines. jina-reranker-m0 is the only baseline that is close on both modalities, and it trails on ViDoRe V3 (0.5939 vs 0.5987).
|
| 104 |
|
| 105 |
## Model Details
|
| 106 |
|
| 107 |
+
- **Model type:** multimodal cross-encoder reranker (**pointwise**: each candidate is scored independently as `logit("Yes") − logit("No")`)
|
| 108 |
- **Base model:** [Qwen/Qwen3.5-2B](https://huggingface.co/Qwen/Qwen3.5-2B) (Qwen3.5 hybrid linear + full attention VLM)
|
| 109 |
- **Parameters:** ≈2.2B (bfloat16, 4.4 GB)
|
| 110 |
+
- **Inputs:** query (text) + candidate document(s): text passage **or** page image
|
| 111 |
+
- **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 1e-4, 1 epoch (465 steps)
|
| 112 |
- **Data:** ~120k EN text queries (NQ, TriviaQA, MSMARCO) with mined hard negatives + ~118k visual query–page pairs with ColPali-family hard negatives (`dedup_120k_en_v3` + `ColPali_hard_neg_v2`)
|
| 113 |
- **Languages:** English (training), French (zero-shot transfer)
|
| 114 |
- **Requirements:** `transformers >= 5.4.0` (`qwen3_5` architecture)
|
| 115 |
- **Internal experiment ID:** `exp30`
|
| 116 |
|
| 117 |
+
## Usage: pointwise reranking
|
| 118 |
|
| 119 |
+
Each candidate is scored independently as `logit("Yes") − logit("No")` at the first generated position; sort candidates by descending score. The model was trained with a fixed system prompt and user template: use them verbatim for best results.
|
| 120 |
|
| 121 |
```python
|
| 122 |
import torch
|
|
|
|
| 126 |
model = AutoModelForImageTextToText.from_pretrained(
|
| 127 |
model_id,
|
| 128 |
dtype=torch.bfloat16,
|
| 129 |
+
attn_implementation="flash_attention_2", # optional, remove if flash-attn is not installed
|
| 130 |
device_map="cuda",
|
| 131 |
).eval()
|
| 132 |
processor = AutoProcessor.from_pretrained(model_id)
|
|
|
|
| 203 |
score = lp.get("Yes", -100.0) - lp.get("No", -100.0)
|
| 204 |
```
|
| 205 |
|
| 206 |
+
Full-page document images can exceed 8k tokens, so keep `--max-model-len` at 16384 or higher when reranking page images.
|
| 207 |
|
| 208 |
## Notes & limitations
|
| 209 |
|
| 210 |
+
- Pointwise scoring does not improve with backbone scale (the 4B pointwise model ties this one). If you have the compute budget, [LightOn-rerank-LW-2B](https://huggingface.co/lightonai/LightOn-rerank-LW-2B) is +0.03 nDCG@10 on ViDoRe V3 at the same size.
|
| 211 |
- Training data is English-only. French works zero-shot (the backbone is multilingual) but is slightly behind English on average.
|
| 212 |
+
- BEIR contamination flag: NQ and MSMARCO are part of the text training data; headline text figures use decontaminated means that exclude them.
|
|
|
|
| 213 |
|
| 214 |
## The LightOn-rerank family
|
| 215 |
|
| 216 |
+
| Model | Backbone | Scoring | ViDoRe V3 overall nDCG@10 |
|
| 217 |
|---|---|---|---|
|
| 218 |
| [LightOn-rerank-PW-0.8B](https://huggingface.co/lightonai/LightOn-rerank-PW-0.8B) | Qwen3.5-0.8B | pointwise | 0.4820 |
|
| 219 |
| [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
|