A Bank Trained Its Own Foundation Model to Catch Fraud — Freddy Lecue, Wells Fargo

Freddy Lecue from Wells Fargo discusses the creation of a custom billion-parameter foundation model built from scratch using transformer architecture to analyze vast amounts of structured financial transaction data for tasks like fraud detection, credit scoring, and anti-money laundering. This model outperforms traditional methods by capturing complex temporal and relational patterns in transactions, enabling improved accuracy and efficiency across multiple banking applications.

Freddy Lecue from Wells Fargo presents the development of the bank’s first foundation model tailored specifically for financial transactions, rather than language processing. Unlike popular language-based foundation models like GPT or Claude, this model is designed to handle the vast amounts of structured, tabular data generated by customer transactions across various banking services such as debit, credit, digital checks, and more. The goal was to create a single backbone model that could be fine-tuned for multiple downstream tasks including fraud detection, credit scoring, anti-money laundering, and marketing, thereby streamlining efforts across different organizational units.

The foundation model was built from scratch using transformer blocks, trained on billions of monthly transactions involving millions of accounts. Instead of relying on pre-existing language models or open weights, Wells Fargo developed their own architecture and trained it on their unique financial transaction data. The model learns to predict the next transaction in a sequence, capturing relationships over time and across customers. This pre-training approach allows the model to generate rich representations of transactional behavior, which can then be fine-tuned for specific tasks.

A key challenge addressed was the tokenization of highly heterogeneous tabular data, which includes numerical values, categorical features, and complex identifiers like zip codes and IP addresses. The team carefully designed a vocabulary and embedding strategy to efficiently encode these diverse features into tokens suitable for transformer processing. This step was critical because the financial domain’s vocabulary is very specialized and differs significantly from natural language, requiring custom solutions to balance vocabulary size and model performance.

In terms of architecture, the model uses a decoder-only transformer setup optimized for predicting the next token or transaction. The team experimented with model size and token-to-parameter ratios, settling on a billion-parameter model that provided a strong balance between performance and computational efficiency. Training leveraged best practices such as mixed precision, distributed data parallelism, and memory-efficient attention mechanisms. The model achieved inference latency well below the 250-millisecond threshold required for real-time transaction processing, making it practical for deployment in fraud detection systems.

The results were significant: compared to the existing XGBoost fraud detection model, the foundation model improved fraud detection rates while simultaneously reducing false positives, leading to substantial cost savings for the bank. This improvement is attributed to the model’s ability to capture complex temporal and relational patterns in transaction sequences that traditional models struggle to encode. Beyond fraud detection, Wells Fargo is exploring additional applications such as credit line increases, anti-money laundering, and marketing, demonstrating the versatility and value of their transaction-based foundation model across multiple financial services domains.

Useful Links