← All talks

AI Engineer NYC 2026 Main stage · 18 min

Wells Fargo Foundation Model: Application to Fraud Detection at Scale

Freddy LecueWells Fargo

Freddy Lecue explains why Wells Fargo trained a transformer on transactions rather than text, how it tokenizes heterogeneous banking data, and how the resulting representation supports fraud detection.

A foundation model does not have to speak

1:55:42 ↗

A bank has language data, but much of its most valuable information is structured: purchases, transfers, card activity, checks, and the history of how customers transact. Putting all of it into a language model is one possible approach. Freddy Lecue’s team at Wells Fargo instead built a foundation model whose basic material is transactions.

The ambition is a reusable backbone. Separate teams traditionally build separate models for fraud, credit, anti-money-laundering work, and other tasks. A shared model can first learn representations of customer activity at scale, then be adapted to those downstream problems.

The obvious comparison is a strong tabular model such as XGBoost. Lecue makes that comparison explicit: Wells Fargo already used an XGBoost model for the fraud task discussed here. The motivation for the new approach was better detection with fewer false positives, while still meeting the time limit of a live transaction decision. Watch the setup at 1:55:42.

Learn the next transaction, then the downstream task

1:58:40 ↗

A language model learns useful representations through next-token prediction. The transaction model borrows that idea while changing what the tokens mean. It predicts the next transaction or the next token within a transaction, drawing on activity across channels.

Prediction is the pretraining objective, not the final product. The learned representation is then adapted for a task such as fraud classification or a credit-line decision. Lecue emphasizes that the team pretrains from scratch on Wells Fargo transaction data. It reuses transformer architecture, rather than starting from a language model’s pretrained weights.

The representation has to retain several kinds of information:

  • Participants: the customer, merchant, and others involved.
  • Activity: what is transacted and through which channel.
  • Time and location: when and where the activity happens.

Each dimension expands into many features. The model needs enough of them to distinguish ordinary activity from a transaction that makes little sense in its context.

Traditional fraud systems can require substantial feature engineering to encode those relationships manually. The team instead worked back toward the raw information units and asked the transformer to learn relationships among them. The resulting vocabulary is specific to financial transactions, which is a major reason to avoid simply inheriting a general text vocabulary.

Tokenization is the hard part

2:03:21 ↗

The raw input is tabular, but its values are heterogeneous. Some fields are categorical, some numerical, and some have an enormous set of possible values. A transaction amount, a time interval between purchases, an IP address, and a postal code cannot all be treated as interchangeable text labels.

The first design decision is what information each token should represent. Giving every possible value its own token can make the vocabulary unwieldy. Grouping values can make the model tractable, but the grouping must preserve distinctions useful to the task. Lecue uses postal codes as an example of a field that can be regrouped using its distribution rather than assigning a separate token to every code.

The vocabulary slide makes the imbalance visible: 97 raw features become 5,164 tokens, and postal-code features alone account for 2,858 of them. Different kinds of data demand different tokenization choices.

Vocabulary design slide maps 97 raw features to 5,164 tokens across 8 feature types, including 2,858 postal-code tokens.

The breakdown at 2:04:30 shows why counting features is not enough to estimate vocabulary size.

Once the representation is defined, an incoming transaction follows a regular path: values map to tokens, tokens map to identifiers, and identifiers select embeddings. Those embeddings let the transformer process the transaction alongside its history.

The initial architecture used established scaling guidance as a starting point, then changed through experiments on this specialized data. Lecue describes a decoder-only model at roughly the billion-parameter scale and work on a larger version. The goal was a size that produced useful downstream gains, rather than matching the parameter counts of frontier language models.

The team can reuse familiar distributed-training and memory-efficiency techniques. Deciding what a token means, and how the resulting representation supports a fraud decision, requires work specific to the bank’s data. Watch the vocabulary discussion at 2:03:21.

Judge a transaction in its history

2:08:48 ↗

For fraud detection, the backbone becomes a classifier. The input is a sequence of transactions; the question is whether the new transaction is fraudulent in light of the customer’s history.

That history is the key mechanism in Lecue’s explanation of the improvement. A boosted-tree model can use historical information when engineers explicitly encode it into features. Attention provides another way to connect the current transaction to previous activity. The team believes those learned relationships help the model recognize patterns that improve detection.

