Large-scale behavioral pretraining offers a promising route to generalizable representations in online payment systems. However, high-cardinality identity fields such as card, device, and account IDs, though rich in behavioral signals, remain underexploited. Their continually growing vocabularies and limited semantic meaning make existing vocabulary-based and semantics-based encodings ill-suited. Their generalizable signal lies not in specific values, but in the identity behavior patterns they exhibit across a transaction sequence. Building on this insight, we propose ID2Pattern, a pretraining framework that brings these patterns into transaction foundation models. ID2Pattern first encodes identity fields with a Local Anonymous ID (LAID) tokenizer, which captures how each identity appears and recurs within the sequence, independent of its specific value. It then pretrains a multi-scale pattern codebook on unlabeled sequences, which abstracts LAID sequences into discrete behavior patterns for downstream prediction. Experiments on an industrial dataset with over 100M sequences and six public datasets show that ID2Pattern consistently outperforms strong baselines, improving industrial by 4.13% and public datasets by 8.83% on average. Notably, ID2Pattern remains equally effective even when all identity values are unseen during training, highlighting its potential to generalize to new users and markets.
Figures & tables
Figure 1. Identity fields vs. semantic attributes on our industrial payment data: (a) continual vocabulary growth; (b) limited semantic meaning.
Figure 2. Overview of ID2Pattern . (A) Pattern tokens and event tokens are jointly modeled for risk prediction. (B) The LAID tokenizer encodes each identity by its relative identity within the sequence. (C) The multi-scale pattern codebook quantizes LAID sequences over short, medium, and long windows into discrete pattern tokens.
Dataset
Domain
#Sequences
#ID Fields
Pos. Rate
Industrial
Risk
100.0M+
9
–
Elliptic++
Risk
37.3K
2
5.69%
IBM AML
Risk
1.54M
2
0.20%
CCT
Risk
7.44M
2
0.12%
RetailRocket
Commerce
540.4K
1
2.78%
Synerise
Commerce
6.12M
2
24.44%
Table 1. Statistics of evaluated datasets. #Sequences counts the supervised targets, each with its own history sequence; the positive rate is computed on the test set.
Method
AUC-ROC (%)
T1 (%)
AddCB (%)
Semantic-attribute-only
—
—
—
+ Hash ID
−5.87
−11.91
−8.07
+ Hash ID (relabeled)
−8.00
−50.53
−46.96
+ LAID
+1.11
+6.96
+6.09
+ LAID (relabeled)
+1.11
+6.96
+6.09
ID2Pattern
+4.13
+22.64
+19.67
Table 2. Relative performance changes on the industrial payment-risk test set, using the semantic-attribute-only baseline as the reference.
Figure 3. Online shadow evaluation from July to August. AUC is normalized by the average AUC of the semantic-attribute-only model over the first three days.
Table 3. Performance on six public datasets in terms of PR-AUC (PR) and recall at a false positive rate of at most 0.5% ([email protected]%). Best results are in bold, and second-best results are underlined.
Ablation Variants
Risk
Commerce
CCT
IBM AML
RetailRocket
Synerise
w/o LAID
.0338
.2018
.7814
.4228
Local ID Only
.0600
.2695
.8152
.4718
w/o Pattern Branch
.0418
.1880
.8064
.4734
Single-scale
.0526
.2263
.8087
.4700
w/o Codebook
.0419
.2047
.8092
.4630
Table 4. Ablation study of different components (PR-AUC).
Figure 4. Generalization to unseen identities on CCT and Taobao. Left: PR-AUC with original and fully relabeled identities. Right: PR-AUC under increasing relabeling ratios.
Figure 5. Case study on learned codebooks. Left: positive-rate lift of codes at each scale. Right: multi-scale code combinations describing behavior patterns on CCT and Taobao.
Risk
Commerce
Backbone
IBM AML
CCT
RetailRocket
Taobao
GRU
.1600
.0315
.7358
.2102
+ ID2Pattern
.2397
.0345
.7700
.2756
Improv.
+49.8%
+9.5%
+4.6%
+31.1%
LSTM
.2014
.0318
.7255
.2078
+ ID2Pattern
.2543
.0268
.7763
.2678
Table 5. PR-AUC of different backbones with and without the identity modeling of ID2Pattern , averaged over 3 seeds.
Pretraining data
Taobao
RetailRocket
Synerise
Without pretraining
.2608 ± .0042
.8011 ± .0055
.4561 ± .0036
Target only
.2686 ± .0022
.8283 ± .0067
.4776 ± .0047
Other two datasets
.2698 ± .0025
.8313 ± .0016
.4836 ± .0010
Table 6. PR-AUC with the pattern encoder pretrained on the target dataset alone or on the other two commerce datasets.
Figure 6. Efficiency of identity representations. (a) Parameters per identity field; numbers give identities per hash bucket. (b) Inference time per sample.
Appendix figures & tables2 assets
Supplementary material from the paper’s appendix.
Appendix
Strategy
Size grows with IDs
Unseen IDs
Identity behavior
Vocabulary-based
Linear
OOV vector
Value-tied
Hashing
No
Arbitrary code
Value-tied
Hand-crafted
No
Supported
Predefined
Semantics-based
No
If content
Not captured
LAID (ours)
No
Invariant
Learned
Appendix
Table 7. Comparison of strategies for encoding high-cardinality identity fields.
Dataset
Positive class
Identity fields
Subjects
Train
Valid
Test
Lmax
CCT
fraud
merchant name, city
6,139
125,304
3,657,794
3,656,690
512
IBM AML
laundering
receiving bank, account
496,999
15,936
760,071
760,345
512
Elliptic++
illicit
two output addresses
46,564
18,360
7,765
11,184
256
Taobao
purchase
item, category
987,991
2,683,554
10,944,062
25,628,669
100
RetailRocket
purchase
item
58,653
428,761
55,209
56,467
100
Synerise
7-day conversion
SKU, URL
2,032,633
4,944,430
529,289
642,336
512
Appendix
Table 8. Details of the public datasets: positive class, identity fields, number of sequence subjects and supervised targets in each split, and maximum history length Lmax .