CoolFace
Modelpublic

maaz-zaidi/transaction-classifier-minilm

sourceHugging Faceapache-2.0updated 5mo agoView on Hugging Face
0likes20downloads
Model Card

Transaction Classifier — Fine-tuned MiniLM (v4)

A fine-tuned sentence-transformers/all-MiniLM-L6-v2 model that classifies raw bank transaction strings into 10 budget categories using standard cross-entropy fine-tuning.

This is version 4 (Phase 4b) in a progressive model development series. It was the production model before being succeeded by the metadata-enriched variant (v7).

Model Details

PropertyValue
Base modelsentence-transformers/all-MiniLM-L6-v2 (22M params)
TaskMulti-class text classification (10 categories)
Training samples8,000
Epochs3
Batch size64
Learning rate2e-5
Max sequence length64 tokens
LossCross-entropy
FormatSafeTensors
Trained2026-03-29

Categories

IDCategory
0Food & Dining
1Transportation
2Shopping & Retail
3Entertainment & Recreation
4Healthcare & Medical
5Utilities & Services
6Financial Services
7Income
8Government & Legal
9Charity & Donations

Performance

Evaluated on 505 unique real-world RBC transactions (3,113 weighted, 2019-2026). Results shown are after Phase 4b preprocessing fixes.

Overall

MetricScore
Real-world accuracy (weighted)86.5%
ML-only accuracy78.7%
Validation accuracy93.0%

Per-Category Accuracy

CategoryAccuracy
Income100.0%
Healthcare & Medical100.0%
Financial Services94.7%
Food & Dining89.3%
Entertainment & Recreation88.6%
Transportation83.3%
Shopping & Retail78.9%
Utilities & Services68.4%
Government & Legal54.5%
Charity & Donations0.0%

Usage

python
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch

model_name = "maaz-zaidi/transaction-classifier-minilm"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)

categories = [
    "Food & Dining", "Transportation", "Shopping & Retail",
    "Entertainment & Recreation", "Healthcare & Medical",
    "Utilities & Services", "Financial Services", "Income",
    "Government & Legal", "Charity & Donations"
]

text = "UBER TRIP HELP.UBER.COM ON"
inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=64)

with torch.no_grad():
    logits = model(**inputs).logits
    predicted = torch.argmax(logits, dim=-1).item()

print(f"Category: {categories[predicted]}")
# Output: Category: Transportation

Training Data

Key Improvements Over Previous Versions

  • v3 (SetFit) -> v4: Switched from contrastive learning to standard cross-entropy fine-tuning. Accuracy improved from 80.5% to 84.5%.
  • Phase 4b fixes: Preprocessing improvements (AMZN MKTP -> AMAZON MARKETPLACE mapping, ATM/mobile deposit/card fee markers). Accuracy improved from 84.5% to 86.5%.
  • Utilities & Services jumped from 34.2% to 68.4%.

Part of a Series

See the Transaction Classifier collection for all 7 model versions.

Limitations

  • Trained on only 8,000 samples from a synthetic dataset
  • Charity & Donations: 0% accuracy due to insufficient training examples
  • Domain-specific to Canadian banking transaction formats
  • Best results achieved within a multi-stage pipeline (direction detection + rules + merchant KB + ML)

Citation

bibtex
@misc{zaidi2026txnclassifier,
  title={Transaction Classifier: Multi-Stage Bank Transaction Categorization},
  author={Maaz Zaidi},
  year={2026},
  url={https://huggingface.co/maaz-zaidi/transaction-classifier-minilm}
}