Built to order

MCQ Distractor Generation using Transformers

This project automates the hardest part of writing multiple-choice questions: the wrong answers. A T5 model fine-tuned on the RACE reading-comprehension corpus takes a passage, question and correct answer, then generates three distractors that are wrong but believable — filtered so none paraphrases the answer, and ranked by a plausibility scorer. Evaluation combines BLEU overlap with human-written distractors and teacher plausibility ratings. A web demo generates and ranks distractors for sample questions live. The training notebook, evaluation and viva kit are fully documented. Suitable for

MCQ Distractor Generation using Transformers — project thumbnail preview
More project photos (2)

The problem

A multiple-choice question is only as good as its distractors: if the wrong options are obviously wrong, the question tests nothing, and writing three genuinely plausible wrong answers per question is slow expert labour. Automating it is a real generation challenge — the model must understand the passage deeply enough to produce options that look right to an unprepared student while remaining unambiguously wrong. This project fine-tunes T5 on the RACE corpus (100k exam questions with human-written distractors) to generate three diverse distractors per question. Diverse beam search keeps the options distinct, a filtering stage drops anything that paraphrases the correct answer, and a ranking step orders survivors by plausibility so the best distractor leads.

How it works

  1. RACE questions are formatted as: passage + question + correct answer (input) → three human distractors (target).
  2. T5-base is fine-tuned on these pairs with a standard seq2seq objective.
  3. At inference, diverse beam search decodes multiple candidate distractors per question.
  4. Candidates are filtered: near-duplicates of each other and paraphrases of the answer are removed.
  5. A plausibility scorer ranks the survivors; the top three are returned with scores.
  6. The demo renders the question with the correct answer marked and each distractor scored and explained.
  7. Test evaluation reports BLEU-4 vs human distractors, answer-leak rate, diversity and human plausibility ratings.

Tech stack:

  • Python 3, PyTorch
  • Hugging Face Transformers
  • T5-base (Raffel et al.)
  • RACE dataset (Lai et al.)
  • Sentence embeddings (filtering)
  • HTML/CSS/JS demo
  • NLTK · sacreBLEU

Dataset & model details

  • Dataset: RACE — approximately 100,000 multiple-choice questions from Chinese middle- and high-school English examinations, each with a passage, question, correct answer and human-written distractors (Lai et al., EMNLP 2017).
  • Task: Distractor generation; input = passage + question + correct answer, output = three plausible-but-incorrect options.
  • Model: T5-base fine-tuned as conditional generation; diverse beam search decoding; embedding-similarity filtering; learned plausibility ranker.
  • Metrics: BLEU-4 design target 31.6 vs human distractors on the RACE test split; human plausibility design target 3.8/5; answer-leak rate design target below 4%; distinct-2 diversity design target 0.71. No metric is claimed as measured until the fine-tuning run is executed for the order.
Parameter Value
Input Passage + question + correct answer (English)
Output 3 ranked distractors with plausibility scores
Model T5-base fine-tuned (design run)
BLEU-4 31.6 (design target, not a measured claim)
Human plausibility 3.8 / 5 (design target)
Answer-leak rate Below 4% (design target)
Inference Approximately 1.4 s per question on GPU (expected)
Demo Single-file web app with sample questions

Project features

  • [T5 distractor fine-tuning] T5-base trained on passage + question + answer → three distractors, using RACE's human-written options as targets.
  • [Diverse beam search] Decoding produces three options that differ from each other, not three paraphrases of one idea.
  • [Answer-leak filtering] Candidates semantically close to the correct answer are dropped automatically.
  • [Plausibility ranking] A scorer orders the surviving distractors so the most believable wrong answer ranks first.
  • [Live generation demo] Pick a sample passage and question; the demo generates, filters and ranks three distractors with scores.
  • [BLEU + human evaluation] BLEU-4 against RACE's human distractors plus teacher plausibility ratings on a 5-point scale.
  • [Exported model] Saved weights with a generate-distractors function for reuse.

What is included

  • Complete fine-tuning and evaluation Jupyter notebook
  • Trained T5 distractor model with inference code
  • Live distractor-generation web demo with sample passages
  • BLEU, diversity and answer-leak evaluation scripts
  • Project report PDF (background, generation theory, methodology, results)
  • PPT presentation for final review
  • Viva Q&A preparation document (seq2seq, beam search, BLEU, evaluation design)

