Stability-Aware Prompt Optimization for Clinical Data Abstraction

Arinbjörn Kolbeinsson, Daniel R. Timbie, Sajjan Narsinghani, Sanjay Hariharan

TL;DR

Large language models (LLMs) used in clinical settings are surprisingly sensitive to prompt wording, even when the meaning remains the same. This paper introduces a method to optimize prompts not just for accuracy but also for "stability" – ensuring consistent predictions across slight prompt variations. This dual-objective approach significantly reduces prediction errors caused by prompt changes, a crucial step for building reliable clinical AI systems.

What Problem Does This Paper Address?

Deploying LLMs in clinical settings, like abstracting information from electronic health records (EHRs), presents a unique challenge: prompt sensitivity. While LLMs are powerful, their performance can drastically change if a prompt is rephrased, even subtly. This is problematic because in real-world systems, prompts are often tweaked by different teams or evolve over time. Current LLM evaluation often treats prompts as fixed and focuses on accuracy and calibration in isolation. This paper argues that prompt sensitivity and predictive uncertainty should be considered together, especially in clinical applications where reliability is paramount. The core problem is that a model might appear accurate and well-calibrated under one specific prompt but become unreliable when that prompt is slightly altered, making validation and monitoring difficult.

Methods

The authors propose a dual-objective prompt optimization loop that iteratively refines prompts. Instead of solely optimizing for accuracy, their objective function balances performance (accuracy) with stability. Stability is measured by the "flip rate" – the proportion of examples whose predictions change when the prompt is paraphrased.

The optimization loop works as follows:

  1. Evaluation: The current prompt is used to generate predictions on an evaluation set. The accuracy is measured, and the flip rate is estimated by generating several paraphrased versions of the prompt and observing prediction changes.
  2. Failure Identification: Examples that are either misclassified by the base prompt or show high flip rates (unstable predictions) are identified.
  3. Candidate Generation: An LLM is used to generate new candidate prompts, specifically conditioned on the identified failure cases. This encourages targeted improvements.
  4. Selection: Candidate prompts are scored based on the joint objective (accuracy + stability). If a candidate prompt improves the joint score, it replaces the current prompt. This process repeats until convergence.

They also analyze the relationship between prompt stability and model uncertainty signals, such as prediction margins and conformal prediction set sizes.

Datasets

The paper evaluates their method on two clinical chart-grounded abstraction tasks:

  • MedAlign: A benchmark dataset for instruction following on EHRs, used for two tasks:
  • MedAlign applicability: Determining if an instruction is supported by the chart.
  • MedAlign correctness: Assessing if a model's response aligns with clinician judgment.
  • MS subtype: An internal EHR-derived corpus for abstracting Multiple Sclerosis subtypes from neurology notes.

These datasets are used as held-out evaluation corpora, with capped evaluation set sizes (50-200 examples) and a 50/50 split for calibration/evaluation in conformal prediction.

Key Insights and Ideas

  • Accuracy ≠ Stability: A model that performs well on one prompt doesn't automatically mean it's stable across prompt variations. Prompts with similar accuracy can have vastly different flip rates, highlighting the need to optimize for stability explicitly.
  • Certainty is a Heuristic, Not a Guarantee: Stable predictions (those that don't flip under prompt variation) tend to be associated with higher prediction margins (more confident predictions). However, this correlation is modest, meaning certainty alone isn't a perfect indicator of stability.
  • Prompt Sensitivity is Optimizable: By incorporating stability into the optimization objective, the authors demonstrate a significant reduction in flip rates across tasks and models, sometimes with only minor trade-offs in accuracy.
  • Bridging Measurement and Optimization: Previous work focused on measuring prompt sensitivity or optimizing for accuracy. This paper bridges these by using sensitivity signals to drive prompt optimization, making stability an explicit target.
  • Clinical Validation Needs More: Prompt stability should be an explicit objective in validating clinical LLM systems, alongside accuracy and calibration, to prevent unexpected failures in deployed systems.

Key Results

  • Stability Improvement: In 8 out of 9 model-task combinations tested, joint optimization (balancing accuracy and stability) significantly reduced the flip rate compared to accuracy-only optimization.
  • Accuracy Trade-offs: The accuracy trade-off varied. In some cases, accuracy slightly improved or remained similar, while in others, it decreased modestly. For instance, on MedAlign applicability with Llama-4 Maverick, the flip rate dropped from 0.309 to 0.036 with a modest accuracy decrease.
  • Model-Level Trends: Larger models generally showed better performance and stability at the model level (higher accuracy, lower flip rate across models), but this doesn't guarantee prompt-level stability within a specific model.
  • Correlation: A positive correlation was observed between prompt stability and model certainty (Spearman p = 0.204 for flip rate vs. margin).

Limitations and Future Work

  • Scale of Experiments: The experiments used capped evaluation sets and a limited number of prompt paraphrases (k=3), which might affect the generalizability of the stability-calibration correlation.
  • Paraphrase Distribution: The measured stability is relative to the specific paraphrases generated by an LLM, which may not capture the full spectrum of real-world prompt variations.
  • Stability-Calibration Analysis: The analysis connecting stability and calibration was limited to models with access to output probabilities (HuggingFace models), not API-based models.
  • Optimization Method: The study evaluated only one LLM-in-the-loop optimizer architecture, and other optimization methods might yield different results.
  • Downstream Clinical Impact: While stability was improved, the paper does not directly demonstrate that this translates to better clinical outcomes or reduced patient harm.
  • Task Scope: The findings are based on two clinical abstraction tasks; generalization to other clinical NLP tasks remains to be explored.

Future work could involve exploring alternative optimization methods, expanding the range of prompt variations, and conducting downstream clinical validation to establish a direct link between prompt stability and patient safety.

Summary updated

BibTeX
@inproceedings{kolbeinsson2026stability,
  author = {Arinbjörn Kolbeinsson and Daniel R. Timbie and Sajjan Narsinghani and Sanjay Hariharan},
  title = {{Stability-Aware Prompt Optimization for Clinical Data Abstraction}},
  booktitle = {Trustworthy AI @ ICLR},
  year = {2026},
  url = {https://openreview.net/forum?id=DwTXMaA50T},
}
Figure