ameliechatelain commited on
Commit
58807b1
Β·
verified Β·
1 Parent(s): 6ee5f2c

Add model card

Browse files
Files changed (1) hide show
  1. README.md +214 -0
README.md ADDED
@@ -0,0 +1,214 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ language:
4
+ - en
5
+ - fr
6
+ base_model:
7
+ - Qwen/Qwen3.5-2B
8
+ pipeline_tag: image-text-to-text
9
+ library_name: transformers
10
+ tags:
11
+ - reranker
12
+ - cross-encoder
13
+ - multimodal
14
+ - text-ranking
15
+ - document-reranking
16
+ - vidore
17
+ - beir
18
+ ---
19
+
20
+ <div align="center">
21
+ <img src="https://cdn-uploads.huggingface.co/production/uploads/609bbe2f4932693ca2009d6a/kbQOAarw0eaApow3M9HIl.png" alt="LightOn" width="512">
22
+
23
+ [![Website](https://img.shields.io/badge/LightOn-Website-blue?logo=google-chrome)](https://lighton.ai)
24
+ [![LinkedIn](https://img.shields.io/badge/LightOn-LinkedIn-0A66C2?logo=linkedin)](https://www.linkedin.com/company/lighton/)
25
+ [![X](https://img.shields.io/badge/@LightOnIO-X-black?logo=x)](https://x.com/LightOnIO)
26
+
27
+ πŸ“ Blog post: *coming soon* <!-- TODO: add blog post link -->
28
+
29
+ </div>
30
+
31
+ <h1 align="center">LightOn-rerank-PW-2B</h1>
32
+ <h3 align="center">Unified Text + Visual Document Reranker by LightOn</h3>
33
+
34
+ <p align="center">
35
+ <a href="https://huggingface.co/lightonai/LightOn-rerank-PW-0.8B">PW-0.8B</a> |
36
+ <a href="https://huggingface.co/lightonai/LightOn-rerank-LW-0.8B">LW-0.8B</a> |
37
+ <a href="https://huggingface.co/lightonai/LightOn-rerank-PW-2B">PW-2B</a> |
38
+ <a href="https://huggingface.co/lightonai/LightOn-rerank-LW-2B">LW-2B</a> |
39
+ <a href="https://huggingface.co/lightonai/LightOn-rerank-PW-4B">PW-4B</a> |
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
46
+
47
+ Production retrieval pipelines usually need two rerankers: one for text passages and one for visual documents (PDF pages, slides, scans). **LightOn-rerank** models are *unified* cross-encoder rerankers: a single model scores both text passages and document page images against a query, on top of any first-stage retriever (BM25, dense embeddings, or ColPali-family late-interaction models).
48
+
49
+ The models are built on Qwen3.5 vision-language backbones (hybrid linear + full attention) and jointly fine-tuned on text and visual reranking data with mixed-modality batches (LoRA, merged into the released weights). Training data is English-only; French performance transfers zero-shot from the multilingual backbone.
50
+
51
+ The family comes in two scoring flavours Γ— three sizes (0.8B / 2B / 4B):
52
+
53
+ - **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, no generation β€” simple to serve (vLLM-compatible) and embarrassingly parallel.
54
+ - **LW (listwise)** β€” generative listwise ranking: 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.
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 β€” with none of the usual trade-off between the two modalities, and the serving simplicity of independent per-candidate scoring.
57
+
58
+ ## Results
59
+
60
+ **ViDoRe V3** (visual document reranking, 8 domains Γ— EN/FR queries), 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.
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* |
66
+ | [LightOn-rerank-LW-2B](https://huggingface.co/lightonai/LightOn-rerank-LW-2B) | 2.2B | listwise | 0.6266 |
67
+ | **LightOn-rerank-PW-2B (this model)** | 2.2B | pointwise | **0.5987** |
68
+ | [LightOn-rerank-PW-4B](https://huggingface.co/lightonai/LightOn-rerank-PW-4B) | 4.5B | pointwise | 0.5980 |
69
+ | *jina-reranker-m0* | *2.4B* | *pointwise* | *0.5939* |
70
+ | *Qwen3-VL-Reranker-2B* | *2B* | *pointwise (pooling)* | *0.5918* |
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 (NDCG, ColQwen2.5 first stage, rerank-100)
75
+
76
+ | Domain | EN @5 | EN @10 | FR @5 | FR @10 |
77
+ |---|---|---|---|---|
78
+ | finance_en | 0.5893 | 0.6113 | 0.5585 | 0.5716 |
79
+ | finance_fr | 0.4643 | 0.4934 | 0.4947 | 0.5260 |
80
+ | computer_science | 0.7239 | 0.7398 | 0.6814 | 0.7047 |
81
+ | hr | 0.6570 | 0.6665 | 0.5996 | 0.6139 |
82
+ | energy | 0.6634 | 0.6921 | 0.6735 | 0.7013 |
83
+ | industrial | 0.5420 | 0.5520 | 0.4808 | 0.4864 |
84
+ | pharmaceuticals | 0.6298 | 0.6385 | 0.5958 | 0.6039 |
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
+ ### Other benchmarks (same fixed-first-stage protocol)
91
+
92
+ | Benchmark | LightOn-rerank-PW-2B | Best 2B-class baseline |
93
+ |---|---|---|
94
+ | ViDoRe V2, mean NDCG@10 (ColQwen2.5 first stage) | 0.8558 | jina-reranker-m0: 0.8596; MonoQwen2-VL-v0.1: 0.8454; Qwen3-VL-Reranker-2B: 0.8428 |
95
+ | BEIR 15 datasets, clean mean NDCG@10 (jina-embeddings-v3 first stage) | 0.5227 | jina-reranker-m0: 0.5677; Qwen3-VL-Reranker-2B: 0.5025 |
96
+ | BEIR 15 datasets, clean mean NDCG@10 (BM25 first stage) | 0.4968 | jina-reranker-m0: 0.5397; Qwen3-VL-Reranker-2B: 0.4815 |
97
+
98
+ Clean mean excludes the two contaminated datasets (NQ, MSMARCO). On text it sits between the two strongest 2B baselines; on visual reranking it matches or beats every 2B-class model β€” jina-reranker-m0 is the only baseline that is close on both, and it trails on ViDoRe V3 (0.5939 vs 0.5987).
99
+
100
+ ## Model Details
101
+
102
+ - **Model type:** multimodal cross-encoder reranker β€” **pointwise**: each candidate is scored independently as `logit("Yes") βˆ’ logit("No")`
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) β€” text passage **or** page image
106
+ - **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)
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 β€” pointwise reranking
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 (`RERANKER_SYSTEM_V2` / `RERANKER_TEXT_V2` / `RERANKER_VISION_V2`) β€” these will be published alongside the blog post and **must** be used verbatim for best results.
115
+
116
+ ```python
117
+ import torch
118
+ from transformers import AutoModelForImageTextToText, AutoProcessor
119
+
120
+ 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",
125
+ device_map="cuda",
126
+ ).eval()
127
+ processor = AutoProcessor.from_pretrained(model_id)
128
+ processor.tokenizer.padding_side = "left" # scores are read at the last position
129
+
130
+ YES_TOKEN_ID = 9175 # "Yes"
131
+ NO_TOKEN_ID = 2665 # "No"
132
+
133
+ SYSTEM_PROMPT = ... # RERANKER_SYSTEM_V2 β€” released with the blog post
134
+ USER_TEMPLATE = ... # RERANKER_TEXT_V2, with {query} and {doc} fields
135
+
136
+ query = "What is late interaction in neural information retrieval?"
137
+ documents = [
138
+ "ColBERT computes token-level query-document interactions at search time...",
139
+ "The Eiffel Tower is located on the Champ de Mars in Paris.",
140
+ ]
141
+
142
+ texts = [
143
+ processor.apply_chat_template(
144
+ [
145
+ {"role": "system", "content": SYSTEM_PROMPT},
146
+ {"role": "user", "content": USER_TEMPLATE.format(query=query, doc=doc)},
147
+ ],
148
+ tokenize=False,
149
+ add_generation_prompt=True,
150
+ )
151
+ for doc in documents
152
+ ]
153
+ inputs = processor(
154
+ text=texts, return_tensors="pt", padding=True, truncation=True, max_length=2048
155
+ ).to(model.device)
156
+ with torch.inference_mode():
157
+ logits = model(**inputs).logits[:, -1]
158
+ scores = (logits[:, YES_TOKEN_ID] - logits[:, NO_TOKEN_ID]).tolist()
159
+
160
+ ranked = sorted(zip(scores, documents), reverse=True)
161
+ ```
162
+
163
+ To score a **page image** instead of a text passage, replace the user message with:
164
+
165
+ ```python
166
+ {"role": "user", "content": [
167
+ {"type": "image", "image": page_image}, # PIL.Image
168
+ {"type": "text", "text": VISION_TEMPLATE.format(query=query)}, # RERANKER_VISION_V2
169
+ ]}
170
+ ```
171
+
172
+ and pass `images=[page_image, ...]` to the processor call.
173
+
174
+ ### Serving with vLLM
175
+
176
+ ```bash
177
+ vllm serve lightonai/LightOn-rerank-PW-2B --trust-remote-code --max-model-len 16384
178
+ ```
179
+
180
+ ```python
181
+ resp = client.chat.completions.create(
182
+ model="lightonai/LightOn-rerank-PW-2B",
183
+ messages=messages, # same system + user messages as above
184
+ max_tokens=1,
185
+ logprobs=True,
186
+ top_logprobs=20,
187
+ temperature=0.0,
188
+ )
189
+ top = resp.choices[0].logprobs.content[0].top_logprobs
190
+ lp = {t.token: t.logprob for t in top}
191
+ score = lp.get("Yes", -100.0) - lp.get("No", -100.0)
192
+ ```
193
+
194
+ Full-page document images can exceed 8k tokens β€” keep `--max-model-len` at 16384 or higher when reranking page images.
195
+
196
+ ## Notes & limitations
197
+
198
+ - 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.
199
+ - Training data is English-only. French works zero-shot (the backbone is multilingual) but is slightly behind English on average.
200
+ - Vision hard negatives were mined with ColPali-family retrievers; the model pairs best with a ColPali-family first stage (e.g. ColQwen2.5) for visual reranking.
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 |
209
+ | [LightOn-rerank-PW-2B](https://huggingface.co/lightonai/LightOn-rerank-PW-2B) | Qwen3.5-2B | pointwise | 0.5987 |
210
+ | [LightOn-rerank-LW-2B](https://huggingface.co/lightonai/LightOn-rerank-LW-2B) | Qwen3.5-2B | listwise | 0.6266 |
211
+ | [LightOn-rerank-PW-4B](https://huggingface.co/lightonai/LightOn-rerank-PW-4B) | Qwen3.5-4B | pointwise | 0.5980 |
212
+ | [LightOn-rerank-LW-4B](https://huggingface.co/lightonai/LightOn-rerank-LW-4B) | Qwen3.5-4B | listwise | **0.6469** |
213
+
214
+ Rule of thumb: **LW** models are stronger at every size (and the gap grows with size); **PW** models are cheaper to serve and score candidates independently. For the best quality pick [LW-4B](https://huggingface.co/lightonai/LightOn-rerank-LW-4B); for the best quality/cost trade-off pick [LW-2B](https://huggingface.co/lightonai/LightOn-rerank-LW-2B); for maximum throughput on text-heavy workloads pick a PW model.