allenai / specter2_aug2023refresh_adhoc_query

huggingface.co
Total runs: 32
24-hour runs: 0
7-day runs: -20
30-day runs: -114
Model's Last Updated: Mai 14 2024

Introduction of specter2_aug2023refresh_adhoc_query

Model Details of specter2_aug2023refresh_adhoc_query

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.

******Update******

This update introduces a new set of SPECTER 2.0 models with the base transformer encoder pre-trained on an extended citation dataset containing more recent papers. For benchmarking purposes please use the existing SPECTER 2.0 models w/o the aug2023refresh suffix viz. allenai/specter2_base .

Adapter allenai/specter2_aug2023refresh_adhoc_query for allenai/specter2_aug2023refresh_base

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

This adapter was created for usage with the adapters library.

Usage

First, install adapters :

pip install -U adapters

Note: adapters is built as an add-on to transformers that 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_aug2023refresh_base")
adapter_name = model.load_adapter("allenai/specter2_aug2023refresh_adhoc_query", source="hf", set_active=True)

Model Details

Model Description

SPECTER 2.0 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
  • Adhoc Search

This is the adhoc search query specific adapter. For tasks where papers have to retrieved for a short textual query, use this adapter to encode the query and allenai/specter2_proximity to encode the candidates.

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
Model Name and HF link Description
Proximity* allenai/specter2_aug2023refresh Encode papers as queries and candidates eg. Link Prediction, Nearest Neighbor Search
Adhoc Query allenai/specter2_aug2023refresh_adhoc_query Encode short raw text queries for search tasks. (Candidate papers can be encoded with the proximity adapter)
Classification allenai/specter2_aug2023refresh_classification Encode papers to feed into linear classifiers as features
Regression allenai/specter2_aug2023refresh_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
from sklearn.metrics.pairwise import euclidean_distances

def embed_input(text_batch: List[str]):
  # 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, :]
  return embeddings

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

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

#load the query adapter, provide an identifier for the adapter in load_as argument and activate it
model.load_adapter("allenai/specter2_aug2023refresh_base_adhoc_query", source="hf", load_as="specter2_adhoc_query", set_active=True)
query = ["Bidirectional transformers"]
query_embedding = embed_input(query)

#load the proximity adapter, provide an identifier for the adapter in load_as argument and activate it
model.load_adapter("allenai/specter2_aug2023refresh_base", source="hf", load_as="specter2_proximity", 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_papers_batch = [d['title'] + tokenizer.sep_token + (d.get('abstract') or '') for d in papers]
paper_embeddings = embed_input(text_papers_batch)

#Calculate L2 distance between query and papers
l2_distance = euclidean_distances(papers, query).flatten()
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.

Model SciRepEval In-Train SciRepEval Out-of-Train SciRepEval Avg MDCR(MAP, Recall@5)
BM-25 n/a n/a n/a (33.7, 28.5)
SPECTER 54.7 57.4 68.0 (30.6, 25.5)
SciNCL 55.6 57.8 69.0 (32.6, 27.3)
SciRepEval-Adapters 61.9 59.0 70.9 (35.3, 29.6)
SPECTER 2.0-Adapters 62.3 59.2 71.2 (38.4, 33.0)

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

SPECTER paper :

@inproceedings{specter2020cohan,
  title={{SPECTER: Document-level Representation Learning using Citation-informed Transformers}},
  author={Arman Cohan and Sergey Feldman and Iz Beltagy and Doug Downey and Daniel S. Weld},
  booktitle={ACL},
  year={2020}
}

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}
}

Runs of allenai specter2_aug2023refresh_adhoc_query on huggingface.co

32
Total runs
0
24-hour runs
-10
3-day runs
-20
7-day runs
-114
30-day runs

More Information About specter2_aug2023refresh_adhoc_query huggingface.co Model

specter2_aug2023refresh_adhoc_query huggingface.co

