---
title: Hallucination Controlled Accuracy (HCAcc@k%)
url: https://www.emergentmind.com/topics/hallucination-controlled-accuracy-at-k-hcacc-k
type: topic
---

# Hallucination Controlled Accuracy (HCAcc@k%)

Searching arXiv for the cited papers to ground the article.
Hallucination Controlled Accuracy at \(k\%\) (HCAcc@\(k\%\)) is a selective prediction metric for settings in which a model may abstain rather than answer under uncertainty. In its original formulation for Electronic Health Record (EHR) clinical question answering, HCAcc@\(k\%\) quantifies the maximum overall accuracy attainable while enforcing a bound on hallucination rate through confidence-thresholded abstention [2508.19096]. A closely related but non-identical usage appears in later work on hallucination assessment, where the same notation is mapped to accuracy measured on the retained subset at a target coverage level read from a Rejection-Accuracy Curve (RAC) [2601.14210]. Across both usages, the central concern is the same: evaluating whether an LLM system can increase reliability by rejecting low-confidence cases without collapsing utility.

## 1. Original definition in reliability-constrained selective answering

In the EHR setting, “hallucination” denotes an LLM-generated answer that is asserted with confidence but is factually incorrect or unsupported by the patient record/database [2508.19096]. Traditional accuracy is inadequate in this setting because it assumes the agent attempts every question, does not distinguish high-confidence correctness from high-confidence error, and does not reward abstention when uncertainty is high.

The original HCAcc@\(k\%\) formalism is defined over a set of questions \(Q\). For a confidence threshold \(\tau\), the agent attempts only those questions whose confidence score satisfies \(c(q) \ge \tau\). This induces the attempted set
\[
Q_\tau = \{ q \in Q \mid c(q) \ge \tau \}.
\]
The correctly attempted set is the subset of \(Q_\tau\) for which the answer \(a(q)\) is correct.

From these sets, the paper defines four quantities:
\[
CA(\tau) = \frac{|Q_\tau^{\text{correct}}|}{|Q_\tau|},
\]
\[
HR(\tau) = 1 - CA(\tau) = \frac{|Q_\tau| - |Q_\tau^{\text{correct}}|}{|Q_\tau|},
\]
\[
RR(\tau) = \frac{|Q_\tau|}{|Q|},
\]
\[
OA(\tau) = \frac{|Q_\tau^{\text{correct}}|}{|Q|} = CA(\tau)\times RR(\tau).
\]

HCAcc@\(k\%\) is then defined as
\[
\mathrm{HCAcc}@k\% = \max_{\tau} \left\{ OA(\tau) \;\middle|\; HR(\tau) \le \frac{100-k}{100} \right\}.
\]
Because \(HR(\tau)=1-CA(\tau)\), the constraint can be written equivalently as \(CA(\tau)\ge k/100\). HCAcc@\(k\%\) therefore selects the threshold \(\tau\) that maximizes overall accuracy subject to a minimum conditional accuracy requirement. In this formulation, \(k\%\) is a reliability constraint, not a coverage target. The paper states explicitly that HCAcc@\(0\%\) recovers standard accuracy, namely \(OA\) at \(\tau=0\) under no reliability constraint.

The associated abstention rule is threshold-based:
\[
\begin{cases}
\text{provide answer } a, & \text{if } C \ge \tau,\\
\text{reject}, & \text{if } C < \tau.
\end{cases}
\]
Tightening \(\tau\) reduces the response rate but can increase conditional accuracy by filtering out low-confidence cases.

## 2. Position within selective prediction and related evaluation frameworks

HCAcc@\(k\%\) belongs to the family of reliability-aware selective answering metrics [2508.19096]. Its purpose is not merely to quantify how accurate a model is when it answers everything, but to characterize the utility–reliability frontier under abstention. This is particularly important in clinical deployment, where safe abstention is preferable to confident error.

The paper relates HCAcc@\(k\%\) to several established notions. Conventional accuracy measures \(OA\) at a fixed operating point with full coverage and therefore offers no direct handle on hallucinations. Selective prediction and coverage–risk curves instead analyze how error changes as coverage varies across thresholds. HCAcc@\(k\%\) takes a constrained view of this trade-off: it maximizes utility, represented by \(OA\), subject to a minimum reliability condition, represented by \(CA \ge k/100\).