The classifier still has to fit the operational system. Lecue describes a processing requirement below 250 milliseconds because a decline decision must arrive within the transaction’s time window. A model that performs well offline but arrives too late would not solve this problem.

The business evaluation has two sides. Detecting more fraud is valuable, but simply declining more transactions can also increase false positives. A legitimate customer whose purchase is rejected may call support, and the bank can lose the transaction. Lecue reports more detected fraud and fewer false positives than the production XGBoost model in this comparison, producing savings for the firm. The useful result is the improvement on both measures: the bank catches more fraud while rejecting fewer legitimate purchases.

The team trained the backbone on billions of transactions, then adapted it for fraud. Credit-line increases, anti-money-laundering work, and marketing were still under investigation. Each would test the original bet: that learning customer activity once could give several banking models a better starting point.

Full transcript

Timestamps follow the original livestream. Select a time to watch that moment. Transcripts are machine-generated with reviewed name and terminology corrections; occasional recognition errors may remain.

1:55:22

My name is Freddy Lecue.

1:55:23

I'm part of the Wells Fargo team.

1:55:25

I'm leading the Frontier AI modeling organization here.

1:55:29

And I'm going to show you the work we've been doing lastly on building our first foundation

1:55:34

model, Wells Fargo Foundation model.

1:55:37

So I explain why we did that, how we did it, and what we accomplished.

1:55:41

in doing so so so first from financial model it doesn't necessarily need to be language based i

1:55:48

mean we're all playing with uh claude and chat gpt and others they're all language-based

1:55:55

from the show models in financial services uh we also have language of course uh from a

1:56:00

structure unstructured representation data but we also have a lot of structure representation

1:56:05

a lot of these data is tabular data we have a lot of information from our customers we have

1:56:11

information in investment banking, consumer banking, and all of this data is data that we

1:56:17

have in Wells Fargo, and all big financial organizations have too. And we want to take

1:56:23

benefit of all of this huge amount of data that we have. And it's not like you just take it and

1:56:30

put it in a language model and get the best of it. Of course, you can get a lot of benefit out of it,

1:56:37

but it's not necessarily the best way to do it.

1:56:40

So what we decided to do is to look at the data we have,

1:56:43

all the transactions, all the customer transactions

1:56:46

that they're doing with their debit card, credit card, digital, check,

1:56:50

all of those coming from many different channels

1:56:52

and see if we can build a foundational model

1:56:56

that we can use and fine-tune for downstream tasks

1:56:59

like credit scoring or that you can use it for fraud detection,

1:57:03

anti-money laundering, do marketing.

1:57:05

So how we can build one backbone that you can use and streamline across downstream tasks.

1:57:12

So now you're moving from many models very siloed across different organizations.

1:57:17

In really one backbone that every organization can just reuse because you learn the representations of customers' transactions at scale.

1:57:27

So that's the intent.

1:57:28

And just spoiler alert, you may say, hey, that's tabular data.

1:57:31

why do you just don't use XGBoost and the usual suspect?

1:57:35

We did that.

1:57:36

This is the model we had in production.

1:57:37

But the model I'm going to show you is something that beats XGBoost,

1:57:42

even from a latency perspective, but also from a fault detection,

1:57:47

we get much better reduction of false positive and better detection rate.

1:57:54

So it was a really good lesson learned in terms of having better model

1:57:59

using foundation model.

1:58:01

And to foundation, I mean transformer blocks, and that's what we build.

1:58:06

So we have, as I mentioned, billions of transactions on a monthly basis.

1:58:13

Our customers are interacting with their debit credit card, and they do checks, and they do different sort of transactions.

1:58:19

And the question is really how we can use this information at scale, and not for one and every single downstream task.

1:58:26

So I'm going to cover a bit of the data, the representations, the architecture that we use,

1:58:34

what the result we get, and the lesson we learned in building this.

1:58:40

So left-hand side, language foundational model.

1:58:44

They're processing language tokens, and then the goal is to learn the representations that's going to predict the next token.

1:58:51

and then you have supervised fine-tuning

1:58:54

and then you do LHF, LRVR

1:58:57

and all of the great post-training process

1:59:00

to get better at the task that you want to, right?

1:59:03

And that's for languages, that's great.

1:59:05

But what if your data is very much more specialized

1:59:09

in terms of representation?

1:59:11

So that's where we build this transaction foundation model.

1:59:15

So instead of having languages as the base,

1:59:19

the base is now transactions.

1:59:21

