ModernFinBERT: Financial Sentiment Analysis
ModernFinBERT is a financial sentiment analysis model based on the ModernBERT architecture, fine-tuned specifically for financial text classification.
Model Details
- Base Model: answerdotai/ModernBERT-base
- Task: 3-class sentiment classification (Negative, Neutral, Positive)
- Training Data: Financial text from multiple sources (excluding FinancialPhraseBank for evaluation)
- Parameters: 149,607,171
Performance
- FinancialPhraseBank Accuracy: 90.47%
- Target: >94% accuracy on FinancialPhraseBank
Usage
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
tokenizer = AutoTokenizer.from_pretrained("neoyipeng/ModernFinBERT-base")
model = AutoModelForSequenceClassification.from_pretrained("neoyipeng/ModernFinBERT-base")
text = "The company's quarterly results exceeded analyst expectations."
inputs = tokenizer(text, return_tensors="pt")
outputs = model(**inputs)
predictions = torch.nn.functional.softmax(outputs.logits, dim=-1)
labels = ["NEGATIVE", "NEUTRAL", "POSITIVE"]
predicted_class = labels[predictions.argmax().item()]
confidence = predictions.max().item()
print(f"Sentiment: {predicted_class} ({confidence:.2f})")
Training Details
- Epochs: 10
- Batch Size: 32
- Learning Rate: 5e-5
- Optimizer: AdamW
- Scheduler: Cosine
- Framework: Unsloth + Transformers
Citation
If you use this model, please cite:
@misc{modernfinbert2025,
title={ModernFinBERT: A Modern Approach to Financial Sentiment Analysis},
author={Neo Yi Peng},
year={2025},
howpublished={HuggingFace Model Hub},
url={https://huggingface.co/neoyipeng/ModernFinBERT-base}
}
- Downloads last month
- 8
Inference Providers
NEW
This model isn't deployed by any Inference Provider.
🙋
Ask for provider support