bert-base-uncased-agnews4-v01

Model description

This model is a fine-tuned version of bert-base-uncased
on the AG News dataset.
It classifies English news headlines or articles into four categories:

Label Category Description
0 World International and world news
1 Sports Sports-related news
2 Business Financial and economic news
3 Sci/Tech Science and technology news

The model was trained for text classification using the transformers library from Hugging Face.


Intended uses & limitations

Intended uses

  • News topic classification
  • Benchmarking or educational purposes
  • Text categorization for NLP pipelines

Limitations

  • The model is trained on English text only.
  • It may perform poorly on informal or domain-specific text (e.g., social media).
  • The dataset contains news articles up to 2015; recent topics or events may be underrepresented.

How to use

from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch

tokenizer = AutoTokenizer.from_pretrained("Vantish/bert-based-uncased-agnews4-v01")
model = AutoModelForSequenceClassification.from_pretrained("Vantish/bert-based-uncased-agnews4-v01")

text = "NASA launches a new satellite to study climate change."
inputs = tokenizer(text, return_tensors="pt")
outputs = model(**inputs)
pred = torch.argmax(outputs.logits, dim=-1).item()

label_map = {
    0: "World",
    1: "Sports",
    2: "Business",
    3: "Sci/Tech"
}
print("Predicted label:", label_map[pred])

Training procedure

  • Base model: bert-base-uncased
  • Dataset: AG News
  • Task: Text classification (4 classes)
  • Optimizer: AdamW
  • Learning rate: 2e-5
  • Batch size: 16
  • Epochs: 3
  • Loss function: CrossEntropyLoss
  • Evaluation metric: Accuracy

Hardware

Trained on a single NVIDIA GPU (e.g., T4 or V100).


Evaluation results

| Metric | Score | | F1 Score | 85.6% | | Accuracy | 85.5% |

⚠️ Replace with your actual evaluation results if available.


Citation

If you use this model, please cite:

@misc{bert_agnews_finetune,
  title={BERT Base Uncased Fine-Tuned on AG News},
  author={Vantish},
  year={2025},
  howpublished={\url{https://huggingface.co/Vantish/bert-based-uncased-agnews4-v01}},
}

License


Author

Author: [Vantish]


Downloads last month
1
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 Vantish/bert-based-uncased-agnews4-v01

Evaluation results