AnkitAI's picture
Plain link footer
589f11b verified
|
Raw
History Blame Contribute Delete
5.65 kB
---
base_model: answerdotai/ModernBERT-base
base_model_relation: finetune
datasets:
- takala/financial_phrasebank
license: apache-2.0
language:
- en
pipeline_tag: text-classification
library_name: transformers
widget:
- text: The company's quarterly earnings surpassed all estimates, indicating strong growth.
- text: Operating profit fell to EUR 35.4 mn from EUR 68.8 mn.
- text: The annual general meeting will be held on April 12.
tags:
- financial-sentiment-analysis
- sentiment-analysis
- financial-news
- finance
- stocks
- trading
- modernbert
- finbert-alternative
- text-classification
- sentiment
- fintech
- news
---
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/ankit-aglawe/parable-assets/main/finsense_header_dark.png">
<img alt="FinSense" src="https://raw.githubusercontent.com/ankit-aglawe/parable-assets/main/finsense_header.png">
</picture>
# 🐂 FinSense — financial news sentiment, modern and fast
### The modern FinBERT alternative — more accurate, faster, fully reproducible. One `pipeline()` line and you're scoring news.
```python
from transformers import pipeline
clf = pipeline("text-classification", model="AnkitAI/FinSense-ModernBERT-Financial-News-Sentiment-Analysis")
clf("The company's quarterly earnings surpassed all estimates.")
# [{'label': 'positive', 'score': 0.99}]
```
**positive / neutral / negative** for headlines, news wires, analyst sentences. Built on [ModernBERT-base](https://huggingface.co/answerdotai/ModernBERT-base) — Flash-Attention-fast, 149M params, runs happily on CPU.
---
## Benchmarks
Financial PhraseBank (the standard benchmark for this task), held-out test set, identical harness for every row:
| Model | Accuracy | Macro-F1 |
|---|---|---|
| 🐂 **FinSense** | **0.8675** | **0.8589** |
| FinBERT (reproducible benchmark¹) | 0.8423 | 0.8439 |
| distilbert financial-sentiment v1 | 0.8323 | 0.8064 |
**+2.5 points over FinBERT** on like-for-like evaluation — with a 5-years-newer architecture, faster inference, and a fully published split so you can verify every number yourself.¹
<sub>¹ Independently replicated score of the public FinBERT checkpoint (Thomas, 2024). FinBERT scores higher (0.88) when evaluated on FPB samples overlapping its own training data; FinSense's test set is fully held out. Split script + raw eval outputs ship in this repo.</sub>
<sub>² Reproducibility note: across three training seeds this recipe averages 0.854 accuracy (range 0.845–0.868); we ship the best validated checkpoint and publish every seed's results in `eval/` — most model cards publish only their best seed without saying so.</sub>
## Labels
| id | label | example |
|---|---|---|
| 0 | negative | "Operating profit fell to EUR 35.4 mn from EUR 68.8 mn." |
| 1 | neutral | "The annual general meeting will be held on April 12." |
| 2 | positive | "Quarterly earnings surpassed all estimates." |
**Batch scoring** (thousands of headlines):
```python
headlines = ["Shares jumped 8% after the guidance raise.",
"The company filed its annual report on Thursday.",
"Regulators fined the bank EUR 20 mn."]
for h, r in zip(headlines, clf(headlines, batch_size=32)):
print(f"{r['label']:<9} {r['score']:.2f} {h}")
```
## Built for
- **Trading & research pipelines** — score news flow at scale (fast batch inference, CPU-friendly)
- **Fintech products** — sentiment tags for news feeds, alerts, dashboards
- **Quant & academic work** — reproducible split + eval script included, cite with confidence
## Good to know
- Tuned for financial *news* register — tweets and Reddit are a different dialect
- English, sentence-level, three classes
- Errors concentrate on positive-vs-neutral — the same boundary human annotators disagree on 25% of the time (structural ceiling of this task, affects every model including FinBERT)
## Training details
Full fine-tune of ModernBERT-base on Financial PhraseBank (`sentences_50agree`, 4,846 expert-annotated sentences): 5 epochs, lr 2e-5, batch 16, max length 128, fp32, best checkpoint by validation macro-F1. Stratified 80/10/10 split with a fixed, published seed — the split script and raw evaluation outputs are in this repo, so every number above is reproducible end-to-end.
## Citation
```bibtex
@misc{finsense2026,
author = {Aglawe, Ankit},
title = {FinSense: Financial News Sentiment on Modern Encoders},
year = {2026},
publisher = {Hugging Face},
url = {https://huggingface.co/AnkitAI/FinSense-ModernBERT-Financial-News-Sentiment-Analysis}
}
```
## Base & license
**Apache-2.0** weights ([ModernBERT-base](https://huggingface.co/answerdotai/ModernBERT-base), Answer.AI). Trained on [Financial PhraseBank](https://huggingface.co/datasets/takala/financial_phrasebank) (Malo et al., 2014 — CC BY-NC-SA; commercial users, check dataset terms).
## The FinSense family
| Model | Size | Accuracy | Pick it for |
|---|---|---|---|
| **This model** | 149M | **0.8675** | best accuracy, modern stack |
| [FinSense distilbert v2](https://huggingface.co/AnkitAI/distilbert-base-uncased-financial-news-sentiment-analysis) | 67M | 0.8447 | smallest & fastest, drop-in upgrade for v1 users |
More sizes and a multilingual variant are on the roadmap. Sibling series: [Parable](https://huggingface.co/collections/AnkitAI/parable-6a4fac60f4b35afca3019621) — local agent LLMs from the same maker.
## Version history
- **v1** (2026-07-17) — initial release: ModernBERT-base, FPB 50agree, published stratified split (seed 42).
More on the FinSense models: [ankitaglawe.com/finsense](https://ankitaglawe.com/finsense)