SAVRN
Search Contact SAVRN

Open-weight model · Question answering

electra-base-squad2

by Deepset deepset/electra-base-squad2

Evaluated on the SQuAD 2.0 dev set with the official eval script. Haystack is an AI orchestration framework to build customizable, production-ready LLM applications. You can use this model in Haystack to do extractive question answering on documents.

Parameters109M
Context512
Weights871.2 MB
Licensecc-by-4.0
AccessOpen weights
Monthly Downloads3.3k

Runs On

What it takes to serve electra-base-squad2 (109M parameters): the memory its weights need at each precision, and the cheapest way to rent enough data-center GPUs to hold them.

PrecisionWeightsMemory neededCheapest setupPer hourAlso fits
16-bit 0.2 GB 0.3 GB 1x MI300X (192 GB)
Vultr
$1.85 1x H100 $1.99 · 1x MI325X $2.00
8-bit 0.1 GB 0.1 GB 1x MI300X (192 GB)
Vultr
$1.85 1x H100 $1.99 · 1x MI325X $2.00
4-bit 0.1 GB 0.1 GB 1x MI300X (192 GB)
Vultr
$1.85 1x H100 $1.99 · 1x MI325X $2.00

Memory is the weights at that precision plus 20% for the runtime and a short context; a long context needs more. Prices are the lowest on-demand hourly rates in the SAVRN Index, read Sep 18, 2026.

Model Card

By Deepset, published under cc-by-4.0, revision 3a28cce3f99d.

Evaluated on the SQuAD 2.0 dev set with the official eval script. Haystack is an AI orchestration framework to build customizable, production-ready LLM applications. You can use this model in Haystack to do extractive question answering on documents. To load and run the model with Haystack: For a complete example with an extractive question answering pipeline that scales over many documents, check out the corresponding Haystack tutorial. Vaishali Pal vaishali.pal [at] deepset.ai Timo Möller: timo.moeller [at] deepset.ai deepset is the company behind the production-ready open-source AI framework Haystack. We also have a Discord community open to everyone!

Read Deepset's full model card

electra-base for Extractive QA

Overview

Language model: electra-base
Language: English
Downstream-task: Extractive QA
Training data: SQuAD 2.0
Eval data: SQuAD 2.0
Code: See an example extractive QA pipeline built with Haystack Infrastructure: 1x Tesla v100

Hyperparameters

seed=42
batch_size = 32
n_epochs = 5
base_LM_model = "google/electra-base-discriminator"
max_seq_len = 384
learning_rate = 1e-4
lr_schedule = LinearWarmup
warmup_proportion = 0.1
doc_stride=128
max_query_length=64

Performance

Evaluated on the SQuAD 2.0 dev set with the official eval script.

"exact": 77.30144024256717,
 "f1": 81.35438272008543,
 "total": 11873,
 "HasAns_exact": 74.34210526315789,
 "HasAns_f1": 82.45961302894314,
 "HasAns_total": 5928,
 "NoAns_exact": 80.25231286795626,
 "NoAns_f1": 80.25231286795626,
 "NoAns_total": 5945

Usage

In Haystack

Haystack is an AI orchestration framework to build customizable, production-ready LLM applications. You can use this model in Haystack to do extractive question answering on documents. To load and run the model with Haystack:

# After running pip install haystack-ai "transformers[torch,sentencepiece]"

from haystack import Document
from haystack.components.readers import ExtractiveReader

docs = [
    Document(content="Python is a popular programming language"),
    Document(content="python ist eine beliebte Programmiersprache"),
]

reader = ExtractiveReader(model="deepset/roberta-base-squad2")
reader.warm_up()

question = "What is a popular programming language?"
result = reader.run(query=question, documents=docs)
# {'answers': [ExtractedAnswer(query='What is a popular programming language?', score=0.5740374326705933, data='python', document=Document(id=..., content: '...'), context=None, document_offset=ExtractedAnswer.Span(start=0, end=6),...)]}

For a complete example with an extractive question answering pipeline that scales over many documents, check out the corresponding Haystack tutorial.

In Transformers

from transformers import AutoModelForQuestionAnswering, AutoTokenizer, pipeline

model_name = "deepset/roberta-base-squad2"

# a) Get predictions
nlp = pipeline('question-answering', model=model_name, tokenizer=model_name)
QA_input = {
    'question': 'Why is model conversion important?',
    'context': 'The option to convert models between FARM and transformers gives freedom to the user and let people easily switch between frameworks.'
}
res = nlp(QA_input)

# b) Load model & tokenizer
model = AutoModelForQuestionAnswering.from_pretrained(model_name)
tokenizer = AutoTokenizer.from_pretrained(model_name)

