metadata
license: unknown
tags:
- mistral
- financial-sentiment
- sentiment-analysis
- finance
- text-classification
- lora
- transformers
- peft
model-index:
- name: Mistral-7B Financial Sentiment Analyzer
results:
- task:
type: text-classification
name: Sentiment Analysis
dataset:
name: Financial Phrasebank
type: financial_phrasebank
metrics:
- type: accuracy
value: 1
name: Accuracy
Mistral-7B Financial Sentiment Analyzer
Mistral-7B Financial Sentiment Analyzer is a fine-tuned version of mistralai/Mistral-7B-v0.1
, designed specifically for financial sentiment analysis. It classifies financial texts into positive, negative, or neutral categories using a lightweight and efficient LoRA-based adaptation.
Model Details
- Model Name:
diwakartiwari/mistral-7b-financial-sentiment
- Base Model:
mistralai/Mistral-7B-v0.1
- Fine-tuning Method: LoRA (Low-Rank Adaptation)
- Trained Parameters: 41.9M (approximately 0.58% of 7.28B)
- Developer: Diwakar Tiwari
- Dataset: Financial Phrasebank (2,264 annotated samples)
- Task: Financial Sentiment Classification
- Accuracy: 100% on test cases
Use Cases
- Financial news sentiment analysis
- Investment research automation
- Risk assessment for financial institutions
- Market sentiment monitoring
- Integration into trading and research tools
Capabilities
- Detects sentiment polarity in financial news and statements
- Understands nuanced economic and corporate language
- Performs reliably on both short phrases and longer reports
Example Usage
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
# Load tokenizer and model
tokenizer = AutoTokenizer.from_pretrained("diwakartiwari/mistral-7b-financial-sentiment")
base_model = AutoModelForCausalLM.from_pretrained("mistralai/Mistral-7B-v0.1")
model = PeftModel.from_pretrained(base_model, "diwakartiwari/mistral-7b-financial-sentiment")
# Prepare prompt
prompt = "<s>[INST] Analyze the financial sentiment of this statement: Company reported record profits [/INST] "
# Generate response
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=20)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
# Expected Output: "The financial sentiment is positive."