Ettin-150m-WSD-wiktionary
a compact model for word-sense disambiguation
2 min readupdated
The model solves the task of determining which dictionary definition fits a word in a specific sentence (Word-Sense Disambiguation). It is built on the ModernBERT architecture (around 150M parameters) and fine-tuned on usage examples and citations from the English Wiktionary. The model outputs probabilities for the proposed sense options, helping choose the most appropriate one for the context. The development is designed for the Contextual Dictionary browser extension to look up meanings right on the user's device.
Key features
- Based on the lightweight ModernBERT architecture with 22 layers and a hidden size of 768.
- Fine-tuned on English Wiktionary data with soft labels from a larger model of the same series.
- Exported to ONNX formats (including a dynamic quantized INT8 version) for running in the browser.
- Uses a special 128-choice answer decoder instead of a standard vocabulary one.
What you can do
- Integrate the model into local utilities or browser extensions for instant term interpretation.
- Use it for text analysis and semantic markup of English documents.
- Test the model with your own definition lists and complex sentences.
Example
import json
import torch
from transformers import AutoTokenizer, ModernBertForMaskedLM
path = "andrepaim/Ettin-150m-WSD-wiktionary"
tokenizer = AutoTokenizer.from_pretrained(path)
model = ModernBertForMaskedLM.from_pretrained(path, ignore_mismatched_sizes=True).eval()
definitions = [
"A small flying mammal that hunts at night.",
"A club of wood or metal used to strike the ball."
]
print("Модель успешно загружена для задач WSD")Read more
DetailsArchitecture: ModernBERT (150M parameters, float32 in the repository)
Data: trained on a sample of 125,031 training items based on Wiktionary
Limitations: input context up to 2048 tokens, up to 24 senses at a time
Hardware: tested on CPU and GPUs like RTX 3060 (12 GB)










Comments