Instructions to use hasnainn19/complaintflow-classifier with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use hasnainn19/complaintflow-classifier with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="hasnainn19/complaintflow-classifier")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("hasnainn19/complaintflow-classifier") model = AutoModelForSequenceClassification.from_pretrained("hasnainn19/complaintflow-classifier", device_map="auto") - Notebooks
- Google Colab
- Kaggle
ComplaintFlow classifier (classifier-v1)
Classifies a US consumer complaint about a financial product into one of 85 product and issue pairs, such as Credit card | Fees or interest. It is the classifier in ComplaintFlow, a complaint triage pipeline: every complaint is classified, and answers below a confidence of 0.30 are sent to a person for review.
Files
| File | What it is |
|---|---|
model.onnx |
The model in ONNX, full precision, for inference with onnxruntime on a CPU. This is what ComplaintFlow runs. |
tokenizer.json |
The tokenizer, for the tokenizers library. Inputs are cut to 512 tokens. |
metadata.json |
The 85 labels in output order, the training settings and the version. |
model.safetensors, config.json, tokenizer_config.json |
The same model for PyTorch and transformers (ModernBertForSequenceClassification). |
val_metrics.json |
Scores on the validation split. |
The ONNX model takes input_ids and attention_mask (int64, one row per complaint) and returns logits, one score per label. A softmax over them gives each label's probability; the highest is the answer and its probability is the confidence. Each label is a product and an issue joined by |.
Training
Fine-tuned from ModernBERT-base on 97,407 complaints with text received from 1 January to 7 June 2026, from the CFPB Consumer Complaint Database. Labels are the CFPB's own product and issue after merging rare issues; only pairs seen in training are possible answers.
2 epochs, batch size 16, learning rate 3e-5 with 6% warmup then linear decay, weight decay 0.01, bfloat16, on one RTX 3060 in 67 minutes.
Results
| Data | Complaints | Product accuracy | Issue accuracy | Issue macro-F1 |
|---|---|---|---|---|
| Validation split (later complaints, not used for training) | 11,932 | 0.855 | 0.612 | 0.513 |
| ComplaintFlow evaluation sample (held out) | 1,000 | 0.849 | 0.586 | 0.474 |
On the evaluation sample the ONNX model gives the same answers as the PyTorch model and takes a median 220 ms per complaint on a desktop CPU.
Limitations
- Trained on complaints from the first half of 2026; products, issues and the way people describe them change over time.
- Issue accuracy is moderate: many issues overlap (several products share similar issue names), and broad issues such as customer service problems are often confused.
- English only, and only the CFPB's product and issue categories.
- Complaint text can contain personal details even after the CFPB's redaction; do not use the model to identify people.
Data
CFPB Consumer Complaint Database, published by the US Consumer Financial Protection Bureau. Complaint text is published only with the consumer's consent and after the CFPB removes personal information.
- Downloads last month
- 19
Model tree for hasnainn19/complaintflow-classifier
Base model
answerdotai/ModernBERT-base