|
|
--- |
|
|
language: en |
|
|
license: mit |
|
|
tags: |
|
|
- federated-learning |
|
|
- finance |
|
|
- sentiment-analysis |
|
|
- bert |
|
|
- finbert |
|
|
- fedprox |
|
|
library_name: transformers |
|
|
pipeline_tag: text-classification |
|
|
authors: |
|
|
- Harsh Prasad |
|
|
- Sai Dhole |
|
|
--- |
|
|
|
|
|
## FinBERTβFedProx: Federated Proximal Optimization for Financial Sentiment Analysis |
|
|
|
|
|
--- |
|
|
|
|
|
### π Model Summary |
|
|
|
|
|
This model is a **federated version of FinBERT** fine-tuned for |
|
|
**financial sentiment classification (Positive / Negative / Neutral)**. |
|
|
|
|
|
Training is performed across **three clients**: |
|
|
|
|
|
* Financial Twitter posts |
|
|
* Financial news headlines |
|
|
* Financial reports & statements |
|
|
|
|
|
Unlike standard FedAvg, this model uses **FedProx optimization**, |
|
|
which adds a **proximal penalty term** to stabilize client training when |
|
|
data across clients is **non-identically distributed (non-IID)**. |
|
|
|
|
|
This model is part of a research project comparing: |
|
|
|
|
|
* FedAvg |
|
|
* FedProx |
|
|
* Adaptive Aggregation |
|
|
|
|
|
for federated financial NLP. |
|
|
|
|
|
--- |
|
|
|
|
|
### π§ Intended Use |
|
|
|
|
|
Designed for: |
|
|
|
|
|
* Financial sentiment research |
|
|
* Risk & market analytics |
|
|
* Academic exploration of federated learning |
|
|
|
|
|
Not intended for automated trading without expert oversight. |
|
|
|
|
|
--- |
|
|
|
|
|
### π Model Architecture |
|
|
|
|
|
Base Model: |
|
|
|
|
|
``` |
|
|
|
|
|
ProsusAI/finbert |
|
|
|
|
|
``` |
|
|
|
|
|
Task: |
|
|
|
|
|
``` |
|
|
|
|
|
Sequence classification β 3 classes |
|
|
|
|
|
``` |
|
|
|
|
|
Training Setup: |
|
|
|
|
|
``` |
|
|
|
|
|
3 federation clients |
|
|
10 global rounds |
|
|
3 local epochs |
|
|
FedProx (Β΅ = 0.05) |
|
|
|
|
|
```` |
|
|
|
|
|
--- |
|
|
|
|
|
### π Client Data Sources |
|
|
|
|
|
| Client | Data Type | |
|
|
| -------- | ----------------- | |
|
|
| Client-1 | Financial Twitter | |
|
|
| Client-2 | Financial News | |
|
|
| Client-3 | Financial Reports | |
|
|
|
|
|
No raw data is shared between clients. |
|
|
|
|
|
--- |
|
|
|
|
|
### π Privacy Advantage |
|
|
|
|
|
Only model updates are exchanged β not text data. |
|
|
This supports data governance and privacy-aware ML. |
|
|
|
|
|
--- |
|
|
|
|
|
### π Performance (Validation) |
|
|
|
|
|
| Method | Final Avg F1-Score | |
|
|
| ------- | ------------------ | |
|
|
| FedProx | **0.855** | |
|
|
|
|
|
FedProx provided **slightly better stability and performance** |
|
|
compared to standard FedAvg under client data imbalance. |
|
|
|
|
|
--- |
|
|
|
|
|
### π Example Usage |
|
|
|
|
|
```python |
|
|
from transformers import AutoTokenizer, AutoModelForSequenceClassification |
|
|
import torch |
|
|
|
|
|
model = AutoModelForSequenceClassification.from_pretrained( |
|
|
"harshprasad03/FinBERT-FedProx" |
|
|
) |
|
|
tokenizer = AutoTokenizer.from_pretrained( |
|
|
"harshprasad03/FinBERT-FedProx" |
|
|
) |
|
|
|
|
|
text = "Oil stocks rose after strong quarterly performance." |
|
|
|
|
|
inputs = tokenizer(text, return_tensors="pt") |
|
|
outputs = model(**inputs) |
|
|
|
|
|
prob = torch.softmax(outputs.logits, dim=1) |
|
|
print(prob) |
|
|
```` |
|
|
|
|
|
--- |
|
|
|
|
|
### β οΈ Limitations |
|
|
|
|
|
* Trained only on finance-domain text |
|
|
* Sentiment β market prediction |
|
|
* Model may inherit dataset biases |
|
|
* Designed for research use |
|
|
|
|
|
--- |
|
|
|
|
|
### π Citation |
|
|
|
|
|
``` |
|
|
Harsh Prasad, Sai Dhole (2025). |
|
|
FedProx-based Federated FinBERT for Financial Sentiment Analysis. |
|
|
``` |
|
|
|
|
|
--- |
|
|
|
|
|
### π¨βπ» Authors |
|
|
|
|
|
**Harsh Prasad** |
|
|
AI and ML Research |
|
|
|
|
|
**Sai Dhole** |
|
|
AI and ML Research |
|
|
|
|
|
--- |