Skip to main content
A retriever is a pipeline of stages: searches, filters, fusion, reranking. The right pipeline depends on the query. A product SKU lookup wants a fast keyword search. A vague question wants several embedding searches fused and reranked. A photo search wants the image model. One fixed pipeline is either slow for the easy queries or weak for the hard ones. An adaptive query pipeline changes how each query runs. Part of it is live today. Per-query pipeline selection, where you say what matters to you and Mixpeek picks the pipeline, is designed but not built.

What adapts today

Every retriever adapts in two ways with no configuration, and in a third when you turn on learned fusion:

The query optimizer

Before each run, Mixpeek rewrites your stage list: it pushes filters into the vector store, fuses compatible stages and runs independent work in parallel. Explain shows what it did.

Filtered search strategy

Each filtered vector search counts the documents that match the filter, then either scans exactly those documents or searches a wider part of the index, whichever suits that query.

Auto-Tune

With learned fusion, the weights that blend your searches adapt to each user from clicks, purchases and feedback.
All three tune the pipeline you saved. Choosing a different pipeline for each query is designed, not built.

Learned fusion (Auto-Tune)

Auto-Tune (learned fusion) sets a retriever’s fusion weights, such as text: 0.7, image: 0.3, from how users interact with results. The feature search stage learns which embedding features produce results people click, buy or rate well, and it learns this per user with Thompson Sampling, a multi-armed bandit algorithm. Users without enough history fall back to segment-level weights, then to weights learned across all users.
Thompson Sampling: Beta distributions evolve from uniform to peaked as interactions accumulate

How learned fusion works

Each feature search in the stage (for example a text embedding and an image embedding) is one arm of the bandit. Each arm has a Beta(alpha, beta) distribution that describes how well that feature has served this user so far.
1

A query arrives with a user ID

The stage reads the user_id from the query inputs and looks up the stored interactions for that user. If the user has too few, it uses the user’s segment or all users instead (see Hierarchical fallback).
2

Weights are sampled

The stage draws one value from each feature’s Beta distribution and normalizes the values to sum to 1. While a feature has little data its distribution is wide, so samples vary between requests (exploration). As data accumulates the distribution narrows and samples settle (exploitation). With no interaction data at all, every feature gets an equal weight.
3

Results are fused with those weights

The stage runs one search per feature, ranks each feature’s results, and merges them. A result’s fused score is the sum, over the features that returned it, of the feature’s weight times 1 / (1 + rank). A feature’s share of the page roughly follows its weight, and equal weights interleave the features.
4

The user interacts

Your application posts each click, purchase, skip or rating to the interactions API with the feature_uri of the result. The API turns the interaction types into a single reward using the retriever’s reward_map.
5

The distributions update

A positive reward adds to that feature’s alpha, and a negative reward adds its absolute value to beta. A reward of 0 (for example an impression under the default map) changes neither. Older interactions count for less (see Temporal decay).
6

The next query uses the updated weights

The next search for this user samples from the updated distributions, so features the user engages with get higher weights while the others are still tried some of the time.

Quick start

Learned fusion needs a feature search stage with at least two searches. With fewer, the API rejects the retriever, since there is nothing to weight.

1. Create a retriever with learned fusion

If you set "fusion": "learned" without a learning_config, the stage uses a learning_config with every default from the configuration reference.

2. Execute with a user ID

With zero interactions, every feature gets an equal weight. The response includes an execution_id, each result’s document_id, and each result’s feature_uri, which names the feature that contributed most to that result’s fused score. You send these back in step 3. The response also carries learned_fusion_context (see Response metadata).

3. Post interactions

When a user engages with a result, post an interaction with the result’s document_id (as feature_id), its feature_uri, and the execution_id of the search:
An interaction with the same execution_id, feature_id and interaction_type as one recorded in the previous 5 minutes is not stored. The response returns deduplicated: true and no interaction_id. The Python SDK can build the interaction from an execute response. Pass feature_uri when the retriever fuses more than one feature: without it the helper warns and sends none, and the server then leaves the weights unchanged.
Once user_456 has min_interactions stored interactions on this retriever, their searches use personal weights. If they keep engaging with text-matched results over image-matched ones, the text feature’s weight rises for their queries.

