Trajectory-Derived Confidence for Reliable, Resource-Aware Clinical Text-to-SQL Agents
Organizations: University of California, Los Angeles
Abstract
LLM agents for clinical text-to-SQL applications reason autonomously over multiple steps but cannot assess whether their own reasoning or outputs can be trusted. In high leverage applications such as healthcare, this presents a critical risk where system mistakes can be costly. These reliability failures are also resource failures: an incorrect reasoning trajectory spends computation budget on outputs that must be discarded. We introduce Sentinel, a trajectory-derived, classifier-based confidence layer that analyzes an agent's reasoning, code and database outputs to decide at three points whether to stop: refusing unanswerable questions before the agent runs, halting doomed trajectories mid-run, and withholding untrustworthy answers at delivery. Here, utilizing Chow's rule, we optimize decisions under the EHRSQL shared task's Reliability Score, which penalizes incorrect answers given a utility weighting, and find on the benchmark EHRSQL that Sentinel raises this score from +0.08 to +0.24 when mistakes have a low utility weighting, well above the +0.03 earned by refusing every question, with delivered-answer accuracy rising from 54% to 69% as coverage falls from 84% to 55%. At higher stakes the agents we test rarely answer reliably enough to deliver, and Sentinel detects this on its own, abstaining to that same +0.03 where the unmonitored agent scores -3.02. The same stopping decisions cut computation: at low stakes, where the system still answers, Sentinel eliminates 13-28% of agent steps at little or no reliability cost.
Figures & tables
| Vanilla | Monitor AUROC | Vanilla | Full System | ||||||
| Agent | Acc. | Corr. | Ans. | ||||||
| GPT-4o-mini | |||||||||
| GPT-4o | |||||||||
| Llama-3.1-8B | |||||||||
| Qwen2.5-Coder-7B | |||||||||
| Phi-4-mini | |||||||||
| System | Steps Saved | Gen. Tokens Saved | Total Time Saved |
|---|---|---|---|
| ( ) | ( ) | ( ) | |
| + exit gate / + Chow delivery | min | ||
| + early exit | min / h / h |
Appendix figures & tables11 assets
Supplementary material from the paper’s appendix.
Appendix
| System | Cov. | Acc. | Cov. | Acc. | Cov. | Acc. |
|---|---|---|---|---|---|---|
| vanilla agent | ||||||
| + Chow delivery | ||||||
| + early stopping | ||||||
| Agent | |||
|---|---|---|---|
| GPT-4o-mini | |||
| GPT-4o | |||
| Llama-3.1-8B | |||
| Qwen2.5-Coder-7B | |||
| Phi-4-mini |
| Correctness | Answerability | |||
|---|---|---|---|---|
| Agent | Delivery | Delivery | ||
| GPT-4o-mini | ||||
| GPT-4o | ||||
| Llama-3.1-8B | ||||
| Qwen2.5-Coder-7B | ||||
| Phi-4-mini | ||||
| Agent | lp_mean | lp_min | ent_mean | ent_max | empty_rate | error_rate | n_steps | failed_refs | bad_joins | ungrounded_frac | Survivors |
|---|---|---|---|---|---|---|---|---|---|---|---|
| GPT-4o-mini | ✓ | 1 | |||||||||
| GPT-4o | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | 7 | |||
| Llama-3.1-8B | ✓ | ✓ | ✓ | ✓ | ✓ | 5 | |||||
| Qwen2.5-Coder-7B | 0 | ||||||||||
| Phi-4-mini | ✓ | ✓ | 2 |
| System | Steps Saved ( ) | |||
|---|---|---|---|---|
| vanilla agent | — | |||
| + exit gate | ||||
| + Chow delivery | ||||
| + early stopping |
| Early-Stop | Steps Saved | |||||
|---|---|---|---|---|---|---|
| Agent | ||||||
| GPT-4o-mini | ||||||
| GPT-4o | ||||||
| Llama-3.1-8B | ||||||
| Qwen2.5-Coder-7B | ||||||
| Phi-4-mini | ||||||
| Agent | Fabrication | Correct Refusal | Typical Answerable |
|---|---|---|---|
| GPT-4o-mini | |||
| GPT-4o | |||
| Llama-3.1-8B | |||
| Qwen2.5-Coder-7B | |||
| Phi-4-mini |
LLM Agent Reliability
Large language model (LLM) agent reliability concerns dependable, safe, and verifiable behavior across tools, multi-step tasks, and changing environments.
See all 826 papers