The training corpus contains definitions across 16 domains (geography, mathematics, science, law, technology, philosophy, etc.) and 11 reading levels (kindergarten through PhD).
The model uses ModernBERT's hybrid attention pattern with full attention every 3 layers and sliding window attention in between, enabling efficient processing of long sequences.
1from transformers import pipeline
2
3fill_mask = pipeline("fill-mask", model="mjbommar/ogbert-v1-mlm")
4result = fill_mask("A molecule is the smallest <|mask|> of a chemical compound.")
5print(result)
1from transformers import AutoTokenizer, AutoModel
2import torch
3
4tokenizer = AutoTokenizer.from_pretrained("mjbommar/ogbert-v1-mlm")
5model = AutoModel.from_pretrained("mjbommar/ogbert-v1-mlm")
6
7text = "Photosynthesis is the process by which plants convert light into energy."
8inputs = tokenizer(text, return_tensors="pt")
9
10with torch.no_grad():
11 outputs = model(**inputs)
12 embeddings = outputs.last_hidden_state.mean(dim=1) # Mean pooling
13
14print(embeddings.shape) # torch.Size([1, 384])
1from transformers import AutoTokenizer, AutoModelForMaskedLM
2import torch
3
4tokenizer = AutoTokenizer.from_pretrained("mjbommar/ogbert-v1-mlm")
5model = AutoModelForMaskedLM.from_pretrained("mjbommar/ogbert-v1-mlm")
6
7text = "A molecule is the smallest <|mask|> of a chemical compound."
8inputs = tokenizer(text, return_tensors="pt")
9
10with torch.no_grad():
11 outputs = model(**inputs)
12 mask_idx = (inputs.input_ids == tokenizer.mask_token_id).nonzero(as_tuple=True)[1]
13 predictions = outputs.logits[0, mask_idx].softmax(dim=-1)
14 top_tokens = predictions.topk(5)
15
16for score, idx in zip(top_tokens.values[0], top_tokens.indices[0]):
17 print(f"{tokenizer.decode(idx)}: {score:.4f}")
18# Output:
19# unit: 0.6509
20# part: 0.1069
21# component: 0.0541
22# form: 0.0294
23# portion: 0.0243
-
Word similarity: The model achieves relatively low word similarity scores (SimLex 0.29). MLM pretraining optimizes for categorical boundaries rather than pairwise similarity. For tasks requiring fine-grained similarity, consider contrastive fine-tuning.
-
Domain coverage: Performance varies by domain. Arts and history show higher loss (0.77-0.84) compared to geography and mathematics (0.44-0.56).
-
English only: The model is trained exclusively on English text.
1@misc{bommarito2025opengloss,
2 title={OpenGloss: A Synthetic Encyclopedic Dictionary and Semantic Knowledge Graph},
3 author={Bommarito, Michael J., II},
4 year={2025},
5 eprint={2511.18622},
6 archivePrefix={arXiv},
7 primaryClass={cs.CL},
8 url={https://arxiv.org/abs/2511.18622}
9}
This model is released under the Apache 2.0 license.