Key concepts

What learned fusion optimizes

Learned fusion learns one weight per feature. Each feature URI is an arm of the bandit, and its state is a Beta distribution for that feature. The system keeps no state per document. A click changes feature weights, and every document is then scored from its rank in each feature under the new weights. A document that ranks low in every feature cannot be lifted by clicks. To change how individual documents rank, add a Rerank stage, which re-scores each document against the query.

Thompson Sampling

Think of each feature as a weighted coin. At the start every coin is fair: you have no idea which feature is better, so each gets an equal share. As users click text-matched results more than image-matched ones, the text coin lands heads more often and with less variance, so text gets the larger weight on most queries while image is still tried on some. Each coin is a Beta(alpha, beta) distribution:
  • alpha = 1 + the decayed sum of positive rewards for the feature
  • beta = 1 + the decayed sum of the absolute values of negative rewards
Sampling from these distributions balances exploration and exploitation without a separate schedule. exploration_bonus and exploration_decay adjust how wide the samples are (see Exploration decay).

Rewards

The interactions API turns the types in one interaction into a single reward. It looks up each type in the retriever’s reward_map, keeps the value with the largest absolute size (sign preserved), and clamps it to ±max_reward_per_interaction. With the quick start’s map, ["click", "purchase"] gives 3.0 and ["click", "negative_feedback"] gives -2.0. A type missing from the map contributes 0.0. See Multi-signal rewards.

Hierarchical fallback

Not every user has enough history for personal weights. The stage resolves weights from the first level that has data: An interaction counts toward these thresholds when it was recorded with this retriever’s retriever_id and a feature_uri the stage searches.
  • Personal uses the user_id input. Include INPUT.user_id in context_features and declare user_id in the retriever’s input_schema. A request without a user_id skips this level.
  • Demographic uses the fields in demographic_features, such as ["INPUT.user_segment"]. It matches interactions whose metadata holds the same value under the same field name, so send the segment in metadata or in query_snapshot. This level reads interactions from the analytics store; where analytics is not enabled, lookup goes from personal to global.
When none of these levels has data but the current session has recorded interactions, the weights come from the session alone and context_level reads session (see Session-level adaptation).
A new user starts at the global or prior level and moves to personal weights once they have min_interactions interactions. No configuration change is needed; the level is chosen per query.

Response metadata

When learned fusion runs, the execute response carries a top-level learned_fusion_context object. Use it to confirm personalization is active and to watch the weights change:
On a skip response the object carries gate, gate_reason, served_fusion, rollout_pct and rollout_skip instead of weights. Rollout and safety covers reading these and the execution profile.
Check context_level to confirm personalization. If it reads global or none for a user you expect to be personal, check that the user’s interactions carry retriever_id, feature_uri and user_id, and compare their count with min_interactions. If circuit_breaker_triggered is true, the lookup is slow; raise circuit_breaker_timeout_ms or look at interaction store latency.

Configuration reference

fusion must be "learned", and searches must hold at least two entries. Each searches[].feature_uri is one arm of the bandit. The learning_config object sits in the feature search stage’s parameters next to fusion. Every field is optional. Default reward_map:

Complete learning_config example

Every settable field at its default. Put it in the feature search stage’s parameters next to fusion: "learned" and change only what you need:
The API rejects the retriever when min_weight is not less than max_weight, or when a reward_map key is not a valid interaction type.

Advanced controls

Session-level adaptation