The distinction from selective accuracy is explicit. Selective accuracy, or conditional accuracy, is just \(CA(\tau)\), the proportion correct among attempted answers. HCAcc@\(k\%\) does not directly optimize \(CA\); it optimizes \(OA\) under a lower bound on \(CA\). This means that an operating point with perfect conditional accuracy but vanishing response rate may be inferior to one with slightly lower \(CA\) but substantially higher \(RR\), provided both satisfy the reliability constraint.

The paper also distinguishes HCAcc@\(k\%\) from Precision@\(k\). Precision@\(k\) fixes the number of attempted items and reports conditional accuracy on that top-\(k\) subset. HCAcc@\(k\%\), by contrast, does not fix the number attempted. It enforces a reliability floor and then maximizes the total number of correct answers through \(OA\).

Two further comparisons delimit its scope. First, HCAcc@\(k\%\) benefits from better confidence calibration but does not assume perfect calibration. Second, it differs from conformal prediction, which provides coverage guarantees for prediction sets under exchangeability assumptions. HCAcc@\(k\%\) is empirical and post-hoc threshold-based; it provides no formal coverage guarantees, but directly measures the practical accuracy–reliability trade-off.

A recurrent source of confusion is the role of \(k\). In the original definition, \(k\) denotes the required reliability level. The paper explicitly notes that a coverage-controlled alternative could be defined, but that such a metric would be different from the HCAcc@\(k\%\) definition used there.

## 3. Computation, threshold selection, and dataset notation

For implementation, the original paper restates the setup in a standard dataset form \(D=\{(x_i,y_i)\}_{i=1}^n\), with model predictions \(\hat{y}_i\) and confidence scores \(c_i\in[0,1]\) [2508.19096]. For any threshold \(t\), it defines
\[
\mathrm{Cover}(t) = \frac{1}{n}\sum_{i=1}^{n}\mathbf{1}[c_i \ge t],
\]
\[
S(t)=\{ i \in \{1,\dots,n\} \mid c_i \ge t \},
\]
\[
\mathrm{SelAcc}(t)=\frac{1}{|S(t)|}\sum_{i\in S(t)} \mathbf{1}[\hat{y}_i = y_i] = CA(t),
\]
\[
\mathrm{Overall}(t)=\frac{1}{n}\sum_{i=1}^{n}\mathbf{1}[c_i \ge t]\cdot \mathbf{1}[\hat{y}_i = y_i] = OA(t).
\]

The practical computation procedure is threshold scanning over the unique confidence values. For a given \(k\), one computes \(CA(t)\), \(RR(t)\), and \(OA(t)\) for each threshold, filters thresholds satisfying \(CA(t)\ge k/100\), and selects
\[
t^\* = \arg\max_t OA(t)
\]
among feasible thresholds. If no feasible threshold exists, HCAcc@\(k\%\) is set to \(0\).

The paper recommends inclusive thresholding, \(c_i \ge t\), when confidences are discrete. If multiple thresholds yield the same \(OA\), it recommends preferring the threshold with higher \(RR\) or the lowest \(t\) for stability. It also notes that HCAcc can be plotted as a function of \(k\) by sweeping values such as \(0\), \(50\), \(70\), and \(90\), and that bootstrap confidence intervals may optionally be obtained by resampling items and recomputing HCAcc@\(k\%\). For multiple-answer or partial-credit tasks, the binary correctness indicator can be replaced by graded correctness \(g_i\in[0,1]\).

A worked numerical example in the paper illustrates the selection logic. With five items and correctness pattern \((1,1,0,1,0)\) at confidences \((0.95,0.80,0.60,0.55,0.30)\), the threshold \(t=0.55\) yields \(CA=0.75\), \(RR=0.8\), and \(OA=0.6\). For \(k=70\%\), this threshold is feasible and attains the maximum \(OA\), giving HCAcc@\(70\%\)=\(0.6\). For \(k=90\%\), the optimal feasible threshold becomes \(t=0.80\), giving HCAcc@\(90\%\)=\(0.4\).

