Consumer Complaint Classifier

A fine-tuned DistilBERT model that classifies a consumer complaint narrative into one of five categories. Built as part of an end-to-end NLP project comparing SimpleRNN, LSTM, GRU, and a fine-tuned transformer on the same data.

Labels

Label Description
credit_card Complaints about credit card charges, fraud, fees
credit_reporting Complaints about credit reports and credit bureaus
debt_collection Complaints about debt collection practices
mortgages_and_loans Complaints about mortgages and loan applications
retail_banking Complaints about checking/savings accounts and retail banking

Performance

Evaluated on a held-out test set, compared against three models trained from scratch on the same split:

Model Accuracy Precision Recall F1-score
SimpleRNN 0.749 0.784 0.749 0.759
LSTM 0.842 0.858 0.842 0.846
GRU 0.850 0.861 0.850 0.853
This model (fine-tuned DistilBERT) 0.883 0.887 0.883 0.884

How to use

from transformers import pipeline

classifier = pipeline(
    "text-classification",
    model="Ahmed-Tarek0/complaint-classifier"
)

classifier("I was charged twice for the same transaction and the bank refuses to refund me.")

Or load the tokenizer and model directly:

from transformers import AutoTokenizer, AutoModelForSequenceClassification

tokenizer = AutoTokenizer.from_pretrained("Ahmed-Tarek0/complaint-classifier")
model = AutoModelForSequenceClassification.from_pretrained("Ahmed-Tarek0/complaint-classifier")

Training details

  • Base model: distilbert-base-uncased
  • Task: Multi-class text classification (5 classes)
  • Fine-tuning: Hugging Face Trainer, weighted cross-entropy loss to handle class imbalance, early stopping on validation F1
  • Max sequence length: 150 tokens
  • Trained alongside SimpleRNN, LSTM, and GRU baselines built from scratch for comparison โ€” see the project notebook for the full pipeline.

Intended use

Built for a classification/deployment learning project. Suitable for demonstrating complaint-routing use cases; not validated for production financial compliance use without further evaluation.

Downloads last month
38
Safetensors
Model size
67M params
Tensor type
F32
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support