TAMER: A Test-Time Adaptive MoE-Driven Framework for EHR Representation Learning

Yinghao Zhu, Xiaochen Zheng, Ahmed Allam, Michael KrauthammerarXiv 2025 · DOI

Abstract

Predictive modeling in Electronic Health Records (EHR) is challenged by patient heterogeneity and temporal distribution shifts. We present TAMER (Test-time Adaptive MoE-driven Representation learning), a modular framework that integrates Mixture-of-Experts (MoE) with Test-Time Adaptation (TTA). TAMER enables models to adapt to new data distributions during inference without requiring ground-truth labels. Evaluated across four large-scale datasets (MIMIC-III, MIMIC-IV, eICU, and PhysioNet), TAMER consistently improves performance for mortality and readmission tasks across various backbone architectures, demonstrating its robustness and generalizability in dynamic clinical environments.

Introduction

Clinical predictive models often struggle with the inherent diversity of patient populations and the evolving nature of hospital protocols. Standard deep learning models are typically static; once trained, their parameters remain fixed, leading to performance degradation when encountering "test" data that differs from the training distribution—a phenomenon known as distribution shift. Furthermore, capturing the nuances of specific patient subgroups (e.g., pediatric vs. geriatric) remains a significant hurdle.

To address these challenges, we introduce TAMER, a "plug-in" framework designed to enhance EHR representation learning. TAMER combines the specialized processing of Mixture-of-Experts (MoE) with the real-time flexibility of Test-Time Adaptation (TTA), allowing models to refine their internal representations on the fly during deployment.

Methods

The TAMER framework is designed to be backbone-agnostic, meaning it can be integrated with various existing EHR models such as GRUs or Transformers. The architecture consists of three primary stages: a feature-extracting backbone, a Test-Time Adaptation (TTA) layer, and a Dynamic Soft MoE module.

The TAMER architecture overview, illustrating the flow from patient EHR data through the backbone, TTA layer, and MoE experts to the final representation.

The TTA layer, an MLP situated between the backbone and the MoE, performs a self-supervised reconstruction task during inference. By minimizing the error in reconstructing hidden features from the backbone, the model updates the TTA layer's weights in real-time to align with the current batch of patient data. This process occurs in a two-pass flow: a first forward pass to compute reconstruction loss, a backpropagation step to update TTA parameters, and a second forward pass for the final clinical prediction.

Following adaptation, the Dynamic Soft MoE module processes the refined features. Unlike sparse MoE approaches that select only a few experts, TAMER utilizes a "Soft MoE" strategy, computing a weighted combination of all experts. This approach prevents "representation collapse" and ensures that the model leverages a diverse set of specialized components for every patient.

Experimental Evaluation

TAMER was rigorously tested on four major EHR datasets: MIMIC-III, MIMIC-IV, eICU, and the PhysioNet Challenge 2012. The evaluation focused on two critical clinical tasks: in-hospital mortality prediction and 30-day readmission risk. The framework's performance was compared against several baseline models, including GRU, Transformer, RETAIN, and more specialized architectures like ConCare and GRASP.

Results and Discussion

The experimental results demonstrate the broad compatibility and effectiveness of the TAMER framework. TAMER improved predictive performance, measured by AUPRC and AUROC, in 53 out of 54 tested scenarios across different backbones and datasets.

Performance comparison of various backbone models with and without the TAMER framework across multiple datasets and tasks.

Key findings include:

  • Label-Free Adaptation: The TTA module's ability to adapt using self-supervised reconstruction loss allows for performance gains during deployment without needing immediate clinical outcomes.
  • Robustness to Distribution Shift: In cross-dataset experiments, TAMER consistently outperformed static baselines, effectively bridging the distributional gap between different hospital systems.
  • Efficiency: TAMER adds approximately 345K parameters to a standard 2.2M parameter backbone, introducing negligible computational overhead (less than one second) during inference.

Ablation studies further highlighted that placing the TTA module before the MoE is critical, as adapting the input distribution first leads to more accurate expert utilization.

Conclusion

TAMER represents a significant step toward more adaptive and robust clinical decision support systems. By combining real-time adaptation with specialized expert modules, it addresses the core challenges of patient heterogeneity and distribution shift in EHR modeling. Future work will focus on enhancing the interpretability of expert selection and ensuring the long-term stability of "on-the-fly" model updates in clinical settings.

Summary updated

BibTeX
@misc{zhu2025tamer,
  author = {Yinghao Zhu and Xiaochen Zheng and Ahmed Allam and Michael Krauthammer},
  title = {{TAMER: A Test-Time Adaptive MoE-Driven Framework for EHR Representation Learning}},
  year = {2025},
  eprint = {2501.05661},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2501.05661},
}
Figure