## 4. TrustEHRAgent and the clinical instantiation of HCAcc@\(k\%\)

TrustEHRAgent is the system through which HCAcc@\(k\%\) is introduced and empirically evaluated in EHR clinical question answering [2508.19096]. It is a confidence-aware agent built on a GPT-4.1-mini backbone with temperature \(=0.0\), shared EHR metadata and tools, four-shot demonstrations, and maximum interaction steps \(T=10\).

Its confidence mechanism has two components. The first is step-wise confidence estimation: during multi-step reasoning involving code generation, SQL execution, and aggregation, the agent emits a verbalized confidence score on a \(0\)–\(10\) scale for each step via prompting. These signals are intended to capture uncertainty due to data quality, query complexity, and interpretation ambiguities. The second is a final confidence estimator that aggregates over \(N=5\) discrete levels \(S\in\{0,1,2,3,4\}\). Using token log-probabilities, the probability for each level is
\[
P(S=i)=\frac{\exp(\mathrm{logprob}_i)}{\sum_{j=0}^{4}\exp(\mathrm{logprob}_j)},
\]
and the final confidence is a normalized expected level,
\[
C=\frac{1}{4}\sum_{i=0}^{4} i\,P(S=i)\in[0,1].
\]
The paper states that this continuous scoring helps avoid the brittleness of a purely discrete scale and yields smoother threshold performance.

Evaluation uses QA derived from EHRSQL on MIMIC-III and eICU EHRs, with \(580\) real clinical questions per database, \(n=1160\) in total, exact-match correctness, and questions spanning demographics, prescriptions, labs, diagnoses, and temporal logic. Baselines without confidence estimation include CoT, ReACT, Reflexion, DIN-SQL, SQLAgent, PythonAgent, and EHRAgent. Confidence-aware baselines are SQLAgent and PythonAgent enhanced with the same step-wise confidence prompting and final estimator.

The key reported HCAcc@\(k\%\) results are as follows.

| Dataset | HCAcc@0 / 50 / 70 / 90 |
|---|---|
| MIMIC-III | 62.13 / 62.13 / 44.23 / 3.27 |
| eICU | 59.82 / 59.82 / 25.34 / 2.24 |

Under strict reliability constraints, TrustEHRAgent substantially outperforms confidence-aware baselines. At HCAcc@\(70\%\), the reported improvements are \(44.23\) percentage points on MIMIC-III and \(25.34\) percentage points on eICU, while the confidence-aware baselines collapse to \(0.0\). EHRAgent’s standard accuracy, corresponding to HCAcc@\(0\%\), is \(58.97\) on MIMIC-III and \(53.10\) on eICU, so TrustEHRAgent also improves base QA performance.

The paper attributes baseline collapse at high reliability to unusable confidence ranking: if confidence scores cannot maintain \(CA \ge 70\%\), the threshold \(\tau\) must be raised so high that \(RR \to 0\), implying \(OA=0\). TrustEHRAgent’s step-wise signals combined with probability-based final scoring preserve a viable response rate at feasible thresholds while meeting the conditional accuracy constraint. It also reports that removing step-wise confidence signals degrades performance at higher \(k\), and that binary-classification or discrete-scoring alternatives yield poorer reliability curves than the probability-weighted estimator.

## 5. Coverage-based interpretation in HALT and the associated terminological ambiguity

A later paper, HALT, does not introduce the name HCAcc@\(k\%\), but explicitly maps closely related selective prediction quantities onto it [2601.14210]. HALT uses the Rejection-Accuracy Curve and “accuracy against coverage,” defining the RAC as a plot of accuracy against coverage after ranking samples by confidence. It also uses the phrase “Accuracy after Hallucination Removed” for selective prediction by rejecting low-confidence or high-risk queries before generation and measuring accuracy on the retained subset.