specter2_aug2023refresh_adhoc_query huggingface.co is an AI model on huggingface.co that provides specter2_aug2023refresh_adhoc_query's model effect (), which can be used instantly with this allenai specter2_aug2023refresh_adhoc_query model. huggingface.co supports a free trial of the specter2_aug2023refresh_adhoc_query model, and also provides paid use of the specter2_aug2023refresh_adhoc_query. Support call specter2_aug2023refresh_adhoc_query model through api, including Node.js, Python, http.

specter2_aug2023refresh_adhoc_query huggingface.co Url

https://huggingface.co/allenai/specter2_aug2023refresh_adhoc_query

allenai specter2_aug2023refresh_adhoc_query online free

specter2_aug2023refresh_adhoc_query huggingface.co is an online trial and call api platform, which integrates specter2_aug2023refresh_adhoc_query's modeling effects, including api services, and provides a free online trial of specter2_aug2023refresh_adhoc_query, you can try specter2_aug2023refresh_adhoc_query online for free by clicking the link below.

allenai specter2_aug2023refresh_adhoc_query online free url in huggingface.co:

https://huggingface.co/allenai/specter2_aug2023refresh_adhoc_query

specter2_aug2023refresh_adhoc_query install

specter2_aug2023refresh_adhoc_query is an open source model from GitHub that offers a free installation service, and any user can find specter2_aug2023refresh_adhoc_query on GitHub to install. At the same time, huggingface.co provides the effect of specter2_aug2023refresh_adhoc_query install, users can directly use specter2_aug2023refresh_adhoc_query installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

specter2_aug2023refresh_adhoc_query install url in huggingface.co:

https://huggingface.co/allenai/specter2_aug2023refresh_adhoc_query

Url of specter2_aug2023refresh_adhoc_query

specter2_aug2023refresh_adhoc_query huggingface.co Url

Provider of specter2_aug2023refresh_adhoc_query huggingface.co

allenai
ORGANIZATIONS

Other API from allenai

huggingface.co

Total runs: 91.7K
Run Growth: 78.6K
Growth Rate: 85.70%
Updated: Octobre 18 2023
huggingface.co

Total runs: 91.3K
Run Growth: 63.3K
Growth Rate: 69.57%
Updated: Janvier 06 2025
huggingface.co

Total runs: 77.3K
Run Growth: -517.1K
Growth Rate: -669.13%
Updated: Octobre 10 2024
huggingface.co

Total runs: 63.3K
Run Growth: 51.7K
Growth Rate: 81.63%
Updated: Octobre 10 2024
huggingface.co

Total runs: 61.6K
Run Growth: -50.5K
Growth Rate: -81.96%
Updated: Décembre 04 2024
huggingface.co

Total runs: 23.0K
Run Growth: 7.7K
Growth Rate: 33.79%
Updated: Août 14 2024
huggingface.co

Total runs: 8.5K
Run Growth: 3.3K
Growth Rate: 36.78%
Updated: Juillet 16 2024
huggingface.co

Total runs: 6.1K
Run Growth: -21.5K
Growth Rate: -354.06%
Updated: Juillet 03 2024
huggingface.co

Total runs: 5.1K
Run Growth: -17.0K
Growth Rate: -321.48%
Updated: Juillet 16 2024
huggingface.co

Total runs: 2.5K
Run Growth: -163
Growth Rate: -6.49%
Updated: Décembre 04 2024
huggingface.co

Total runs: 1.7K
Run Growth: -110
Growth Rate: -6.43%
Updated: Juillet 16 2024
huggingface.co

Total runs: 895
Run Growth: 878
Growth Rate: 98.10%
Updated: Janvier 24 2023
huggingface.co

Total runs: 502
Run Growth: -100
Growth Rate: -21.23%
Updated: Janvier 24 2023
huggingface.co

Total runs: 486
Run Growth: 256
Growth Rate: 52.67%
Updated: Février 12 2024
huggingface.co

Total runs: 404
Run Growth: 354
Growth Rate: 94.65%
Updated: Juin 13 2024
huggingface.co

Total runs: 313
Run Growth: -437
Growth Rate: -139.62%
Updated: Avril 30 2024
huggingface.co

Total runs: 297
Run Growth: 159
Growth Rate: 53.54%
Updated: Avril 19 2024