Question Answering with Transformers

Extractive question answering system using Transformer models fine-tuned on the Stanford Question Answering Dataset (SQuAD), with a Flask web interface to ask questions and get answers from context.

Overview

An extractive question-answering system that takes a context paragraph and a question, then returns a span of text from the context as the answer. Transformer models (e.g. DistilBERT, BERT) are fine-tuned on the Stanford Question Answering Dataset (SQuAD). The project includes a full training pipeline with configurable model name, data path, epochs, and batch size, plus a Flask web app where users can enter context and questions and receive extracted answers. Evaluation uses Exact Match and F1; metrics are saved to outputs/eval_metrics.txt.

Challenge

Finding a precise answer inside long text is slow for users. The challenge was to fine-tune transformer models on SQuAD to extract the exact answer span from a given context, and make it usable through a simple interface.

Solution

Transformer models fine-tuned on SQuAD for extractive QA, exposed through a Flask context/question interface.

Architecture

Hugging Face Transformers fine-tuning · SQuAD train/dev · Exact Match & F1 evaluation · Flask inference UI

Results

  • Training: outputs/checkpoint-*, outputs/final
  • Metrics: outputs/eval_metrics.txt (EM & F1)
  • Flask app: context + question → answer
  • Extractive QA with Transformers fine-tuned on SQuAD
  • Flask web interface for context + question → answer
  • CLI training: quick run (small subset) or full training with configurable args
  • Support for different base models (e.g. bert-base-uncased, distilbert-base-uncased)
  • Evaluation: Exact Match and F1 saved to file

Technologies

  • Python 3.8+
  • Flask
  • Hugging Face Transformers
  • Datasets
  • Pandas
  • Exact Match & F1

All projects · Contact

Loading project…