/ Модель

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

Опубликована
17 фев 2023

specter2

Языковая модель4 профессии

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

3 925скачиваний за 30 дней89лайковвеса обновлены4 дек 2024

Бенчмарки

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

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

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

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

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

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

Она разработана Amanpreet Singh, Mike D’Arcy, Arman Cohan, Doug Downey и Sergey Feldman и опубликована Allen AI. Модель предназначена для представления научных статей по заголовку и аннотации, а также коротких текстовых запросов, чтобы использовать полученные векторы в поиске, извлечении похожих публикаций, классификации, регрессии и задачах link prediction.

Идентификатор allenai/specter2 соответствует retrieval-адаптеру proximity для базовой модели allenai/specter2_base. Архитектура основана на bert-base-uncased с адаптерами; исходная модель дообучена на базе allenai/scibert_scivocab_uncased. SPECTER2 обучалась на более чем 6 миллионах троек цитирования научных статей и дополнительно на задачах SciRepEval. Поддерживаются форматы proximity retrieval, adhoc search, classification и regression, для которых используются соответствующие адаптеры. В README не указаны точный размер контекстного окна, размерность эмбеддингов и перечень языков; по описанию модель ориентирована на англоязычные научные тексты.

Сильная сторона модели — специализация на научной литературе и возможность адаптировать представления под конкретный тип задачи. Адаптер proximity предназначен для кодирования статей-запросов и статей-кандидатов при поиске релевантных публикаций. Для коротких поисковых запросов, классификации и регрессии рекомендуются отдельные адаптеры. Модель не предназначена как универсальная мультимодальная система и работает с текстовыми данными; для использования требуется библиотека adapters и базовая модель specter2_base. Лицензия — Apache 2.0.

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

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

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

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

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

Открыть на Hugging Face

SPECTER2

SPECTER2 is a family of models that succeeds SPECTER and is capable of generating task specific embeddings for scientific tasks when paired with adapters. Given the combination of title and abstract of a scientific paper or a short texual query, the model can be used to generate effective embeddings to be used in downstream applications.

Note:For general embedding purposes, please use allenai/specter2.

To get the best performance on a downstream task type please load the associated adapter () with the base model as in the example below.

Dec 2023 Update:

Model usage updated to be compatible with latest versions of transformers and adapters (newly released update to adapter-transformers) libraries.

Aug 2023 Update:

  1. The SPECTER2 Base and proximity adapter models have been renamed in Hugging Face based upon usage patterns as follows:
Old NameNew Name
allenai/specter2allenai/specter2_base
allenai/specter2_proximityallenai/specter2
  1. We have a parallel version (termed aug2023refresh) where the base transformer encoder version is pre-trained on a collection of newer papers (published after 2018). However, for benchmarking purposes, please continue using the current version.

Adapter allenai/specter2 for allenai/specter2_base

An adapter for the allenai/specter2_base model that was trained on the allenai/scirepeval dataset.

This adapter was created for usage with the adapters library.

Adapter Usage

First, install adapters:

pip install -U adapters

Note: adapters is built as an add on to transformers and acts as a drop-in replacement with adapter support. More

Now, the adapter can be loaded and activated like this:

from adapters import AutoAdapterModel

model = AutoAdapterModel.from_pretrained("allenai/specter2_base")
adapter_name = model.load_adapter("allenai/specter2", source="hf", set_active=True)

Model Details

Model Description

SPECTER2 has been trained on over 6M triplets of scientific paper citations, which are available here. Post that it is trained with additionally attached task format specific adapter modules on all the SciRepEval training tasks.

Task Formats trained on:

  • Classification
  • Regression
  • Proximity (Retrieval)
  • Adhoc Search

This is a retrieval specific adapter. For tasks where given a paper query, other relevant papers have to be retrieved from a corpus, use this adapter to generate the embeddings.

It builds on the work done in SciRepEval: A Multi-Format Benchmark for Scientific Document Representations and we evaluate the trained model on this benchmark as well.

  • Developed by: Amanpreet Singh, Mike D'Arcy, Arman Cohan, Doug Downey, Sergey Feldman
  • Shared by : Allen AI
  • Model type: bert-base-uncased + adapters
  • License: Apache 2.0
  • Finetuned from model: allenai/scibert.

Model Sources

