Downloads · 30 days
6
7% of all-time downloads
anuragsinghiitm/distilbert_output
distilbert_output is a text classification model from anuragsinghiitm. Use it when you need a label for a piece of text. It is set up for transformers. The card lists the license as mit.
Author: Anurag Singh Framework: Hugging Face Transformers + PyTorch Base Model: distilbert-base-uncased Task: Binary classification for multiple-choice question answering
Downloads · 30 days
6
7% of all-time downloads
All-time downloads
84
Public
Parameters
109M
1.1 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors438 MB · 100%
From the Hugging Face model README
Author: Anurag Singh
Framework: Hugging Face Transformers + PyTorch
Base Model: distilbert-base-uncased
Task: Binary classification for multiple-choice question answering
This model is a fine-tuned DistilBERT model developed for the Smart MCQ Solver Challenge.
The original task contains a question with five answer options (A-E). The problem was converted into a binary classification task by creating one training example for each (question, option) pair.
During inference, the model predicts a probability for each option, and the option with the highest probability is selected as the final answer.
Question: What is the capital of France?
| Input | Label |
|---|---|
| Question: What is the capital of France? Option: Berlin | 0 |
| Question: What is the capital of France? Option: Madrid | 0 |
| Question: What is the capital of France? Option: Paris | 1 |
| Question: What is the capital of France? Option: Rome | 0 |
| Question: What is the capital of France? Option: Lisbon | 0 |
This model is based on DistilBERT, a compressed version of BERT that retains most of BERT's language understanding capability while being significantly smaller and faster.
text Question + Option Text
↓
DistilBERT Tokenizer
↓
Input IDs
↓
DistilBERT Encoder (6 Transformer Layers)
↓
Contextual Representation
↓
Classification Head (Linear Layer)
↓
Binary Correctness Score
| Component | Value |
|---|---|
| Base Model | distilbert-base-uncased |
| Transformer Layers | 6 |
| Hidden Size | 768 |
| Attention Heads | 12 |
| Vocabulary Size | 30,522 |
| Max Position Embeddings | 512 |
| Classification Head | Linear layer (768 → 2) |
| Output Labels | 2 (incorrect, correct) |
Each training sample is constructed as:
Question: <question> Option: <option>
The text is tokenized using the DistilBERT WordPiece tokenizer and converted into:
input_idsattention_maskThe contextual representation produced by DistilBERT is passed to a linear classification head that outputs logits for two classes:
During inference, the probability of class 1 is used as the correctness score for each option. The option with the highest score among A-E is selected as the final answer.
This model is a fine-tuned version of bert-base-uncased on the private dataset. It achieves the following results on the evaluation set:
The model was trained on a multiple-choice question dataset where each question contained five candidate answers (A-E).
The original dataset was converted into a binary classification dataset by generating one training sample for every (question, option) pair.
Training labels:
Each input was tokenized using the DistilBERT tokenizer with appropriate padding and truncation before training.
Model performance was evaluated using:
The model was fine-tuned using Hugging Face Transformers with the following configuration:
| Parameter | Value |
|---|---|
| Base Model | distilbert-base-uncased |
| Task | Binary Sequence Classification |
| Loss Function | CrossEntropyLoss |
| Optimizer | AdamW |
| Learning Rate | 2e-5 |
| Number of Labels | 2 |
| Framework | PyTorch + Hugging Face Transformers |
The trained model predicts the probability that a candidate option is correct. For each MCQ, all options are scored independently, and the option with the highest probability is selected as the final answer.
The following hyperparameters were used during training:
The DistilBERT model achieved the best overall performance among the evaluated models in this project, outperforming both the custom BiLSTM and BERT models in terms of validation performance and Kaggle leaderboard score. The model was selected as the final submission because it provided the best balance between prediction accuracy, computational efficiency, and inference speed.
| Training Loss | Epoch | Step | Validation Loss | Accuracy | Precision | Recall | F1 |
|---|---|---|---|---|---|---|---|
| 0.2479 | 1.0 | 250 | 0.3284 | 0.9475 | 0.9743 | 0.7575 | 0.8523 |
| 0.2102 | 2.0 | 500 | 0.2452 | 0.952 | 0.8781 | 0.8825 | 0.8803 |
| 0.1279 | 3.0 | 750 | 0.1781 | 0.975 | 0.9605 | 0.9125 | 0.9359 |
| 0.1124 | 4.0 | 1000 | 0.1519 | 0.9775 | 0.9449 | 0.9425 | 0.9437 |
| 0.0485 | 5.0 | 1250 | 0.0985 | 0.986 | 0.9769 | 0.9525 | 0.9646 |