vishesh-t27 commited on
Commit
4e35cdd
·
verified ·
1 Parent(s): 4fb7112

Clarify re-normalization after truncation for dot product vs cosine

Browse files
Files changed (1) hide show
  1. README.md +1 -1
README.md CHANGED
@@ -214,7 +214,7 @@ print(model.similarity(embs, embs))
214
 
215
  EmbeddingNandi-150M is trained with Matryoshka Representation Learning, so the 768-dimensional vector can be shortened by keeping only its first values. The supported sizes are 768, 512, 256 and 128 (the sizes the model was trained with; use one of these). Shorter vectors use less storage and make search faster, at some cost in quality.
216
 
217
- * **Re-normalize after truncating:** a cut unit-length vector is no longer unit length, so normalize it again before using it for cosine similarity.
218
  * **Queries and documents must use the same size.**
219
 
220
  Pass `truncate_dim` and `normalize_embeddings=True` to let Sentence Transformers do both:
 
214
 
215
  EmbeddingNandi-150M is trained with Matryoshka Representation Learning, so the 768-dimensional vector can be shortened by keeping only its first values. The supported sizes are 768, 512, 256 and 128 (the sizes the model was trained with; use one of these). Shorter vectors use less storage and make search faster, at some cost in quality.
216
 
217
+ * **Re-normalize after truncating when using dot product:** truncation changes the vector's norm. Re-normalizing the shortened vectors makes the dot product equivalent to cosine similarity. If you use cosine similarity directly, explicit re-normalization is not necessary.
218
  * **Queries and documents must use the same size.**
219
 
220
  Pass `truncate_dim` and `normalize_embeddings=True` to let Sentence Transformers do both: