Precision at K counts judged relevant items among the first K eligible results when the required judgments are available. A ranking report should name K, query population, relevance threshold, missing-judgment policy, and aggregation method. Graded gain measures require an explicit grade-to-gain rule and a declared ideal ordering; a prompt should never invent either. Put metric arithmetic in code, then ask the model to explain the computed numbers and exclusions. Show judgment coverage alongside the score.
Make this comfortable
Search prompts: calculate ranking metrics on judged pairs
Operational case
One Beacon query has three relevant items in its first five judged results, so precision at five is 0.6. That value says nothing about the other 46 queries. Seven disputed query-document judgments are held out of a release comparison until adjudicated or handled by a predeclared missing-label policy. If a new ranker places an unjudged item high, the sheet requests another judgment instead of quietly treating the item as a miss.
BS-Q12: relevant@5 = [1, 0, 1, 0, 1]
P@5 = (1 + 0 + 1 + 0 + 1) / 5 = 0.6
Query set = 47; displayed metric covers BS-Q12 only
Disputed pairs = 7; aggregate comparison = pendingPerformance and review cost
Calculating top-K scores for Q fully judged queries is O(QK) time and O(Q) stored per-query summaries. Obtaining missing judgments is the expensive step. Averages can hide failures on rare intents, so keep the slice breakdown and the count of scored queries beside every reported value.
Common Mistakes
- Do not divide by retrieved count when reporting precision at five.
- Do not present one query's 0.6 as an overall score.
- Do not calculate graded metrics without a grade rule and complete required judgments.
Connected lessons
- Production prompt engineering
- Prompt Engineering
- Aggregation prompts: pin the denominator and recompute the rate
- Report prompts: reconcile every claim with the packet
- Search prompts: define query intent and evaluation slices
- Search prompts: judge relevance without treating unknown as wrong
- Search prompts: diagnose candidate coverage and zero results
- Search prompts: interpret clicks and gate a ranking release
- Project: review Beacon Supply search relevance
- Search relevance prompt decisions
prompt engineering
search relevance
