How it’s built
How our TFM uses 62 Transformer upgrades
For each design decision: how the technique evolved, what our transaction foundation model uses, why, and why not the alternatives. Pick a use case to see what changes. The 62 upgrades, narrated →
Our TFM usesConsidered, not usedPart of the evolution
Input
Reading one transaction
Our TFM uses: Field attention + pooling
A transaction is a row of fields (amount, merchant, time). Attention across its fields, pooled into one vector, lets the sequence model see one event per step.
- Fraud detection
- Fields like merchant category, channel and device carry the signal; field attention learns their combinations.
- Product recommendation
- Item id and timestamp are the only fields, so the field step is small.
- Credit risk
- Balances, payments and limits sit in one event; pooling keeps the history short.
- Money laundering
- Counterparty, amount and country fields; we expect their combinations to help flag structuring.
Input & position
Event order and time
- 2017 Sinusoidal position encoding
- 2018 Relative position representations
- 2021 RoPE
- 2021 ALiBi
- 2023 Position Interpolation
- 2023 YaRN
- 2023 Time gap + calendar fields
- 2026 T-RoPE
Our TFM uses: RoPE + Time gap + calendar fields
RoPE encodes the order of events; real time (gaps, day, month) goes in as fields, both as a token and as a number. In our tests, replacing RoPE by time-aware T-RoPE gave no gain on ML-20M or Pixel200K.
Why not
- Sinusoidal position encoding Absolute positions extrapolate poorly to longer histories.
- ALiBi A fixed recency bias; the time-gap fields already tell the model how recent each event is.
- T-RoPE No gain over RoPE plus time fields in our two-layer TFM (paper, Section 6).
- YaRN Only needed to stretch a trained model to longer histories; we train at the length we serve.
- Fraud detection
- Seconds-to-minutes gaps matter: a burst of payments is the signal, so the gap token is key.
- Product recommendation
- The date matters: on Amazon Books, giving our two-layer TFM the date as a field lifted HR@10 by 12% (8.31 vs 7.39).
- Credit risk
- Calendar fields (month-end, payday) capture repayment cycles.
- Money laundering
- Long, periodic gaps (weekly structuring, dormant accounts) favour continuous gaps plus calendar.
Attention
Attention over the history
- 2019 Sparse Transformer
- 2020 Longformer
- 2020 Linear attention
- 2022 FlashAttention
- 2023 Mamba
- 2024 Gated DeltaNet
- 2025 NSA
- 2025 DSA
- 2025 Qwen3-Next hybrid
Our TFM uses: Longformer + FlashAttention
Causal attention over a sliding window of recent events (64 to 128; Longformer’s window, without its global tokens), run with FlashAttention: recent behaviour carries most of the signal, and the cost stays fixed per event.
Why not
- Linear attention Constant-cost state, but weaker recall of a specific past event; we expect it to pay off past ~10k events.
- Mamba Strong for streaming, but recall of exact past transactions is weaker than attention.
- NSA Built for very long contexts; our sequence lengths (256 to 2,048 events) don't need it yet.
- Sparse Transformer Fixed strides; learned sparsity (NSA, DSA) superseded it.
- Fraud detection
- A short window of the latest events: what just happened decides the score.
- Product recommendation
- 50 to 200 recent items, full causal attention inside the window.
- Credit risk
- Months of history: a longer window; hybrids become worth testing at thousands of events.
- Money laundering
- Multi-year histories: sparse or hybrid attention (NSA, Gated DeltaNet) is the next step, not yet our default.
Attention: KV & heads
Keys, values and serving
Our TFM uses: GQA
Grouped-query attention (4 query heads per key-value head) with a KV cache: about four times less memory per customer than full multi-head attention, with little expected quality loss.
Why not
- MQA One shared key-value head saves more memory but loses more quality.
- MLA Compresses the cache further, but adds complexity that pays off mainly in very large models.
- Fraud detection
- Scored at authorisation in milliseconds: the cache lets each new payment reuse the history.
- Product recommendation
- Session scoring benefits from the cache; batch scoring needs it less.
- Credit risk
- Scored monthly in batch: the cache matters little.
- Money laundering
- Batch investigation: cache size is not the bottleneck.
Normalization
Normalization and stability
Our TFM uses: Pre-LN + RMSNorm + QK-Norm + z-loss
Pre-norm RMSNorm, QK-norm and z-loss: cheap insurance against loss spikes from extreme amounts and large field vocabularies.
Why not
- Gated attention A newer stability gain; a candidate for the next challenge cycle, not yet tested.
- Fraud detection
- Heavy-tailed amounts: QK-norm keeps attention scores from blowing up.
- Product recommendation
- Large item vocabularies: z-loss keeps the output logits in range.
- Credit risk
- Same defaults; stability matters most in long monthly retraining runs.
- Money laundering
- Same defaults.
FFN, experts & memory
Feed-forward and experts
- 2017 Sparsely-gated Mixture-of-Experts
- 2020 SwiGLU FFN
- 2021 Switch Transformer
- 2023 Mixtral 8x7B
- 2024 DeepSeekMoE
- 2026 Engram
Our TFM uses: SwiGLU FFN
A dense SwiGLU feed-forward: a consistent gain at the same latency, simple to train and serve.
Why not
- DeepSeekMoE Experts could specialise by merchant or region, but routing adds serving cost; at our sizes a dense model is simpler.
- Switch Transformer Top-1 routing is the simplest MoE, still more moving parts than a dense block.
- Fraud detection
- Dense; experts become interesting at card-network scale, across very different merchants.
- Product recommendation
- Dense.
- Credit risk
- Dense.
- Money laundering
- Dense; experts by corridor or country are a future option.
Whole-model design
What it learns from
Our TFM uses: GPT + Full-catalogue softmax
Next-event prediction, causal like GPT: the model scores each event using only the past, as in production. For recommendation, scoring every item (full softmax) instead of 128 sampled ones, with four layers, lifted Pixel200K HR@10 from 12.49 to 18.76 (paper, Table 7).
Why not
- BERT Masked events read the future while training, a view live scoring never has; good for offline embeddings.
- MTP Predicting two events at once is an option in the Composer; not yet a tested gain.
- Fraud detection
- Causal next-event: the same model scores each payment in real time.
- Product recommendation
- Next item with a full-catalogue softmax: our biggest gain.
- Credit risk
- Next-event pretraining, then a small default-risk head.
- Money laundering
- Next-event pretraining; masked-event embeddings are an option for offline investigation.
Training & optimizers
Training recipe
- 2014 Adam
- 2016 Cosine decay
- 2017 AdamW
- 2017 Learning-rate warm-up
- 2019 BF16 training
- 2022 Chinchilla compute-optimal scaling
- 2022 µP / µTransfer
- 2024 WSD schedule
- 2025 Muon
Our TFM uses: AdamW + Learning-rate warm-up + WSD schedule + BF16 training
AdamW with warm-up and a warmup–stable–decay schedule, in bf16, sized at about 1,000 transaction tokens per parameter (Chinchilla’s ~20 is for language).
Why not
- Cosine decay Our benchmarks used it (the Composer’s earlier default); WSD suits models retrained as new months arrive.
- Chinchilla compute-optimal scaling Its ~20 tokens per parameter is for language; transaction fields are far more predictable, so we plan at about 1,000.
- Muon Promising for pretraining cost; adopt once tested against AdamW on our data.
- FP8 training at scale Pays off for large models on H100-class GPUs; bf16 is simpler at our sizes.
- Fraud detection
- Retrained often as fraud patterns shift: WSD keeps a stable checkpoint between releases.
- Product recommendation
- Fixed benchmark runs used cosine decay.
- Credit risk
- Monthly retraining: WSD.
- Money laundering
- WSD; sized to the history you hold.
Our choices are the TFM Composer’s recommended design; results are from our benchmarks and our paper; use-case notes are design guidance. Each technique links to its paper.