Authors

Vaishali Pal vaishali.pal [at] deepset.ai
Branden Chan: branden.chan [at] deepset.ai
Timo Möller: timo.moeller [at] deepset.ai
Malte Pietsch: malte.pietsch [at] deepset.ai
Tanay Soni: tanay.soni [at] deepset.ai

About us

deepset is the company behind the production-ready open-source AI framework Haystack.

Some of our other work: - Distilled roberta-base-squad2 (aka "tinyroberta-squad2") - German BERT, GermanQuAD and GermanDPR, German embedding model - deepset Cloud, deepset Studio

Get in touch and join the Haystack community

For more info on Haystack, visit our GitHub repo and Documentation. We also have a Discord community open to everyone!

Twitter | LinkedIn | Discord | GitHub Discussions | Website | YouTube

By the way: we're hiring!

Configuration

Architecture
ElectraForQuestionAnswering
Context length (tokens)
512
Layers
12
Hidden size
768
Feed-forward size
3,072
Attention heads
12
Vocabulary size
30,522
Model type
electra

Identity and Version

Repository
deepset/electra-base-squad2
Publisher
Deepset
Task
Question answering
Modality
Text
Library
transformers
Parameters
109M parameters
Languages
en
Revision
3a28cce3f99d27d7815d94e1f49325e97d03fc56
First published
2022-03-02
Last updated
2024-09-24

Files and Weights

8 files, 871.5 MB in total. The weights are 2 files totalling 871.2 MB in bin, safetensors.

Weights2 files · 871.2 MB
Configuration2 files · 747 B
Tokenizer2 files · 231.7 KB
Documentation1 file · 8.3 KB
Repository1 file · 399 B
Every file
FileTypeSizeSHA-256
model.safetensorsWeights435.6 MB 346d3fdbb702
pytorch_model.binWeights435.6 MB 33abdbab680c
config.jsonConfiguration635 B
special_tokens_map.jsonConfiguration112 B
README.mdDocumentation8.3 KB
.gitattributesRepository399 B
tokenizer_config.jsonTokenizer200 B
vocab.txtTokenizer231.5 KB

License and Download

License
cc-by-4.0
Access
Open weights, no gate
Download size
871.2 MB
Download from Deepset

Released by Deepset through its official repository on Hugging Face. Read the license.

Built From

  • Trained on (disclosed) squad_v2

Evaluations

Each result is shown as reported, with the conditions its reporter stated. None is a SAVRN measurement. A comparison lines two results up only when their configuration, unit and setup are all stated and identical.

BenchmarkConditionsResultReported byRevisionDate
adversarial_qa Configuration adversarialQATask Question AnsweringMetric Exact MatchComparison conditions not established 23.533 deepset
Publisher reported
Evaluated revision not stated
adversarial_qa Configuration adversarialQATask Question AnsweringMetric F1Comparison conditions not established 36.521 deepset
Publisher reported
Evaluated revision not stated
squad Configuration plain_textTask Question AnsweringMetric Exact MatchComparison conditions not established 80.407 deepset
Publisher reported
Evaluated revision not stated
squad Configuration plain_textTask Question AnsweringMetric F1Comparison conditions not established 88.942 deepset
Publisher reported
Evaluated revision not stated
squad_adversarial Configuration AddOneSentTask Question AnsweringMetric Exact MatchComparison conditions not established 73.867 deepset
Publisher reported
Evaluated revision not stated
squad_adversarial Configuration AddOneSentTask Question AnsweringMetric F1Comparison conditions not established 81.381 deepset
Publisher reported
Evaluated revision not stated
squad_v2 Configuration squad_v2Task Question AnsweringMetric Exact MatchComparison conditions not established 77.6074 deepset
Publisher reported
Evaluated revision not stated
squad_v2 Configuration squad_v2Task Question AnsweringMetric F1Comparison conditions not established 81.7181 deepset
Publisher reported
Evaluated revision not stated
squadshifts amazon Configuration amazonTask Question AnsweringMetric Exact MatchComparison conditions not established 64.512 deepset
Publisher reported
Evaluated revision not stated
squadshifts amazon Configuration amazonTask Question AnsweringMetric F1Comparison conditions not established 80.166 deepset
Publisher reported
Evaluated revision not stated
squadshifts new_wiki Configuration new_wikiTask Question AnsweringMetric Exact MatchComparison conditions not established 76.568 deepset
Publisher reported
Evaluated revision not stated
squadshifts new_wiki Configuration new_wikiTask Question AnsweringMetric F1Comparison conditions not established 87.706 deepset
Publisher reported
Evaluated revision not stated
squadshifts nyt Configuration nytTask Question AnsweringMetric Exact MatchComparison conditions not established 77.884 deepset
Publisher reported
Evaluated revision not stated
squadshifts nyt Configuration nytTask Question AnsweringMetric F1Comparison conditions not established 87.858 deepset
Publisher reported
Evaluated revision not stated
squadshifts reddit Configuration redditTask Question AnsweringMetric Exact MatchComparison conditions not established 64.399 deepset
Publisher reported
Evaluated revision not stated
squadshifts reddit Configuration redditTask Question AnsweringMetric F1Comparison conditions not established 78.096 deepset
Publisher reported
Evaluated revision not stated

