YAML Metadata
Warning:
empty or missing yaml metadata in repo card
(https://huggingface.co/docs/hub/model-cards#model-card-metadata)
Model Card: bert-base-uncased-agnews-classifier
Model Details
- Model Name:
bert-base-uncased-agnews-classifier - Base Model:
bert-base-uncased - Model Type: Transformer-based text classification model
- Language: English
- Task: News topic classification (4-way classification)
- Fine-tuned Dataset: AG News
- Developed by: [Your Name or Organization]
- License: Apache 2.0
- Release Date: October 2025
Model Description
This model fine-tunes the bert-base-uncased model on the AG News dataset for news topic classification.
It classifies English news headlines or short articles into one of four categories: World, Sports, Business, and Science/Technology.
Intended Uses and Limitations
Intended Uses
- Automatic categorization of English news articles.
- Topic-based organization of media content.
- Text classification tasks for educational or research purposes.
Limitations
- Designed for English text only.
- May not generalize to domains outside of formal news (e.g., social media posts).
- Does not perform fact verification or sentiment analysis.
Training Details
Training Procedure
- Framework: PyTorch
- Library: Hugging Face Transformers
- Base Model:
bert-base-uncased - Optimizer: AdamW
- Learning Rate: 2e-5
- Batch Size: 16
- Epochs: 3
- Max Sequence Length: 128
Hardware
- Fine-tuning performed on a single NVIDIA GPU.
Evaluation
| Metric | Score |
|---|---|
| Accuracy | 0.86 |
| F1 Score (macro) | 0.86 |
Replace the above with your actual evaluation metrics if available.
Dataset Details
- Dataset: AG News (Version: latest)
- Training samples: 120,000
- Test samples: 7,600
- Classes: 4
- License: CC0 1.0 Universal
Label Mapping
| Label ID | Category |
|---|---|
| 0 | World |
| 1 | Sports |
| 2 | Business |
| 3 | Science/Technology |
How to Use
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
model_name = "your-username/bert-base-uncased-agnews-classifier"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
text = "NASA launches new satellite to study climate change."
inputs = tokenizer(text, return_tensors="pt")
with torch.no_grad():
outputs = model(**inputs)
probabilities = torch.nn.functional.softmax(outputs.logits, dim=-1)
predicted_label = torch.argmax(probabilities).item()
labels = ["World", "Sports", "Business", "Science/Technology"]
print(f"Predicted label: {labels[predicted_label]}")
Bias, Risks, and Ethical Considerations
- The AG News dataset primarily contains articles from English-language Western media sources, which may introduce geographical and cultural bias.
- The model’s predictions reflect the distribution of topics and wording found in that dataset.
- It should not be used to infer real-world importance, bias, or sentiment toward people or groups.
- Always validate model outputs before deploying in production or decision-making systems.
Environmental Impact
Training used a single GPU for a few epochs; estimated carbon footprint is minimal. Fine-tuning on small datasets like AG News is relatively lightweight compared to large-scale pretraining.
Citation
If you use this model, please cite:
@misc{yourname2025bertagnews,
title = {BERT-based AG News Classifier},
author = {Your Name},
year = {2025},
howpublished = {\url{https://huggingface.co/your-username/bert-base-uncased-agnews-classifier}},
}
Acknowledgements
- Base model: BERT (Devlin et al., 2018)
- Dataset: AG News Corpus (Zhang et al., 2015)
- Implementation: Hugging Face Transformers
- Downloads last month
- 43
Inference Providers
NEW
This model isn't deployed by any Inference Provider.
🙋
Ask for provider support