TACTIC for Navigating the Unknown: Tabular Anomaly deteCTion via In-Context inference
Authors: Patryk Marszałek, Tomasz Kuśmierczyk, Marek Śmieja
Organizations: Faculty of Mathematics and Computer Science, Jagiellonian University, Kraków, Poland · Doctoral School of Exact and Natural Sciences, Jagiellonian University, Kraków, Poland
Anomaly detection for tabular data has been a long-standing unsupervised learning problem that remains a major challenge for current deep learning models. Recently, in-context learning has emerged as a new paradigm that has shifted efforts from task-specific optimization to large-scale pretraining aimed at creating foundation models that generalize across diverse datasets. Although in-context models, such as TabPFN, perform well in supervised problems, their learned classification-based priors may not readily extend to anomaly detection. In this paper, we study in-context models for anomaly detection and show that the unsupervised extensions to TabPFN exhibit unstable behavior, particularly in noisy or contaminated contexts, in addition to the high computational cost. We address these challenges and introduce TACTIC, an in-context anomaly detection approach based on pretraining with anomaly-centric synthetic priors, which provides fast and data-dependent reasoning about anomalies while avoiding dataset-specific tuning. In contrast to typical score-based approaches, which produce uncalibrated anomaly scores that require post-processing (e.g. threshold selection or ranking heuristics), the proposed model is trained as a discriminative predictor, enabling unambiguous anomaly decisions in a single forward pass. Through experiments on real-world datasets, we examine the performance of TACTIC in clean and noisy contexts with varying anomaly rates and different anomaly types, as well as the impact of prior choices on detection quality. Our experiments clearly show that specialized anomaly-centric in-context models such as TACTIC are highly competitive compared to other task-specific methods.
Figures & tables
Figure 1: Average AUCROC performance (vertical axis) versus computation time (horizontal axis), calculated over multiple datasets, for classical (circles), deep-learning (triangles), and in-context methods (stars). Note that the horizontal axis corresponds to inference time for out-of-the-box models and to the combined fitting and inference time for models that require per-dataset training. In terms of evaluation time, TACTIC falls within the group of fast shallow methods while achieving top performance for both clean and noisy context settings.
Figure 2: Schematic overview of our approach. By making use of contextual information about data distribution, TACTIC separates query points into nominal and anomalous.
Figure 3: Anomaly-centric priors used for pretraining TACTIC (nominal data is marked in blue; anomalies marked in red). Using a mixture of classification-based and GMM-based priors with various anomaly types improves the generalization ability and robustness of our method.
Figure 4: Performance of our model (TACTIC) against classical, deep, and in-context baselines (the unsupervised extension of TabPFN2.5, termed uTabPFN) in the clean-context setting, computed on multiple real-world datasets. The numeric values under the distribution plots indicate the average rank of each method.
Figure 5: Performance of our model (TACTIC) against classical, deep, and in-context baselines in the contaminated (noisy) context setting, computed on multiple real-world datasets. The numeric values under the distribution plots indicate the average rank of each method.
Figure 6: Anomaly detection performance averaged over datasets containing at least k% anomalies (note that the number of such datasets decreases as k increases), evaluated using contexts with anomaly levels reduced to match exactly k%.
Figure 7: Performance on synthetic Gaussian mixture datasets with different anomaly types. Anomalies were added to both contexts and query sets.
Figure 8: Impact of priors used for pretraining on performance. We compare the default TACTIC models pretrained on clean or contaminated (noisy) contexts against variants with GMM-based priors excluded (w/o GMM) and without classification-based priors (w/o PFN).
Appendix figures & tables18 assets
Supplementary material from the paper’s appendix.
Appendix
Id
Name
#Samples
#Features
#Anomalies
%Anomalies
1
ALOI
49534
27
1508
3.04
2
annthyroid
7200
6
534
7.42
4
breastw
683
9
239
34.99
6
cardio
1831
21
176
9.61
7
Cardiotocography
2114
21
466
22.04
8
celeba
202599
39
4547
2.24
Appendix
Table 1: ADbench dataset statistics.
Id
#Samples
#Features
#Anomalies
%Anomalies
0
5272
21
492
9.33
1
6033
24
494
8.19
2
5611
49
495
8.82
3
8136
26
494
6.07
4
8048
43
496
6.16
5
3302
38
494
14.96
Appendix
Table 2: Statistics of Gaussian mixture datasets with local anomalies.
Id
#Samples
#Features
#Anomalies
%Anomalies
0
3885
11
496
12.77
1
3921
49
499
12.73
2
7330
27
490
6.68
3
3290
30
496
15.08
4
4271
14
496
11.61
5
4228
40
493
11.66
Appendix
Table 3: Statistics of Gaussian mixture datasets used in experiments with global anomalies.
Id
#Samples
#Features
#Anomalies
%Anomalies
0
5908
7
496
8.40
1
6257
15
498
7.96
2
2823
22
498
17.64
3
6691
31
494
7.38
4
3680
32
491
13.34
5
7791
7
497
6.38
Appendix
Table 4: Overview of dataset statistics for cluster anomalies.
Id
TACTIC
uTabPFN
KNN
LOF
TCCM
IForest
PCA
HBOS
OCSVM
CBLOF
DeepSVDD
ECOD
COPOD
LODA
DAGMM
SOD
COF
1
61.58
55.98
63.05
66.84
57.11
55.76
56.34
54.49
55.17
54.63
55.46
55.21
53.36
51.06
51.86
60.28
63.28
2
88.29
94.64
87.04
90.92
76.64
91.44
81.23
70.78
66.03
63.83
85.28
78.97
77.56
60.61
60.87
71.39
64.30
4
99.37
75.75
99.49
72.64
99.56
99.54
99.16
99.49
99.43
99.22
98.20
98.97
99.50
98.48
95.54
84.55
45.03
6
92.86
89.90
95.79
95.24
98.11
94.85
96.70
86.82
97.45
87.88
93.77
93.41
92.28
92.22
86.06
50.32
52.91
7
71.52
80.12
79.78
80.12
81.57
80.05
82.24
70.35
84.27
79.11
79.47
78.07
66.82
78.70
74.37
36.06
41.14
8
74.72
57.90
65.04
45.99
69.26
70.48
78.87
75.94
70.16
69.21
72.55
75.11
74.55
64.03
52.58
49.33
40.94
Appendix
Table 5: Detailed AUCROC performance comparison across all datasets in the clean-context scenario.
Id
TACTIC
KNN
LOF
IForest
PCA
HBOS
OCSVM
CBLOF
DeepSVDD
ECOD
COPOD
LODA
SOD
COF
1
19.96
20.93
23.85
11.56
14.11
13.06
13.78
14.67
13.62
9.99
9.10
11.81
20.14
19.19
2
63.13
59.36
70.91
67.01
56.61
51.13
38.22
38.79
60.39
44.75
37.69
33.03
49.19
23.74
4
98.91
99.02
0.00
98.87
98.93
98.84
98.90
98.57
98.58
93.68
94.74
98.84
87.21
0.00
6
73.08
85.15
84.26
79.94
84.74
65.78
87.05
66.41
80.11
72.46
68.37
78.03
30.67
28.14
7
54.04
65.87
63.09
59.93
65.20
43.64
68.65
58.53
62.24
46.16
36.88
63.19
32.37
20.70
8
25.99
12.91
4.27
27.80
38.74
33.60
29.11
29.24
27.50
33.45
32.24
14.75
11.03
2.89
Appendix
Table 6: Per-dataset F1 assessment in the clean-context setting.
Id
TACTIC
uTabPFN
KNN
LOF
TCCM
IForest
PCA
HBOS
OCSVM
CBLOF
DeepSVDD
ECOD
COPOD
LODA
DAGMM
SOD
COF
1
59.86
53.69
62.55
66.95
57.37
55.93
56.08
54.04
54.90
50.54
55.21
55.48
53.20
50.64
51.31
62.07
64.11
2
76.20
88.49
71.72
70.19
92.68
81.99
64.94
59.88
58.04
50.63
68.27
78.53
76.95
46.86
55.46
77.92
67.30
4
95.00
95.48
97.37
41.00
99.56
98.33
96.32
98.67
91.81
77.91
90.33
99.21
99.55
98.53
93.42
93.55
38.67
6
87.94
57.39
75.61
66.45
67.28
92.71
95.31
86.53
93.32
72.94
88.74
93.47
92.43
88.25
79.24
70.31
64.67
7
63.87
41.43
55.95
59.75
78.37
68.71
75.89
60.17
78.52
61.08
73.60
78.81
66.99
73.48
65.16
51.57
53.25
8
85.36
59.40
60.33
40.76
67.03
69.88
78.26
75.03
68.67
56.34
71.00
75.52
74.75
61.92
51.66
48.54
42.00
Appendix
Table 7: Examination of AUCROC performance across all datasets under the noisy-context setting.
Id
TACTIC
KNN
LOF
IForest
PCA
HBOS
OCSVM
CBLOF
DeepSVDD
ECOD
COPOD
LODA
SOD
COF
1
7.94
10.73
12.55
5.45
7.10
5.93
6.84
4.98
6.69
4.69
4.49
6.19
9.58
11.15
2
27.24
24.37
24.15
31.70
22.17
23.95
14.65
8.31
24.01
28.52
22.81
10.33
27.79
22.62
4
84.78
37.96
0.00
52.13
45.34
46.31
46.26
47.13
44.05
47.90
47.17
47.23
58.70
0.64
6
40.58
38.42
24.87
50.33
64.41
51.22
60.28
42.01
50.24
53.00
57.41
50.61
29.10
24.70
7
40.08
27.99
22.55
31.85
35.14
32.37
41.04
32.70
35.25
35.61
30.15
38.19
28.65
19.72
8
10.80
4.68
1.57
12.95
18.58
16.75
13.67
7.86
12.66
16.99
16.30
6.00
4.19
1.34
Appendix
Table 8: F1 score comparison for all datasets evaluated in the noisy-context scenario.
Anomaly level
IForest
KNN
PCA
TACTIC-N
TACTIC-C
uTabPFN
0
82.34
88.44
78.85
87.17
90.43
88.90
5
75.80
77.03
70.25
80.26
75.61
79.00
10
69.07
72.66
63.50
74.81
70.83
69.47
15
69.88
71.50
63.89
74.45
68.65
67.46
20
68.01
71.25
61.63
71.54
64.64
67.41
Appendix
Table 9: Average AUCROC across different anomaly levels in the context set.
Anomaly level
IForest
KNN
PCA
TACTIC-N
TACTIC-C
0
47.74
58.24
44.30
55.61
65.52
5
38.75
39.33
36.22
47.65
36.16
10
36.65
39.71
33.48
51.25
38.76
15
35.52
35.66
33.54
50.12
34.66
20
32.94
33.41
30.43
48.10
33.09
Appendix
Table 10: Mean F1 performance under varying anomaly levels in the context set.
Id
TACTIC
uTabPFN
KNN
LOF
TCCM
IForest
PCA
HBOS
OCSVM
CBLOF
COPOD
COF
0
99.52
99.35
99.52
99.50
83.80
99.21
99.39
99.06
99.38
75.12
98.71
98.48
1
99.63
99.66
99.68
99.72
86.28
99.39
99.59
99.36
99.54
74.88
99.01
98.51
2
99.99
99.99
99.99
100.00
95.79
99.96
99.99
99.97
99.99
64.35
99.89
99.68
3
99.92
99.87
99.92
99.95
90.22
99.68
99.87
99.75
99.84
75.72
99.49
99.21
4
99.96
99.98
99.98
99.99
92.66
99.92
99.96
99.94
99.96
66.99
99.86
99.66
5
99.99
99.97
99.99
99.99
90.44
99.95
99.98
99.93
99.98
71.85
99.87
99.58
Appendix
Table 11: AUCROC evaluation on synthetic Gaussian mixture datasets with local anomalies.
Id
TACTIC
KNN
LOF
IForest
PCA
HBOS
OCSVM
CBLOF
COPOD
COF
0
86.79
90.92
90.46
88.66
89.93
88.61
90.05
37.65
86.24
84.90
1
87.06
84.64
84.60
82.72
84.42
83.58
83.68
33.98
81.97
79.68
2
98.01
92.03
92.96
92.93
92.30
92.52
92.70
29.04
92.29
90.73
3
89.36
73.91
74.18
72.88
73.59
73.65
73.36
30.10
72.98
73.12
4
95.31
75.47
75.98
74.88
75.65
74.64
76.36
25.40
73.74
79.14
5
98.27
78.64
78.26
79.87
78.17
79.54
77.67
44.59
77.73
74.45
Appendix
Table 12: Method comparison using F1 on synthetic Gaussian mixture datasets with local anomalies.
Id
TACTIC
uTabPFN
KNN
LOF
TCCM
IForest
PCA
HBOS
OCSVM
CBLOF
COPOD
COF
0
99.95
99.68
99.96
99.94
85.98
99.87
99.88
99.83
99.90
73.68
99.56
99.70
1
100.00
100.00
100.00
100.00
99.50
100.00
100.00
100.00
100.00
59.97
100.00
99.99
2
100.00
99.99
100.00
100.00
99.38
100.00
100.00
100.00
100.00
64.92
100.00
99.99
3
100.00
100.00
100.00
100.00
96.57
100.00
100.00
100.00
100.00
67.66
100.00
99.93
4
99.97
99.75
99.97
99.97
90.42
99.85
99.92
99.81
99.92
72.68
99.69
99.69
5
100.00
100.00
100.00
100.00
99.37
100.00
100.00
100.00
100.00
59.17
100.00
99.97
Appendix
Table 13: AUCROC performance benchmarking on synthetic Gaussian mixture datasets with global anomalies.
Id
TACTIC
KNN
LOF
IForest
PCA
HBOS
OCSVM
CBLOF
COPOD
COF
0
87.09
89.33
89.17
89.33
89.49
88.79
89.58
45.59
87.99
85.82
1
100.00
86.89
87.58
88.02
86.47
87.87
86.48
42.40
88.88
79.32
2
94.84
78.51
79.40
79.24
79.34
79.55
79.08
27.23
79.91
79.49
3
99.40
78.70
79.22
76.43
78.01
79.22
78.09
53.27
79.82
66.22
4
89.99
93.60
93.74
93.86
93.68
93.68
93.46
43.70
91.85
88.81
5
99.40
90.28
91.24
91.74
90.75
92.30
91.00
37.78
91.66
85.51
Appendix
Table 14: F1-based evaluation on synthetic Gaussian mixture datasets with global anomalies.
Id
TACTIC
uTabPFN
KNN
LOF
TCCM
IForest
PCA
HBOS
OCSVM
CBLOF
COPOD
COF
0
89.00
79.86
82.74
78.87
51.85
82.43
81.77
80.56
82.33
55.26
81.24
76.60
1
96.30
74.71
72.41
70.06
53.53
70.44
69.62
69.20
70.43
58.16
71.18
66.90
2
81.04
58.71
66.62
63.90
55.03
68.12
69.20
68.01
68.41
56.68
69.82
64.84
3
70.73
67.27
69.43
68.54
59.96
69.30
70.05
69.81
69.83
53.20
68.40
65.56
4
69.76
69.82
68.71
67.97
61.45
68.61
69.66
69.13
69.47
59.45
68.32
67.13
5
87.98
80.91
85.09
81.20
63.30
83.85
84.21
83.05
83.59
59.31
80.20
79.99
Appendix
Table 15: AUCROC performance analysis on Gaussian mixture synthetic datasets with cluster anomalies.
Id
TACTIC
KNN
LOF
IForest
PCA
HBOS
OCSVM
CBLOF
COPOD
COF
0
37.76
32.71
26.51
32.48
32.34
32.02
34.06
10.56
36.29
28.99
1
44.50
23.93
20.24
23.46
24.31
24.22
23.71
17.44
27.49
17.83
2
48.97
21.84
18.65
23.71
24.01
24.26
23.84
20.66
25.96
19.52
3
21.42
17.39
16.36
19.68
18.62
17.97
18.31
14.49
18.37
13.97
4
31.79
26.23
25.54
25.68
27.77
28.16
28.38
23.27
26.83
20.83
5
28.67
35.42
28.36
35.53
33.97
33.65
32.88
12.95
29.42
28.29
Appendix
Table 16: Comparison of F1 scores on synthetic Gaussian mixture datasets with cluster anomalies.
Clean
Noisy
Id
TACTIC
w/o GMM
w/o PFN
TACTIC
w/o GMM
w/o PFN
1
61.58
56.89
50.00
59.86
57.01
55.41
2
88.29
83.52
91.94
76.20
77.55
67.40
4
99.37
99.46
61.44
95.00
92.80
55.97
6
92.86
96.91
89.74
87.94
85.34
64.05
7
71.52
81.02
68.41
63.87
60.23
52.63
Appendix
Table 17: AUCROC of TACTIC variants pretrained on various priors in clean- and noisy-context setups.
Clean
Noisy
Id
TACTIC
w/o GMM
w/o PFN
TACTIC
w/o GMM
w/o PFN
1
19.96
16.63
18.86
7.94
8.17
3.74
2
63.13
52.33
62.57
27.24
24.80
24.83
4
98.91
98.87
14.55
84.78
86.72
4.75
6
73.08
84.93
1.57
40.58
34.98
9.61
7
54.04
54.80
0.00
40.08
33.97
17.06
Appendix
Table 18: F1 of TACTIC variants pretrained on various priors in clean- and noisy-context setups.
Anomaly detection on tabular data is commonly studied under three supervision regimes, including one-class settings that assume access to anomaly-free training samples, fully unsupervised settings with unlabeled and potentially contaminated training data, and semi-supervised settings with limited anomaly labels. Existing deep learning approaches typically train dataset-specific models under the assumption of a single supervision regime, which limits their ability to leverage shared structures across anomaly detection tasks and to adapt to different supervision levels. We propose ICLAD, an in-context learning foundation model for tabular anomaly detection that generalizes across both datasets and supervision regimes. ICLAD is trained via meta-learning on synthetic tabular anomaly detection tasks, and at inference time, the model assigns anomaly scores by conditioning on the training set without updating model weights. Comprehensive experiments on 57 tabular datasets from ADBench show that our method achieves state-of-the-art performance across three supervision regimes, establishing a unified framework for tabular anomaly detection.
Jack Yi Wei, Narges Armanfard
Department of Electrical and Computer Engineering, McGill University, Canada · Mila - Quebec Artificial Intelligence Institute, Montreal, Canada
Unsupervised tabular anomaly detection (TAD) aims to identify anomalous rows in tabular data using normal training samples. While conventional methods rely on dataset-specific training and configuration search, recent tabular foundation models (TFMs) enable zero-shot anomaly detection on unseen datasets via in-context learning. Most TFM-based approaches, however, require anomaly-specific pretraining from scratch, making detection inherently dependent on synthetic TAD-specific priors and costly to update. Some approaches instead repurpose pretrained general-purpose TFMs for TAD to avoid this burden, but rely on computationally expensive formulations with restrictive anomaly inductive biases. In this work, we introduce TaskBridge, a new framework that efficiently repurposes pretrained general-purpose TFMs for unsupervised TAD by constructing virtual supervised tasks that directly recast anomaly detection as supervised in-context inference of TFMs. The resulting virtual tasks induce predictive structures under which normal queries and their target pairs receive high support, whereas anomalies tend to violate the induced structures and receive lower support, providing direct anomaly evidence. Across 790 real-world datasets, TaskBridge consistently outperforms 30 baselines, including state-of-the-art TFM-based approaches, without anomaly-specific TFM pretraining or dataset-specific model optimization.
Anomaly detection in tabular data is challenging because abnormal samples often arise as violations of cross-feature dependencies rather than simple marginal deviations. Existing detectors rely on geometric or reconstruction signals, while prior LLM-based approaches mainly fine-tune LLMs with normal samples or generate synthetic anomalies. We propose LLM-Detector, a framework that utilizes the in-context learning capacity of LLMs for structured, prompt-conditioned scoring synthesis, enabling LLMs to derive anomaly detection logic from structured normal-state knowledge. Specifically, normal training data are converted into statistical summaries, causal dependencies, and distilled prototypes that are organized into a prompt for code generation. The resulting scoring engine evaluates statistical deviation, structural inconsistency, and density-based abnormality then computes an anomaly score for each test sample. We evaluate LLM-Detector on 24 tabular datasets, comparing against 15 SOTA baselines. Results show consistent improvements across both mixed-type and continuous-only settings. Moreover, this design eliminates the need for LLM fine-tuning or neural network training, reducing computational cost and enabling practical anomaly detection in real-world tabular systems.
Tu Anh Hoang Nguyen, Dang Nguyen, Thuc Duy Le +2
Applied Artificial Intelligence Initiative (A2I2), Deakin University, Australia · Adelaide University, Australia · Monash University, Australia