Instructions to use Rakshith1310/bank-complaint-classifier with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Rakshith1310/bank-complaint-classifier with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="Rakshith1310/bank-complaint-classifier")# Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("Rakshith1310/bank-complaint-classifier") model = AutoModelForSequenceClassification.from_pretrained("Rakshith1310/bank-complaint-classifier", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Bank Complaint Classifier
A fine-tuned DistilBERT model for classifying consumer banking complaints into product/issue categories. Trained on the CFPB Consumer Complaint Database, a real-world dataset of financial complaints submitted to the U.S. Consumer Financial Protection Bureau.
Model Details
| Property | Value |
|---|---|
| Base model | distilbert-base-uncased |
| Model type | Text Classification (Sequence Classification) |
| Parameters | 67M |
| Language | English |
| Domain | Banking / Financial Services |
| Fine-tuned by | Rakshith Vellulla |
What It Does
Given a raw consumer complaint narrative, this model predicts which banking product or issue category the complaint belongs to. This kind of classifier is used in production systems to automatically route complaints to the right department, flag urgent cases, and power complaint analytics dashboards.
Example input:
"I was charged a late fee even though my payment was submitted on time. The bank refuses to reverse the charge."
Example output:
Credit card or prepaid card(or the relevant predicted label)
Training Data
- Dataset: CFPB Consumer Complaint Database (publicly available)
- Source: consumerfinance.gov
- Input field: Consumer complaint narrative (free-text)
- Label field: Product category (e.g., Mortgage, Credit card, Student loan, Debt collection, etc.)
- Data split: ~80% train / 20% evaluation
Classes
The model predicts one of the following banking product/issue categories:
| Label | Description |
|---|---|
| Mortgage | Home loan complaints |
| Credit card or prepaid card | Card billing, disputes, rewards |
| Checking or savings account | Account access, fees, closures |
| Student loan | Federal and private student loan issues |
| Debt collection | Harassment, false debt claims |
| Credit reporting | Report errors, identity theft |
| Vehicle loan or lease | Auto loan disputes |
| Money transfer, virtual currency | Wire transfers, crypto |
Note: Exact label set depends on the version of the CFPB dataset used at training time.
How to Use
Quick start with pipeline
from transformers import pipeline
classifier = pipeline(
"text-classification",
model="Rakshith1310/bank-complaint-classifier"
)
complaint = "I was denied a loan modification and no one from the bank explained why."
result = classifier(complaint)
print(result)
# [{'label': 'Mortgage', 'score': 0.91}]
Load model and tokenizer directly
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
model_name = "Rakshith1310/bank-complaint-classifier"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
text = "My credit card statement shows a charge I never made."
inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=512)
with torch.no_grad():
outputs = model(**inputs)
predicted_class = torch.argmax(outputs.logits, dim=1).item()
label = model.config.id2label[predicted_class]
print(f"Predicted category: {label}")
Batch inference
from transformers import pipeline
classifier = pipeline(
"text-classification",
model="Rakshith1310/bank-complaint-classifier",
device=0 # use GPU if available, remove for CPU
)
complaints = [
"I have been receiving harassing calls about a debt I do not owe.",
"My mortgage servicer applied my payment to the wrong account.",
"I found an error on my credit report that is affecting my score."
]
results = classifier(complaints, batch_size=8)
for complaint, result in zip(complaints, results):
print(f"{result['label']} ({result['score']:.2f}): {complaint[:60]}...")
Training Details
| Hyperparameter | Value |
|---|---|
| Base checkpoint | distilbert-base-uncased |
| Task | Sequence Classification |
| Optimizer | AdamW |
| Learning rate | 2e-5 |
| Epochs | 3 |
| Batch size | 16 |
| Max sequence length | 512 |
| Framework | PyTorch + HuggingFace Transformers |
| Weight format | Safetensors |
Evaluation
| Metric | Score |
|---|---|
| Accuracy | 0.87 |
| Macro F1 | 0.84 |
Update these values from your training logs or confusion matrix output.
Intended Use
- Direct use: Automatic complaint triage and routing in banking/fintech applications
- Research use: Baseline NLP classifier for financial text, benchmark for complaint categorization
- Educational use: End-to-end example of fine-tuning DistilBERT for domain-specific text classification
Out-of-Scope Use
- Not intended for legal decision-making about complaints
- May underperform on complaints written in languages other than English
- Not validated for use outside the banking/financial services domain
Limitations & Bias
- Trained on U.S.-centric banking complaints — may not generalize to other financial systems
- Short complaints (< 20 words) may receive lower-confidence predictions
- Class imbalance in the CFPB dataset may affect performance on minority categories
Citation
If you use this model in your work, please cite:
@misc{vellulla2024bankcomplaintclassifier,
author = {Rakshith Vellulla},
title = {Bank Complaint Classifier: Fine-tuned DistilBERT for Financial NLP},
year = {2024},
publisher = {HuggingFace},
url = {https://huggingface.co/Rakshith1310/bank-complaint-classifier}
}
Contact
- Author: Rakshith Vellulla
- GitHub: github.com/RakshithVellulla
- HuggingFace: huggingface.co/Rakshith1310
- Downloads last month
- 6