Model reference · open weights
specter2 is an open-weight embedding model from allenai. specter2_base (BF16) weighs 440 MB; the smallest configuration that runs it is RTX 3060 12 GB.
Summary of the allenai/specter2_base model card, 2026-10-01
What it is
| Released by | allenai |
|---|---|
| Released | 2023-02-16 |
| VRAM | 440 MB for the weights |
What it runs on
| Card | Runs | Memory |
|---|---|---|
| RTX 3060 12 GB | fits | 11.6 GB |
| RTX 4060 Ti 16 GB | fits | 15.4 GB |
| RTX 3090 24 GB | fits | 23.4 GB |
| RTX 4090 24 GB | fits | 23.4 GB |
| RTX 5090 32 GB | fits | 31.0 GB |
| L40S 48 GB | fits | 44.0 GB |
| A100 80 GB | fits | 78.2 GB |
| H100 80 GB | fits | 78.1 GB |
| RTX PRO 6000 Blackwell 96 GB | fits | 93.8 GB |
| DGX Spark (GB10) 128 GB unified | fits | 107 GB |
| H200 141 GB | fits | 138 GB |
| B200 180 GB | fits | 176 GB |
From the model card
SPECTER2 is the successor to SPECTER and is capable of generating task specific embeddings for scientific tasks when paired with adapters. This is the base model to be used along with the 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:
| Old Name | New Name |
|---|---|
| allenai/specter2 | allenai/specter2_base |
| allenai/specter2_proximity | allenai/specter2 |
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.
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:
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.
| Model | Name and HF link | Description |
|---|---|---|
| Proximity* | allenai/specter2 | Encode papers as queries and candidates eg. Link Prediction, Nearest Neighbor Search |
| Adhoc Query | allenai/specter2_adhoc_query | Encode short raw text queries for search tasks. (Candidate papers can be encoded with the proximity adapter) |
| Classification | allenai/specter2_classification | Encode papers to feed into linear classifiers as features |
| Regression | allenai/specter2_regression | Encode 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="proximity", set_active=True)
#other possibilities: allenai/specter2_
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, :]
For evaluation and downstream usage, please refer to https://github.com/allenai/scirepeval/blob/main/evaluation/INFERENCE.md.
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":Quoted from the model card on Hugging Face. The full card is behind the Hugging Face link above.