Editor’s introduction
The study evaluates tabular foundation models in real-world electronic health record settings, comparing classical, deep tabular, and in-context learning approaches across varying data scale, feature complexity, and outcome rarity. It finds that while TICL models perform well with limited data, their effectiveness diminishes under high heterogeneity and imbalance, particularly in larger, more complex cohorts. The results highlight that retrieval-inference alignment and retrieval quality are critical for reliable clinical prediction, with gains increasing as data complexity rises.
Introduction
Accurate prediction from structured electronic health records (EHRs) is central to modern clinical decision support, enabling risk stratification, resource allocation, and timely intervention. The growing availability of routinely collected EHR data offers substantial opportunities to develop predictive Machine Learning (ML) models that capture complex, personalized clinical patterns. However, EHR-based prediction remains methodologically challenging due to high-dimensional heterogeneous features, severe outcome imbalance, irregular temporal structure, and cross-institutional variation.
In a clinically realistic electronic health record, we may encounter thousands of variables, such as demographics, comorbidities, laboratory indices, vital signs, diagnosis codes, and procedural interventions, yet for a given task, such as predicting ICU mortality, only a small, often different subset (e.g., serum lactate, blood pressure, or SOFA score) carries substantial prognostic value. This heterogeneity requires ML models to identify clinically meaningful signals within a high-dimensional, largely noisy feature space; for retrieval-augmented approaches specifically, non-informative dimensions can distort the used similarity metrics, yielding neighbors that are not semantically relevant.
This snapshot-based formulation naturally places the problem within the tabular learning paradigm, which has long been central to EHR-based clinical prediction. In practice, this setting has been dominated by decision tree ensembles, most notably gradient-boosted methods such as XGBoost, LightGBM, and CatBoost, which remain strong baselines for clinical outcome prediction due to their robustness to heterogeneous feature types and favorable interpretability–performance trade-offs. These properties have made tabular models widely adopted across diverse EHR-based supervised learning tasks and institutional settings.
Results
This section presents a systematic evaluation of tabular learning paradigms under clinically realistic EHR conditions. We first conduct progressive ablation studies to isolate the contribution of each AWARE component across multiple retrieval-based backbones (§2.1). We then benchmark the evaluated models on small- to medium-scale clinical datasets (§2.2) and large-scale real-world EHR cohorts (§2.3). Finally, we conduct three controlled stress-test experiments to characterize model behavior as training-set size, feature dimensionality, and outcome rarity are systematically varied (§2.4).
Progressive Ablation of AWARE Components
Across architectures and datasets, task-aligned retrieval through SNNL initiates consistent performance gains, which generally increase with attention weighting and balanced sampling. The gains from balanced sampling are especially pronounced for AUPRC under class imbalance, supporting the interpretation that majority-class retrieval bias limits vanilla RA-TICL. For example, on eICU, the final AWARE-enhanced KNN configuration improves AUPRC by approximately 140%, compared with a more moderate AUROC gain of 23.8%. Improvements occur across all three backbones, suggesting that they arise from the AWARE components rather than increased model capacity. KNN exhibits the largest relative improvement, indicating that naive distance-based retrieval is particularly sensitive to poorly structured neighborhoods in heterogeneous EHR feature spaces. Cross-validation ensembling and adapter fine-tuning provide smaller, complementary gains. Overall, the results indicate that AWARE’s principal contribution is task-aligned restructuring of retrieval neighborhoods, with balanced sampling further supporting rare-event conditioning and subsequent stabilization techniques providing secondary improvements.
Multi-Cohort Consistency
Taken together, results in §2.2 and §2.3 show that TICL and RA-TICL models remain competitive with classical and deep tabular baselines across small-to-medium and large-scale cohorts alike, across diverse medical domains, feature types, and institutional practices, without dataset-specific hyperparameter search. We next extend this multi-cohort view to HIPE, the most heterogeneous and imbalanced cohort in our benchmark.
Taken together, the controlled stress tests and multi-cohort results demonstrate the robustness of AWARE under clinically realistic EHR constraints. Its benefits become increasingly pronounced as dataset scale, feature dimensionality, and outcome rarity increase, and persist in the heterogeneous and severely imbalanced HIPE cohort. By replacing task-agnostic distance-based retrieval with task-aligned context construction, AWARE consistently reduces the performance degradation of RA-TICL models across diverse clinical tasks, feature regimes, and cohorts. These findings support our central conclusion that retrieval-aligned tabular foundation models enable more robust clinical risk prediction from EHRs under clinically realistic constraints, particularly in settings where naive neighborhood construction is least reliable.
Discussion
This study provides a systematic multi-cohort assessment of TICL and RA-TICL for EHR-based clinical prediction. Three principal findings emerge. First, TICL models demonstrate strong sample efficiency on small- and medium-scale datasets, where pretrained tabular priors support competitive prediction with limited labeled data. Second, these advantages do not automatically extend to larger and more complex cohorts, where feature heterogeneity, sparsity, outcome imbalance, and unstable context composition increasingly limit vanilla TICL and RA-TICL. Third, AWARE consistently mitigates these limitations, with its relative benefits generally increasing as the clinical constraints intensify. Thus, transferring the success of foundation models from generic tabular benchmarks to clinical data is neither straightforward nor directly beneficial; retrieval alignment and context construction, rather than model capacity alone, are important determinants of RA-TICL performance in EHR data.
The comparative results reveal a clear regime-dependent pattern. On small- and medium-scale datasets, TICL and RA-TICL remain competitive with classical and deep tabular approaches, consistent with the reported sample efficiency of tabular foundation models. Incorporating AWARE further improves both TabDPT and kNNPFN, indicating that task-aligned retrieval is beneficial even in relatively compact cohorts. As dataset scale and feature heterogeneity increase, however, tree-based and feature-selective deep models become more competitive, whereas several vanilla neighborhood-based methods decline in ranking. AWARE mitigates much of this degradation and moves its RA-TICL backbones to the strongest overall average rankings in the large-scale ICU experiments. Together with evidence that count-based models can remain competitive with sequential transformers and LLM-based pipelines on structured EHR tasks, these findings suggest that no modeling paradigm is uniformly superior: performance depends on the clinical data regime and, for retrieval-based models, on the quality of context construction.
The ablation and stress tests identify retrieval alignment as a key determinant of performance in complex EHR settings. Raw distance can be misleading because predictive information is often concentrated in task-specific variables, while sparse or weakly informative features may dominate patient similarity. AWARE addresses this mismatch by combining task-aligned embeddings, attention-based feature weighting, and imbalance-aware sampling. Its consistent gains across KNN, kNNPFN, and TabDPT suggest that the improvements arise from better context construction rather than increased PFN capacity alone. Moreover, relative AUPRC gains increase from approximately 0.3% to 3–4% with dataset size, approach 7% at 500 features, and exceed 12% under extreme imbalance. Thus, as candidate pools become larger and more heterogeneous, selecting relevant and class-informative examples becomes increasingly important.
Methods
This study comprises two complementary components: (1) a systematic evaluation of tabular learning methods for EHR-based clinical prediction and (2) the development of AWARE, our task-aligned retrieval framework for retrieval-augmented tabular in-context learning. The evaluation examines model performance under four clinically relevant characteristics of real-world EHR data: data scale, feature heterogeneity, outcome rarity, and performance consistency across datasets and healthcare systems.
AWARE Framework Overview
Existing RA-TICL methods commonly construct context sets using fixed similarity metrics, such as Euclidean or cosine distance, in the original feature space. This assumption is restrictive for EHR data because patient representations are high-dimensional and heterogeneous, and the same feature space may support multiple prediction tasks requiring different notions of similarity. Consequently, examples that are close in the raw feature space may not be relevant to the outcome being predicted and may provide label-misaligned context.
At inference, the query patient is embedded by the trained retrieval encoder, and its nearest neighbors are selected exclusively from the training support pool. The retrieved examples are combined with the query to form the in-context prompt. Where applicable, the prompt is transformed by the trained adapter and then passed to the frozen TICL backbone to obtain the final prediction. No encoder, adapter, or backbone parameters are updated during inference. AWARE therefore combines task-aligned neighborhood construction with optional representation alignment while preserving the pretrained PFN backbone.
Imbalance-aware Training and Retrieval Stabilization
Many EHR-based clinical prediction tasks exhibit severe class imbalance, where majority-class examples can dominate embedding structure and distort neighborhood quality. To mitigate this effect during AWARE training, we adopt balanced mini-batch sampling. Specifically, we propose two variants for classification tasks and regression tasks.
The final AWARE training objective thus consists solely of the Soft Nearest Neighbor Loss, while balanced sampling and cross-validated ensembling act as regularization mechanisms that reduce sampling variance and improve retrieval stability in high-dimensional and imbalanced EHR settings.
In summary, AWARE is a complementary adaptation layer for RA-TICL rather than a modification of the underlying in-context learning mechanism. The retrieval encoder, and optional adapter where applicable, are trained on the downstream training data and remain fixed at inference. For each query, AWARE constructs a per-query task-aligned context that is passed to the frozen RA-TICL backbone, whose pretrained parameters and prediction procedure remain unchanged. AWARE therefore improves retrieval and representation alignment around an existing RA-TICL model rather than constituting a purely inference-time method or a new ICL mechanism.
Benchmark Design
We evaluate various methods on a diverse collection of EHR datasets selected to reflect the heterogeneity, sparsity, and distribution complexity of real-world clinical data. The datasets include structured diagnosis and procedure codes, demographic variables, laboratory measurements, and time-series vital signs. To minimize potential overlap with model pretraining data, we exclude datasets reported as part of the pretraining corpus of the benchmarked models. Prediction tasks span regression, binary classification, and multiclass classification, with both balanced and highly imbalanced outcome distributions.
Feature Engineering and Preprocessing
For the OpenML/UCI datasets, we retain all available features and apply standard preprocessing, including mean imputation for numerical variables, mode imputation for categorical variables, and feature normalization. Missingness is handled through this standardized imputation pipeline to ensure comparability across models and datasets. Because explicitly modeling MAR or MNAR mechanisms is beyond the scope of this methodological evaluation, we treat missingness as an inherent component of EHR heterogeneity and compare learning paradigms under consistent preprocessing assumptions. All imputation and normalization parameters are estimated from the training split and applied unchanged to the validation and test splits.
For MIMIC-IV and eICU, we follow established EHR preprocessing pipelines. Because these cohorts contain thousands of highly sparse variables, dimensionality reduction is required for computational feasibility and cross-model compatibility. We therefore apply model-agnostic filtering based on variance and feature prevalence, removing near-constant variables and extremely rare features before capping the dimensionality at 500 when necessary. All filtering criteria are determined using the training split only. This procedure avoids architecture-specific inductive bias in feature selection while retaining a broad and heterogeneous representation of the EHR feature space. Time-series measurements are summarized using simple aggregation statistics (mean, minimum, maximum, and standard deviation).
Training Configuration and Hyperparameters
For adapter fine-tuning, we train the adapter for five epochs with relatively small learning rate. The adapter parameters account for approximately (0.01%) of the total parameters of the corresponding RA-TICL backbone. This adapter fine-tuning is applicable only to backbones with trainable downstream parameters (kNNPFN and TabDPT). For plain KNN, which has no learnable parameters beyond the retrieval encoder, AWARE reduces to the retrieval-alignment stage only; the notation KNN+AWARE throughout this paper refers to this retrieval-only configuration.
For all retrieval-augmented models, unless otherwise specified, we use a fixed context size of 1024 labeled instances (for large-scale datasets) or a multiplier of 32 instances (capped at 1024, for small-to-medium scaled ones) to balance retrieval diversity and computational feasibility. This value is held constant across experiments to ensure comparability. Full definitions and descriptions of all benchmarked models are provided in Supplementary Note 5.5.
Evaluation Configuration
We use stratified patient-level train / test splits for all longitudinal EHR datasets (MIMIC-IV, eICU, and HIPE), so patients are unique across splits. HIPE provides an additional independent cohort with distinct coding practices and patient populations; however, models are trained and evaluated separately within each dataset. Feature extraction and preprocessing use statistics computed on the training split only (e.g., normalization and imputation parameters), and these are reused unchanged for validation and test.
Evaluation Metrics
We report evaluation metrics commonly used in clinical prediction. For classification tasks, we report the area under the receiver operating characteristic curve (AUROC), which measures the probability that a randomly chosen positive instance is assigned a higher predicted score than a randomly chosen negative instance. The area under the precision–recall curve (AUPRC) summarizes the trade-off between precision and recall across decision thresholds and is particularly informative under severe class imbalance.
Component Ablation
Supplementary Tables 2, 3, and 4 present three complementary views of the AWARE ablation: individual component strength, leave-one-out removal, and progressive build-up, respectively. Across all three backbones (KNN, kNNPFN, TabDPT) and all five tasks, Full AWARE consistently achieves the best or near-best AUROC and AUPRC in the vast majority of configurations, confirming that the components are mutually reinforcing rather than redundant.
Training Efficiency
In terms of training cost, ICL-based models exhibit a distinct advantage. TabPFN and TabDPT incur no dataset-specific training time, yet achieve mid-to-high performance rankings, placing them favorably among all evaluated models. Gradient-boosted models (e.g., XGBoost, LightGBM) occupy an intermediate regime, requiring modest training time while achieving competitive performance. In contrast, deep tabular and retrieval-based models such as ModernNCA and TabR incur significantly higher training costs while achieving lower or comparable rankings. The highest-ranked deep tabular models (e.g., ExcelFormer, Trompt) require the great amount of training time and computational resources, reflecting the cost of end-to-end representation learning on large EHR cohorts. Our AWARE adapters are the most notable where they achieve both highest rankings while being training time-efficient.
Inference Efficiency
Inference-time costs reveal a different pattern. Classical linear and tree-based models remain the fastest at inference, with per-patient prediction times substantially lower than all other model classes. Among neural models, shallow architectures such as MLPs and ResNet-style tabular models achieve moderate inference efficiency. PFN-based ICL models, including TabPFN and TabDPT, exhibit inference times comparable to other transformer-based tabular models and retrieval-augmented approaches. Retrieval-based variants, particularly kNNPFN, incur the highest inference cost due to explicit neighbor search and context construction, especially with AWARE incorporated. Importantly, despite slower inference relative to classical models, PFN-based approaches remain competitive with deep tabular models that require both training and inference overhead.
Implications for Clinical Use
Taken together, these results highlight a key efficiency trade-off for in-context learning in EHR prediction. PFN-based models offer a favorable balance between predictive performance and training efficiency by eliminating the need for task-specific retraining, which can be advantageous in settings with limited computational resources or rapidly changing clinical tasks. However, this benefit is partially offset by increased inference-time cost, particularly for retrieval-augmented variants. These findings suggest that ICL-based approaches are best suited for scenarios where retraining is infeasible or costly, while inference latency remains acceptable, rather than as drop-in replacements for lightweight classical models in latency-critical clinical workflows.
TabNet
is a deep learning architecture for tabular data that performs instance-wise feature selection through a sequential attention mechanism. By selecting a sparse subset of features at each decision step, TabNet provides a degree of interpretability while maintaining competitive predictive performance.
TabDPT
is a retrieval-augmented tabular in-context learning model that extends the TabPFN paradigm to larger and more heterogeneous datasets. Instead of conditioning on the full training set, TabDPT constructs a query-specific context via retrieval and processes the retrieved examples jointly with the query through a Transformer encoder. By combining pretrained PFN initialization with explicit context construction, TabDPT enables scalable inference-time adaptation while maintaining the feature-order invariance and amortized Bayesian inference properties of PFN-based models.


