Detect changes in retrieval quality without confusing clicks with labels or exposing shadow results to users.
Retrieval drift: monitor query slices and shadow a candidate safely
Drift is a change in the contract, not one number
Retrieval drift appears when query wording, corpus coverage, permissions, parser behavior or model representations change enough that relevant evidence is no longer found. A stable aggregate click rate can hide a severe miss for a low-volume query class. Define slices such as serial identifiers, recent procedures, multilingual requests and no-answer questions. Track corpus and index freshness alongside result behavior so a stale source is not mistaken for ranking drift. Release gates set initial quality thresholds; monitoring tests whether those assumptions still hold.
Use signals with different levels of trust
Labeled answer-bearing passages give direct recall measurements but are expensive and slow to update. Unlabeled operational signals include zero-result rate, filter rejection, latency, candidate overlap and sudden changes in query length. These indicate where to investigate; they do not prove relevance. Clicks are shaped by result position and interface design, so they cannot be treated as ground-truth judgments. Click bias needs explicit correction or a separate human review path.
Shadow candidates within the same security boundary
A shadow run sends a sampled query to the current and candidate retrievers, then shows only the current result to the user. Both branches must apply the same current permission filters and secret-handling rules. Log bounded, redacted comparisons rather than raw private queries. Record index, model and parser versions; otherwise a changed score distribution cannot be attributed. Compare result IDs, answer-bearing span recall on labeled traffic and latency at the same candidate budget. Do not call a shadow winner from score magnitude alone when scoring scales differ.
Set alert thresholds by slice and baseline
Use a fixed evaluation set for regression checks and a rolling operational baseline for distribution changes. A threshold should include minimum traffic, a window and an action: inspect, pause rollout or roll back. For rare slices, low sample count can make a weekly rate noisy; report numerator and denominator, not only a percentage. A sudden zero-result increase may be caused by a permission policy change, an ingestion delay or new user vocabulary. Traces help separate these causes.
Close the loop with adjudicated cases
When an alert fires, sample misses, attach source revision and permission context, and have reviewers identify the expected evidence or mark the query unanswerable. Add stable cases to the judged set, then test a proposed parser, index or ranking change against old and new slices. Counterfactual tests expose whether the change merely overfits familiar examples. Keep evaluation data versioned; otherwise an apparent gain may come from changed labels rather than a better retriever.
Worked contract
from collections import defaultdict
def slice_recall(records: list[tuple[str, bool, bool]],
minimum_cases: int = 3) -> dict[str, tuple[int, int]]:
counts = defaultdict(lambda: [0, 0])
for query_slice, has_judged_answer, answer_found in records:
if not has_judged_answer:
continue
counts[query_slice][1] += 1
counts[query_slice][0] += int(answer_found)
return {name: (hits, total) for name, (hits, total) in counts.items()
if total >= minimum_cases}
judgments = [
("serial-id", True, True), ("serial-id", True, False),
("serial-id", True, True), ("recent-policy", True, True),
("recent-policy", True, True), ("recent-policy", True, True),
("recent-policy", False, False),
]
report = slice_recall(judgments)
assert report == {"serial-id": (2, 3), "recent-policy": (3, 3)}Performance and operating cost
For Q judged queries, this single-pass slice calculation takes O(Q) time and O(S) space for S slices. Running two retrievers in shadow can nearly double retrieval compute for sampled traffic, plus trace storage and review work; sample deliberately and cap latency impact. The example reports counts instead of a bare percentage and excludes no-answer cases from answer-recall. Evaluate abstention separately, because excluding no-answer cases does not make false answers harmless.
Common Mistakes
- Calling clicks a relevance label without accounting for position and presentation.
- Comparing raw scores from different ranking models as if their scales matched.
- Shadowing a candidate without the current permission filters.
- Triggering a rollback from a tiny slice sample without examining its counts and source context.
Validation drill
Shadow 71 redacted queries across four named slices. Compare candidate overlap and judged recall, report counts with p95 latency and freshness, then adjudicate five disagreements before deciding on a rollout.
