Quickstart
1
Create a ground truth dataset
Each query pairs an input with the document IDs that should be returned.
2
Run the evaluation
Execute your retriever against every query in the dataset. The evaluation runs asynchronously and returns a
task_id for progress tracking.3
Get results
Poll the evaluation until
status is completed.Example response
Metrics
Every metric is computed at each K value you specify. The defaults cover most use cases:F2 vs F1: Use F2 when missing a relevant document is worse than showing an irrelevant one — the common case in search, recommendations, and discovery. F1 treats both errors equally.
Reading Your Scores
Graded Relevance
When you providerelevance_scores in your dataset, NDCG uses graded relevance instead of binary. This distinguishes “exactly right” from “somewhat relevant”:
Without
relevance_scores, all metrics use binary relevance (relevant or not).
Comparing Retrievers
Run the same dataset against different retriever configurations to find the best pipeline:metrics_by_k side by side:
Ground Truth Datasets
Dataset Requirements
- At least 1 query (aim for 50+ for statistically meaningful results)
- Each query must have at least 1 relevant document
query_inputmust use the keys your retriever’sinput_schemadeclaresrelevance_scores, if provided, must cover allrelevant_documents
dataset_name and queries, and each query needs query_id,
query_input and relevant_documents. relevance_scores is optional and takes
0 to 5 per document, which is what NDCG reads.
A run keys on the dataset name, not its id, and returns a task_id
immediately while the evaluation proceeds asynchronously.
Grouped retrievers: relevance_field
A retriever with a group_by or reduce stage returns one document per group, picked from several that share a key. No list of document ids can say “this frame is relevant”. Listing every tile of a frame lowers recall, whichever tile the retriever returns.
Set relevance_field on the dataset to grade by that field’s value:
relevant_documentslists values of the field in place of document ids, andrelevance_scoreskeys on the same values.- Results that share a value count once, at the rank of the first.
- Dotted paths reach nested fields, as in
metadata.frame_key. - A query skips when none of its results has the field. Its
errorinquery_resultsnames the field.
When every query skips
Input validation is strict. A key inquery_input that the retriever does not
declare is rejected rather than ignored, and the message names what it does
accept:
An all-skipped run finishes as
failed, not as zeros. EvaluationStatus
is pending, in_progress, completed or failed, and a run that evaluated
nothing takes the failed branch rather than reporting 0.0 across the board.Read query_results on the evaluation record to see which branch each query
took and the actual error for each skip. total_queries, evaluated_queries
and skipped_queries give you the same story as counts. Diagnosing a skipped
run needs neither worker logs nor a re-run.Managing Datasets
Building Good Datasets
Include query diversity
Cover head queries (popular), torso (moderate), and tail (rare/specific). Don’t just test easy cases.
Use graded relevance
Binary relevant/not-relevant misses nuance. Score documents 0–5 so NDCG can distinguish good rankings from great ones.
Match real traffic
Sample queries from production logs. Synthetic queries test what you think users ask, not what they actually ask.
Version your datasets
Keep datasets stable across evaluations so you can track metric trends over time. Create new versions for schema changes.
Configuration Reference
string
required
Name of the ground truth dataset to evaluate against.
string
Set on the dataset at creation. Grades by this field of each result in place of its document id, for a retriever that groups documents. See Grouped retrievers.
integer[]
default:"[1, 5, 10, 20]"
Cutoff positions for @K metrics. Include the K values that match your UI — if you show 10 results per page, include
10.string[]
Metrics to compute. Available:
precision, recall, f1, f2, map, ndcg, mrr.integer[]
Also grade each query at a multiple of R, the number of entries in its
relevant_documents. With [1, 2], a query with 21 relevant documents is graded at k=21 and k=42, and a query with 4 at k=4 and k=8. Scores appear as f2_at_2r in overall_metrics and in each query’s metrics, and under "2r" in metrics_by_k. k_values still apply. A query whose k exceeds the retriever pagination limit is skipped, and query_results gives the reason.Per-query results
GET /v1/retrievers/{retriever_id}/evaluations/{evaluation_id} returns one entry in query_results for each attempted query. An evaluated query carries its own scores under the same keys as overall_metrics, so one run can score each class of a dataset separately:
relevance_field, these scores grade the values of that field, and relevant_count counts the values listed. The list route omits metrics to keep pages small, so read a single evaluation for them.
Related
- Retriever Benchmarks — replay live sessions against candidate retrievers
- Improve Relevance — interaction signals, fusion strategies, and the feedback loop
- API Reference: Run Evaluation — full endpoint specification
- API Reference: Create Dataset — dataset creation endpoint