transaction from our customers.

1:59:23

And you still try to predict the next thing,

1:59:26

and here the next thing is the next transaction,

1:59:28

or it's the next token in the transaction,

1:59:30

using all of the channels that you have.

1:59:32

But that's not the end goal.

1:59:34

I mean, similarly to language model,

1:59:36

where you try to predict the next token,

1:59:38

that's not the end of the story, right?

1:59:40

You learn the representation,

1:59:41

and then you use that representation,

1:59:43

and then you fine-tune it,

1:59:45

and you post-tune it for any other task, right?

1:59:48

So it could be classification tasks for languages,

1:59:50

but in our context for transaction foundation model it could be used for

1:59:54

credit line increase could be used for doing fraud detections and flagging

1:59:58

bad actors from

2:00:00

an anti-money-laundering perspective.

2:00:01

And the goal is to learn this relationship between transactions over time and transactions across customers. That's really the intent.

2:00:10

So the intent number one is you do pre-train from scratch. I'm saying it again because people are sometimes confused.

2:00:17

we pre-train transformer blocks at scale from scratch using our transaction data.

2:00:26

So the zero rate that we use from open rates, we just use the architecture,

2:00:30

and then we pre-train it from scratch using our GPU cluster,

2:00:34

and then we train it for a couple of days and weeks,

2:00:38

and then you do the downstream task of post-training.

2:00:42

but the goal here and you pre-train it

2:00:45

for predicting the next

2:00:47

token or the next transactions

2:00:48

and you try to do this

2:00:50

you try to predict the next pattern

2:00:52

of the customer but that's not the intent

2:00:54

the intent is to do the downstream

2:00:56

task later on and in terms of scale

2:01:00

we operate

2:01:01

at a large scale

2:01:02

so we have billions of transactions

2:01:04

a million of accounts

2:01:07

hundreds of transactions

2:01:08

per client on a monthly

2:01:11

basis interacting with their

2:01:12

debit card, credit card, or doing check.

2:01:15

And the five main dimensions we look at

2:01:18

is really who is doing,

2:01:20

I mean, who is processing and who is asking

2:01:23

and who is providing a service.

2:01:25

So, will it the customer or the merchant?

2:01:28

The what?

2:01:29

So, I mean, what do we buy?

2:01:32

What do we transact?

2:01:34

And how?

2:01:35

So, which channel?

2:01:35

Is it credit?

2:01:36

Is it debit?

2:01:37

Is it digital?

2:01:38

When is it happening?

2:01:39

And where is it happening?

2:01:40

And all of those, they're basically breaking down in hundreds of features.

2:01:44

And if you look at the existing model we have in production,

2:01:48

there's a lot of people that build those models in similar organizations

2:01:54

may understand that.

2:01:56

They build a lot of very hard-crafted, uncrafted engineering,

2:02:01

feature engineering efforts on that.

2:02:03

And that's required a lot and a lot of time.

2:02:05

So we step back and look at the raw features we need,

2:02:08

not the one that's been pre-built and post-built for doing the downstream tasks,

2:02:14

but try to understand which raw features.

2:02:16

And we ended up with basically Android features.

2:02:19

Even at the end of the day, we had thousands of them,

2:02:22

but we tried to find which ones are the raw information unit.

2:02:27

And then we led the architecture, the transformer blocks,

2:02:31

to figure out the relationship between those core features.

2:02:34

and as you can see

2:02:36

we do have a bunch of features

2:02:39

on those five dimensions

2:02:41

and the vocabulary is very unique

2:02:44

to the financial services setup

2:02:47

and that's the reason why

2:02:49

we didn't really use

2:02:51

existing pre-trained model

2:02:53

because the vocabulary that we use

2:02:56

is very specific to the work

2:02:58

that you want to do

2:02:59

and even if you merge

2:03:02

while all digital and checking and saving

2:03:06

and all of those sort of transactions,

2:03:10

even if you merge all of those,

2:03:12

you still end up with a very limited number of features and characteristics.

2:03:15

So at that scale, then the question is,

2:03:18

well, how you work with that?

2:03:20

So we started, everything is tabular data.

2:03:23

I mean, there's no secret, it's tabular data.

2:03:25

And then the goal is to understand

2:03:26

how you're going to capture the vocabulary

2:03:29

because you do have numerical values,

2:03:31

you have categorical values, you have information like zip code,

2:03:37

