BERT fine-tuned on AG News (Topic Classification)

Model description

This model is a fine-tuned version of bert-base-uncased for topic classification on the AG News dataset. It classifies English news articles into four categories: World, Sports, Business, and Sci/Tech.

Training data

  • Dataset: fancyzhx/ag_news
  • Training examples: 108000 (after reserving 12000 for validation)
  • Validation examples: 12000
  • Test examples (official, held out for final evaluation only): 7600
  • Classes: World, Sports, Business, Sci/Tech

Training procedure

  • Base model: bert-base-uncased
  • Adaptation method: Full fine-tuning
  • Encoder learning rate: 2e-5
  • Classification head learning rate: 1e-3
  • Train batch size: 16, eval batch size: 32
  • Epochs: 1
  • Seed: 42

Evaluation results (official AG News test set)

  • Accuracy: 0.9445
  • Macro F1: 0.9444
  • Official test loss: 0.1754

Intended use

Automatic topic classification of English news articles into the four AG News categories. Can serve as a baseline for organizing or filtering English news content by topic.

Limitations

  • Trained and evaluated only on AG News; may not generalize to other domains, writing styles, or languages.
  • English only.
  • Input truncated to 128 tokens.
  • Fine-tuned for a single epoch.

References

  • Devlin, J., Chang, M.-W., Lee, K., & Toutanova, K. (2019). BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding.
  • Zhang, X., Zhao, J., & LeCun, Y. (2015). Character-level Convolutional Networks for Text Classification (source of the AG News corpus).
  • Hugging Face Transformers documentation: https://huggingface.co/docs/transformers
Downloads last month
37
Safetensors
Model size
0.1B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Dataset used to train bialexacosta21/bert-agnews-topic-classification