LIGHTWEIGHT AND ROBUST BANK TRANSACTION CATEGORIZATION: EMPIRICAL EVALUATION OF SPARENTATIONS, NOVEL-MERCHANT GENERALIZATION, AND UNCERTAINTY GUARDRAILS
Keywords:
Financial Natural Language Processing, Transaction Categorization, Short-Text Classification, Representation Spaces, Model Calibration, Generalization and Uncertainty, Responsible AI.Abstract
Automated classification of digital banking transaction descriptions into standardized spending categories is critical for modern Personal Finance Management (PFM), credit underwriting, and fraud detection systems. However, raw transaction strings are noisy, short, heavily abbreviated, and subject to continuous merchant drift. While deep contextualized transformers are increasingly applied across NLP, their inference latency and memory requirements create significant bottlenecks for cost-effective real-time deployment. In this paper, I present an end-to-end, reproducible machine learning framework for classifying noisy transaction descriptions across 17 balanced categories using the public US Bank Transaction Categories v2 benchmark (N = 68,000). I establish rigorous data hygiene protocols including prior deduplication (removing 22,298 duplicate rows) and regex-based entity normalization to eliminate data leakage across split boundaries. Through controlled experiments logged in MLflow, I demonstrate that sparse TF-IDF word n-grams paired with calibrated Logistic Regression achieve a protected test Macro-F1 of 0.9961 and Top-3 accuracy of 0.9990, significantly outperforming dense sentence embeddings (all-MiniLM-L6-v2, Macro-F1 0.9468) while reducing inference latency by ~40x and maintaining an ultra-compact ~1.2 MB artifact. Crucially, I evaluate generalization on a dedicated unseen-merchant slice (n = 716), measuring an honest out-of-distribution score of 0.9784 Macro-F1. Finally, I implement a dual-layer inference safeguard combining calibrated probability thresholds (= 0.50) and out-of-vocabulary merchant term coverage filters to surface ambiguous transactions for human review, preventing silent misclassifications. My findings provide empirical evidence that domain-specific lexical sparsity combined with principled uncertainty handling offers a superior, resource-efficient alternative to heavy neural models for real-time financial NLP.
References
1.DoDataThings. (2024). US Bank Transaction Categories v2. Hugging Face Datasets. https://huggingface.co/datasets/DoDataThings/us-bank-transaction-categories-v2
2.Pedregosa, F., Varoquaux, G., Gramfort, A., Michel, V., Thirion, B., Grisel, O., ... & Duchesnay, E. (2011). Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12, 2825-2830.
3.Reimers, N., & Gurevych, I. (2019). Sentence-BERT: Sentence embeddings using Siamese BERT-networks. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 3982-3992.
4.Zadrozny, B., & Elkan, C. (2002). Transforming classifier scores into accurate multiclass probability estimates. In Proceedings of the eighth ACM SIGKDD international conference on Knowledge discovery and data mining, pp. 694-699.
5.Sculley, D., Holt, G., Golovin, D., Davydov, E., Phillips, T., Ebner, D., ... & Dennison, D. (2015). Hidden technical debt in machine learning systems. Advances in Neural Information Processing Systems (NeurIPS), 28, 2503-2511.
6.Ribeiro, M. T., Singh, S., & Guestrin, C. (2016). 'Why should I trust you?': Explaining the predictions of any classifier. In Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, pp. 1135-1144.