NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Knowledgeable Language Models as Black-Box Optimizers for Personalized Medicine

Michael S Yao, Osbert Bastani, Alma Andersson, Tommaso Biancalani, Aicha BenTaieb, Claudia Iriondo

TL;DR

Finding the right personalized medical treatment is challenging because we cannot safely test every option on a patient, and predictive surrogate models often fail when applied to new patient demographics. This paper introduces LEON, a method that uses Large Language Models (LLMs) as black-box optimizers guided by retrieved medical knowledge and statistical constraints. By keeping proposed treatments close to historical data and favoring high-certainty LLM outputs, LEON outperforms both traditional and LLM-based optimization methods in designing personalized treatments.

The Challenge of Personalized Medicine

In personalized medicine, clinicians aim to find the optimal treatment regimen tailored to a patient's unique genetic and environmental profile. Mathematically, this can be framed as a conditional black-box optimization problem. Since we cannot safely test thousands of treatments on a human patient to find the best one, researchers rely on in silico surrogate models (like machine learning predictors or digital twins) to estimate treatment efficacy.

However, these surrogate models suffer from distribution shift: they are often trained on specific demographics (e.g., patients from a single hospital or a specific racial group) and fail to generalize to out-of-distribution (OOD) patients. If an optimization algorithm blindly maximizes the surrogate model's score, it will often exploit the model's blind spots. This results in the algorithm proposing treatments that look highly effective to the flawed model, but would perform poorly—or dangerously—in reality.

Introducing LEON

To address these limitations, the authors introduce LEON (LLM-based Entropy-guided Optimization with kNowledgeable priors). Instead of fine-tuning a model, LEON uses "optimization by prompting," treating an off-the-shelf LLM as a stochastic engine to propose treatments.

Overview of the LEON framework

To prevent the LLM from exploiting the flawed surrogate model, LEON applies a mathematically principled constrained optimization framework with two key guardrails:

  1. Adversarial Source Critic: It bounds the distance between the proposed treatments and historically administered treatments. A trained "critic" model penalizes designs that stray too far from known clinical data, preventing dangerous extrapolation.
  2. Entropy-Guided Certainty: It bounds the coarse-grained entropy of the LLM's proposed designs. If the LLM consistently proposes similar treatments across multiple generations (low entropy), it indicates high certainty.

To boost this certainty, LEON uses tool-calling to retrieve patient-specific domain knowledge from medical textbooks and biomedical knowledge graphs (like HetioNet and PrimeKG) before optimization. The LLM is then iteratively prompted with the patient's profile, the retrieved knowledge, and a history of previously proposed designs and their scores to propose increasingly better treatments.

Evaluation and Datasets

The authors evaluated LEON on five real-world personalized medicine optimization tasks, specifically constructing them to feature a distribution shift between the source (training) data and target (evaluation) patients:

  • Warfarin: Dosing optimization based on pharmacogenetics (continuous space). Shift: White vs. Non-White patients.
  • HIV: Antiretroviral therapy selection based on viral mutations (discrete space). Shift: Pre-2008 vs. Post-2008 studies.
  • Breast Cancer & Lung Cancer (NSCLC): Treatment strategy selection (discrete space). Shifts based on patient age and treatment response times.
  • ADR: Adverse Drug Reaction risk prediction (continuous space). Shift based on different medications.

Key Insights

  • Domain knowledge grounds optimization: Purely data-driven surrogate models fail on OOD patients, but established medical principles remain true. Injecting this knowledge helps the LLM overcome the statistical randomness of next-token prediction and zero in on viable treatments.
  • Entropy as a proxy for quality: By grouping LLM outputs into "equivalence classes" and measuring the entropy of the distribution, the authors successfully map a rigorous mathematical constraint into an empirical property of the LLM's generation. High consistency equals high reward.
  • No fine-tuning needed: The entire framework operates via prompting and a lightweight external critic model. The LLM acts as a zero-shot conditional optimizer, making it highly adaptable to different medical domains without expensive retraining.

Results

  • LEON achieved an average rank of 1.2 across the 5 tasks, consistently outperforming 10 baseline methods, including traditional optimizers (Bayesian Optimization, Genetic Algorithms) and recent LLM-based optimizers (OPRO, Eureka, LLAMBO).
  • Remarkably, LEON's proposed treatments outperformed the Human baseline (the actual treatments the patients retrospectively received from clinicians) on the oracle objective functions.
  • Ablation studies showed that both the source critic constraint and the entropy constraint are crucial; removing either significantly degrades performance.
  • The system is highly sample-efficient, often surpassing human-level performance within just 4-6 optimization steps (128-192 surrogate model evaluations).
  • Proprietary reasoning models (like GPT-4o Mini and Gemini-2.5 Flash) performed best, while smaller open-source models struggled to output properly structured and reasoned designs.

Limitations and Future Directions

  • Sensitivity to Prior Knowledge: LEON is highly dependent on the accuracy of the retrieved information. Injecting plausible but factually incorrect medical knowledge significantly harms optimization performance.
  • Simulation vs. Reality: While the benchmarks use real-world data, they are still simulations and cannot fully capture the heterogeneous responses seen in actual clinical practice.
  • Model Constraints: The method currently relies heavily on advanced, closed-source LLMs due to their superior instruction-following. Future work will explore adapting this for locally hosted, privacy-preserving open-source models.
  • Future Directions: The authors suggest extending LEON to handle multi-objective optimization (e.g., maximizing efficacy while minimizing toxicity and cost) and integrating "human-in-the-loop" physician feedback to mitigate the risks of autonomous LLM systems.

Summary updated

BibTeX
@inproceedings{yao2026knowledgeable,
  author = {Michael S Yao and Osbert Bastani and Alma Andersson and Tommaso Biancalani and Aicha BenTaieb and Claudia Iriondo},
  title = {{Knowledgeable Language Models as Black-Box Optimizers for Personalized Medicine}},
  booktitle = {International Conference on Learning Representations},
  year = {2026},
  url = {https://openreview.net/forum?id=w025bYRVkO},
}
Figure