CoolFace
Modelpublic

LKHUMANLEIMA/ag-news-distilbert

sourceHugging Faceupdated 4mo agoView on Hugging Face
0likes58downloads
Model Card

base_model: distilbert-base-uncased tags:

  • —text-classification
  • —distilbert
  • —ag-news
  • —news-classification
  • —mlops

datasets: Recurrent/prepareddatamlops2

language: en

metrics:

  • —accuracy
  • —f1 pipeline_tag: text-classification

Model Card for Model ID

A DistilBERT model fine-tuned for 4-class news topic classification on the AG News dataset. Given a short news snippet, it predicts one of four categories: World, Sports, Business, Sci/Tech. <!-- Provide a quick summary of what the model is/does. -->

Model Details

Model Description

This is a distilbert-base-uncased model fine-tuned for sequence classification on AG News (4 classes). It was trained as part of an MLOps assignment workflow on Kaggle (GPU T4 x2), with experiment tracking via Weights & Biases and the best checkpoint pushed to the Hugging Face Hub. Two hyperparameter configurations were trained and compared, and the version with the higher weighted F1 score was published.

<!-- Provide a longer summary of what this model is. -->

  • —Developed by: LKHUMANLEIMA (PGD AI, IIT Jodhpur — MLOps group assignment)
  • —Model type: DistilBERT for sequence classification (DistilBertForSequenceClassification)
  • —Language(s) (NLP): English
  • —License: apache-2.0 (inherited from distilbert-base-uncased)
  • —Finetuned from model [optional]: `distilbert-base-uncased`

Model Sources [optional]

<!-- Provide the basic links for the model. -->

  • —Repository: https://huggingface.co/LKHUMANLEIMA/ag-news-distilbert
  • —Code: https://github.com/riteshmaury-iitj/group13-assignment-mlops
  • —Experiment tracking: Weights & Biases project mlops-assignment3

Uses

<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->

Direct Use

The model classifies a short English news headline or article snippet into one of four topics. Label mapping:

IDLabel
0World
1Sports
2Business
3Sci/Tech

Typical uses include news feed categorization, content tagging, and routing of news text by topic.

<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->

Downstream Use [optional]

<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app --> Can serve as a starting point for related topic-classification tasks (e.g., further fine-tuning on a different news taxonomy) or be wrapped behind an inference API/CI pipeline.

Out-of-Scope Use

<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. --> Not suitable for long documents — inputs are truncated to 128 tokens.

  • —Trained only on English AG News–style text; performance on other domains (social media, legal, medical, non-English) is unverified.
  • —Should not be used as the sole basis for high-stakes decisions, and is not intended for any harmful, deceptive, or surveillance application.

Bias, Risks, and Limitations

<!-- This section is meant to convey both technical and sociotechnical limitations. --> The model inherits biases present in distilbert-base-uncased and in the AG News corpus, which is drawn from a fixed period of English-language news sources. It may reflect the topical conventions and any imbalances of that data, may misclassify text styles unlike news articles, and confuses semantically overlapping categories (e.g., Business vs. Sci/Tech for tech-business stories). The 128-token limit means information beyond the start of a longer article is ignored.

Recommendations

<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->

Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.

How to Get Started with the Model

python
from transformers import pipeline

clf = pipeline("text-classification", model="LKHUMANLEIMA/ag-news-distilbert")
print(clf("NASA's new telescope captured images of a distant galaxy."))
# -> [{'label': 'Sci/Tech', 'score': ...}]

Or load the components directly:

python
from transformers import AutoTokenizer, AutoModelForSequenceClassification

tokenizer = AutoTokenizer.from_pretrained("LKHUMANLEIMA/ag-news-distilbert")
model = AutoModelForSequenceClassification.from_pretrained("LKHUMANLEIMA/ag-news-distilbert")

Training Details

Training Data

<!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. --> Prepared AG News dataset hosted on the Hub: `Recurrent/prepared_data_mlops2` (loaded from the prepared_data directory). The data is a 4-class topic-classification set with text and label fields.

Training Procedure

<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->

Preprocessing [optional]

Texts were tokenized with the distilbert-base-uncased tokenizer using padding="max_length", truncation=True, and max_length=128

Training Hyperparameters

Two versions were trained from the pretrained checkpoint (each started fresh, not from the other's checkpoint) using the 🤗 Trainer. Common settings: weight_decay=0.01, max_length=128, eval and save per epoch, load_best_model_at_end=True, metric_for_best_model="f1".

SettingVersion 1Version 2
Learning rate2e-55e-5
Train batch size1632
Epochs3.53
Weight decay0.010.01
Eval batch size3232

The published checkpoint is whichever version achieved the higher weighted F1 on the test split.

  • —Training regime: fp32 (default Trainer settings)

Evaluation

Testing Data, Factors & Metrics

Testing Data

The test split of `Recurrent/prepared_data_mlops2`.

Metrics
  • —Accuracy — overall fraction of correctly classified examples.
  • —F1 (weighted) — weighted-average F1 across the four classes, used as the model-selection criterion to account for any class imbalance.

Results

<!-- Fill in from your W&B run / trainer.evaluate() output (project: mlops-assignment3). -->

MetricVersion 1Version 2
AccuracyTODOTODO
F1 (weighted)TODOTODO
Eval lossTODOTODO

Best version published: TODO (v1 or v2)

Summary

DistilBERT fine-tuned on AG News reaches strong topic-classification performance; the exact figures for this run are available in the W&B project mlops-assignment3.

Environmental Impact

Carbon emissions can be estimated using the Machine Learning Impact calculator presented in Lacoste et al. (2019).

  • —Hardware Type: NVIDIA Tesla T4 x2 (Kaggle)
  • —Cloud Provider: Kaggle

Technical Specifications

Model Architecture and Objective

DistilBERT encoder with a sequence-classification head (4 output labels), trained with a cross-entropy objective for single-label classification.

Compute Infrastructure

Hardware

NVIDIA Tesla T4 x2 GPUs (Kaggle notebook environment).

Software

Python with 🤗 transformers, datasets, accelerate, scikit-learn (metrics), and wandb (tracking). Secrets (WANDB_API_KEY, HF_TOKEN, GITHUB_TOKEN) were managed via Kaggle Secrets and never hardcoded.

Citation

If you use this model, please cite the base model and dataset.

DistilBERT (BibTeX):

bibtex
@article{sanh2019distilbert,
  title={DistilBERT, a distilled version of BERT: smaller, faster, cheaper and lighter},
  author={Sanh, Victor and Debut, Lysandre and Chaumond, Julien and Wolf, Thomas},
  journal={arXiv preprint arXiv:1910.01108},
  year={2019}
}

AG News (BibTeX):

bibtex
@inproceedings{zhang2015character,
  title={Character-level convolutional networks for text classification},
  author={Zhang, Xiang and Zhao, Junbo and LeCun, Yann},
  booktitle={Advances in Neural Information Processing Systems},
  year={2015}
}

Model Card Authors

LKHUMANLEIMA (Group 13, MLOps assignment — PGD AI, IIT Jodhpur).

Model Card Contact

Via the Hugging Face repository: https://huggingface.co/LKHUMANLEIMA/ag-news-distilbert