do you encode each and every zip code in a token?

2:03:39

Does it make sense?

2:03:41

So there's a lot of efforts you need to push in understanding

2:03:44

the vocabulary that you need and the vocabulary that you want also to scale

2:03:49

because at the training, if you have too huge vocabulary,

2:03:52

it would be kind of messy to train such a model with a vocabulary

2:03:56

which is far, far too big.

2:03:57

So there's a lot of effort in understanding this value to tokens.

2:04:02

So which information do you encode in a token?

2:04:04

And then you have the token to ID, the tokenizations,

2:04:07

and then the embedding lookup.

2:04:09

So then when we have a transaction coming up,

2:04:11

you do have the vocabulary.

2:04:13

So basically it's a lookup in aligning a transaction

2:04:16

and all the characteristics of that transaction

2:04:19

to a token and an ID and then an embedding.

2:04:25

So just to give you a number,

2:04:26

well some numbers so we have quantitative qualitative categorical of different kind

2:04:32

right so categories with only eight types some with much bigger types you have transaction amount

2:04:38

which is a big deal you have the delta time between transaction so you have anything related

2:04:44

to ip address postal code so just to give you example of variety and heterogeneity of each and

2:04:51

every characteristic could be encoded in a binary token

2:04:55

or could be encoded in a much larger number of tokens.

2:04:59

And even if you look at the zip code,

2:05:01

I mean, you have a much larger number of zip code

2:05:03

in the US than those 2,800,

2:05:07

but you have much better way to structure

2:05:11

how you're going to regroup zip code

2:05:15

based on distributions, for instance.

2:05:17

so architecture

2:05:19

so here just

2:05:21

so we use the

2:05:23

chinchilla

2:05:25

mathematics behind

2:05:26

to define how we build it

2:05:29

initially because we had

2:05:31

no clue how it's going to work in the tabular

2:05:33

space even though there are

2:05:35

existing

2:05:37

open ways and open solutions

2:05:39

for doing tabular

2:05:41

data foundation models

2:05:42

so we started from

2:05:45

what they learn and adapt it to what we needed to do and that gives you an

2:05:49

example of invading dimensions number of decoder blocks we use and all of the

2:05:54

recipe from a from an architecture perspective so we have and as you can

2:06:00

see we're not trying to build a trillion parameters model we don't try to compete

2:06:05

with any of the the leaders in the language models because we working with

2:06:11

and focusing on transactions, right?

2:06:14

Transactions, foundation models at billion level.

2:06:18

And one billion is because that's the model that gave us,

2:06:21

that was kind of the smallest and gave us the highest boost.

2:06:25

And now we're working on the next versions at 11 billion.

2:06:29

But that's good enough to give a lot of ROI

2:06:33

from a false positive reduction for downstream tasks

2:06:37

like for detections and the detection,

2:06:39

unit detection rate.

2:06:41

So, and the type of architecture,

2:06:45

so the decoder-only architecture,

2:06:47

that's basically for predicting the next token

2:06:50

or the next transactions.

2:06:51

And that's really the pre-training.

2:06:54

So here we initially used 20 times the number of parameters

2:06:57

to define the number of tokens we might need.

2:06:59

We ended up actually 10 times fractured than that.

2:07:02

So by doing a few experimentations,

2:07:04

we needed much more tokens per parameters.

2:07:08

I mean, this is kind of the initial experimentation we did.

2:07:13

So I'll pass on this because this is the usual suspect

2:07:16

from an objective function,

2:07:19

so causal language modeling and mass language modeling

2:07:22

type of optimization work.

2:07:27

And from an architecture perspective,

2:07:30

nothing really fancy here.

2:07:33

the most complex part was really the tokenization

2:07:36

and then

2:07:37

doing the pre-training and then how you do the fine-tuning.

2:07:41

So I would say the recipe or the secret sauce

2:07:43

is really how you do the tokenization

2:07:45

and how you're going to do the post-training.

2:07:48

But anything from a training perspective,

2:07:52

the question is just

2:07:53

how many transactions

2:07:56

you're going to put in your context

2:07:58

or in your history for doing the training.

2:08:00

and evaluation perplexity-based accuracy dashboard

2:08:05

on downstream tasks.

2:08:06

That's the ULs respect.

2:08:09

And so, yeah, so use mixed precision,

2:08:13

distributed data parallel,

2:08:15

maximize macro batch size,

2:08:18