Uses

Direct Use

ModelName and HF linkDescription
Proximity*allenai/specter2Encode papers as queries and candidates eg. Link Prediction, Nearest Neighbor Search
Adhoc Queryallenai/specter2_adhoc_queryEncode short raw text queries for search tasks. (Candidate papers can be encoded with the proximity adapter)
Classificationallenai/specter2_classificationEncode papers to feed into linear classifiers as features
Regressionallenai/specter2_regressionEncode papers to feed into linear regressors as features

*Proximity model should suffice for downstream task types not mentioned above

from transformers import AutoTokenizer
from adapters import AutoAdapterModel

# load model and tokenizer
tokenizer = AutoTokenizer.from_pretrained('allenai/specter2_base')

#load base model
model = AutoAdapterModel.from_pretrained('allenai/specter2_base')

#load the adapter(s) as per the required task, provide an identifier for the adapter in load_as argument and activate it
model.load_adapter("allenai/specter2", source="hf", load_as="specter2", set_active=True)

papers = [{'title': 'BERT', 'abstract': 'We introduce a new language representation model called BERT'},
          {'title': 'Attention is all you need', 'abstract': ' The dominant sequence transduction models are based on complex recurrent or convolutional neural networks'}]

# concatenate title and abstract
text_batch = [d['title'] + tokenizer.sep_token + (d.get('abstract') or '') for d in papers]
# preprocess the input
inputs = self.tokenizer(text_batch, padding=True, truncation=True,
                                   return_tensors="pt", return_token_type_ids=False, max_length=512)
output = model(**inputs)
# take the first token in the batch as the embedding
embeddings = output.last_hidden_state[:, 0, :]

Downstream Use

For evaluation and downstream usage, please refer to https://github.com/allenai/scirepeval/blob/main/evaluation/INFERENCE.md.

Training Details

Training Data

The base model is trained on citation links between papers and the adapters are trained on 8 large scale tasks across the four formats. All the data is a part of SciRepEval benchmark and is available here.

The citation link are triplets in the form

{"query": {"title": ..., "abstract": ...}, "pos": {"title": ..., "abstract": ...}, "neg": {"title": ..., "abstract": ...}}

consisting of a query paper, a positive citation and a negative which can be from the same/different field of study as the query or citation of a citation.

Training Procedure

Please refer to the SPECTER paper.

Training Hyperparameters

The model is trained in two stages using SciRepEval:

  • Base Model: First a base model is trained on the above citation triplets. batch size = 1024, max input length = 512, learning rate = 2e-5, epochs = 2 warmup steps = 10% fp16
  • Adapters: Thereafter, task format specific adapters are trained on the SciRepEval training tasks, where 600K triplets are sampled from above and added to the training data as well. batch size = 256, max input length = 512, learning rate = 1e-4, epochs = 6 warmup = 1000 steps fp16

Evaluation

We evaluate the model on SciRepEval, a large scale eval benchmark for scientific embedding tasks which which has [SciDocs] as a subset. We also evaluate and establish a new SoTA on MDCR, a large scale citation recommendation benchmark.

ModelSciRepEval In-TrainSciRepEval Out-of-TrainSciRepEval AvgMDCR(MAP, Recall@5)
BM-25n/an/an/a(33.7, 28.5)
SPECTER54.772.067.5(30.6, 25.5)
SciNCL55.673.468.8(32.6, 27.3)
SciRepEval-Adapters61.973.870.7(35.3, 29.6)
SPECTER2 Base56.373.669.1(38.0, 32.4)
SPECTER2-Adapters62.374.171.1(38.4, 33.0)

Please cite the following works if you end up using SPECTER 2.0:

SciRepEval paper

@inproceedings{Singh2022SciRepEvalAM,
  title={SciRepEval: A Multi-Format Benchmark for Scientific Document Representations},
  author={Amanpreet Singh and Mike D'Arcy and Arman Cohan and Doug Downey and Sergey Feldman},
  booktitle={Conference on Empirical Methods in Natural Language Processing},
  year={2022},
  url={https://api.semanticscholar.org/CorpusID:254018137}
}

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

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

GPU в ailist

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

Нельзя запустить

У модели не указана задача, поэтому рантайм не знает, как её запускать.

Ревизия весов
2081559

0 моделей