/ Модель

Характеристики

Контекст
512 токенов
Параметры
136 млн
Лицензия
Apache 2.0
Архитектура
bert · dense
Опубликована
25 сен 2026

bert-base-cased-squad-extractive-qa

Ответы на вопросыТекст → текст7 профессий

Англоязычная модель BERT-Base, дообученная на SQuAD v1.1 для извлечения ответов на вопросы из заданного текста.

58скачиваний за 30 дней0лайковвеса обновлены26 сен 2026

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Публичные оценки

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

RusselKuAguilar/bert-base-cased-squad-extractive-qa — англоязычная модель BERT-Base с регистрозависимой токенизацией, дообученная на полном наборе SQuAD v1.1 для извлекающего ответа на вопросы. По вопросу и отрывку текста она находит фрагмент ответа непосредственно в контексте; модель содержит 135,5 млн параметров и поддерживает контекст до 512 токенов.

Модель предназначена для поиска фактических ответов в статьях, документации и других текстовых материалах, в том числе как компонент чтения в RAG- и поисковых конвейерах. На валидационной выборке SQuAD v1.1 автор сообщает F1 88,21% и Exact Match 80,75%. Модель извлекает готовые фрагменты, а не генерирует пояснения или синтезированные ответы.

Модель рассчитана на английский язык и использует веса в формате safetensors. При контексте длиннее 512 токенов важный фрагмент может быть отброшен, если текст не разбит на окна. Обучение на SQuAD v1.1 не предусматривает вопросов без ответа: модель всё равно выберет наиболее вероятный фрагмент. Лицензия — Apache-2.0.

Сценарии применения

  • поиск точного ответа в абзаце статьи
  • извлечение ответа из технической документации
  • ответы на вопросы по найденным документам в RAG-конвейере
  • оценка извлекающего QA на англоязычных текстах

Ограничения

Контекст ограничен 512 токенами; для длинных текстов требуется разбиение на окна. Модель не умеет надёжно отклонять вопросы без ответа и не предназначена для генеративных ответов, многошагового рассуждения или нерелевантных ей языков.

Для каких профессий подходит7

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Также подходит для

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

🧠 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 / CheckpointFinal 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-Score88.21% 🏆88.19%88.50%
Final Training Loss0.49900.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:

CaseQuestionGold Reference AnswerModel PredictionEM / F1Error Diagnosis
1. Span Boundary Over-extensionWho was the architect of the bridge?Joseph StraussJoseph Strauss, who oversaw the constructionEM: 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 ConfusionWho invented the first electric light?Humphry DavyThomas EdisonEM: 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 TruncationWhat kind of reparations were imposed?financial reparationsfinancialEM: 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.

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · question-answering

Можно запустить

Подбираем GPU…

Класс архитектуры
BertForQuestionAnswering
Ревизия весов
a0ae4fb

0 моделей