Financial-Sentiment-LLM (Multi-Task FinBERT)
A production-ready financial sentiment classifier fine-tuned on FinBERT. This model utilizes a Multi-Task Architecture (Classification + Regression) to achieve state-of-the-art performance across diverse financial text sources, including professional news, social media, and forum discussions.
- 🚀 Live Demo: Hugging Face Space
- 💻 Source Code: GitHub Repository
- 👨💻 Author: Pablo Matorras-Cuevas
Model Performance
This Multi-Task model achieves 85.4% overall accuracy, significantly outperforming standard baselines, particularly on noisy social media data.
| Metric / Dataset | FinBERT (Multi-Task) | FinBERT (LoRA) |
|---|---|---|
| Overall Accuracy | 85.4% | 83.2% |
| Macro F1-Score | 0.83 | 0.80 |
| Financial PhraseBank (News) | 95.9% | 97.1% |
| Twitter Financial News | 83.3% | 80.5% |
| FiQA (Forums) | 81.5% | 72.6% |
Note: For edge deployment or low-memory environments, check out the LoRA version which reduces storage by 99% (5MB vs 420MB).
Architecture
Unlike standard sentiment classifiers, this model shares a bert-base backbone with two task-specific heads:
- Classification Head: Predicts
Negative/Neutral/Positive(Optimized for News & Twitter). - Regression Head: Predicts a continuous sentiment score (Optimized for FiQA forum discussions).
This approach yielded a +6.1% accuracy boost on Twitter data compared to single-task training, proving that learning continuous sentiment intensity helps the model understand noisy social text better.
Usage
You can use this model directly with the Hugging Face pipeline or AutoModel:
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
# Load the model and tokenizer
model_name = "pmatorras/financial-sentiment-multi-task"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
# Inference
text = "The stock market rally is driven by strong tech earnings."
inputs = tokenizer(text, return_tensors="pt")
with torch.no_grad():
outputs = model(**inputs)
probabilities = torch.nn.functional.softmax(outputs.logits, dim=-1)
print(probabilities)
Training Details
- Base Model: ProsusAI/finbert
- Optimizer: AdamW
- Loss Function: Weighted sum of Cross-Entropy (Classification) and MSE (Regression).
- Compute: Trained on NVIDIA RTX 4050.
- Downloads last month
- -
Model tree for pmatorras/financial-sentiment-analysis
Base model
ProsusAI/finbert