Skip to main content
Measure how good a retriever’s results are, change the pipeline, and measure again, until the numbers and your users agree. Prerequisites: a retriever with a feature_search stage, saved in RETRIEVER_ID, and MIXPEEK_API_KEY and NAMESPACE_ID set. Learned fusion also needs two or more entries in searches and a user_id input.
1

Measure a baseline

Create a ground-truth dataset and run an evaluation. Keep the evaluation_id. See Measure quality with an evaluation.
2

Change the pipeline

Try a different fusion strategy, add a rerank stage, or filter earlier.
3

Measure again

Run the same dataset with baseline_evaluation_id set, and keep the change only if the metrics rise.
4

Learn from users

Record interactions from your UI, then turn on learned fusion in shadow mode and ramp it up.

Measure quality with an evaluation

An evaluation runs every query in a ground-truth dataset through a retriever and scores the results. Each query has a query_id, a query_input keyed by the retriever’s input_schema, the relevant_documents, and optional relevance_scores from 0 to 5 for NDCG.
The run is asynchronous and keys on the dataset name. Poll GET /v1/retrievers/{retriever_id}/evaluations/{evaluation_id} until status is completed, then read overall_metrics and metrics_by_k. Aim for 50 queries or more. POST /v1/retrievers/{retriever_id}/evaluations/generate-from-interactions builds a dataset from recorded interactions. A retriever that returns one document per group needs relevance_field on the dataset, so relevant_documents lists that field’s values instead of document ids. See Run evaluation. To grade by source file, set relevance_field: "root_object_id". Every result carries root_object_id, the id of the bucket object it was extracted from, so the scenes of one video or the chunks of one PDF share it. List object ids in relevant_documents; results from one file count once, at the rank of the first, so the scores read per file. A customer field stored as root_object_id takes the place of the source object id.
Dataset graded by source file

Hybrid search fusion strategies

When feature_search runs two or more searches, fusion decides how their ranked lists merge into one. Set it in the stage’s parameters beside searches.
feature_search with two searches under dbsf
RRF scores are small by design. The best possible score is about 1 / 61 ≈ 0.0164 per search, so a top score near 0.017 is healthy. Compare documents by their order; the size of an RRF score carries no meaning on its own. For an absolute 0 to 1 score, run one search without fusion, or gate on a rerank score with score_threshold. Every strategy adds under 10 ms.

Record interactions

An interaction records what a user did with one result. Send feature_id (the result’s document_id), interaction_type (always an array), and position (0-based rank). Add retriever_id, execution_id, user_id, session_id, and the result’s feature_uri, which learned fusion needs to credit the right search.
The array holds the signals of one user action, so a click followed by a long read is ["click", "long_view"]. Send separate actions as separate interactions. For buffered events, POST /v1/retrievers/interactions/batch takes up to 1,000 per call; batched events skip the real-time session cache. view, wishlist, query_refinement, zero_results, filter_toggle, play, download, save, add_to_project and rating are also valid and score 0 unless your reward_map names them. Interactions are stored in the namespace’s mxp_retriever_interactions system collection, which you can list and filter like any collection. See Create interaction.

Learned fusion (Auto-Tune)

Learned fusion sets the weights between a stage’s searches per user, from that user’s interactions. Each search’s feature_uri is one arm of a Thompson Sampling bandit with a Beta(alpha, beta) distribution. A positive reward adds to alpha, a negative reward adds its absolute value to beta, and each query samples weights from the distributions. With no interactions, every search gets an equal weight. Set "fusion": "learned" and a learning_config in the feature_search parameters, and declare user_id in the retriever’s input_schema:
learning_config for a shadow-mode rollout
Weights come from the first level with data: the user (after min_interactions), the user’s segment, all users of the retriever, then equal weights. Learned fusion changes how searches are weighted; it keeps no per-document state, so a document that ranks low in every search stays low. To move single documents, add a rerank stage. Roll out in three steps: run with shadow_mode: true and compare the reported weights with your evaluation; set shadow_mode: false with rollout_pct at 10, then raise it; set fusion back to rrf to turn it off. Each change is a PATCH of the retriever’s stages and applies on the next request. A published retriever’s stages are fixed, so clone it first.

Check that it worked

  • Evaluation: the new run’s metrics_by_k beats the baseline at the k your UI shows.
  • Learned fusion: an execute response from a learned-fusion stage carries learned_fusion_context. gate is serve, shadow or skip. context_level is personal, demographic, global, session or none. sampled_weights gives the weight per feature URI.
  • Production: the retriever analytics endpoints show the effect on real traffic.

What goes wrong

A click at position 8 earns the same reward as a click at position 0. Mixpeek stores position for your own analysis.