MedFeat: Model-Aware and Explainability-Driven Feature Engineering with LLMs for Clinical Tabular Prediction

Zizheng Zhang, Yiming Li, Justin Xu, Jinyu Wang, Rui Wang, Lei Song, Jiang Bian, David W Eyre, Jingjing FuarXiv 2026

TL;DR

MedFeat is a novel feature engineering framework for clinical tabular data that pairs Large Language Models (LLMs) with downstream machine learning models. By making the LLM explicitly aware of a specific model's structural limitations and guiding it with SHAP feature importance signals, MedFeat automatically generates targeted, privacy-preserving, and clinically meaningful features that boost prediction performance by over 10% on average.

What Problem Does This Paper Address?

Predicting clinical outcomes from tabular data (like electronic health records) is incredibly challenging due to severe class imbalances, missing values, and mixed data types. While deep learning dominates fields like computer vision, classical tree-based models (like XGBoost) and logistic regression still reign supreme for tabular clinical tasks. However, these classical models rely heavily on high-quality feature engineering to capture complex, non-linear relationships.

Recently, researchers have turned to LLMs to automate feature engineering, leveraging their vast medical domain knowledge. However, existing methods are learner-agnostic—they decouple feature generation from the downstream model. The LLM proposes features blindly, without knowing what the model has already learned or where its representational capacity falls short. This leads to redundant features or missed opportunities to surface critical clinical signals.

Methods

MedFeat introduces an iterative, model-aware loop that mirrors how a human data scientist works:

  1. Explainability-Driven Search: It trains a baseline model and computes feature importance using SHAP (Shapley Additive exPlanations) values. It then samples subsets of highly influential features to create "feature islands," focusing the LLM's attention on the most promising regions of the feature space.
  2. Model-Aware Feature Generation: MedFeat constructs a prompt that explicitly instructs the LLM on what the downstream model can already learn easily versus what it cannot naturally learn. For example, it tells the LLM that Logistic Regression cannot handle non-linear interactions, or that XGBoost struggles to capture high-order temporal dynamics across multiple columns.
  3. Code Generation & Evaluation: The LLM generates executable Python code to construct the proposed features. These features are evaluated locally, and accepted into the dataset only if they improve validation performance beyond a noise-tolerance threshold.
  4. Memory Bank: MedFeat maintains a history of accepted and rejected features across iterations to prevent redundant exploration and refine future prompts.
Figure 1: Overview of MedFeat. MedFeat iteratively augments clinical tabular data with LLM-generated features. (1) Starting from a model trained on raw features, the framework computes feature importance. (2) It then forms importance-weighted “feature islands” by sampling a subset of influential features, (3) and guides the LLM with the island profiles, model constraints, and a memory bank to propose clinically meaningful transformations. (4) Proposed features are validated and evaluated locally, (5) accepted features are added to the data, and the feedback memory is updated for the next iteration.

Datasets

The authors evaluated MedFeat across seven distinct clinical prediction tasks spanning three real-world datasets:

  • MIMIC-IV: Used for predicting 24-hour ICU mortality, 30-day readmission, and 30-day heart failure onset.
  • IORD (Infections in Oxfordshire Research Database): Used for predicting 24-hour ward mortality and next-day hospital discharge.
  • HRS (Health and Retirement Study): Used for predicting 10-year mortality risk and 10-year cognitive impairment.

Key Insights and Ideas

  • Tailored to the Learner: Because the LLM understands the model's inductive biases, it generates completely different features for different architectures. For Logistic Regression, it might generate non-linear interaction terms (e.g., $Age \times Length\ of\ Stay$). For XGBoost, it shifts toward cross-temporal summaries like calculating the interaction between respiratory rate and oxygen saturation variability.
  • Privacy by Design: Standard LLM feature engineering tools often pass raw patient rows into prompts, violating strict healthcare privacy regulations. MedFeat solves this by transmitting only schema metadata (feature names) and aggregated, population-level SHAP scores to the LLM. No raw patient records ever leave the local environment.
  • Zero-Shot Feature Transfer: Features engineered by MedFeat on one hospital dataset (MIMIC-IV) successfully improved performance when transferred directly to a completely different clinical cohort (IORD). This indicates that the framework captures universal clinical dynamics rather than overfitting to dataset-specific noise.

Key Results

  • Substantial Performance Gains: MedFeat consistently outperformed state-of-the-art automated feature engineering baselines (such as OpenFE, CAAFE, and OCTree). It achieved an average F1 score improvement of 11.4% over raw baselines.
  • Crucial for Rare Outcomes: The largest gains were observed in highly imbalanced tasks. For instance, on ICU mortality prediction using Logistic Regression, MedFeat boosted the F1 score by 31.3%.
  • Resilience to Hyperparameter Tuning: The performance advantages persisted even after applying extensive hyperparameter optimization (HPO), demonstrating that MedFeat expands the model's fundamental representational capacity in ways that parameter tuning alone cannot achieve.
Performance comparison across 7 clinical prediction tasks

Limitations and Future Work

A primary limitation of MedFeat is its reliance on SHAP values to guide feature sampling. In datasets with extreme feature collinearity (highly correlated variables) or high noise, feature importance rankings can fluctuate across data splits, potentially misguiding the LLM.

The authors note that this can be mitigated by integrating classical pre-hoc feature selection methods (like L1/L2 regularization) prior to running MedFeat. Future work includes exploring how this framework handles multi-modal clinical data (combining tabular data with clinical text or images) and evaluating its utility in non-medical tabular domains.

Summary updated

BibTeX
@misc{zhang2026medfeat,
  author = {Zizheng Zhang and Yiming Li and Justin Xu and Jinyu Wang and Rui Wang and Lei Song and Jiang Bian and David W Eyre and Jingjing Fu},
  title = {{MedFeat: Model-Aware and Explainability-Driven Feature Engineering with LLMs for Clinical Tabular Prediction}},
  year = {2026},
  eprint = {2603.02221},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2603.02221},
}
Figure