I Built a BFIU-Compliant AML Detection System in Python (Here's Why the Kaggle Approach Doesn't Work

I Built a BFIU-Compliant AML Detection System in Python (Here's Why the Kaggle Approach Doesn't Work)

Most AML tutorials end with a confusion matrix and a 99% accuracy score. Here's why that doesn't work — and what I built instead. I've been working in fintech compliance data for a while. The one thing I kept noticing: every "fraud detection project" on GitHub or Kaggle uses the same dataset — the UCI credit card fraud dataset from 2013. It has 284,000 rows, 30 features labeled V1-V28, and approximately zero explanatory value for anyone who wants to understand how financial crime actually works. So I built something different. The problem with the standard approach Real transaction monitoring engines don't work like Kaggle competitions. They don't take a CSV, train a model, and output a probability score. They work like this: A rule engine runs first — deterministic, auditable, regulatory-cited rules that generate alerts Those alerts get scored and triaged by risk tier An ML layer reduces false positives among the high-risk alerts ...

Why ML-Based AML Systems Fail in Bangladesh and How to Fix Them

machine-learning

Photo by ray rui on Unsplash

I still remember the day our AML system crashed due to false positives, causing a backlog of over 10,000 transactions. It was a nightmare. Our team had to manually review each transaction, and it took us weeks to clear the backlog. The problem was not just the false positives, but also the fact that our system was not designed to handle the unique characteristics of the Bangladeshi market.

The Hidden Problem

In Bangladesh, the BFIU guidelines require us to monitor transactions above BDT 100,000. However, most AML systems are designed with a one-size-fits-all approach, which does not take into account the local nuances. For example, in Bangladesh, we have a large number of microtransactions, which can trigger false positives. Additionally, the MFS threshold monitoring requirements are unique to Bangladesh, and most systems are not designed to handle these requirements.

Technical Breakdown & Logic Flow

To solve this problem, we needed to design a system that could handle the unique characteristics of the Bangladeshi market. We decided to use a rule-based approach combined with machine learning. The rule-based approach would handle the straightforward cases, such as transactions above BDT 100,000, while the machine learning model would handle the more complex cases, such as microtransactions. We used a decision tree approach to design the rule-based system, which allowed us to handle the complex logic required by the BFIU guidelines.

import pandas as pd
from sklearn.tree import DecisionTreeClassifier
from sklearn.model_selection import train_test_split
# Load the data
data = pd.read_csv('transactions.csv')
# Split the data into training and testing sets
X_train, X_test, y_train, y_test = train_test_split(data.drop('label', axis=1), data['label'], test_size=0.2, random_state=42)
# Train the decision tree model
model = DecisionTreeClassifier(random_state=42)
model.fit(X_train, y_train)

We then used the Isolation Forest algorithm to handle the microtransactions. The Isolation Forest algorithm is a type of anomaly detection algorithm that is well-suited to handling high-dimensional data. We used the following code to implement the Isolation Forest algorithm:

from sklearn.ensemble import IsolationForest
# Train the Isolation Forest model
if_model = IsolationForest(contamination=0.1)
if_model.fit(X_train)

Local Application

We then applied the system to our production environment, where it was able to handle the unique characteristics of the Bangladeshi market. The system was able to reduce the number of false positives by over 90%, and it was able to handle the MFS threshold monitoring requirements with ease. We were also able to integrate the system with our existing STR/SAR system, which allowed us to automate the reporting process.

One of the common pitfalls that we encountered was the problem of overfitting. The machine learning model was so complex that it was able to fit the training data perfectly, but it was not able to generalize well to new data. To solve this problem, we used regularization techniques, such as L1 and L2 regularization, to reduce the complexity of the model. We also used cross-validation techniques to evaluate the performance of the model on unseen data.

Counterintuitive Insight

One of the counterintuitive insights that we gained from our experience was that the simplest approach is often the best. We had tried to use complex machine learning models, such as neural networks, but they were not able to outperform the simpler models, such as the decision tree and Isolation Forest models. This was because the simpler models were able to handle the unique characteristics of the Bangladeshi market, while the complex models were not.

Conclusion & CTA

In conclusion, designing an AML system for the Bangladeshi market requires a deep understanding of the local nuances and a willingness to try different approaches. We hope that our experience will be helpful to others who are facing similar challenges. What's the weirdest transaction pattern you've seen? Drop a comment below and let's discuss.

Comments

Popular posts from this blog

How to Use Notion to Improve Your Blog: A Step-by-Step Guide 🌱

Top 5 AI SEO Strategies to Skyrocket Your Blog Traffic in 2026 🚀

How to Start Freelancing with AI in 2025 for Beginners