Add Sentence Transformers usage

#1
by tomaarsen HF Staff - opened

Hello!

As of Sentence Transformers v6.0.0, this checkpoint loads directly as a multi-vector (ColBERT-style late interaction) retriever through the new MultiVectorEncoder. This PR adds a Sentence Transformers usage section to the model card and the multi-vector tag. The weights and the existing usage are untouched. The example query keeps the instruction plus Query: format from your PyLate example.

from sentence_transformers import MultiVectorEncoder

model = MultiVectorEncoder("DataScience-UIBK/Reason-mxbai-colbert-v0.1-32m")

query = "Given a Psychology post, retrieve relevant passages that help answer the post.\nQuery: why do I procrastinate?"
documents = [
    "Procrastination is often driven by difficulty regulating negative emotions around a task, not laziness, since delaying provides short term relief.",
    "The hippocampus plays a central role in consolidating short term memories into long term storage.",
]

query_embeddings = model.encode_query(query)
document_embeddings = model.encode_document(documents)
print(query_embeddings.shape, document_embeddings[0].shape)
# torch.Size([28, 128]) torch.Size([31, 128])

# MaxSim late-interaction scoring (higher is more relevant)
scores = model.similarity(query_embeddings, document_embeddings)
print(scores)
# tensor([[25.2429, 24.4635]], device='cuda:0')

Verified against a PyLate reference: the snippet reproduces exactly, and the token embeddings match with per-token cosine similarity above 0.999 and matching MaxSim scores. For reference, loaded through this integration the model scores 0.6486 mean nDCG@10 on NanoBEIR.

  • Tom Aarsen
tomaarsen changed pull request status to open
DataScienceUIBK org

Hello Tom,

Thank you for submitting this update. The integration of MultiVectorEncoder in Sentence Transformers v6.0.0 is a great addition, and we appreciate you ensuring our model card reflects this new capability.

Thank you also for sharing the NanoBEIR verification metrics.

This looks perfect—merging now.

abdoelsayed changed pull request status to merged

Sign up or log in to comment