TL;DR
Query, Don’t Train (QDT) is a novel framework that replaces traditional model training with LLM-generated SQL queries to perform privacy-preserving tabular predictions. By retrieving only aggregate population statistics rather than raw patient records, QDT achieves state-of-the-art performance on clinical tasks while remaining inherently interpretable and compliant with strict data regulations like HIPAA and GDPR.
What Problem Does This Paper Address?
Electronic Health Records (EHRs) are a goldmine for predictive modeling, but they are locked behind a "privacy wall." Regulations like HIPAA and GDPR strictly limit access to individual-level data, making it difficult to train centralized models or share datasets across institutions.
Traditional supervised learning (like XGBoost) requires full access to raw training data. Even modern "in-context" learners like TabPFN require raw examples to be fed into the model at inference time. This creates a fundamental tension between predictive utility and patient privacy. The authors ask: Can we build a foundation model for tabular data that makes accurate predictions without ever seeing a single raw patient record?
Methods
The authors introduce Query, Don’t Train (QDT), a two-stage framework that treats a Large Language Model (LLM) as a schema-aware query planner rather than a traditional classifier.
- Query Generation: When presented with a new test record (e.g., a patient’s current vitals and history), an LLM agent (OpenAI’s o4-mini) generates SQL queries designed to find "similar" cohorts in the private database.
- Privacy Firewall: To ensure compliance, a second LLM acts as a validator. It checks that queries only request summary-level statistics (e.g., averages or counts aggregated over at least two patients) and blocks any attempt to retrieve individual rows.
- Execution & Reasoning: The approved SQL runs against the database. The LLM then performs Chain-of-Thought (CoT) reasoning over these aggregate results—comparing the test patient to the retrieved population statistics—to produce a final prediction.
Datasets
The framework was validated on a high-stakes clinical task: 30-day hospital readmission prediction for Type 2 diabetes patients.
- Source: A MIMIC-style EHR cohort derived from a dataset of 130 US hospitals (available via Kaggle/UCI).
- Composition: The dataset includes demographics, lab results, procedures, and prior admissions.
- Evaluation: The authors used 5-fold cross-validation on a subset of 2,000 patients per fold, dealing with a naturally imbalanced task where only ~12% of patients were readmitted.
Key Insights and Ideas
- Symbolic Interpretability: Unlike "black-box" neural networks, QDT is fully auditable. A clinician can look at the generated SQL to see exactly which features the model prioritized and what cohort it used for comparison.
- Zero-Imputation Robustness: Missing data is a chronic issue in EHRs. QDT handles this naturally: if a feature is missing in the test record, the LLM simply omits that filter from its SQL
WHEREclause. There is no need for synthetic data imputation. - Reasoning over Statistics: The "aha moment" is that LLMs are surprisingly good at acting as statisticians. By looking at the outcomes of 300 similar patients, the model can weigh the evidence to make a nuanced prediction for the individual at hand.
- No Model Updates Required: Because the "knowledge" resides in the database and the "reasoning" in the LLM, the system scales to new tasks or updated data without any retraining or parameter tuning.
Key Results
Despite never accessing raw data, QDT outperformed established baselines in the diabetes readmission task:
- Performance: QDT achieved an F1-score of 0.70, surpassing TabPFN (0.69) and XGBoost (0.66).
- Ablation Study: The system proved remarkably robust to missing data. Even when 30% of features were removed from the test records, the F1-score only dropped slightly to 0.67. Even at 70% missingness, it maintained an F1 of 0.64, demonstrating the power of dynamic query planning.
Limitations and Future Work
- Computational Overhead: Generating and executing multiple SQL queries per prediction is significantly slower than a single forward pass of a standard neural network.
- Privacy Nuances: While the "k-anonymity" (aggregates of 2+) approach is a strong start, it is theoretically vulnerable to "differencing attacks" (inferring an individual's data by comparing two slightly different aggregate queries). The authors suggest integrating Differential Privacy in future iterations for stronger guarantees.
- Data Modality: The current work is limited to structured tabular data. Extending this to multi-modal EHRs—incorporating medical images or unstructured clinical notes—remains a challenge for future prompt engineering and system design.
Summary updated