Views
No views yet
ProsusAI/finbert on the SEntFiN 1.0 dataset of human-annotated Indian financial news headlines sourced from the Economic Times and Moneycontrol, covering NSE500-listed companies.ProsusAI/finbert was trained primarily on US/EU financial text (SEC filings, financial news wire). On Indian financial headlines it scores approximately F1 = 0.76. This model addresses that domain gap by fine-tuning on 9,514 expert-annotated Indian financial headlines, achieving F1 = 0.873 on a held-out validation set — a +11% improvement on Indian financial text.| Property | Value |
|---|---|
| Base model | ProsusAI/finbert |
| Architecture | BERT-base (110M parameters) |
| Task | 3-class sentiment classification |
| Labels | positive (0), negative (1), neutral (2) |
| Training data | SEntFiN 1.0 — 8,086 samples |
| Validation data | SEntFiN 1.0 — 1,428 samples |
| Best epoch | 3 / 4 |
| F1 weighted | 0.873 |
| Accuracy | 0.873 |
| Training hardware | Kaggle T4 GPU (fp16) |
1TrainingArguments(
2 num_train_epochs=4,
3 per_device_train_batch_size=32,
4 learning_rate=2e-5,
5 warmup_steps=100,
6 weight_decay=0.01,
7 fp16=True,
8 load_best_model_at_end=True,
9 metric_for_best_model="f1_weighted",
10)| Class | Precision | Recall | F1 | Support |
|---|---|---|---|---|
| positive | 0.91 | 0.86 | 0.89 | 504 |
| negative | 0.87 | 0.89 | 0.88 | 407 |
| neutral | 0.84 | 0.87 | 0.86 | 517 |
| weighted avg | 0.87 | 0.87 | 0.87 | 1428 |
1from transformers import pipeline
2
3pipe = pipeline(
4 "text-classification",
5 model="tahp0604/finbert-sentfin",
6)
7
8headlines = [
9 "Reliance Industries posts record quarterly profit",
10 "HDFC Bank shares fall 4% after RBI penalty",
11 "TCS Q4 results in line with analyst estimates",
12]
13
14for h in headlines:
15 result = pipe(h)[0]
16 print(f"[{result['label'].upper():8s} {result['score']:.2f}] {h}")[POSITIVE 0.94] Reliance Industries posts record quarterly profit
[NEGATIVE 0.91] HDFC Bank shares fall 4% after RBI penalty
[NEUTRAL 0.83] TCS Q4 results in line with analyst estimates1import torch
2from transformers import AutoTokenizer, AutoModelForSequenceClassification
3
4tokenizer = AutoTokenizer.from_pretrained("tahp0604/finbert-sentfin")
5model = AutoModelForSequenceClassification.from_pretrained("tahp0604/finbert-sentfin")
6model.eval()
7
8def predict(text):
9 inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=128)
10 with torch.no_grad():
11 probs = torch.softmax(model(**inputs).logits, dim=-1)[0]
12 idx = int(probs.argmax())
13 label = model.config.id2label[idx]
14 return label, float(probs[idx])
15
16label, confidence = predict("Infosys raises revenue guidance for FY26")
17print(f"{label} ({confidence:.2f})") # positive (0.89)1id2label = {0: "positive", 1: "negative", 2: "neutral"}
2label2id = {"positive": 0, "negative": 1, "neutral": 2}ProsusAI/finbert — the model is a drop-in replacement.1@article{sinha2022sentfin,
2 title={SEntFiN 1.0: Entity-Aware Sentiment Analysis for Financial News},
3 author={Sinha, Ankur and Kedas, Satishwar and Kumar, Rishu and Malo, Pekka},
4 journal={Journal of the Association for Information Science and Technology},
5 volume={73},
6 number={9},
7 pages={1314--1335},
8 year={2022}
9}
10
11@article{araci2019finbert,
12 title={FinBERT: Financial Sentiment Analysis with Pre-Trained Language Models},
13 author={Araci, Dogu},
14 journal={arXiv preprint arXiv:1908.10063},
15 year={2019}
16}