Skip to page content
SAVRN
Search Plan a project

Open-weight model · Question answering

bert-base-cased-squad-extractive-qa

by Russel Ku RusselKuAguilar/bert-base-cased-squad-extractive-qa

bert-base-cased-squad-extractive-qa is an open-weight model for question answering from Russel Ku, released under Apache License 2.0. It has 108M parameters and a 512-token context. At 16-bit it needs about 0.3 GB of GPU memory, which fits on 1x MI300X from $1.85 an hour, at the lowest prices in the SAVRN Index.

This repository provides a fine-tuned bert-base-cased model adapted for the downstream task of Extractive Question Answering on the full SQuAD v1.1 dataset.

Parameters108M
Context512
Weights430.9 MB
Licenseapache-2.0
AccessOpen weights
Monthly Downloads—

Runs On

What it takes to serve bert-base-cased-squad-extractive-qa (108M 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 Oct 18, 2026.

bert-base-cased-squad-extractive-qa on every accelerator the SAVRN Index prices, at every precision

Model Card

By Russel Ku, published under apache-2.0, revision a0ae4fb595ed.

This repository provides a fine-tuned bert-base-cased model adapted for the downstream task of Extractive Question Answering on the full SQuAD v1.1 dataset. Given a (Question, Context) pair, the model predicts the exact start and end character/token spans within the context passage that answer the question. The model was evaluated on the complete SQuAD v1.1 validation set (valdataset, 10,570 examples): Our final Epoch 3 checkpoint achieves 88.21% F1 and 80.75% EM, matching the original Google BERT benchmark (-0.29 F1 points) with complete reproducibility on modern GPU hardware and AMP FP16. - Sequence Length (maxlength): 384 tokens - Document Stride (docstride): 128 tokens To better…

Read Russel Ku's full model card

BERT-Base Cased for Extractive Question Answering (SQuAD v1.1)

This repository provides a fine-tuned bert-base-cased model adapted for the downstream task of Extractive Question Answering on the full SQuAD v1.1 dataset.

Given a (Question, Context) pair, the model predicts the exact start and end character/token spans within the context passage that answer the question.


Intended Use

Intended Uses

  • Extractive Question Answering: Retrieving verbatim factual answers from English text paragraphs (e.g., articles, reports, documentation, encyclopedic entries).
  • Search & Knowledge Retrieval Pipelines: Serving as the reader/answering component in Retrieval-Augmented Generation (RAG) or Dense Passage Retrieval (DPR) search architectures.
  • Academic & Research Benchmarking: Studying parameter-efficient adaptation and transfer learning dynamics of BERT on MRC (Machine Reading Comprehension) tasks.

Out-of-Scope & Unintended Uses

  • Generative / Abstractive QA: The model cannot synthesize new text, paraphrase, or generate reasoning chains; it strictly extracts existing text spans.
  • Unanswerable Questions (SQuAD v2.0 style): Trained on SQuAD v1.1, where every question is guaranteed to have a plausible answer in the context. If given unanswerable questions, it will attempt to extract the most plausible span rather than predicting no answer.
  • Multi-lingual or Non-English Text: The model was fine-tuned on English text and is not intended for non-English corpora.
  • High-Stakes Decision Making: Should not be used for critical medical, legal, or financial diagnosis without human-in-the-loop validation.

Model Performance & Benchmarks

The model was evaluated on the complete SQuAD v1.1 validation set (val_dataset, 10,570 examples):

Metric / Checkpoint Final Checkpoint (Epoch 3) Peak Intermediate (Epoch 2) Official Paper (Devlin et al., 2018)
Validation Exact Match (EM) 80.75% 80.99% 81.50%
Validation F1-Score 88.21% 88.19% 88.50%
Final Training Loss 0.4990 0.7953 —
Training Time (3 epochs) ~67.9 min (4,075.4 s) — —

Our final Epoch 3 checkpoint achieves 88.21% F1 and 80.75% EM, matching the original Google BERT benchmark (-0.29 F1 points) with complete reproducibility on modern GPU hardware and AMP FP16.


Hyperparameters & Training Setup

  • Base Architecture: bert-base-cased (12 layers, 768 hidden size, 12 attention heads, ~108M parameters)
  • Dataset: Stanford Question Answering Dataset (SQuAD v1.1)
  • Training Samples: 87,599 examples (100% full training split)
  • Validation Samples: 10,570 examples
  • Sequence Length (max_length): 384 tokens
  • Document Stride (doc_stride): 128 tokens
  • Batch Size: 16 (per device)
  • Epochs: 3
  • Optimizer: AdamW (weight_decay=0.01, $\epsilon=1\times 10^{-8}$)
  • Learning Rates: QA Head: 3e-4 | BERT Encoder: 3e-5
  • Learning Rate Scheduler: Cosine Annealing with 10% Linear Warmup (warmup_steps=1642)
  • Gradient Clipping: Maximum gradient norm of 1.0
  • Precision: PyTorch Mixed Precision (AMP FP16)
  • Hardware: NVIDIA GeForce RTX 4070 Laptop GPU (8.59 GB VRAM, CUDA 12.4)
  • Random Seed: 42

Error Analysis (Qualitative Case Studies)

To better understand model failure modes on SQuAD v1.1 validation examples, we identified 3 primary error categories:

Case Question Gold Reference Answer Model Prediction EM / F1 Error Diagnosis
1. Span Boundary Over-extension Who was the architect of the bridge? Joseph Strauss Joseph Strauss, who oversaw the construction EM: 0.0%
F1: 44.4%
Boundary Overlap: The model locates the core target entity but extends the span to include the explanatory relative clause due to high semantic co-occurrence.
2. Lexical Distractor Confusion Who invented the first electric light? Humphry Davy Thomas Edison EM: 0.0%
F1: 0.0%
Salience Bias: In complex historical contexts comparing multiple inventors, the model selects the entity most prominently associated with the word "invented" (Edison, 1879) instead of the earlier subordinate clause (Davy, 1802).
3. Modifier Truncation What kind of reparations were imposed? financial reparations financial EM: 0.0%
F1: 66.7%
Head Noun Omission: The model extracts only the adjective modifier answering "what kind of", missing the full syntactic noun phrase expected by human annotators.

How to Use

Using Hugging Face transformers Pipeline

from transformers import pipeline

qa_pipeline = pipeline(
    "question-answering",
    model="RusselKuAguilar/bert-base-cased-squad-extractive-qa",
    tokenizer="RusselKuAguilar/bert-base-cased-squad-extractive-qa"
)

context = "The Apollo 11 mission landed Commander Neil Armstrong and Lunar Module Pilot Buzz Aldrin on July 20, 1969."
question = "Who was the commander of Apollo 11?"

result = qa_pipeline(question=question, context=context)
print(result)
# Output: {'score': 0.9412, 'start': 38, 'end': 52, 'answer': 'Neil Armstrong'}

Direct PyTorch / Transformers Usage

import torch
from transformers import AutoTokenizer, BertForQuestionAnswering

model_id = "RusselKuAguilar/bert-base-cased-squad-extractive-qa"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = BertForQuestionAnswering.from_pretrained(model_id)
model.eval()

context = "Python was conceived in the late 1980s by Guido van Rossum at CWI in the Netherlands."
question = "Who created Python?"

inputs = tokenizer(question, context, return_tensors="pt")

with torch.no_grad():
    outputs = model(**inputs)

start_idx = torch.argmax(outputs.start_logits)
end_idx = torch.argmax(outputs.end_logits)

answer_tokens = inputs["input_ids"][0][start_idx : end_idx + 1]
answer = tokenizer.convert_tokens_to_string(tokenizer.convert_ids_to_tokens(answer_tokens))

print(f"Answer: {answer}")
# Output: Answer: Guido van Rossum

Limitations & Biases

  1. Length Constraint: Sequences longer than 512 tokens are truncated unless segmented using sliding windows (doc_stride). Long contexts might omit critical answer spans if not chunked appropriately.
  2. Span Extraction Dependency: The model cannot answer questions whose solutions require synthesizing facts from disparate sentences, multi-hop reasoning, or calculating numerical operations (e.g., counting, dates difference).
  3. Absence of Negative Verification: Because SQuAD v1.1 does not contain unanswerable questions, the model will output the span with the highest score even if the context does not contain the true answer.
  4. Dataset Biases: SQuAD v1.1 is sourced from Wikipedia articles; hence, historical, demographic, or social biases present in Wikipedia or in bert-base-cased pre-training corpora may be reflected in predictions.

Software Dependencies & Environment

  • Python: 3.11+ / 3.12+ / 3.13
  • PyTorch: 2.6.0+cu124
  • Transformers: 5.17.0
  • Datasets: 5.0.1
  • CUDA Version: 12.4
  • Hardware: NVIDIA GeForce RTX 4070 Laptop GPU

References

  1. Devlin, J., Chang, M. W., Lee, K., & Toutanova, K. (2018). BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding. arXiv:1810.04805.
  2. Rajpurkar, P., Zhang, J., Lopyrev, K., & Liang, P. (2016). SQuAD: 100,000+ Questions for Machine Comprehension of Text. arXiv:1606.05250.
  3. Wolf, T. et al. (2020). Transformers: State-of-the-Art Natural Language Processing. In Proceedings of the 2020 EMNLP: System Demonstrations (pp. 38–45).
  4. Loshchilov, I., & Hutter, F. (2017). Decoupled Weight Decay Regularization (AdamW). arXiv:1711.05101.

Configuration

Architecture
BertForQuestionAnswering
Context length (tokens)
512
Layers
12
Hidden size
768
Feed-forward size
3,072
Attention heads
12
Vocabulary size
28,996
Model type
bert

Identity and Version

Repository
RusselKuAguilar/bert-base-cased-squad-extractive-qa
Publisher
Russel Ku
Task
Question answering
Modality
Text
Library
transformers
Parameters
108M parameters
Languages
en
Revision
a0ae4fb595ed3002d45803c69551c7db7d27249d
First published
2026-09-25
Last updated
2026-09-26

Files and Weights

6 files, 431.6 MB in total. The weights are 1 file totalling 430.9 MB in safetensors.

Weights1 file · 430.9 MB
Configuration1 file · 791 B
Tokenizer2 files · 669.8 KB
Documentation1 file · 9.0 KB
Repository1 file · 1.5 KB
Every file
FileTypeSizeSHA-256
model.safetensorsWeights430.9 MB a32a944b2d9d
config.jsonConfiguration791 B —
README.mdDocumentation9.0 KB —
.gitattributesRepository1.5 KB —
tokenizer.jsonTokenizer669.2 KB —
tokenizer_config.jsonTokenizer564 B —

License and Download

License
apache-2.0
Access
Open weights, no gate
Download size
430.9 MB
Download from Russel Ku

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

Built From

Memory Requirements

PrecisionWeights in memory
As published430.9 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 bert-base-cased-squad-extractive-qa

How much GPU memory does bert-base-cased-squad-extractive-qa need?

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

What is the cheapest GPU to run bert-base-cased-squad-extractive-qa 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 bert-base-cased-squad-extractive-qa commercially?

Yes. bert-base-cased-squad-extractive-qa is released under Apache License 2.0. The Apache License 2.0 is a permissive open-source license. It permits commercial use, modification and redistribution. It requires keeping the license and copyright notices and any NOTICE file, stating significant changes, and it includes an express patent grant from contributors.

What is bert-base-cased-squad-extractive-qa's context length?

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

Similar Models

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

electra-base-squad2

Deepset

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!

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

Model · Question answering

Extractive-QA_BERT_body

Elisabet Sulú

This repository contains the weights and tokenizer for bert-base-uncased fully fine-tuned on SQuAD v1.1 (Stanford Question Answering Dataset) for extractive question answering. The model was adapted using end-to-end full fine-tuning with a differential two-learning-rate optimizer scheme as part of an academic comparative study on BERT adaptation paradigms. The model was trained on a deterministic subsample of SQuAD v1.1 (rajpurkar/squad): - Task Head (QA outputs, 1,538 params): Learning rate = 1e-3 Evaluation was performed on the complete official SQuAD v1.1 validation split (10,570 examples, spanning 10,753 feature windows) using an optimized post-processing pipeline (top-15 start/end…

Open weights apache-2.0 109M parameters 512 tokens

Model · Question answering

bert-base-squad-qa

Dalila Ku

Fine-tuning of bert-base-uncased for extractive Question Answering, delivered as part of assignment U2T01 (Adapting BERT for NLP tasks — Trends in Data Science, Unit 2, Universidad Politécnica de Yucatán). bert-base-uncased with a qaoutputs head that predicts, per token, the probability of being the start and the end of the answer span within the given context. (rajpurkar/squad), subsampled to 15,000 examples from the official train split (as required by the assignment), with a 90/10 split used for training/ validation. SQuAD's official validation set (10,570 questions, never seen during training) was reserved as the final test set. - Preprocessing uses a sliding window (stride) since…

Open weights apache-2.0 109M parameters 512 tokens

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