NohTow commited on
Commit
631f7b7
·
verified ·
1 Parent(s): 7ae6c85

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +349 -0
README.md ADDED
@@ -0,0 +1,349 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - ColBERT
4
+ - PyLate
5
+ - sentence-transformers
6
+ - sentence-similarity
7
+ - feature-extraction
8
+ pipeline_tag: sentence-similarity
9
+ library_name: PyLate
10
+ license: apache-2.0
11
+ language:
12
+ - en
13
+ ---
14
+
15
+ <div align="center">
16
+
17
+ <img src="https://cdn-uploads.huggingface.co/production/uploads/609bbe2f4932693ca2009d6a/wAztcBQeYSvCcj52mVK_w.png" alt="LightOn" width="512">
18
+
19
+ <h1 align="center">Party is over: regularizing ColBERT models to fix efficient ANN methods</h1>
20
+
21
+ <h3 align="center">LateOn-regularized</h3>
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
+ 📚 [Collection](https://huggingface.co/collections/lightonai/denseon-and-lateon) | 📝 [Blog](https://huggingface.co/blog/lightonai/lateon-regularization)
28
+
29
+ </div>
30
+
31
+
32
+
33
+ <p align="center">
34
+ <a href="https://huggingface.co/lightonai/DenseOn">DenseOn</a> |
35
+ <a href="https://huggingface.co/lightonai/LateOn-regularized">LateOn-regularized</a> |
36
+ <a href="https://huggingface.co/lightonai/LateOn">LateOn</a> |
37
+ <a href="https://github.com/lightonai/pylate">PyLate</a> |
38
+ <a href="https://github.com/lightonai/fast-plaid">FastPLAID</a>
39
+ </p>
40
+
41
+ ---
42
+
43
+ ## Overview
44
+
45
+ **LateOn-regularized** is a ColBERT (multi-vector) retrieval model built on the [LateOn](https://huggingface.co/lightonai/LateOn) methology, trained by [LightOn](https://lighton.ai) using [PyLate](https://github.com/lightonai/pylate). It applies a novel Straight-Through Estimator (STE) regularization during supervised fine-tuning that makes the model compatible with efficient ANN candidate-generation methods like [MUVERA](https://arxiv.org/abs/2405.19504) and [SMVE](https://www.topk.io/blog/20260311-smve-multi-vector-retrieval), **while fully preserving PLAID retrieval performance**.
46
+
47
+ This model is the recommended choice when you plan to use MUVERA or SMVE for candidate generation in your ColBERT retrieval pipeline. If you only use PLAID indexes, [LateOn](https://huggingface.co/lightonai/LateOn) is equivalent and equally recommended.
48
+
49
+ For full details on the problem, methodology, and analysis, please read our [blog post](https://huggingface.co/blog/lightonai/lateon-regularization).
50
+
51
+ ## Why This Model Exists
52
+
53
+ Recent ColBERT models (including LateOn) produce highly **anisotropic** token embeddings: nearly all vectors cluster into a narrow cone with mean pairwise cosine similarity as high as 0.95. While this does not affect PLAID-based retrieval, it breaks ANN methods like MUVERA and SMVE that rely on random projections to separate embeddings. When all vectors point in roughly the same direction, random hyperplanes and rotations cannot distinguish them, making candidate generation essentially random.
54
+
55
+ **Mean-centering** the embeddings removes the dominant shared direction and helps significantly, but isn't enough on its own as the residual geometry still doesn't project cleanly.
56
+
57
+ **STE-based regularization** solves this by directly optimizing the model to produce discriminative representations after MUVERA/SMVE projection. During training, we build the true projected codes in the forward pass and compute a contrastive loss on them, then use the Straight-Through Estimator to pass gradients through the non-differentiable discretization steps (SimHash bucketing in MUVERA, top-k sparsification in SMVE). The total loss is a weighted combination of the standard MaxSim contrastive loss and the projected-representation contrastive loss.
58
+
59
+ Surprisingly, the regularization does not make the space more isotropic. Instead, it teaches the model to **concentrate discriminative information into fewer effective dimensions** that random projections can capture efficiently, **the opposite of what isotropy-based intuition would predict**. The regularization also transfers across methods (a MUVERA-trained model helps SMVE and vice-versa), across random seeds, and across hyperparameter configurations.
60
+
61
+ See the [blog post](https://huggingface.co/blog/lightonai/lateon-regularization) for the complete analysis.
62
+
63
+ ## Results
64
+
65
+ > **Important:** All results below use **mean-centered** representations. We recommend always centering embeddings when using MUVERA or SMVE.
66
+
67
+ ### MUVERA / SMVE Retrieval (8 BEIR datasets average NDCG@10)
68
+
69
+ `rk=k` means the top-k candidates from MUVERA/SMVE are reranked with full MaxSim.
70
+
71
+ | Model | Center | PLAID | Method | rk=0 | rk=50 | rk=100 | rk=200 | rk=400 | rk=1000 |
72
+ |---|---|---|---|---|---|---|---|---|---|
73
+ | LateOn | no | 55.28 | MUVERA | 2.89 (-52.4) | 9.46 (-45.8) | 12.53 (-42.8) | 15.87 (-39.4) | 20.29 (-35.0) | 27.52 (-27.8) |
74
+ | | | | SMVE | 1.51 (-53.8) | 7.59 (-47.7) | 10.84 (-44.4) | 14.24 (-41.0) | 18.29 (-37.0) | 25.10 (-30.2) |
75
+ | LateOn | yes | 55.28 | MUVERA | 32.66 (-22.6) | 46.22 (-9.1) | 48.68 (-6.6) | 50.01 (-5.3) | 50.85 (-4.4) | 52.09 (-3.2) |
76
+ | | | | SMVE | 21.18 (-34.1) | 37.39 (-17.9) | 40.90 (-14.4) | 43.52 (-11.8) | 45.83 (-9.5) | 48.61 (-6.7) |
77
+ | **LateOn-regularized (MUVERA)** | yes | **55.72** | MUVERA | **40.80** (-14.9) | **51.60** (-4.1) | **52.37** (-3.4) | **53.02** (-2.7) | **53.60** (-2.1) | **53.87** (-1.9) |
78
+ | | | | SMVE | 37.18 (-18.5) | 48.97 (-6.8) | 50.45 (-5.3) | 51.51 (-4.2) | 52.40 (-3.3) | 53.50 (-2.2) |
79
+ | **LateOn-regularized (SMVE)** | yes | 54.92 | MUVERA | 40.22 (-14.7) | 50.94 (-4.0) | 51.90 (-3.0) | 52.67 (-2.3) | 53.02 (-1.9) | 53.35 (-1.6) |
80
+ | | | | SMVE | **40.39** (-14.5) | **50.70** (-4.2) | **52.09** (-2.8) | **52.92** (-2.0) | **53.19** (-1.7) | **53.47** (-1.5) |
81
+
82
+ Key takeaways:
83
+
84
+ - **PLAID performance is preserved** (55.72 vs 55.28 for MUVERA-reg), confirming that regularization does not conflict with MaxSim requirements.
85
+ - **Massive improvement for MUVERA/SMVE**: centered MUVERA rk=0 goes from 32.66 → 40.80 (+8.1 points), and with rk=200 reranking the gap to full PLAID drops to just 2.7 points (note: the goal of the study was making representations better, not sweeping MUVERA/SMVE parameters to get perfect scores)
86
+ - **Cross-method transfer**: MUVERA-regularized training also boosts SMVE, and vice-versa, showing the regularization improves global compressibility rather than optimizing a single projection subspace.
87
+
88
+ ### BEIR (14 datasets, NDCG@10) — PLAID Retrieval
89
+
90
+ LateOn-regularized maintains the strong PLAID performance of the LateOn family. For full BEIR results, see the [LateOn model card](https://huggingface.co/lightonai/LateOn).
91
+
92
+ ## Related Checkpoints
93
+
94
+ | Model | Description | Link |
95
+ |:---|:---|:---|
96
+ | **LateOn-regularized** *(this card)* | STE-regularized for MUVERA/SMVE compatibility | [`lightonai/LateOn-regularized`](https://huggingface.co/lightonai/LateOn-regularized) |
97
+ | LateOn | Base supervised ColBERT model *(best for PLAID-only)* | [`lightonai/LateOn`](https://huggingface.co/lightonai/LateOn) |
98
+ | LateOn-unsupervised | Pre-training only | [`lightonai/LateOn-unsupervised`](https://huggingface.co/lightonai/LateOn-unsupervised) |
99
+ | DenseOn | Single-vector counterpart | [`lightonai/DenseOn`](https://huggingface.co/lightonai/DenseOn) |
100
+
101
+ ## Model Details
102
+
103
+ ### Model Description
104
+ - **Model Type:** PyLate ColBERT model
105
+ - **Base model:** [LateOn-unsupervised](https://huggingface.co/lightonai/LateOn-unsupervised) (ModernBERT-base)
106
+ - **Regularization:** STE-based contrastive loss on MUVERA projected representations
107
+ - **Document Length:** 300 tokens
108
+ - **Query Length:** 32 tokens
109
+ - **Output Dimensionality:** 128 tokens
110
+ - **Similarity Function:** MaxSim
111
+ - **Recommended:** Use mean-centered embeddings for MUVERA/SMVE
112
+ - **Language:** English
113
+ - **License:** Apache 2.0
114
+
115
+ ### Model Sources
116
+
117
+ - **Documentation:** [PyLate Documentation](https://lightonai.github.io/pylate/)
118
+ - **Repository:** [PyLate on GitHub](https://github.com/lightonai/pylate)
119
+ - **Hugging Face:** [PyLate models on Hugging Face](https://huggingface.co/models?library=PyLate)
120
+
121
+ ### Full Model Architecture
122
+
123
+ ```
124
+ ColBERT(
125
+ (0): Transformer({'max_seq_length': 299, 'do_lower_case': False, 'architecture': 'ModernBertModel'})
126
+ (1): Dense({'in_features': 768, 'out_features': 1536, 'bias': False, 'activation_function': 'torch.nn.modules.linear.Identity', 'use_residual': True})
127
+ (2): Dense({'in_features': 1536, 'out_features': 768, 'bias': False, 'activation_function': 'torch.nn.modules.linear.Identity', 'use_residual': True})
128
+ (3): Dense({'in_features': 768, 'out_features': 128, 'bias': False, 'activation_function': 'torch.nn.modules.linear.Identity', 'use_residual': False})
129
+ )
130
+ ```
131
+
132
+ ## Usage
133
+
134
+ First install the PyLate library:
135
+
136
+ ```bash
137
+ pip install -U pylate
138
+ ```
139
+
140
+ ### Retrieval
141
+
142
+ Use this model with PyLate to index and retrieve documents. The index uses [FastPLAID](https://github.com/lightonai/fast-plaid) for efficient similarity search.
143
+
144
+ #### Indexing documents
145
+
146
+ Load the ColBERT model and initialize the PLAID index, then encode and index your documents:
147
+
148
+ ```python
149
+ from pylate import indexes, models, retrieve
150
+
151
+ # Step 1: Load the ColBERT model
152
+ model = models.ColBERT(
153
+ model_name_or_path="lightonai/LateOn-regularized",
154
+ )
155
+
156
+ # Step 2: Initialize the PLAID index
157
+ index = indexes.PLAID(
158
+ index_folder="pylate-index",
159
+ index_name="index",
160
+ override=True, # This overwrites the existing index if any
161
+ )
162
+
163
+ # Step 3: Encode the documents
164
+ documents_ids = ["1", "2", "3"]
165
+ documents = ["document 1 text", "document 2 text", "document 3 text"]
166
+
167
+ documents_embeddings = model.encode(
168
+ documents,
169
+ batch_size=32,
170
+ is_query=False, # Ensure that it is set to False to indicate that these are documents, not queries
171
+ show_progress_bar=True,
172
+ )
173
+
174
+ # Step 4: Add document embeddings to the index by providing embeddings and corresponding ids
175
+ index.add_documents(
176
+ documents_ids=documents_ids,
177
+ documents_embeddings=documents_embeddings,
178
+ )
179
+ ```
180
+
181
+ Note that you do not have to recreate the index and encode the documents every time. Once you have created an index and added the documents, you can re-use the index later by loading it:
182
+
183
+ ```python
184
+ # To load an index, simply instantiate it with the correct folder/name and without overriding it
185
+ index = indexes.PLAID(
186
+ index_folder="pylate-index",
187
+ index_name="index",
188
+ )
189
+ ```
190
+
191
+ #### Retrieving top-k documents for queries
192
+
193
+ Once the documents are indexed, you can retrieve the top-k most relevant documents for a given set of queries.
194
+ To do so, initialize the ColBERT retriever with the index you want to search in, encode the queries and then retrieve the top-k documents to get the top matches ids and relevance scores:
195
+
196
+ ```python
197
+ # Step 1: Initialize the ColBERT retriever
198
+ retriever = retrieve.ColBERT(index=index)
199
+
200
+ # Step 2: Encode the queries
201
+ queries_embeddings = model.encode(
202
+ ["query for document 3", "query for document 1"],
203
+ batch_size=32,
204
+ is_query=True, # Ensure that it is set to True to indicate that these are queries
205
+ show_progress_bar=True,
206
+ )
207
+
208
+ # Step 3: Retrieve top-k documents
209
+ scores = retriever.retrieve(
210
+ queries_embeddings=queries_embeddings,
211
+ k=10, # Retrieve the top 10 matches for each query
212
+ )
213
+ ```
214
+
215
+ ### Reranking
216
+
217
+ If you only want to use the ColBERT model to perform reranking on top of your first-stage retrieval pipeline without building an index, you can simply use rank function and pass the queries and documents to rerank:
218
+
219
+ ```python
220
+ from pylate import rank, models
221
+
222
+ queries = [
223
+ "query A",
224
+ "query B",
225
+ ]
226
+
227
+ documents = [
228
+ ["document A", "document B"],
229
+ ["document 1", "document C", "document B"],
230
+ ]
231
+
232
+ documents_ids = [
233
+ [1, 2],
234
+ [1, 3, 2],
235
+ ]
236
+
237
+ model = models.ColBERT(
238
+ model_name_or_path="lightonai/LateOn-regularized",
239
+ )
240
+
241
+ queries_embeddings = model.encode(
242
+ queries,
243
+ is_query=True,
244
+ )
245
+
246
+ documents_embeddings = model.encode(
247
+ documents,
248
+ is_query=False,
249
+ )
250
+
251
+ reranked_documents = rank.rerank(
252
+ documents_ids=documents_ids,
253
+ queries_embeddings=queries_embeddings,
254
+ documents_embeddings=documents_embeddings,
255
+ )
256
+ ```
257
+
258
+ ## Training Details
259
+
260
+ ### Regularization Setup
261
+
262
+ LateOn-regularized starts from the unregularized unsupervised checkpoint and applies the same supervised training step as LateOn, with an additional STE-based regularization signal. The total loss is:
263
+
264
+ ```
265
+ L = (1 - α) × MaxSim contrastive loss + α × projected-representation contrastive loss
266
+ ```
267
+
268
+ The projected representations are built using MUVERA (R=20, k=5, d=16, FDE dim=10,240) in the forward pass, with the Straight-Through Estimator passing gradients through the non-differentiable bucketing step during backpropagation. The random projection matrices are sampled once at the start of training and kept fixed. Despite this, the regularization generalizes across different random seeds and MUVERA/SMVE hyperparameter configurations at evaluation time.
269
+
270
+ The supervised stage is lightweight — we did not even run the full 3 epochs — demonstrating that effective regularization is achievable with minimal additional compute.
271
+
272
+ ### Framework Versions
273
+ - Python: 3.11.10
274
+ - Sentence Transformers: 5.1.1
275
+ - PyLate: 1.3.4
276
+ - Transformers: 4.57.5
277
+ - PyTorch: 2.9.0+cu128
278
+ - Accelerate: 1.12.0
279
+ - Datasets: 3.6.0
280
+ - Tokenizers: 0.22.1
281
+
282
+ ## Citation
283
+
284
+ ### BibTeX
285
+
286
+ #### LateOn Regularization
287
+
288
+ ```bibtex
289
+ @misc{chaffin2026lateonregularization,
290
+ title={Party is over: regularizing ColBERT models to fix efficient ANN methods},
291
+ author={Chaffin, Antoine},
292
+ year={2026},
293
+ howpublished={\url{https://huggingface.co/blog/lightonai/lateon-regularization}},
294
+ }
295
+ ```
296
+
297
+ #### DenseOn and LateOn
298
+
299
+ ```bibtex
300
+ @misc{sourty2026denseonlateon,
301
+ title={DenseOn with the LateOn: Open State-of-the-Art Single and Multi-Vector Models},
302
+ author={Sourty, Raphael and Chaffin, Antoine and Weller, Orion and Demoura, Paulo and Chatelain, Amelie},
303
+ year={2026},
304
+ howpublished={\url{https://huggingface.co/blog/lightonai/denseon-lateon}},
305
+ }
306
+ ```
307
+
308
+ #### PyLate
309
+
310
+ ```bibtex
311
+ @inproceedings{DBLP:conf/cikm/ChaffinS25,
312
+ author = {Antoine Chaffin and
313
+ Rapha{\"{e}}l Sourty},
314
+ editor = {Meeyoung Cha and
315
+ Chanyoung Park and
316
+ Noseong Park and
317
+ Carl Yang and
318
+ Senjuti Basu Roy and
319
+ Jessie Li and
320
+ Jaap Kamps and
321
+ Kijung Shin and
322
+ Bryan Hooi and
323
+ Lifang He},
324
+ title = {PyLate: Flexible Training and Retrieval for Late Interaction Models},
325
+ booktitle = {Proceedings of the 34th {ACM} International Conference on Information
326
+ and Knowledge Management, {CIKM} 2025, Seoul, Republic of Korea, November
327
+ 10-14, 2025},
328
+ pages = {6334--6339},
329
+ publisher = {{ACM}},
330
+ year = {2025},
331
+ url = {https://github.com/lightonai/pylate},
332
+ doi = {10.1145/3746252.3761608},
333
+ }
334
+ ```
335
+
336
+ #### Sentence Transformers
337
+
338
+ ```bibtex
339
+ @inproceedings{reimers-2019-sentence-bert,
340
+ title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
341
+ author = "Reimers, Nils and Gurevych, Iryna",
342
+ booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
343
+ month = "11",
344
+ year = "2019",
345
+ publisher = "Association for Computational Linguistics",
346
+ url = "https://arxiv.org/abs/1908.10084"
347
+ }
348
+ ```
349
+