We introduce RecPFN, a prior-fitted network that brings in-context learning to sequential recommendation. RecPFN is pretrained entirely on synthetic clickstream environments sampled from a broad structural causal prior, enabling it to amortize Bayesian-style inference from a small support set. At inference, a lightweight decoder-only transformer conditions on a handful of domain sequences and produces next-item predictions for queries in a single forward pass, without any weight updates. Across eight public benchmarks, RecPFN achives state-of-the-art zero-shot performance while remaining strongly competitive with supervised methods in low-compute and low-data regimes. It is deployment-efficient and robust to domain shift, outperforming strong zero-shot baselines that rely on large real-interaction corpora. RecPFN provides a practical path toward generalizable, data-efficient recommenders and opens avenues for richer priors, longer-context ICL, and multimodal extensions. Code for training and evaluation is publicly available at https://github.com/SAP-samples/tabular-ai-recpfn/.
Figures & tables
Figure 1. Overall framework of RecPFN: (From left to right) Synthetic data-driven pre-training on next-item prediction task; RecPFN model architecture comprising of alternating Type-A and Type-B ICL modules; Inference based on on-the-fly adaptation to support set retrieved via a recency-weighted overlap
Dataset
Users
Items
Interactions
Ave. Length
Evaluation
Appliances
703
30,252
6,875
9.78
Arts
1,579,230
302,809
2,875,917
1.82
Dianping
208,596
243,247
4,422,473
21.20
Games
100,955
71,982
733,447
7.27
Movies
450,757
182,032
4,169,631
9.25
Table 1. Dataset statistics
Dataset
RecPFN
RecFormer
RecGPT
UniSRec
VQ-Rec
EmbKNN
Improv.
@10
HR
MRR
HR
MRR
HR
MRR
HR
MRR
HR
MRR
HR
MRR
HR
MRR
Appliances
.1915
.1471
.1250
.0808
.1064
.0993
.0709
.0340
.1206
.0844
.1064
.0483
+53.2%
+48.1%
Arts
.2077
.1485
.1851
.1393
.0390
.0372
.1469
.1124
.1293
.1199
.1918
.1301
+8.3%
+6.6%
Games
.0673
.0417
.0585
.0283
.0355
.0330
.0239
.0116
.0346
.0302
.0471
.0161
+15.0%
+26.6%
Movies
.1253
.0708
.0875
.0431
.0416
.0367
.0354
.0212
.0428
.0366
.0774
.0268
+43.2%
+64.2%
Pantry
.2491
.2031
.1534
.1004
.0599
.0579
.2069
.1780
.1975
.1853
.2377
.1913
+4.8%
+6.2%
Table 2. RecPFN performance against SOTA zero-shot baselines
Dataset
@10
RecPFN
BERT
BERT ∧
FDSA
GRU
GRU ∧
SAS
SAS ∧
UniSRec
VQ-Rec
Improv.
Rank
Appliances
HR
.1915 ∗
.0391
.0938
.0836
.0240
.0000
.0697
.1192
.1259
.1242
+52.1%
1
MRR
.1471 ∗
.0095
.0392
.0235
.0113
.0000
.0655
.0831
.0937
.0982
+49.8%
1
Arts
HR
.2077 ∗
.0396
.0163
.0661
.0264
.0149
.0229
.0484
.1936
.1280
+7.3%
1
MRR
.1485
.0181
.0076
.0458
.0135
.0090
.0094
.0343
.1531
.1183
-3.0%
2
Games
HR
.0673 ∗
.0372
.0122
.0396
.0244
.0152
.0169
.0352
.0636
.0343
+5.9%
1
MRR
.0417 ∗
.0144
.0053
.0165
.0093
.0099
.0070
.0283
.0346
.0300
+20.5%
1
Table 3. RecPFN performance against supervised baselines trained for 3 epochs on the full target domain dataset, illustrating deployment efficiency under a per-domain training budget. ∧ denotes the semantic embedding variant of the ID-based models. ∗ indicates statistically significant improvements (p<0.05).
Dataset
@10
RecPFN
BERT
BERT ∧
FDSA
GRU
GRU ∧
SAS
SAS ∧
UniSRec
VQ-Rec
Rank
Appliances
HR
.1348
.0868
.0834
.0960
.0295
.0428
.1221
.1342
.1277
.1277
1
MRR
.1016 ∗
.0225
.0513
.0314
.0100
.0214
.0632
.0829
.0931
.0887
1
Arts
HR
.1947
.0531
.0173
.1102
.0720
.0157
.0973
.0658
.1990
.1834
2
MRR
.1424
.0360
.0060
.0920
.0544
.0096
.0716
.0534
.1610
.1656
3
Pantry
HR
.2364
.0258
.0296
.0755
.0398
.0405
.0688
.0594
.2357
.2187
1
MRR
.1990
.0170
.0169
.0583
.0145
.0254
.0506
.0503
.1993
.1944
2
Table 4. RecPFN performance against supervised baselines trained for 50 epochs on 10% of the target domain dataset. ∧ denotes the semantic embedding variant of the ID-based models. ∗ indicates statistically significant improvements (p<0.05)
Figure 2. MRR@10 versus training epochs (up to 100) on four datasets for SASRec, FDSA, VQ-Rec, and RecPFN. RecPFN requires no target-domain training and is shown as a horizontal line.
Experiment
Appliances
Arts
Pantry
Scientific
Dianping
Yelp
@10
HR
MRR
HR
MRR
HR
MRR
HR
MRR
HR
MRR
HR
MRR
RecPFN-base
.1915
.1471
.2077
.1485
.2491
.2031
.1007
.0730
.0574
.0269
.0245
.0165
Model
RecPFN-small
+3.7
-26.6
+0.5
+0.7
-1.0
+0.3
+1.9
-1.0
-17.8
-29.2
-9.0
-10.0
RecPFN-mini
+3.7
-12.8
+0.5
-0.8
-1.3
+0.2
+4.8
-14.7
-25.1
-40.7
+2.0
+4.5
baai/bge-m3
-14.8
-20.9
+2.5
+0.4
+1.2
+1.1
+4.4
-4.6
+17.6
+16.2
+2.0
+0.1
Table 5. Relative performance of various ablation experiments for RecPFN (expressed as percentage change)
Method
Preprocessing (s)
Training (s)
Inference (ms)
Yelp
RecPFN
46.56
-
6.58
RecGPT
-
-
40.81
VQ-Rec
691.20
380.69
0.44
FDSA
-
1016.30
2.49
Scientific
Table 6. RecPFN runtimes in seconds against baselines for Pantry and Yelp. Times reported for single epoch training, inference per user (averaged across full test split)
Query history
Last Vegas; The Big Wedding (Digital); Life of Pi; Poverty, Inc.; Intolerable Cruelty; In the Arms of Angels
Ground truth
A Pioneer Miracle
RecPFN Top-3
A Pioneer Miracle; The Teacher; Savior
RecPFN (no context) Top-3
Panic in the Streets (VHS); Frightworld; A Tale of Two Cities
EmbKNN Top-3
Silver Linings Playbook; Movies He’ll Love; City by the Sea
Rationale
RecPFN observes support sequences containing the transition: In the Arms of Angels → A Pioneer Miracle (Table 8 ). This in-context signal steers the model toward the correct next item. Without context, predictions revert to broadly similar or popular items.
Table 7. Qualitative example (Amazon Movies). RecPFN correctly predicts the ground-truth next item when conditioned on the retrieved support sequences; removing the context or using EmbKNN yields plausible but incorrect recommendations.
1
Secrets of Archeology: The Lost Cities of the Maya; Seven Girlfriends; In the Arms of Angels; A Pioneer Miracle
2
About Miracles; Doctor Thorne (Season 1); In the Arms of Angels; A Pioneer Miracle
3
In the Arms of Angels; A Pioneer Miracle; Touched By Grace; Before All Others
4
Dying of the Light; In the Arms of Angels; Finding Neverland; A Pioneer Miracle
Table 8. Most influential support sequences retrieved by the context selector (titles shown). These sequences contain the co-occurrence and transition indicative of the ground-truth next item.
Figure 3. UMAP projection for the Amazon Movies case in Table 7 . Dense, relevant context near the label (star) pulls RecPFN’s prediction (blue diamond) toward the ground truth, as indicated by the arrow from the no-context prediction. Scattered context is ignored. Axes: UMAP-1 and UMAP-2.
Figure 4. MRR@10 relative to the in-range median as each SDG hyperparameter is swept inside and outside its training range (shaded). Results are averaged over 50 synthetic environments per value; shaded bands show ±1 std. RG = random-graph prior; LF = latent-factor prior.