Skip to content

Clusters and resampling

Evaluations often contain several answers per prompt: repeated samples, several system prompts, or several turns of one conversation. Answers to the same prompt succeed or fail together, so they are not independent. Treating them as independent makes the interval too narrow.

Clustered evaluation set

Pass the prompt identifier of every evaluated answer:

vc.correct_rate(audit, judge_verdicts, clusters=prompt_ids)  # delta
vc.correct_rate(audit, judge_verdicts, clusters=prompt_ids, method="bootstrap", seed=0)

With the delta method the variance of the judge's rate becomes cluster-robust. With the bootstrap whole prompts are resampled.

Clustered audit

audit = vc.JudgeAudit.from_labels(human_labels, judge_labels, clusters=audit_prompt_ids)

The sensitivity and specificity variances then use the cluster-robust ratio estimator, and the bootstrap resamples audited prompts.

How much does it matter?

In a simulation with 10 answers per prompt and an intra-prompt correlation of 0.3, intervals that ignored the clustering covered the truth in about 92 % of nominal 95 % intervals, cluster-robust delta intervals in 97 % and the cluster bootstrap in 94 %. The effect grows with the number of answers per prompt.

Reproducibility

All bootstrap functions accept seed. Use a fixed seed in reports so that the numbers can be reproduced exactly.