The stage builds weight state from stored interactions. With analytics enabled it reads them from the analytics store. Without it, it reads the namespace’s mxp_retriever_interactions collection and caches the aggregate for 60 seconds, so a new click can take up to a minute to reach the weights. For adaptation within a session, the interactions API also writes each interaction that has a session_id and a feature_uri to a session cache that expires after 1 hour. On the next search with the same session_id, the stage adds the session’s rewards to the stored distributions before sampling:
Pass the same session_id in the execute inputs and on each interaction, and send retriever_id on the interaction so it matches the retriever being searched. session_id is accepted as an input on any retriever with a learning_config, without declaring it in input_schema:
Backfilled interactions (those sent with occurred_at) do not go to the session cache.
Without session_id, the stage still learns from interactions. They reach the weights on the next read of the stored aggregate instead of on the next search.

Temporal decay

User preferences change over time, so older interactions count for less:
With the default decay_factor of 0.995:
  • decay_factor (default 0.995): per-day multiplier. 1.0 turns decay off.
  • decay_window_days (default 365): interactions older than this are ignored.
Age is measured from when the interaction happened, so interactions backfilled with occurred_at decay by their real age.
A low decay_factor forgets quickly. At 0.95, a week-old interaction keeps about 70% of its weight (0.95^7). Values between 0.99 and 0.999 suit most uses.

Weight clamping

Sampling can produce extreme weights that all but remove a feature, such as text: 0.99, image: 0.01. Clamping bounds each weight:
After sampling and normalizing, each weight is clamped to [min_weight, max_weight] and the set is re-normalized to sum to 1. Re-normalizing can move a weight slightly past a bound when several weights were clamped, but every feature keeps a share of the results. This matters for recovery. Without clamping, a user who clicks only text results could end up with image: 0.01. If their preferences shift later, recovery is slow because image results would almost never be shown, and so almost never clicked.

Exploration decay

exploration_bonus sets how widely the bandit samples. A fixed bonus keeps the samples equally wide forever, so exploration decay shrinks it as interactions accumulate:
The stage divides each feature’s alpha and beta by effective_exploration before sampling. Values above 1 widen the distributions (more exploration) and values below 1 narrow them (more exploitation).
  • exploration_bonus (default 1.0): starting multiplier.
  • exploration_decay (default 0.99): per-interaction decay.
  • exploration_floor (default 0.1): lowest value the multiplier reaches.
With the defaults, after 100 interactions the multiplier is 1.0 * 0.99^100 = 0.37. After 500 it would be 0.007, so the floor of 0.1 applies. total_interactions is the interaction count of the level that supplied the weights, which learned_fusion_context reports as interaction_count.

Multi-signal rewards

reward_map gives each interaction type its own reward:
Positive values add to the feature’s alpha, making it more likely to get a higher weight. Negative values add to its beta. A purchase at 3.0 moves the distribution three times as far as a click at 1.0. When one interaction lists several types, only the type with the largest absolute reward counts. Each reward is capped at max_reward_per_interaction (default 5.0), so a single interaction cannot dominate the learned weights. Without a reward_map, the default map shown in the configuration reference applies. See Reward signals for the supported interaction types and how to choose values.

When to use learned vs static

Roll out learned fusion safely

Start in shadow mode, ramp traffic in steps, watch the metrics below, and turn learned fusion off with one config change if results get worse.

Traffic splitting

The rollout_pct field controls what percentage of requests use learned fusion weights. The rest fall back to static fusion (RRF by default).
Bucketing is deterministic by user ID: the same user always gets the same treatment (learned or static) on consecutive requests. This prevents a user from seeing different ranking behavior on every search.
Bucketing uses a hash of the user_id, or of session_id when there is no user_id. A request with neither is bucketed at random, so it gets learned weights with probability rollout_pct.
Changing the rollout
rollout_pct lives in the feature search stage’s learning_config, so you change it by updating the retriever. Send the retriever’s stages with that stage’s learning_config edited; the next request uses the new value, with no redeploy.
Include the stage’s other parameters (its searches, limits and the rest of learning_config) as they are today: the stage is replaced by what you send. In the Studio, the Learning tab rollout slider makes this update for you.

Shadow mode