Memory Requirements

PrecisionWeights in memory
As published871.2 MB
16-bit0.2 GB
8-bit0.1 GB
4-bit0.1 GB

Weights only, from the published parameter count; the key-value cache and runtime add to this.

Questions About electra-base-squad2

How much GPU memory does electra-base-squad2 need?

About 0.3 GB at 16-bit and 0.1 GB at 4-bit: the weights (109M parameters) plus a working margin. A long context needs more.

What is the cheapest GPU to run electra-base-squad2 on?

At 16-bit, 1x MI300X from $1.85 an hour; at 4-bit, 1x MI300X from $1.85 an hour, at the lowest on-demand prices the SAVRN Index lists.

Can I use electra-base-squad2 commercially?

Yes. electra-base-squad2 is released under Creative Commons Attribution 4.0. CC BY 4.0 permits sharing and adapting the work, including commercially, provided the creator is credited and changes are indicated.

What is electra-base-squad2's context length?

512 tokens, from the maximum position embeddings in its published configuration.

Similar Models

Model · Question answering

bert-base-uncased-squad2

Deepset

Haystack is an AI orchestration framework to build customizable, production-ready LLM applications. You can use this model in Haystack to do extractive question answering on documents. To load and run the model with Haystack: For a complete example with an extractive question answering pipeline that scales over many documents, check out the corresponding Haystack tutorial. - Timo Möller: timo.moeller [at] deepset.ai deepset is the company behind the production-ready open-source AI framework Haystack. We also have a Discord community open to everyone!

Open weights cc-by-4.0 109M parameters 512 tokens transformers

Model · Question answering

gelectra-base-germanquad

Deepset

We trained a German question answering model with a gelectra-base model as its basis. - The dataset is GermanQuAD, a new, German language dataset, which we hand-annotated and published online. - The training dataset is one-way annotated and contains 11518 questions and 11518 answers, while the test dataset is three-way annotated so that there are 2204 questions and with 2204·3−76 = 6536answers, because we removed 76 wrong answers. See https://deepset.ai/germanquad for more details and dataset download in SQuAD format. Haystack is an AI orchestration framework to build customizable, production-ready LLM applications. You can use this model in Haystack to do extractive question answering on…

Open weights mit 109M parameters 512 tokens transformers

Model · Question answering

bert-base-cased-squad2

Deepset

This is a BERT base cased model trained on SQuAD v2 Haystack is an AI orchestration framework to build customizable, production-ready LLM applications. You can use this model in Haystack to do extractive question answering on documents. To load and run the model with Haystack: For a complete example with an extractive question answering pipeline that scales over many documents, check out the corresponding Haystack tutorial. deepset is the company behind the production-ready open-source AI framework Haystack. We also have a Discord community open to everyone!

Open weights cc-by-4.0 108M parameters 512 tokens transformers

Model · Question answering

bert-base-uncased-squad-v1

Qingqing Cao

This model was fine-tuned from the HuggingFace BERT base uncased checkpoint on SQuAD1.1. CPU: Intel(R) Core(TM) i7-6800K CPU @ 3.40GHz Memory: 32 GiB GPUs: 2 GeForce GTX 1070, each with 8GiB memory GPU driver: 418.87.01, CUDA: 10.1 It took about 2 hours to finish. Note that the above results didn't involve any hyperparameter search.

Open weights mit 109M parameters 512 tokens transformers

Model · Question answering

roberta-base-squad2

Deepset

This is the roberta-base model, fine-tuned using the SQuAD2.0 dataset. It's been trained on question-answer pairs, including unanswerable questions, for the task of Extractive Question Answering. We have also released a distilled version of this model called deepset/tinyroberta-squad2. It has a comparable prediction quality and runs at twice the speed of deepset/roberta-base-squad2. Haystack is an AI orchestration framework to build customizable, production-ready LLM applications. You can use this model in Haystack to do extractive question answering on documents. To load and run the model with Haystack: For a complete example with an extractive question answering pipeline that scales over…

Open weights cc-by-4.0 124M parameters 514 tokens transformers