get faster convergence,

2:08:20

yeah, using Muran,

2:08:23

Rope, usual,

2:08:25

and memory efficiency, flash attention,

2:08:27

activation chain pointing.

2:08:28

I mean, here there's nothing really new.

2:08:30

It's just we use the advices from the best

2:08:35

and from the one that built even much bigger models.

2:08:39

So I'll pass on this one.

2:08:42

Time is short.

2:08:42

But I wanted to spend some time on the results.

2:08:47

So, yeah, so when you build this foundation,

2:08:52

That foundation is really, is only a backbone.

2:08:58

It's something you can use for downstream tasks.

2:09:01

And the downstream task was to do fraud classification.

2:09:04

So you have a transaction, and then you try to predict if that transaction is going to be fraudulent.

2:09:09

So in the model we have in production, it's an XGBoost model,

2:09:13

and it's trained on large amount of transactions, which is fraudulent or non-fraudulent.

2:09:19

and the missing pieces

2:09:20

was the relationship

2:09:23

between whatever transaction

2:09:25

you try to predict, try to classify

2:09:28

and the relationship with this

2:09:29

transaction with all of the past transactions

2:09:32

and that information is kind of

2:09:34

gone when you use an XGBoost model

2:09:36

unless you encode it

2:09:38

in a very hard way which is not

2:09:39

so easy but if you use

2:09:41

transformer architectures you do have

2:09:43

these nice attentions

2:09:46

from transactions to

2:09:47

past transactions

2:09:48

And that's basically what helps, and this is what we think, this is what really helps pushing the fraud detection rate much higher.

2:09:56

But at the end of the day, the downstream task was to say, here's the

2:10:00

sequence of transactions. I have someone just using the debit card. Is that transaction fraudulent with respect of all historical information? And that's exactly what you put in at inference time when you try to do the prediction.

2:10:15

so that's the

2:10:19

architecture so nothing

2:10:21

really fancier you just need to have the

2:10:23

good engineering

2:10:24

in place to do

2:10:26

less than 250

2:10:28

milliseconds for doing the processing

2:10:31

because the

2:10:32

decline needed to happen within that time frame

2:10:35

but it's

2:10:36

we were

2:10:38

10 times slower than done from a latency perspective

2:10:40

so it was all good

2:10:42

and just in terms of

2:10:44

final result we get. So the main

2:10:46

metrics and those metrics

2:10:48

relate right away to

2:10:53

savings for the firm.

2:10:55

So it's detection rate

2:10:56

and false positive rate. Of course

2:10:58

you can detect much higher, but

2:11:00

in many cases

2:11:02

sometimes you get much more false positive.

2:11:04

And in this case, we managed to get

2:11:06

more fraudulent

2:11:08

activities and we even

2:11:10

reduced the false positive.

2:11:12

so that was a big win

2:11:13

because at the end of the day

2:11:15

if you decline a transaction

2:11:18

which is not fraudulent

2:11:19

then that person is going to call

2:11:21

there is an operation cost associated to it

2:11:23

you lose the transaction related to

2:11:26

that non-fraudulent action

2:11:28

so it's a very

2:11:31

something that you don't really want to happen

2:11:34

so again

2:11:35

that's compared to the state of the art

2:11:38

of the XGBoost model

2:11:39

using fraud detection

2:11:41

So it's basically huge.

2:11:44

It's millions of dollars savings.

2:11:47

So it's a very big boost.

2:11:50

So just to finish up on that slide,

2:11:53

so that foundation model has been built on billions of transactions

2:12:00

from Wells Fargo customers.

2:12:04

That's number one.

2:12:06

It's pre-trained from scratch.

2:12:08

So we don't free train from any open-rate existing model.

2:12:11

We use existing architecture, but the way the zero rate, we pre-training on a couple

2:12:17

of days.

2:12:18

I mean, we did a couple of weeks initially, but then that's pre-trained.

2:12:21

And then when it's pre-trained, it's pretty good in predicting the next transaction.

2:12:26

And when you're done with that, then you can use it for many downstream tasks.

2:12:29

We did it for fraud detection.

2:12:31

Now we're investigating for credit line increase, investigating for anti-money laundering,

2:12:36

investigating for marketing.

2:12:37

so now the same foundation is used

2:12:39

across different organizations

2:12:41

even Wells Fargo

2:12:43

and yeah

2:12:45

thank you for having me and thank you