Shadow mode computes learned fusion weights and logs what the results would have been, but serves static fusion results to the user. This lets you evaluate the quality of learned fusion before it affects real users.
In shadow mode:
  1. Both fusion strategies execute in parallel
  2. Static fusion results are served to the user
  3. Learned fusion weights and re-ranked results are logged as shadow_execution metadata
  4. The evaluation system can compare shadow vs. served results offline
The execution response includes a learned_fusion_context field (when shadow mode is active) so you can inspect what weights would have been used:
Run shadow mode for at least one week before enabling live traffic. Compare NDCG and click-through rates between shadow and served results using evaluations.

Turning learned fusion off

Set rollout_pct to 0 with the same update. Every request then uses static fusion, and the rest of learning_config and the accumulated interaction history stay as they are, so setting the percentage back resumes where it left off.
The /v1/retrievers/{retriever_id}/learned-fusion/* endpoints (enable, disable, rollout, per-user opt-out, opt-in and reset, weights, stats, activity) have been removed and answer 410 Gone with the replacement in the error body. Rollout and shadow mode are set in learning_config; what served each search is in the execution history (below).
Each execution records the learned-fusion arm that served it as learned_fusion_context: the gate it took (serve, shadow or skip), the context level (personal, demographic, global), the sampled weights and the user. It is in the execute response and stored on the execution’s profile:
List recent executions with POST /v1/retrievers/{retriever_id}/executions/list and read each one’s profile to see weights per feature over time, or every execution served to one user_id.

Weight bounds

Even with strong personalization data, individual feature weights are clamped to prevent degenerate rankings:
After Thompson Sampling produces raw weights, they are clamped to [min_weight, max_weight] and re-normalized to sum to 1.0. This means even a user with extreme interaction patterns will always see results influenced by all configured features.

Circuit breaker

If learned fusion weight resolution takes too long (slow signal reads, Redis issues, or high load), that request is fused with equal weights for every feature instead of learned weights, and the response’s top-level warnings says so:
The timeout is configurable via the circuit_breaker_timeout_ms field in learning_config (range 1–30000ms). The circuit breaker is per-request, not per-retriever. A single slow request does not disable learned fusion for everyone. The response’s learned_fusion_context metadata indicates when a fallback occurred:
A context_level of "none" with circuit_breaker_triggered: true indicates the circuit breaker fired and uniform priors were used. The weight_resolution_ms field shows the actual resolution time. Monitor the mxp_learned_fusion_circuit_breaker_total Prometheus metric to detect systemic latency issues.
1

Shadow mode (1-2 weeks)

Enable shadow_mode: true with rollout_pct: 100. All users get static results, but learned fusion runs in parallel and logs what it would have returned.Check: Run evaluations comparing shadow vs. served results. Learned fusion NDCG should be equal to or better than static.
2

1% canary (1 week)

Set shadow_mode: false, rollout_pct: 1.0. A small fraction of users get learned fusion.Check: Monitor click-through rates and circuit breaker triggers. No degradation vs. control group.
3

10% ramp (1 week)

Set rollout_pct: 10.0. Enough traffic to produce statistically significant comparisons.Check: Run a benchmark comparing learned vs. static. Expect learned fusion to show improvement for users with sufficient interaction history.
4

50% ramp (1 week)

Set rollout_pct: 50.0. Half of users get personalized results.Check: Monitor weight distributions across users. Look for convergence patterns (weights stabilizing) rather than oscillation.
5

100% GA

Set rollout_pct: 100.0. All users get personalized fusion weights, with hierarchical fallback for new users.Check: Keep evaluations running on a schedule to catch regressions. Set up alerts for high global fallback rates and circuit breaker storms.
At any step, if you see regression:
  1. Set rollout_pct: 0 to serve static fusion to everyone
  2. Investigate a specific user through the learned_fusion_context on their executions’ profiles
  3. Check whether the issue is global (bad reward map) or user-specific (outlier behavior)
  4. Adjust the learning_config and restart from the previous step

Per-query pipeline selection

Designed, not built. Nothing in this section is available yet, and field names may change before release.
You keep your retriever as it is and add up to two candidate pipelines to it, for example a fast keyword-only pipeline and a thorough one with reranking. For each query, Mixpeek picks the pipeline that did best for your goal on queries like it in your own evaluation data. When no candidate has proven itself for that kind of query, your saved stages run.
Three queries are classified into shapes from their text and a quick keyword search. A product code runs the fast keyword pipeline, a long question runs the deep hybrid-and-rerank pipeline, and a short phrase runs your saved stages because no candidate is confirmed for its shape.

How it works

1

You add candidate pipelines

Each candidate is a named list of stages saved inside your retriever’s planner block, next to its normal stages. Saving one sends no traffic to it. Your normal stages are always the default.
2

You pick a goal and an evaluation dataset

Set optimize_for (quality, balanced, speed or cost) and point the planner at a judged evaluation dataset for this retriever.
3

Mixpeek evaluates every pipeline

Evaluation runs score your default and each candidate on your judged queries, through your retriever, recording quality, latency and credits per query. A run starts when you change the retriever or the dataset, at most once a day, and never on a timer. These runs are on us.
4

It confirms a choice per kind of query

Queries are grouped into shapes by simple statistics of the query text, such as length and whether it is a question, and by the scores of one quick keyword search. A shape switches away from your default only when a candidate wins on one half of that shape’s judged queries and the win holds on the other half.
5

Each query runs the confirmed choice

A query of that shape runs the confirmed candidate. Every response says which pipeline ran and why, with forecasts for the alternatives.
A shape's judged queries are split into two halves. The best pipeline is picked on half A and must keep winning on half B before the shape switches. Live traffic can only send a shape back to your default.

Which pipeline runs

Mixpeek runs these checks for every query, in order. The first check that answers yes decides which pipeline runs.
Check 1: adaptation off or in shadow runs your saved stages. Check 2: a plan_id on the request or a pin runs the pipeline you chose. Check 3: a confirmed candidate inside your budget runs that candidate. Otherwise your saved stages run with a reason code.

What you control

Configure it

Start in shadow: the planner decides and logs what it would run while your default keeps serving. Switch to on when the logged decisions look right.

Read the routing block

routing.source tells you who chose the pipeline: When your saved stages run, reason_codes explains the reason:

What it promises

Candidates are compared only by evaluation runs on your judged dataset. Live queries are never used to test pipelines against each other, and your users’ queries are never re-run. Live traffic can only send a kind of query back to your default: if a candidate runs slower, costs more or fails more often than its evaluation showed, those queries return to your default until the next evaluation run.
A shape switches only when a candidate’s win is confirmed on judged queries it was not chosen on, and its worst queries are no worse than your default’s beyond a set margin. A retriever with no judged dataset never switches. Editing your retriever sends every shape back to the default until the next evaluation run, and the response says it is waiting for one.
A candidate forecast to exceed your credit or time limit is never chosen. Time limits are checked against forecasts, since a run is not yet stopped at the time limit; the response says so.
A query is billed for the pipeline that ran, as today, and never above your retriever’s credit limit or its quote. The evaluation runs the planner starts are not billed.
Pins, a plan_id sent in the request, and adaptation: off always take precedence over what the planner learned, and the response marks them as your choice.
Decisions and statistics are stored in your own namespace. Nothing learned from your evaluations is used for anyone else. Marketplace and public retrievers cannot turn the planner on, so consumers’ queries never train a publisher’s routing.

What we have measured so far

These numbers come from our own simulator and test namespaces, not from production traffic.
We also tested routing each query individually with a trained model, and re-bucketing query shapes automatically. Held to the same safety rules, neither beat the simpler shapes, so the design uses those.

Query optimization and explain

See the plan the optimizer built for a query, with per-stage estimates.

Interactions

Capture the user behavior that drives learned fusion.

Reward signals

Choose reward values for each interaction type.

Evaluations

Measure quality, and build the judged dataset per-query selection would use.