takala/financial_phrasebank
Updated โข 9.11k โข 263
Fine-tuned on Mistral-7B-Instruct using LoRA via Adaption AutoScientist.
Classifies financial news, headlines, and social media text into positive, negative, or neutral sentiment.
Built for the HackIndia Adaption AutoScientist Challenge โ Finance track.
| Metric | Base Model | Our Model | Improvement |
|---|---|---|---|
| Win Rate (our dataset) | 44 | 56 | +27% relative |
| Win Rate (market analysis category) | 40 | 60 | +50% relative |
| Dataset quality grade | E (2.0) | B (8.1) | +305% relative |
Training curves showed clean, consistent loss reduction with no overfitting across 4 epochs.
| Property | Value |
|---|---|
| Base model | mistralai/Mistral-7B-Instruct-v0.3 |
| Training method | Supervised Fine-Tuning (SFT) + LoRA |
| LoRA rank | 64 |
| LoRA alpha | 128 |
| Target layers | q_proj, k_proj, v_proj, o_proj |
| Epochs | 4 |
| Optimizer | Cosine LR scheduler |
| Warmup ratio | 0.05 |
| Gradient clipping | 1.0 |
| Weight decay | 0.01 |
| Training platform | Adaption AutoScientist |
| Dataset size | 20,000 rows (adapted) |
The training dataset is a curated merge of 6 sources totalling ~120,000 raw rows, cleaned and deduplicated down to 20,000 high-quality rows via Adaption's Adaptive Data pipeline.
| Source | Type | Rows (approx) |
|---|---|---|
| financial_phrasebank (sentences_allagree) | Human-labeled news sentences | ~2,200 |
| zeroshot/twitter-financial-news-sentiment | Human-labeled financial tweets | ~9,900 |
| flwrlabs/fingpt-sentiment-train | Financial NLP training data | ~76,800 |
| TimKoornstra/financial-tweets-sentiment | Human-labeled financial tweets | ~38,000 |
| nickmuchi/financial-classification | Financial text classification | ~2,000 |
| Hand-labeled originals (Indian market) | Original, manually written examples | ~60+ |
| NewsAPI live headlines | Rule-labelled recent business news | ~500 |
positive : ~35%
negative : ~33%
neutral : ~32%
Balanced across all three classes to prevent label bias.
Adaption's Adaptive Data pipeline was applied before training:
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
base_model = "mistralai/Mistral-7B-Instruct-v0.3"
lora_model = "Sashank1006/finance-sentiment-mistral-lora"
tokenizer = AutoTokenizer.from_pretrained(base_model)
model = AutoModelForCausalLM.from_pretrained(base_model, device_map="auto")
model = PeftModel.from_pretrained(model, lora_model)
model.eval()
def predict_sentiment(text: str) -> str:
prompt = f"Classify the sentiment of this financial text as positive, negative, or neutral:\n\n{text}\n\nSentiment:"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
output = model.generate(**inputs, max_new_tokens=5, do_sample=False)
result = tokenizer.decode(output[0], skip_special_tokens=True)
return result.split("Sentiment:")[-1].strip().lower()
# Example
text = "Reliance Industries reported a 23% jump in quarterly profit."
print(predict_sentiment(text)) # โ "positive"
Raw data (6 sources, ~120K rows)
โ
Merge + deduplicate (prepare_dataset.py)
โ
Upload to Adaption Adaptive Data
โ
Adaptive Data optimization (Grade E โ B, 305% quality improvement)
โ
AutoScientist fine-tuning (Mistral-7B-Instruct, LoRA, 4 epochs)
โ
Evaluation (Win rate: 44 โ 56 on dataset, 40 โ 60 on market analysis)
โ
Released on HuggingFace + Kaggle
Team Caribou โ HackIndia Adaption AutoScientist Challenge, Finance Track
Built using:
@misc{caribou2026financeSentiment,
title = {Finance Sentiment Classifier โ Indian Market Focus},
author = {Team Caribou},
year = {2026},
url = {https://huggingface.co/YOUR_HF_USERNAME/finance-sentiment-mistral-lora},
note = {Built for HackIndia Adaption AutoScientist Challenge}
}
Base model
mistralai/Mistral-7B-v0.3