ucrelnlp/PyMUSAS-Neural-English-Small-BEM

Model

0

stars

15

commits

2

repos using this model

2

linked in READMEs

Jan 19, 2026

updated

lexical-semantics
model_hub_mixin
pytorch
pytorch_model_hub_mixin
safetensors
word-sense-disambiguation

README

Model Card for PyMUSAS Neural English Small BEM

A fine tuned 17 Million (17M) parameter English ModernBERT architecture semantic tagger. The tagger outputs semantic tags at the token level from the USAS tagset.

The semantic tagger is a variation of the Bi-Encoder Model (BEM) from Blevins and Zettlemoyer 2020 a Word Sense Disambiguation (WSD) model.

Table of contents

Quick start

Installation

Requires Python 3.10 or greater, it is best that you install the version of PyTorch you would like to use, e.g. CPU/GPU version etc before installing this package else you will get the default version of PyTorch for your operating system/setup, but we do require torch>=2.2,<3.0.

pip install wsd-torch-models

Usage

from transformers import AutoTokenizer
import torch

from wsd_torch_models.bem import BEM


if __name__ == "__main__": 
    wsd_model_name = "ucrelnlp/PyMUSAS-Neural-English-Small-BEM"
    wsd_model = BEM.from_pretrained(wsd_model_name)
    tokenizer = AutoTokenizer.from_pretrained(wsd_model_name, add_prefix_space=True)

    wsd_model.eval()
    # Change this to the device you would like to use, e.g. cpu
    model_device = "cpu"
    wsd_model.to(device=model_device)
    
    sentence = "The river bank was full of fish"
    sentence_tokens = sentence.split()
    
    with torch.inference_mode(mode=True):
        # sub_word_tokenizer can be None when None it will download the appropriate tokenizer
        # but generally it is better to give it the tokenizer as it saves the operation
        # of checking if the tokenizer is already downloaded.
        predictions = wsd_model.predict(sentence_tokens, sub_word_tokenizer=tokenizer, top_n=5)
        
        for sentence_token, semantic_tags in zip(sentence_tokens, predictions):
            print("Token: "+ sentence_token)
            print("Most likely tags: ")
            for tag in semantic_tags:
                tag_definition = wsd_model.label_to_definition[tag]
                print("\t" + tag + ":" + tag_definition)
            print()

Model Description

For more details about the model and how it was trained please see the citation/technical report, as well as the links in the model sources section.

Model Sources

The training repository contains the code used to train this model. The inference repository contains the code used to run the model as shown in the usage section.

Model Architecture

Parameter17M English68M English140M Multilingual307M Multilingual
Layers7192222
Hidden Size256512384768
Intermediate Size38476811521152
Attention Heads48612
Total Parameters17M68M140M307M
Non-embedding Parameters3.9M42.4M42M110M
Max Sequence Length8,0008,0008,1928,192
Vocabulary Size50,36850,368256,000256,000
TokenizerModernBERTModernBERTGemma 2Gemma 2

Training Data

The model has been trained on a portion of the ucrelnlp/English-USAS-Mosaico, specifically data/wikipedia_shard_0.jsonl.gz, which contains 1,083 English Wikipedia articles, with 444,880 sentences, 6.6 million tokens, with 5.3 million silver labelled tokens generated by a English rule based semantic tagger.

Evaluation

We have evaluated the models on 5 datasets from 5 different languages, 4 of these datasets are publicly available whereas one (the Irish data) requires permission from the data owner to access it. The results for these models using top 1 and top 5 accuracy results are shown below, for a more comprehensive comparison please see the technical report.

Dataset17M English68M English140M Multilingual307M Multilingual
Top 1
Chinese--42.247.9
English66.470.166.070.2
Finnish--15.825.9
Irish--28.535.6
Welsh--21.742.0
Top 5
Chinese--66.370.4
English87.690.088.990.1
Finnish--32.842.4
Irish--47.651.6
Welsh--40.856.4

The publicly available datasets can be found on HuggingFace Hub ucrelnlp/USAS-WSD.

Note the English models have not been evaluated on the non-English datasets as they are unlikely to be able to represent non-English text well or perform well on non-English data.

Citation

Paper: Creating a Hybrid Rule and Neural Network Based Semantic Tagger using Silver Standard Data: the PyMUSAS framework for Multilingual Semantic Annotation

