Kiel-2-Matrix
Kiel-2-Matrix is a specialized dense embedding model based on microsoft/codebert-base for code and text representation.
This is a sentence-transformers model that maps sentences and code blocks into a 768-dimensional dense vector space optimized for semantic textual similarity, semantic search, and clustering tasks.
Model Details
Model Description
- Model Type: Sentence Transformer / Dense Embedding Backbone
- Base Model: microsoft/codebert-base
- Maximum Sequence Length: 512 tokens
- Output Dimensionality: 768 dimensions
- Similarity Function: Cosine Similarity
- Supported Modality: Text & Code
Model Sources
- Documentation: Sentence Transformers Documentation
- Repository: Sentence Transformers on GitHub
- Hugging Face Hub: kiel2/Kiel-2-Matrix
Full Model Architecture
SentenceTransformer(
(0): Transformer({'transformer_task': 'feature-extraction', 'modality_config': {'text': {'method': 'forward', 'method_output_name': 'last_hidden_state'}}, 'module_output_name': 'token_embeddings', 'architecture': 'RobertaModel'})
(1): Pooling({'embedding_dimension': 768, 'pooling_mode': 'mean', 'include_prompt': True})
)
Direct Usage (Sentence Transformers)
First, install the Sentence Transformers library:
Bash
pip install -U sentence-transformers
Then load your model and run inference:
Python
from sentence_transformers import SentenceTransformer
# Load your model from the Hugging Face Hub
model = SentenceTransformer("kiel2/Kiel-2-Matrix")
# Run inference
sentences = [
'" Any decision on Charleroi will have huge implications for regional airports in France , " he said .',
'" A bad decision on Charleroi would have huge implications for state-owned regional airports in France .',
"He said the ferry 's crew will be interviewed and tested for drugs and alcohol .",
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 768]
# 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)",
}