In HALT’s notation, each query has a detector output \(p_i\in[0,1]\), interpreted as the probability that the model can correctly answer the query, and a corresponding hallucination risk
\[
r_i = 1-p_i.
\]
For a risk threshold \(\tau\), empirical coverage is
\[
C(\tau)=\frac{1}{n}\sum_{i=1}^{n}\mathbf{1}[r_i \le \tau].
\]
For a target coverage \(k\%\), one selects the \(m=\lfloor (k/100)\,n \rfloor\) lowest-risk examples, or equivalently chooses \(\tau_k\) by risk quantiles so that \(|S_k|=m\). HCAcc@\(k\%\) is then defined as accuracy on the retained subset:
\[
\mathrm{HCAcc@}k\%=\frac{1}{|S_k|}\sum_{i\in S_k}\mathbf{1}[y_i = y_i^\*].
\]

This is not the same definition as the original clinical HCAcc@\(k\%\). In the original paper, \(k\) is a reliability constraint and the metric reports the best overall accuracy subject to that constraint. In HALT’s mapping, \(k\) is a coverage level and the metric reports retained-subset accuracy at that coverage. The papers therefore use the same notation for two different operating semantics. The overlap is conceptual rather than definitional: both assess whether confidence ranking can isolate low-hallucination cases.

HALT further links accuracy-at-coverage to the integral summary
\[
\mathrm{AURAC}=\int_0^1 \mathrm{Acc}(c)\,dc,
\]
with discrete trapezoidal approximation over a coverage grid. In this usage, \(\mathrm{Acc}(c)\) at coverage \(c\) is exactly HCAcc@\(100c\%\).

For Qwen-2.5-7B on TriviaQA in the question-only setting, HALT reports the following RAC points.

| Coverage | Accuracy |
|---|---|
| 100% | 85.7% |
| 80% | 91.6% |
| 60% | 95.6% |
| 40% | 97.7% |

The reported AURAC for this curve is \(0.8753\). HALT argues that internal residual probes on intermediate layers provide stronger confidence ranking than many output-based methods, enabling steep RAC behavior and useful routing of low-risk queries to immediate answers while delegating high-risk cases to stronger verification pipelines.

## 6. Assumptions, failure modes, and deployment considerations

HCAcc-style evaluation depends fundamentally on the quality of the confidence or risk signal [2508.19096]. The original paper states the core assumption directly: confidence scores should correlate with correctness so that tightening the threshold increases conditional accuracy and reduces hallucination rate. Perfect monotonicity is not guaranteed, and empirical threshold scanning is therefore recommended.

Several failure modes follow from this dependence. Miscalibration can produce overconfident errors, which either violate the \(CA \ge k/100\) constraint or force thresholds so high that the response rate collapses and \(OA \approx 0\). Domain shift, such as EHR schema differences or hospital-specific abbreviations, can lower conditional accuracy or make confidence systematically too high or too low. Low-data regimes and a small number of unique confidence values can make HCAcc@\(k\%\) sensitive to threshold choice. The paper also notes fairness concerns: subpopulations may exhibit different confidence–accuracy characteristics, so stratified HCAcc analysis is advisable.

Deployment recommendations are explicitly tied to the choice of \(k\). For routine decision support, the paper suggests \(k=50\)–\(70\%\) to balance coverage and utility. For high-stakes decisions, it suggests \(k\ge 90\%\), while acknowledging that \(OA\) will be low unless calibration and QA accuracy are very strong. It recommends using reliability diagrams and ablations, such as step-wise versus non-step-wise confidence, to select \(\tau\) for the clinical context.

HALT introduces parallel caveats for the coverage-based setting [2601.14210]. It notes that tie-breaking at the boundary coverage should be deterministic or randomly sampled with a fixed policy for reproducibility, that task format and label imbalance can affect detector training signal, and that thresholding under dataset shift should be validated on a held-out split from the target domain. This suggests that both reliability-constrained and coverage-constrained variants of HCAcc are best interpreted as operational metrics whose usefulness depends on stable ranking quality rather than on formal guarantees.

Taken together, these limitations clarify what HCAcc@\(k\%\) does and does not measure. It does not certify truthfulness, calibration, or robustness by itself. It measures whether a system can convert uncertainty estimates into safer behavior by abstaining on risky cases while retaining as much useful accuracy as possible. In applications such as clinical QA, that operationalization directly targets the distinction between harmless uncertainty and harmful confident hallucination.

Source: https://www.emergentmind.com/topics/hallucination-controlled-accuracy-at-k-hcacc-k