A 110M parameter ModernBERT-based sentence embedding model for glossary and domain-specific text.
Evaluated on 80 domain-specific documents across 10 categories using KMeans clustering.
Mean Reciprocal Rank for same-category document retrieval.
Spearman correlation between model cosine similarities and human judgments.
1from sentence_transformers import SentenceTransformer
2
3model = SentenceTransformer('mjbommar/ogbert-110m-sentence')
4embeddings = model.encode(['your text here']) # L2 normalized by default
1sentences = [
2 'The financial audit revealed discrepancies in the quarterly report.',
3 'An accounting review found errors in the fiscal statement.',
4 'The patient was diagnosed with acute respiratory infection.',
5]
6embeddings = model.encode(sentences)
The model correctly identifies higher similarity within the same domain.
1from transformers import AutoModel, AutoTokenizer
2import torch.nn.functional as F
3
4tokenizer = AutoTokenizer.from_pretrained('mjbommar/ogbert-110m-sentence')
5model = AutoModel.from_pretrained('mjbommar/ogbert-110m-sentence')
6
7inputs = tokenizer('your text here', return_tensors='pt', padding=True, truncation=True)
8outputs = model(**inputs)
9
10# Mean pooling + L2 normalize (critical for performance)
11mask = inputs['attention_mask'].unsqueeze(-1)
12pooled = (outputs.last_hidden_state * mask).sum(1) / mask.sum(1)
13embeddings = F.normalize(pooled, p=2, dim=1)
1@article{bommarito2025opengloss,
2 title={OpenGloss: A Synthetic Encyclopedic Dictionary and Semantic Knowledge Graph},
3 author={Bommarito II, Michael J.},
4 journal={arXiv preprint arXiv:2511.18622},
5 year={2025}
6}