What is a transformer?
A transformer is a neural network design that uses a mechanism called attention to weigh how parts of an input relate to each other. It is the basis of most modern language models.
Also called: transformer architecture, transformer model
How it works
A transformer splits input into tokens and turns each token into a list of numbers. Attention layers then let every token look at every other token and decide which ones matter most for its meaning. Stacking many of these layers lets the model build up rich context.
Unlike older designs that read one word at a time, a transformer processes a whole sequence in parallel during training. That makes it practical to train on very large datasets, which is a main reason transformers power today's large language models.
Why it matters for fraud and trust
Transformers are not limited to text. Any data that can be written as a sequence can, in principle, be modeled this way: a list of transactions, the steps in a login session or the events on a device. Some risk teams use transformer-style models to find patterns in event sequences that simple rules miss.
Transformers also power the tools attackers use, from text generators to voice cloning. Knowing how they work helps teams set realistic expectations about what these models can and cannot do.
Practical trade-offs
- Attention cost grows quickly with input length, which is why models have a fixed context window.
- Large transformers need specialized hardware to train and run.
- Their internal reasoning is hard to inspect, which can make decisions harder to explain.
- For tabular risk data with clear features, simpler models are often just as accurate and much cheaper.
Related terms
- Large language model (LLM)A large language model (LLM) is a neural network trained on large amounts of text to predict and generate language. It powers chat assistants, AI agents and many text tools.
- Token (AI)In AI, a token is the small unit of text, often a word or part of a word, that a language model reads and writes. Model limits and usage prices are usually counted in tokens.
- Context windowA context window is the maximum amount of text, measured in tokens, that a language model can take in and consider at once, including the prompt, any attached data and its own reply.
- Mixture of experts (MoE)Mixture of experts is a model design that splits parts of the network into many specialist sub-networks and uses a router to send each input to only a few of them.
- Machine learning for fraud detectionMachine learning for fraud detection uses models trained on past data to estimate how likely a transaction, account or event is to be fraudulent.