QueryLens: DistilBERT Fine-Tuned on SQuAD v1.1
📌 Model Overview
QueryLens is an extractive Question Answering model based on distilbert-base-uncased, fine-tuned end-to-end on the complete Stanford Question Answering Dataset (SQuAD v1.1). Given a reference passage (Context) and a natural language Question, the model extracts the precise answer span directly from the text.
- Base Model:
distilbert-base-uncased(66M parameters) - Architecture: DistilBertForQuestionAnswering
- Training Dataset: SQuAD v1.1 (87,599 training examples)
- Validation Dataset: SQuAD v1.1 Validation Split (10,570 examples)
- Training Hardware: NVIDIA GeForce RTX 3060 Laptop GPU (6GB VRAM, Mixed Precision FP16)
📊 Benchmark & Performance
Evaluated rigorously on the complete official SQuAD v1.1 validation split (10,570 samples):
| Model | Training Samples | Exact Match (EM) | Token-Level F1 |
|---|---|---|---|
| QueryLens (Full Fine-Tuned) | 87,599 (Full) | 77.09% | 85.25% |
| Pretrained DistilBERT Baseline | Reference Checkpoint | 79.10% | 86.87% |
| DistilBERT 4k Subset | 4,000 | 47.05% | 57.42% |
🚀 Quick Start / Inference
from transformers import pipeline
qa = pipeline("question-answering", model="a7medanoo/querylens-distilbert-squad")
context = (
"Stanford University is a private research university in Stanford, California. "
"It was founded in 1885 by Leland and Jane Stanford in memory of their only child."
)
question = "When was Stanford University founded?"
result = qa(question=question, context=context)
print(f"Answer: {result['answer']}")
print(f"Score: {result['score']:.4f}")
print(f"Span: [{result['start']}, {result['end']}]")
⚙️ Hyperparameters
- Learning Rate:
3e-5(Linear warmup with decay) - Optimizer: AdamW (
weight_decay=0.01) - Batch Size: 16 per device (Gradient Accumulation Steps = 2, Effective Batch Size = 32)
- Epochs: 2
- Max Sequence Length: 384
- Doc Stride: 128
- Precision: FP16 Mixed Precision