Limitations & prerequisites

  • BLEU 31.6 is a design target for the fine-tuning run, stated honestly — the report documents the measured figure after training.
  • Generation quality depends on passage quality; vague passages yield vague distractors.
  • The model generates English distractors only; other languages are out of scope.
  • Human plausibility ratings in the demo are simulated; the report documents the real rating protocol for the order's evaluation.
  • GPU inference timing is an expected value, not a measured benchmark.

Frequently Asked Questions

What is a distractor?

The wrong options in a multiple-choice question. Good distractors are plausible enough that only a student who understands the topic can eliminate them — writing them is the most time-consuming part of authoring MCQs.

Which dataset is used?

RACE — about 100,000 exam questions with passages and human-written distractors, from Chinese middle- and high-school English exams (Lai et al., EMNLP 2017). It is the standard benchmark for this task.

How do you stop the model leaking the answer?

Generated candidates are compared against the correct answer with sentence embeddings; anything above a similarity threshold is discarded before ranking, keeping the answer-leak rate below 4% by design.

Why BLEU if distractors just need to be plausible?

BLEU measures overlap with the human-written distractors in RACE — a useful automatic signal — but the honest evaluation is teacher plausibility ratings, which the project protocol includes.

Can it generate for my own passage and question?

The trained model accepts any passage/question/answer triple; the demo ships with curated samples, and the notebook shows how to run custom inputs.

Is this project suitable for a final-year project?

Yes — for Computer Science, IT and AI/ML programs. It covers conditional text generation, decoding strategies, and a thoughtful human-plus-automatic evaluation design. Suitable for B.E./B.Tech final-year projects in Computer Science, IT and AI & Machine Learning.

Components & software requirements
  • Python 3, PyTorch
  • Hugging Face Transformers
  • T5-base (Raffel et al.)
  • RACE dataset (Lai et al.)
  • Sentence embeddings (filtering)
  • HTML/CSS/JS demo
  • NLTK · sacreBLEU

Dataset & model details

  • Dataset: RACE — approximately 100,000 multiple-choice questions from Chinese middle- and high-school English examinations, each with a passage, question, correct answer and human-written distractors (Lai et al., EMNLP 2017).
  • Task: Distractor generation; input = passage + question + correct answer, output = three plausible-but-incorrect options.
  • Model: T5-base fine-tuned as conditional generation; diverse beam search decoding; embedding-similarity filtering; learned plausibility ranker.
  • Metrics: BLEU-4 design target 31.6 vs human distractors on the RACE test split; human plausibility design target 3.8/5; answer-leak rate design target below 4%; distinct-2 diversity design target 0.71. No metric is claimed as measured until the fine-tuning run is executed for the order.
Delivery information

Built-to-order project. Delivery timeline is shared after order confirmation based on current queue.

Support terms

Complete documentation, setup guide, and viva preparation included. Support for setup and explanation provided.

Download abstract (PDF)

Related guides

All guides
Blueprint-style technical illustration of multiple decision trees voting together into one final predictionStudents with basic Python and pandas skills who want a reliable first classifier for ML coursework and tabular data projects.

Random Forests Explained: Why Decision Trees Vote Better Together

Decision trees are readable but overfit; random forests fix this by training hundreds of varied trees on bootstrapped data with random feature subsets, then letting them vote. This guide explains Gini impurity, bagging, out-of-bag validation and the four hyperparameters that matter, with a complete scikit-learn workflow, honest feature-importance practices, and the mistakes students keep making.

Read guide
Illustration of object tracking showing video frames with bounding boxes and persistent ID labels following people and vehicles, comparing motion prediction and appearance matching.B.E./B.Tech Computer Science and Electronics students building video analytics projects — people counting, vehicle tracking, sports analysis — who have detection working and need

Object Tracking: DeepSORT and ByteTrack Explained

Detection finds objects per frame; tracking keeps their identities across frames. This guide explains tracking-by-detection, Kalman motion models, DeepSORT's appearance embeddings vs ByteTrack's low-confidence box recovery, tracking metrics (HOTA, IDF1, ID switches), and the tuning parameters that determine real-world quality.

Read guide
Illustration of image segmentation showing U-Net's U-shaped encoder-decoder with skip connections producing pixel masks, alongside Mask R-CNN detecting instances with masks.B.E./B.Tech Computer Science and AI/ML students moving from image classification or detection to pixel-level understanding — medical imaging, defect detection, autonomous driving

Image Segmentation: U-Net and Mask R-CNN

When projects need pixel-level answers, segmentation delivers. This guide explains semantic vs instance vs panoptic segmentation, U-Net's encoder-decoder with skip connections, Mask R-CNN's parallel mask head, Dice and IoU evaluation, paired augmentation, and how to choose the right architecture for your data and question.

Read guide
Get a quotation