SAVRN
Search Contact SAVRN

Open-weight model · Question answering

flan-t5-base-squad2

by Sebastian Husch Lee sjrhuschlee/flan-t5-base-squad2

This is the flan-t5-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.

Parameters223M
Context
Weights1.8 GB
Licensemit
AccessOpen weights
Monthly Downloads6k

Runs On

What it takes to serve flan-t5-base-squad2 (223M 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.4 GB 0.5 GB 1x MI300X (192 GB)
Vultr
$1.85 1x H100 $1.99 · 1x MI325X $2.00
8-bit 0.2 GB 0.3 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 Sebastian Husch Lee, published under mit, revision c1fc232b3e8d.

This is the flan-t5-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. UPDATE: With transformers version 4.31.0 the useremotecode=True is no longer necessary. NOTE: The token must be manually added to the beginning of the question for this model to work properly. It uses the token to be able to make "no answer" predictions. The t5 tokenizer does not automatically add this special token which is why it is added manually. The following hyperparameters were used during training: - learningrate: 2e-05 - trainbatchsize: 16 - evalbatchsize: 8 - gradientaccumulationsteps: 6…

Read Sebastian Husch Lee's full model card

flan-t5-base for Extractive QA

This is the flan-t5-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.

UPDATE: With transformers version 4.31.0 the use_remote_code=True is no longer necessary.

NOTE: The <cls> token must be manually added to the beginning of the question for this model to work properly. It uses the <cls> token to be able to make "no answer" predictions. The t5 tokenizer does not automatically add this special token which is why it is added manually.

Overview

Language model: flan-t5-base
Language: English
Downstream-task: Extractive QA
Training data: SQuAD 2.0
Eval data: SQuAD 2.0
Infrastructure: 1x NVIDIA 3070

Model Usage

import torch
from transformers import(
  AutoModelForQuestionAnswering,
  AutoTokenizer,
  pipeline
)
model_name = "sjrhuschlee/flan-t5-base-squad2"

# a) Using pipelines
nlp = pipeline(
  'question-answering',
  model=model_name,
  tokenizer=model_name,
  # trust_remote_code=True, # Do not use if version transformers>=4.31.0
)
qa_input = {
'question': f'{nlp.tokenizer.cls_token}Where do I live?',  # '<cls>Where do I live?'
'context': 'My name is Sarah and I live in London'
}
res = nlp(qa_input)
# {'score': 0.980, 'start': 30, 'end': 37, 'answer': ' London'}

# b) Load model & tokenizer
model = AutoModelForQuestionAnswering.from_pretrained(
  model_name,
  # trust_remote_code=True # Do not use if version transformers>=4.31.0
)
tokenizer = AutoTokenizer.from_pretrained(model_name)

question = f'{tokenizer.cls_token}Where do I live?'  # '<cls>Where do I live?'
context = 'My name is Sarah and I live in London'
encoding = tokenizer(question, context, return_tensors="pt")
output = model(
  encoding["input_ids"],
  attention_mask=encoding["attention_mask"]
)

all_tokens = tokenizer.convert_ids_to_tokens(encoding["input_ids"][0].tolist())
answer_tokens = all_tokens[torch.argmax(output["start_logits"]):torch.argmax(output["end_logits"]) + 1]
answer = tokenizer.decode(tokenizer.convert_tokens_to_ids(answer_tokens))
# 'London'

Metrics

# Squad v2
{
    "eval_HasAns_exact": 79.97638326585695,
    "eval_HasAns_f1": 86.1444296592862,
    "eval_HasAns_total": 5928,
    "eval_NoAns_exact": 84.42388561816652,
    "eval_NoAns_f1": 84.42388561816652,
    "eval_NoAns_total": 5945,
    "eval_best_exact": 82.2033184536343,
    "eval_best_exact_thresh": 0.0,
    "eval_best_f1": 85.28292588395921,
    "eval_best_f1_thresh": 0.0,
    "eval_exact": 82.2033184536343,
    "eval_f1": 85.28292588395928,
    "eval_runtime": 522.0299,
    "eval_samples": 12001,
    "eval_samples_per_second": 22.989,
    "eval_steps_per_second": 0.96,
    "eval_total": 11873
}

# Squad
{
    "eval_exact_match": 86.3197729422895,
    "eval_f1": 92.94686836210295,
    "eval_runtime": 442.1088,
    "eval_samples": 10657,
    "eval_samples_per_second": 24.105,
    "eval_steps_per_second": 1.007
}

Training procedure

Training hyperparameters

The following hyperparameters were used during training: - learning_rate: 2e-05 - train_batch_size: 16 - eval_batch_size: 8 - seed: 42 - gradient_accumulation_steps: 6 - total_train_batch_size: 96 - optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08 - lr_scheduler_type: linear - lr_scheduler_warmup_ratio: 0.1 - num_epochs: 4.0

Training results

Framework versions

  • Transformers 4.30.0.dev0
  • Pytorch 2.0.1+cu117
  • Datasets 2.12.0
  • Tokenizers 0.13.3

Configuration

Architecture
T5ForQuestionAnswering
Vocabulary size
32,128
Stored precision
float32
Model type
t5

Identity and Version

Repository
sjrhuschlee/flan-t5-base-squad2
Publisher
Sebastian Husch Lee
Task
Question answering
Modality
Text
Library
transformers
Parameters
223M parameters
Languages
en
Revision
c1fc232b3e8d745877fb1658a30627cf23629022
First published
2023-06-14
Last updated
2025-10-15

Files and Weights

11 files, 1.8 GB in total. The weights are 2 files totalling 1.8 GB in bin, safetensors.

Weights2 files · 1.8 GB
Configuration4 files · 13.0 KB
Tokenizer3 files · 3.2 MB
Documentation1 file · 6.4 KB
Repository1 file · 1.5 KB
Every file
FileTypeSizeSHA-256
model.safetensorsWeights891.7 MB 91c789f42701
pytorch_model.binWeights891.7 MB 112d93666dbe
added_tokens.jsonConfiguration21 B
config.jsonConfiguration1.6 KB
modeling_t5qa.pyConfiguration9.1 KB
special_tokens_map.jsonConfiguration2.2 KB
README.mdDocumentation6.4 KB
.gitattributesRepository1.5 KB
spiece.modelTokenizer791.7 KB d60acb128cf7
tokenizer.jsonTokenizer2.4 MB
tokenizer_config.jsonTokenizer2.3 KB

License and Download

License
mit
Access
Open weights, no gate
Download size
1.8 GB
Download from Sebastian Husch Lee

Released by Sebastian Husch Lee through its official repository on Hugging Face. Read the license.

Built From

  • Derived from google/flan-t5-base
  • Trained on (disclosed) squad
  • 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 34.167 sjrhuschlee
Publisher reported
Evaluated revision not stated
adversarial_qa Configuration adversarialQATask Question AnsweringMetric F1Comparison conditions not established 46.911 sjrhuschlee
Publisher reported
Evaluated revision not stated
squad Configuration plain_textTask Question AnsweringMetric Exact MatchComparison conditions not established 86.367 sjrhuschlee
Publisher reported
Evaluated revision not stated
squad Configuration plain_textTask Question AnsweringMetric F1Comparison conditions not established 92.965 sjrhuschlee
Publisher reported
Evaluated revision not stated
squad_adversarial Configuration AddOneSentTask Question AnsweringMetric Exact MatchComparison conditions not established 80.862 sjrhuschlee
Publisher reported
Evaluated revision not stated
squad_adversarial Configuration AddOneSentTask Question AnsweringMetric F1Comparison conditions not established 86.07 sjrhuschlee
Publisher reported
Evaluated revision not stated
squad_v2 Configuration squad_v2Task Question AnsweringMetric Exact MatchComparison conditions not established 82.203 sjrhuschlee
Publisher reported
Evaluated revision not stated
squad_v2 Configuration squad_v2Task Question AnsweringMetric F1Comparison conditions not established 85.283 sjrhuschlee
Publisher reported
Evaluated revision not stated
squadshifts amazon Configuration amazonTask Question AnsweringMetric Exact MatchComparison conditions not established 71.624 sjrhuschlee
Publisher reported
Evaluated revision not stated
squadshifts amazon Configuration amazonTask Question AnsweringMetric F1Comparison conditions not established 85.113 sjrhuschlee
Publisher reported
Evaluated revision not stated
squadshifts new_wiki Configuration new_wikiTask Question AnsweringMetric Exact MatchComparison conditions not established 82.389 sjrhuschlee
Publisher reported
Evaluated revision not stated
squadshifts new_wiki Configuration new_wikiTask Question AnsweringMetric F1Comparison conditions not established 91.259 sjrhuschlee
Publisher reported
Evaluated revision not stated
squadshifts nyt Configuration nytTask Question AnsweringMetric Exact MatchComparison conditions not established 83.736 sjrhuschlee
Publisher reported
Evaluated revision not stated
squadshifts nyt Configuration nytTask Question AnsweringMetric F1Comparison conditions not established 91.675 sjrhuschlee
Publisher reported
Evaluated revision not stated
squadshifts reddit Configuration redditTask Question AnsweringMetric Exact MatchComparison conditions not established 72.743 sjrhuschlee
Publisher reported
Evaluated revision not stated
squadshifts reddit Configuration redditTask Question AnsweringMetric F1Comparison conditions not established 84.273 sjrhuschlee
Publisher reported
Evaluated revision not stated

Memory Requirements

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

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

Questions About flan-t5-base-squad2

How much GPU memory does flan-t5-base-squad2 need?

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

What is the cheapest GPU to run flan-t5-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 flan-t5-base-squad2 commercially?

Yes. flan-t5-base-squad2 is released under MIT License. The MIT License is a short permissive license. It permits commercial use, modification and redistribution, provided the copyright notice and permission notice are included.

Similar Models

Model · Question answering

deberta-v3-base-squad2

Deepset

This is the deberta-v3-base model, fine-tuned using the SQuAD2.0 dataset. It's been trained on question-answer pairs, including unanswerable questions, for the task of Question Answering. 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…

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

This model was created by Google and fine-tuned on XQuAD like data for multilingual (11 different languages) Q&A downstream task. Deepmind XQuAD As the dataset is based on SQuAD v1.1, there are no unanswerable questions in the data. We chose this setting so that models can focus on cross-lingual transfer. We show the average number of tokens per paragraph, question, and answer for each language in the table below. The statistics were obtained using Jieba for Chinese and the Moses tokenizer for the other languages. As XQuAD is just an evaluation dataset, I used Data augmentation techniques (scraping, neural machine translation, etc) to obtain more samples and split the dataset in order to…

Open weights 178M parameters 512 tokens transformers

Model · Question answering

xlm-roberta-base-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. Evaluated on the SQuAD 2.0 dev set with the official eval script. "exact": 33.67279167589108 "total": 4517 "exact": 48.739495798319325 "total": 1190 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…

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

Model · Question answering

xlm-roberta-base-squad2-distilled

Deepset

Haystack's distillation feature was used for training. deepset/xlm-roberta-large-squad2 was used as the teacher model. 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. Evaluated on the SQuAD 2.0 dev set Timo Möller: [email protected] deepset is the company behind the production-ready open-source AI framework Haystack. We also have a Discord community open to…

Open weights mit 277M parameters 514 tokens transformers

Model · Question answering

mdeberta-v3-base-squad2

Tim

It has been finetuned for 3 epochs on SQuAD2.0. DeBERTa improves the BERT and RoBERTa models using disentangled attention and enhanced mask decoder. With those two improvements, DeBERTa out perform RoBERTa on a majority of NLU tasks with 80GB training data. In DeBERTa V3, we further improved the efficiency of DeBERTa using ELECTRA-Style pre-training with Gradient Disentangled Embedding Sharing. Compared to DeBERTa, our V3 version significantly improves the model performance on downstream tasks. You can find more technique details about the new model from our paper. Please check the official repository for more implementation details and updates. mDeBERTa is multilingual version of DeBERTa…

Open weights mit 278M 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