Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks
Paper • 1908.10084 • Published • 18
How to use kiel2/Kiel-2-Index with sentence-transformers:
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("kiel2/Kiel-2-Index")
sentences = [
"The total number of new cases in China was fewer than 100 for the third day in a row .",
"The American Anglican Council , which represents Episcopalian conservatives , said it will seek authorization to create a separate group in North America .",
"On Monday , the number of SARS cases in China passed 5,000 , hitting a total of 5,013 .",
"Grant , a 22-year Monsanto veteran , also has been elected to the company 's board of directors , Monsanto said in a statement ."
]
embeddings = model.encode(sentences)
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [4, 4]Kiel-2-Index is a flagship, high-performance dense embedding model based on BAAI/bge-large-en-v1.5 for enterprise retrieval and semantic similarity tasks.
This is a sentence-transformers model that maps sentences and paragraphs into a high-fidelity 1024-dimensional dense vector space optimized for cross-domain retrieval.
SentenceTransformer(
(0): Transformer({'transformer_task': 'feature-extraction', 'modality_config': {'text': {'method': 'forward', 'method_output_name': 'last_hidden_state'}}, 'module_output_name': 'token_embeddings', 'architecture': 'BertModel'})
(1): Pooling({'embedding_dimension': 1024, 'pooling_mode': 'cls', 'include_prompt': True})
(2): Normalize({})
)
Direct Usage (Sentence Transformers)
First, install the Sentence Transformers library:
Bash
pip install -U sentence-transformers
Then load the model and run inference:
Python
from sentence_transformers import SentenceTransformer
# Load your custom cloud-hosted flagship embedder
model = SentenceTransformer("kiel2/Kiel-2-Index")
# Run inference
sentences = [
'Many conservatives have staunchly opposed condom programs , saying they send the wrong message and encourage and enable teens to have sex before marriage .',
'Some conservative groups have staunchly opposed such programs , saying they send the wrong message and in effect encourage and enable teens to have sex before marriage .',
"It 's just a matter of time , said Frank McDonald , of the University of Maryland .",
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 1024]
# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities)
Citation
Code snippet
@inproceedings{reimers-2019-sentence-bert,
title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
author = "Reimers, Nils and Gurevych, Iryna",
booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
month = "11",
year = "2019",
publisher = "Association for Computational Linguistics",
url = "[https://arxiv.org/abs/1908.10084](https://arxiv.org/abs/1908.10084)",
}
Base model
BAAI/bge-large-en-v1.5