Twelve papers behind a sequence model over account histories, the model under ACH return scores and credit underwriting, pretrained on a mix of CPC, replaced token detection (RTD) and a CoLES-style temporal contrast (TCL, where two periods of one user are positives). Three papers are the sources of those objectives and two benchmark their families on bank data. The rest cover forward-window targets, serving, long histories, numeric encodings and shrinking the per-event embedding from a transaction encoder.
CPC (van den Oord, Li, Vinyals, DeepMind, 2018). Self-supervised features need a target that rewards slow structure over local detail. CPC picks the true future embedding out of negatives (other candidates in the batch) from a summary of the past, so it keeps what predicts several steps ahead. A linear probe (a linear classifier on frozen features) reached 64.6% phone accuracy predicting 12 steps ahead against 28.5% at 2. In practice: predict a calendar horizon ahead with negatives from the same user, or CPC learns to recognize the user.
ELECTRA (Clark, Luong, Le, Manning, Stanford and Google, 2020). A masked language model learns only from the 15% of positions it masks. ELECTRA has a small generator fill them and trains the kept discriminator to label every token original or replaced, so every position carries a loss. ELECTRA-Small beat a same-compute BERT-Small on GLUE (79.9 against 75.1), and a generator that ignored context was clearly worse. In practice: other users' random events are that weak generator, so RTD needs same-user perturbations of amount, date or merchant.
CoLES (Babaev et al., Sber AI Lab, 2022). Bank histories have few labels. CoLES treats each user as a class (slices of one history are positives, other users' slices negatives), so the embedding learns what stays constant within a user. In the bank's own tables it trailed hand-crafted features alone (retail churn 0.65 against 0.74) and won mainly on identity-like tasks. In practice: TCL is CoLES across time, so it pulls a user's healthy and distressed periods together and blurs what a return model needs.
Local and global representations (Bazarova et al., Skoltech and Sber, 2024). Some labels belong to a client, others to a moment. Contrastive models capture the stable client, while generative ones (predicting the next or a masked event) keep the current state, so each wins its own kind of label. Per-transaction fraud ROC-AUC was 0.81 for a masked model against 0.38 for CoLES, though below-chance scores like that one suggest noisy local labels, and no model saw time. In practice: CPC sits near next-event models, RTD near masked ones and TCL near CoLES, so the loss weights pick which labels the joint model serves.
EBES (Osin et al., Skoltech, 2024). Event-sequence comparisons seldom control tuning effort or seed noise. Under 210 tuning runs, 20 seeds and significance tests, shuffling a trained GRU's test events cost 0.10% on banking data, so the models act as bags of events, and an MLP on aggregates came within about 5% of the best. Time entered as one min-max-scaled scalar, though, which erases calendar position. In practice: run the shuffle test on the production model and compare it against a tree on aggregated transaction embeddings.
PinnerFormer (Pancha, Zhai, Leskovec, Rosenberg, Pinterest, 2022). A user embedding computed once a day goes stale if it was trained to predict the very next action. The dense all-action loss has random positions each predict one engagement from the next 28 days, so the embedding holds what stays relevant between refreshes. Recall@10 rose to 0.229 from 0.186, and daily inference cost 8.3% against 13.9% for next-action training. In practice: predict typed events over the next 30 days from many positions.
TransAct (Xia et al., Pinterest, 2023). A real-time ranker has to relate the item being scored to the user's last few actions. Early fusion concatenates the candidate onto every row of the recent-action history, so attention compares each past action, typed and including hides, with that item. Removing TransAct cost 8.59% of repin hits, while mean-pooling the history gained only 0.21%. In practice: for ACH returns, fuse the pending debit's amount, originator and date onto every history row, with returns and NSF fees as event types.
Context Clues (Wornow et al., Stanford, 2025). Medical-record models usually read short windows of long histories. Longer context helps, but copied-forward diagnoses repeat events, and the most repetitive quarter of patients scored about 23% worse on Brier. Mamba (an attention-free long-sequence model) at 16k events reached mean AUROC 0.807 against 0.777 for the prior best model at 512 tokens, lifting every quarter about equally. In practice: collapse each recurring rent, payroll or subscription stream into a summary event and keep the deviations, which carry the signal.
MOTOR (Steinberg, Fries, Xu, Shah, Stanford, 2024). Risk tasks ask when an event happens, while next-code pretraining asks only what comes next. MOTOR predicts after every event the time until each of 8,192 codes next appears, under a censored survival likelihood, so it learns hazards over a horizon. It beat next-code pretraining on every task (celiac C statistic 0.802 against 0.774), assuming censoring is uninformative. In practice: pretrain on time to the next NSF fee, return or missed payroll, with account disconnection as a competing event.
FATA-Trans (Zhang et al., Visa Research, 2023). TabBERT, a Transformer doing masked prediction over transaction rows, copies static fields such as card type into every row, so a masked static field can be read off a neighbor. FATA-Trans encodes static fields once as their own token, removing the shortcut. On Amazon Electronics reviews AUC rose to 0.7206 from TabBERT's 0.7098, but the static split alone was worth 0.003, a small gain on 10-record windows. In practice: factor institution and account attributes into one conditioning token, or replaced events get caught by a copied field.
Numerical embeddings (Gorishniy, Rubachev, Babenko, Yandex, 2022). Deep tabular models take raw numeric scalars and lose to gradient-boosted trees. A learned embedding per feature, piecewise linear over quantile bins (PLE) or trainable sines and cosines (PLR), lets the network separate nearby values. PLR moved an MLP's average rank from 8.5 to 3.0 on eleven tree-friendly datasets though none had a heavy-tailed signed variable like an amount. In practice: encode signed log amount with PLE or PLR, since a log scalar barely separates rent of 1,400 from 1,550.
Matryoshka representations (Kusupati et al., University of Washington and Google, 2022). A model trained at one embedding size spreads information over every dimension, so truncation fails. MRL sums the loss over nested prefixes (8, 16, 32 dimensions and up), so the first dimensions work alone. On ImageNet the 64-dimensional prefix scored 75.82% against 76.80% for all 2048 and 48.10% for SVD truncation, though no test fed a prefix into a second model. In practice: train the transaction encoder with nested prefixes so the sequence model reads 64 dimensions.
What the papers say together. CPC resembles the next-event models that win time-local labels, RTD the masked model that best catches per-transaction fraud, and TCL is CoLES, which wins fixed per-user traits. Returns and default are future-event labels, where identity contrast does not help, and the forward-window target that beat next-event prediction in MOTOR and PinnerFormer is missing from the mix. No paper tests CPC with RTD, PinnerFormer's summed objectives never beat its best single one, and time and amounts are weakly encoded in most of these papers. Every gain should be reported against a tree on aggregates.
Experiments to run first on a CPC, RTD and TCL objective mix. (1) Ablate the objectives (each alone, each pair, all three, matched compute) on return dollars caught and default losses, with linear probes for institution, income band and distress onset to see whether the embedding is mostly identity. (2) Add a MOTOR-style time-to-event head with disconnection as a competing event, and a dense 30-day target, scored with embeddings 1, 7 and 30 days old. (3) Vary only the RTD proposal, from other users' events to same-user perturbations and encoder nearest neighbors. (4) Swap the amount encoding and run the EBES shuffle and random-timestamp tests. (5) Serve a 64-dimensional Matryoshka input plus a small real-time module, and report risk against latency.
Terms
- CPC / InfoNCE
- pick the true future embedding out of N candidates; multi-step horizon
- within-user negatives
- CPC's content signal; other-user negatives teach identity
- RTD
- discriminator labels every event original or replaced by a generator
- generator size
- 1/4 to 1/2 of discriminator; unigram (random) proposals are weak
- CoLES
- slices of one user are positives; good for static traits, weak for future events
- local vs global
- next-event and masked models win local labels; contrastive wins per-user
- EBES shuffle test
- permute event order at test time; small drop means a bag of events
- dense all-action
- from many positions, predict events in the next K days
- logQ correction
- subtract log batch frequency so popular items aren't demoted
- early fusion
- concatenate the candidate onto every history row (TransAct)
- copy-forward repetition
- repeated events use up context; recurring transactions do too
- MOTOR
- piecewise-exponential time-to-event head over 8,192 codes
- static/dynamic split
- constant fields encoded once as their own token
- PLE / PLR
- piecewise-linear bins or trainable periodic features per numeric input
- Matryoshka
- loss on nested prefixes so the first m dims stand alone
Quiz
- Suppose a transaction model's CPC draws its negatives almost entirely from other users' events in the batch. What is the model most likely to learn from CPC?With every negative drawn from someone else, matching the user's institution, amount scale and merchant mix is enough to pick the true future. Same-sequence negatives are what teach content, and dropping them cost CPC 7 points.
- ELECTRA worked best with a generator 1/4 to 1/2 the discriminator's size. What was the authors' explanation for why a full-size generator did worse?The discriminator learns most from a hard but solvable task, and near-perfect fakes push it to model the generator's quirks. Compute does not explain it, since the comparison ran at a fixed number of steps, which if anything favored the larger generator.
- Based on CoLES's production results and the EBES diagnosis, for which label would TCL-style pretraining (two periods of one user are positives) help least?TCL pulls a user's periods together, which suits constant traits like age, ownership and interests but smooths over the balance drop or missed paycheck that drives the next return.
- A team keeps TCL but wants institution and income level to stop being enough to win the contrast. Which change to the negatives does that most directly?When negatives share institution and income band, matching on them no longer finds the positive, so the model must use other information. More random negatives tighten the bound but leave institution a valid shortcut.
- A team runs the EBES test on its sequence model: shuffle the order of events in each test window and re-score. ACH return performance barely changes. What is the most reasonable conclusion?The shuffle measures what this model uses, and the data may hold order information it ignores; EBES's own null came partly from min-max-scaled time. Either way the model does not justify its cost over an aggregate.
- Much of TransAct's gain came from early fusion (concatenating the candidate item onto every history row). What is the closest analogue for an ACH return model?Fusing the debit into each row lets attention compare it with every past event, such as earlier debits from the same originator or the balance before similar amounts. Pooling first and adding the debit afterwards loses those pairwise comparisons.
- A team wants RTD replacements that shift a rent payment by about 10%. Why does the amount encoding matter for this?On a log scale a 10% change is a tiny step on one input, easy to ignore, while PLE spreads the common range over many bins with their own vectors, so nearby amounts get distinct embeddings. Periodic encodings have trainable frequencies and are not shift-invariant.
- Context Clues found that repetitive patient histories are harder and that longer context helps all patients by about the same amount. What does that suggest for fixed-length transaction windows full of recurring payments?Recurring payments carry their information mostly in deviations (late, missing, changed amount), and each routine copy uses up context, so summarizing streams gives some of the benefit of longer context at low cost. Deleting them loses the deviations, and gap tokens hurt in the paper because they use up context too.
- To shrink the sequence model's input, why not just keep the top 64 principal components of today's transaction embeddings?Normal training spreads information across all dimensions, so SVD to 64 dimensions fell far below a Matryoshka 64-dimensional prefix, which stayed near the full vector. The nested loss has to be there at training time.
Sources
- Aaron van den Oord, Yazhe Li, and Oriol Vinyals. Representation Learning with Contrastive Predictive Coding. arXiv preprint, 2018.
- Kevin Clark, Minh-Thang Luong, Quoc V. Le, and Christopher D. Manning. ELECTRA: Pre-training Text Encoders as Discriminators Rather Than Generators. ICLR, 2020.
- Dmitrii Babaev et al. CoLES: Contrastive Learning for Event Sequences with Self-Supervision. SIGMOD, 2022.
- Alexandra Bazarova et al. Learning Transactions Representations for Information Management in Banks: Mastering Local, Global, and External Knowledge. International Journal of Information Management Data Insights, 2025.
- Dmitry Osin, Igor Udovichenko, Viktor Moskvoretskii, Egor Shvetsov, and Evgeny Burnaev. EBES: Easy Benchmarking for Event Sequences. arXiv preprint, 2024.
- Nikil Pancha, Andrew Zhai, Jure Leskovec, and Charles Rosenberg. PinnerFormer: Sequence Modeling for User Representation at Pinterest. KDD, 2022.
- Xue Xia et al. TransAct: Transformer-based Realtime User Action Model for Recommendation at Pinterest. KDD, 2023.
- Michael Wornow et al. Context Clues: Evaluating Long Context Models for Clinical Prediction Tasks on EHRs. ICLR, 2025.
- Ethan Steinberg, Jason Fries, Yizhe Xu, and Nigam Shah. MOTOR: A Time-To-Event Foundation Model For Structured Medical Records. ICLR, 2024.
- Dongyu Zhang et al. FATA-Trans: Field And Time-Aware Transformer for Sequential Tabular Data. CIKM, 2023.
- Yury Gorishniy, Ivan Rubachev, and Artem Babenko. On Embeddings for Numerical Features in Tabular Deep Learning. NeurIPS, 2022.
- Aditya Kusupati et al. Matryoshka Representation Learning. NeurIPS, 2022.