@misc{moore2026creatinghybridruleneural,
      title={Creating a Hybrid Rule and Neural Network Based Semantic Tagger using Silver Standard Data: the PyMUSAS framework for Multilingual Semantic Annotation}, 
      author={Andrew Moore and Paul Rayson and Dawn Archer and Tim Czerniak and Dawn Knight and Daisy Lal and Gearóid Ó Donnchadha and Mícheál Ó Meachair and Scott Piao and Elaine Uí Dhonnchadha and Johanna Vuorinen and Yan Yabo and Xiaobin Yang},
      year={2026},
      eprint={2601.09648},
      archivePrefix={arXiv},
      primaryClass={cs.CL},
      url={https://arxiv.org/abs/2601.09648}, 
}

Contact Information

Contributors

apmoore1

15 commits

ucrelnlp/PyMUSAS-Neural-English-Small-BEM

Model

0

stars

15

commits

2

repos using this model

2

linked in READMEs

Jan 19, 2026

updated

lexical-semantics
model_hub_mixin
pytorch
pytorch_model_hub_mixin
safetensors
word-sense-disambiguation

README

Model Card for PyMUSAS Neural English Small BEM

A fine tuned 17 Million (17M) parameter English ModernBERT architecture semantic tagger. The tagger outputs semantic tags at the token level from the USAS tagset.

The semantic tagger is a variation of the Bi-Encoder Model (BEM) from Blevins and Zettlemoyer 2020 a Word Sense Disambiguation (WSD) model.

Table of contents

Quick start

Installation

Requires Python 3.10 or greater, it is best that you install the version of PyTorch you would like to use, e.g. CPU/GPU version etc before installing this package else you will get the default version of PyTorch for your operating system/setup, but we do require torch>=2.2,<3.0.

pip install wsd-torch-models

Usage

from transformers import AutoTokenizer
import torch

from wsd_torch_models.bem import BEM


if __name__ == "__main__": 
    wsd_model_name = "ucrelnlp/PyMUSAS-Neural-English-Small-BEM"
    wsd_model = BEM.from_pretrained(wsd_model_name)
    tokenizer = AutoTokenizer.from_pretrained(wsd_model_name, add_prefix_space=True)

    wsd_model.eval()
    # Change this to the device you would like to use, e.g. cpu
    model_device = "cpu"
    wsd_model.to(device=model_device)
    
    sentence = "The river bank was full of fish"
    sentence_tokens = sentence.split()
    
    with torch.inference_mode(mode=True):
        # sub_word_tokenizer can be None when None it will download the appropriate tokenizer
        # but generally it is better to give it the tokenizer as it saves the operation
        # of checking if the tokenizer is already downloaded.
        predictions = wsd_model.predict(sentence_tokens, sub_word_tokenizer=tokenizer, top_n=5)
        
        for sentence_token, semantic_tags in zip(sentence_tokens, predictions):
            print("Token: "+ sentence_token)
            print("Most likely tags: ")
            for tag in semantic_tags:
                tag_definition = wsd_model.label_to_definition[tag]
                print("\t" + tag + ":" + tag_definition)
            print()

Model Description

For more details about the model and how it was trained please see the citation/technical report, as well as the links in the model sources section.

Model Sources

The training repository contains the code used to train this model. The inference repository contains the code used to run the model as shown in the usage section.

Model Architecture

Parameter17M English68M English140M Multilingual307M Multilingual
Layers7192222
Hidden Size256512384768
Intermediate Size38476811521152
Attention Heads48612
Total Parameters17M68M140M307M
Non-embedding Parameters3.9M42.4M42M110M
Max Sequence Length8,0008,0008,1928,192
Vocabulary Size50,36850,368256,000256,000
TokenizerModernBERTModernBERTGemma 2Gemma 2

Training Data

The model has been trained on a portion of the ucrelnlp/English-USAS-Mosaico, specifically data/wikipedia_shard_0.jsonl.gz, which contains 1,083 English Wikipedia articles, with 444,880 sentences, 6.6 million tokens, with 5.3 million silver labelled tokens generated by a English rule based semantic tagger.

Evaluation

We have evaluated the models on 5 datasets from 5 different languages, 4 of these datasets are publicly available whereas one (the Irish data) requires permission from the data owner to access it. The results for these models using top 1 and top 5 accuracy results are shown below, for a more comprehensive comparison please see the technical report.

Dataset17M English68M English140M Multilingual307M Multilingual
Top 1
Chinese--42.247.9
English66.470.166.070.2
Finnish--15.825.9
Irish--28.535.6
Welsh--21.742.0
Top 5
Chinese--66.370.4
English87.690.088.990.1
Finnish--32.842.4
Irish--47.651.6
Welsh--40.856.4

The publicly available datasets can be found on HuggingFace Hub ucrelnlp/USAS-WSD.

Note the English models have not been evaluated on the non-English datasets as they are unlikely to be able to represent non-English text well or perform well on non-English data.

Citation

Paper: Creating a Hybrid Rule and Neural Network Based Semantic Tagger using Silver Standard Data: the PyMUSAS framework for Multilingual Semantic Annotation

@misc{moore2026creatinghybridruleneural,
      title={Creating a Hybrid Rule and Neural Network Based Semantic Tagger using Silver Standard Data: the PyMUSAS framework for Multilingual Semantic Annotation}, 
      author={Andrew Moore and Paul Rayson and Dawn Archer and Tim Czerniak and Dawn Knight and Daisy Lal and Gearóid Ó Donnchadha and Mícheál Ó Meachair and Scott Piao and Elaine Uí Dhonnchadha and Johanna Vuorinen and Yan Yabo and Xiaobin Yang},
      year={2026},
      eprint={2601.09648},
      archivePrefix={arXiv},
      primaryClass={cs.CL},
      url={https://arxiv.org/abs/2601.09648}, 
}

Contact Information

Contributors

apmoore1

15 commits