Downloads · 30 days
6
18% of all-time downloads
yahoyaho13/finbert-lora-operational-sentiment
finbert-lora-operational-sentiment is a machine learning model from yahoyaho13. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for peft. The card lists the license as apache-2.0.
This repository provides a LoRA adapter for ProsusAI/finbert that mitigates a domain bias commonly observed in financial sentiment models.
Downloads · 30 days
6
18% of all-time downloads
All-time downloads
34
Public
Repo size
10.7 MB
Likes
0
Public
Click a slice to open those files.
.safetensors10.7 MB · 100%
From the Hugging Face model README
This repository provides a LoRA adapter for ProsusAI/finbert that mitigates a domain bias commonly observed in financial sentiment models.
Standard FinBERT models are heavily trained on financial news and reports.
As a result, phrases containing words such as "down", "reduced", or "failure"
are often interpreted as negative signals,
even when they describe improvements in operational or quality-related metrics.
However, in manufacturing, operations, and enterprise contexts, statements like:
"Failure rate down 10% QoQ"
represent positive operational improvements.
This adapter reduces that semantic conflict inside the model, without rule-based postprocessing.
✅ Classifies decreases in bad operational metrics as Positive
Quality / Operations KPIs
✅ Preserves negative sentiment for genuine financial deterioration
| Text | Base FinBERT | +Adapter (LoRA) |
|---|---|---|
| Failure rate down 10% QoQ | Negative (0.9640) | Positive (0.9000) |
| Defect rate reduced | Neutral (0.6343) | Positive (0.7902) |
| Revenue reduced by 20% | Negative (0.9690) | Negative (0.9469) |
| The production line was audited last week. | Neutral (0.5524) | Positive (0.6094) |
The adapter consistently reclassifies decreases in negative operational KPIs as Positive, while preserving Negative sentiment for genuine financial deterioration.
These examples are based on a small set of manually selected sentences and are intended for illustrative comparison.
0 → positive 1 → negative 2 → neutral
from transformers import AutoTokenizer, AutoModelForSequenceClassification
from peft import PeftModel
import torch
base = "ProsusAI/finbert"
adapter = "yahoyaho13/finbert-lora-operational-sentiment"
device = "cuda" if torch.cuda.is_available() else "cpu"
tokenizer = AutoTokenizer.from_pretrained(base)
base_model = AutoModelForSequenceClassification.from_pretrained(
base,
num_labels=3,
id2label={0: "positive", 1: "negative", 2: "neutral"},
label2id={"positive": 0, "negative": 1, "neutral": 2},
)
model = PeftModel.from_pretrained(base_model, adapter).to(device).eval()
text = "Failure rate down 10% QoQ"
inputs = tokenizer(text, return_tensors="pt").to(device)
with torch.inference_mode():
probs = torch.softmax(model(**inputs).logits, dim=-1)
print({base_model.config.id2label[i]: round(float(probs[0, i]), 4) for i in range(3)})
Base model: ProsusAI/finbert
Fine-tuning method: LoRA (PEFT)
Target modules: all-linear
LoRA configuration:
Dataset size: ~170 short operational / financial statements
Hardware: NVIDIA GTX 1060 6GB (local training)
Apache-2.0 (inherits base model license)