/ Модель

Характеристики

Контекст
512 токенов
Параметры
137 млн
Архитектура
bert · dense
Опубликована
18 мая 2024

Bert-MLM_arXiv-MP-class_arXiv

ЭмбеддингиТекст → embedding3 профессии

BERT-модель кодирует короткие математические тексты в эмбеддинги для поиска похожих материалов, кластеризации и оценки семантического сходства.

187скачиваний за 30 дней0лайковвеса обновлены6 июн 2024

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Тесты пользователейпока нет

Никто ещё не опубликовал тест этой модели. Соберите бенчмарк из своих задач — результат появится здесь.

  1. Добавьте модель в бенчмарк

    Вместе с другими моделями категории «Эмбеддинги» — сравнение идёт внутри одной категории.

  2. Опишите свои задачи

    Напишите запросы, при необходимости приложите файлы и эталонные ответы.

  3. Запустите и опубликуйте

    Модели ответят на каждую задачу, судья оценит ответы. Опубликованный результат появится на этой странице.

Публичные оценки

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

Bert-MLM_arXiv-MP-class_arXiv — модель Sentence Transformers на архитектуре BERT, разработанная для вычисления семантического сходства коротких математических текстов. Она кодирует предложение или короткий абзац в плотный вектор размерности 768, который можно использовать для поиска похожих материалов, кластеризации и сравнения текстов. Модель создана как дополнительный ресурс к работе «On modelling similarity of short mathematical texts» для CICM'24.

В основе лежит доменно-адаптированная math-similarity/Bert-MLM_arXiv с mean pooling и последующим дообучением на cosine similarity. Для обучения использовались пары заголовков и аннотаций arXiv: тексты считались похожими, если имели общий классификационный код. Метаданные указывают 136,7 млн параметров и контекст до 512 токенов; README сообщает, что по умолчанию входы длиннее 256 word pieces обрезаются. Модель принимает математический текст и выдаёт эмбеддинги; указаний на поддержку конкретного естественного языка нет.

Лицензия в предоставленных данных не указана. Модель рассчитана на короткие математические тексты и может хуже подходить для общих текстов или задач, отличающихся от поиска семантического сходства; обучающий набор из карточки не включён в репозиторий.

Сценарии применения

  • поиск похожих математических статей arXiv по заголовку и аннотации
  • ранжирование математических текстов по семантическому сходству
  • кластеризация коротких математических описаний
  • сравнение аннотаций статей по тематической близости

Ограничения

Модель ориентирована на короткие математические тексты; по умолчанию входы длиннее 256 word pieces обрезаются, хотя метаданные указывают контекст до 512 токенов. Языковая поддержка и лицензия в предоставленных данных не обозначены, а обучающий набор напрямую не включён в репозиторий.

Для каких профессий подходит3

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

Bert-MLM_arXiv-MP-class_arXiv

This is a sentence-transformers model: It maps sentences & paragraphs to a 768 dimensional dense vector space and can be used for tasks like clustering or semantic search.

The model is specifically designed to compute similarities of short mathematical texts.

Usage (Sentence-Transformers)

Using this model becomes easy when you have sentence-transformers installed:

pip install -U sentence-transformers

Then you can use the model like this:

from sentence_transformers import SentenceTransformer
sentences = ["In this paper we show how to compute the $\\Lambda_{\\alpha}$ norm, $\\alpha\\ge 0$, using the dyadic grid. This result is a consequence of the description of the Hardy spaces $H^p(R^N)$ in terms of dyadic and special atoms.",
             "We show that a determinant of Stirling cycle numbers counts unlabeled acyclic single-source automata. The proof involves a bijection from these automata to certain marked lattice paths and a sign-reversing involution to evaluate the determinant."]

model = SentenceTransformer('math-similarity/Bert-MLM_arXiv-MP-class_arXiv')
embeddings = model.encode(sentences)
print(embeddings)

Usage (HuggingFace Transformers)

Without sentence-transformers, you can use the model like this: First, you pass your input through the transformer model, then you have to apply the right pooling-operation on-top of the contextualized word embeddings.

from transformers import AutoTokenizer, AutoModel
import torch


#Mean Pooling - Take attention mask into account for correct averaging
def mean_pooling(model_output, attention_mask):
    token_embeddings = model_output[0] #First element of model_output contains all token embeddings
    input_mask_expanded = attention_mask.unsqueeze(-1).expand(token_embeddings.size()).float()
    return torch.sum(token_embeddings * input_mask_expanded, 1) / torch.clamp(input_mask_expanded.sum(1), min=1e-9)


# Sentences we want sentence embeddings for
sentences = ["In this paper we show how to compute the $\\Lambda_{\\alpha}$ norm, $\\alpha\\ge 0$, using the dyadic grid. This result is a consequence of the description of the Hardy spaces $H^p(R^N)$ in terms of dyadic and special atoms.",
             "We show that a determinant of Stirling cycle numbers counts unlabeled acyclic single-source automata. The proof involves a bijection from these automata to certain marked lattice paths and a sign-reversing involution to evaluate the determinant."]

# Load model from HuggingFace Hub
tokenizer = AutoTokenizer.from_pretrained('math-similarity/Bert-MLM_arXiv-MP-class_arXiv')
model = AutoModel.from_pretrained('math-similarity/Bert-MLM_arXiv-MP-class_arXiv')

# Tokenize sentences
encoded_input = tokenizer(sentences, padding=True, truncation=True, return_tensors='pt')

# Compute token embeddings
with torch.no_grad():
    model_output = model(**encoded_input)

# Perform pooling. In this case, mean pooling.
sentence_embeddings = mean_pooling(model_output, encoded_input['attention_mask'])

print("Sentence embeddings:")
print(sentence_embeddings)

Background

Intended uses

Our model is intended to be used as a sentence and short paragraph encoder for mathematical texts. Given an input text, it outputs a vector which captures the semantic information. The sentence vector may be used for information retrieval, clustering or sentence similarity tasks.

By default, input text longer than 256 word pieces is truncated.

Training procedure

Domain-adaption

We use the domain-adapted math-similarity/Bert-MLM_arXiv model. Please refer to the model card for more detailed information about the domain-adaption procedure.

Pooling

We add a mean-pooling layer on top of the domain-adapted model.

Fine-tuning

We fine-tune the model using a cosine-similarity objective. Formally, it computes the vectors u = model(sentence_A) and v = model(sentence_B) and measures the cosine-similarity between the two. By default, it minimizes the following loss: ||input_label - cos_score_transformation(cosine_sim(u,v))||_2, with MSE as loss function.

We use pairs of concenated title+abstract texts from arXiv as fine-tuning dataset and model semantic similarity with their classificattion codes. Two texts are defined as similar, if they share their classification code. Otherwise, they are defined as semantically dissimilar. We only use texts with a singular classification code in this dataset. The training set contains 43.572 text pairs and the evaluation set contains 5.447 pairs. See the fine-tuning notebook for more information.

We do not include the fine-tuning dataset directly. It can be recreated using its generation notebook and datasets/math-similarity/arXiv-metadata-oai-snapshot-111.

Citing & Authors

This model is an additional resource for the CICM'24 submission On modelling similarity of short mathematical texts.

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм

Можно запустить

Подбираем GPU…

Класс архитектуры
BertModel
Ревизия весов
b5bd4dd

0 моделей