Evaluating Knowledge Interventions › The hazard of overlap: making validity checks executable
Language AI HandbookAll chapters A held-out score loses its meaning for any prompt that was already used to construct the edit. Hash the prompts to find exact reuse, and validate separately that the reference is independent.
PythonIn [16]Expand
def prompt_hash(text):
return hashlib.sha256(text.encode("utf-8")).hexdigest()[:16]
def find_overlaps(results, reference_slice="edit_surface"):
ref_hashes = {
prompt_hash(r["prompt"])
for r in results
if r["slice"] == reference_slice
}
overlaps = []
for r in results:
if r["slice"] == reference_slice:
continue
if prompt_hash(r["prompt"]) in ref_hashes:
overlaps.append(r)
return overlaps
overlaps = find_overlaps(all_results)The profile below uses the same estimates and Wilson endpoints as the table. The answer rates coincide in this uncoupled lookup example, while the interval widths reflect the different slice sizes.
VisualizationOut [18]Expand

ConsoleOut [19]Expand
Number of test prompts overlapping the edit surface: 0
An exact duplicate invalidates an otherwise held-out transfer claim for that item. Exclude duplicates before reporting held-out scores. Exact hashes do not detect all near-duplicates or shared underlying facts.
Run the exact check after generating the slices, since different generation paths can emit identical prompts. A reworded prompt can still reuse the same underlying fact or construction example while producing a different digest. Consult the split provenance and check plausible near-duplicates separately.
A frequent and damaging shortcut is to compute "expected" answers by asking the un-edited model and treating its outputs as ground truth. This evaluates self-consistency under edit, not knowledge change. The reference must be an external knowledge state (the intended post-edit KB, label from a human annotator, or a verified source), derived independently of the model under test.
Comments
Add to the conversation
A question, a correction, or an example from your own work.
No comments yet. Be the first to share your thoughts!