Add Sentence Transformers usage

#2
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 new section covers standard late interaction retrieval on independent texts and points readers to your contextual-embeddings package for the InSeNT contextual pooling, so the two usages complement each other.

from sentence_transformers import MultiVectorEncoder

model = MultiVectorEncoder("illuin-conteb/modern-colbert-insent")

query = "Who keeps watch over ships near the dangerous coast at night?"
documents = [
    "The old lighthouse keeper trimmed his lamp, its beam cutting a lonely path through the fog.",
    "A curious fox cub, all rust and wonder, ventured out from its den for the first time.",
]

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

# MaxSim late-interaction scoring (higher is more relevant)
scores = model.similarity(query_embeddings, document_embeddings)
print(scores)
# tensor([[15.9199,  6.9771]], 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.5490 mean nDCG@10 on NanoBEIR.

  • Tom Aarsen

Closing this one after more thought: this model's strength is the contextual InSeNT pooling via your contextual-embeddings package, and the plain late interaction usage this PR adds undersells it (your card's own warning about standard-task regression applies). Sorry for the noise!

tomaarsen changed pull request status to closed

Gemini_Generated_Image_4asan34asan34asa

Sign up or log in to comment