> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mixpeek.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Feedback loop with learned fusion

> Start a photo search with fixed fusion weights, send click signals back, and let learned fusion tune the weights per user.

Start a photo search with fixed fusion weights, send click signals back, and let learned fusion tune the weights per user. Each photo is searched by its image and by its caption, and the retriever learns which of the two your users trust.

> [card] [Jump to the manifest](#the-manifest)
>
> `feedback-loop.namespace.yaml`: apply it with one API call, then read the walkthrough below to change it.

## At a glance

| | |
| - | - |
| **Creates** | 1 namespace, 1 bucket, 2 collections, 1 retriever |
| **Extractors** | [`image_extractor`](https://docs.mixpeek.com/docs/extract/extractors#image) v1, [`text_extractor`](https://docs.mixpeek.com/docs/extract/extractors#text) v1 |
| **Daily spend budget** | 1 USD, set on the namespace. Queries are not capped. |
| **Sample data** | 8 objects, uploaded to `photos` when you apply |

## How the pieces connect

Buckets hold what you upload, collections turn it into searchable documents, and retrievers answer queries over the collections.

```mermaid theme={null}
flowchart LR
  b0[("photos")]
  c1["photo-visual<br/>image_extractor v1"]
  c2["photo-captions<br/>text_extractor v1"]
  r3{{"photo-search"}}
  b0 --> c1
  b0 --> c2
  c1 --> r3
  c2 --> r3
```

## Deploy it

**1. Get the manifest**

```bash theme={null}
# Copy the manifest from the bottom of this page into feedback-loop.namespace.yaml
```

**2. Validate it**

Validate runs every check apply runs and creates nothing. Fix each entry in `errors`, then run it again.

```bash theme={null}
curl -X POST https://api.mixpeek.com/v1/manifest/validate \
  -H "Authorization: Bearer $MIXPEEK_API_KEY" \
  -F "manifest_file=@feedback-loop.namespace.yaml"
```

**3. Apply it**

Apply creates every resource in one call. `wait_for_seed=true` also waits until the sample objects are processed, so the first query below has documents to return.

```bash theme={null}
curl -X POST "https://api.mixpeek.com/v1/manifest/apply?wait_for_seed=true" \
  -H "Authorization: Bearer $MIXPEEK_API_KEY" \
  -F "manifest_file=@feedback-loop.namespace.yaml"
```

The response lists each resource with its outcome in `resources`. Apply refuses a resource that already exists and rolls the whole apply back, so to apply the file again over this namespace add `?mode=create_missing`, which creates only what is missing.

## Run the first query

Look up the namespace id by name, then run `photo-search`. Check `status` and `warnings` along with `documents`: a run that times out still answers 200, with `status` `degraded`.

```bash cURL theme={null}
NAMESPACE_ID=$(curl -s https://api.mixpeek.com/v1/namespaces/feedback-loop \
  -H "Authorization: Bearer $MIXPEEK_API_KEY" | jq -r .namespace_id)

curl -X POST https://api.mixpeek.com/v1/retrievers/photo-search/execute \
  -H "Authorization: Bearer $MIXPEEK_API_KEY" \
  -H "X-Namespace: $NAMESPACE_ID" \
  -H "Content-Type: application/json" \
  -d '{"inputs": {"query": "oil tankers in a Greek harbor"}}' \
  | jq '{status, warnings, documents: [.documents[] | {document_id, score}]}'
```

```python Python theme={null}
import os, requests

AUTH = {"Authorization": f"Bearer {os.environ['MIXPEEK_API_KEY']}"}
ns = requests.get("https://api.mixpeek.com/v1/namespaces/feedback-loop", headers=AUTH).json()

run = requests.post(
    "https://api.mixpeek.com/v1/retrievers/photo-search/execute",
    headers={**AUTH, "X-Namespace": ns["namespace_id"]},
    json={"inputs": {"query": "oil tankers in a Greek harbor"}},
).json()

print(run["status"], run["warnings"])  # "completed" on a clean run
for doc in run["documents"]:
    print(doc["document_id"], doc["score"])
```

```javascript JavaScript theme={null}
const auth = { Authorization: `Bearer ${process.env.MIXPEEK_API_KEY}` };
const ns = await fetch("https://api.mixpeek.com/v1/namespaces/feedback-loop", { headers: auth }).then((r) => r.json());

const run = await fetch("https://api.mixpeek.com/v1/retrievers/photo-search/execute", {
  method: "POST",
  headers: { ...auth, "X-Namespace": ns.namespace_id, "Content-Type": "application/json" },
  body: JSON.stringify({"inputs": {"query": "oil tankers in a Greek harbor"}}),
}).then((r) => r.json());

console.log(run.status, run.warnings); // "completed" on a clean run
for (const doc of run.documents) console.log(doc.document_id, doc.score);
```

## Add your own data

Each object you add to a bucket is processed by every collection that reads it. This adds one object to `photos`. `NAMESPACE_ID` is the id from the namespace lookup above.

```bash cURL theme={null}
curl -X POST "https://api.mixpeek.com/v1/buckets/photos/objects?auto_process=true" \
  -H "Authorization: Bearer $MIXPEEK_API_KEY" \
  -H "X-Namespace: $NAMESPACE_ID" \
  -H "Content-Type: application/json" \
  -d '{"title": "example", "blobs": [{"property": "image", "type": "image", "data": "https://example.com/photo.jpg"}, {"property": "caption", "type": "text", "data": "The text you want indexed."}]}'
```

```python Python theme={null}
import os, requests

HEADERS = {"Authorization": f"Bearer {os.environ['MIXPEEK_API_KEY']}", "X-Namespace": os.environ["NAMESPACE_ID"]}

obj = requests.post(
    "https://api.mixpeek.com/v1/buckets/photos/objects",
    params={"auto_process": "true"},
    headers=HEADERS,
    json={
        "title": "example",
        "blobs": [
            {
                "property": "image",
                "type": "image",
                "data": "https://example.com/photo.jpg"
            },
            {
                "property": "caption",
                "type": "text",
                "data": "The text you want indexed."
            }
        ]
    },
).json()
print(obj["object_id"], obj["status"])  # PENDING until processing finishes
```

```javascript JavaScript theme={null}
const headers = {
  Authorization: `Bearer ${process.env.MIXPEEK_API_KEY}`,
  "X-Namespace": process.env.NAMESPACE_ID,
  "Content-Type": "application/json",
};

const obj = await fetch("https://api.mixpeek.com/v1/buckets/photos/objects?auto_process=true", {
  method: "POST",
  headers,
  body: JSON.stringify({
    "title": "example",
    "blobs": [
      {
        "property": "image",
        "type": "image",
        "data": "https://example.com/photo.jpg"
      },
      {
        "property": "caption",
        "type": "text",
        "data": "The text you want indexed."
      }
    ]
  }),
}).then((r) => r.json());
console.log(obj.object_id, obj.status); // PENDING until processing finishes
```

The object is `PENDING` until processing finishes, then `COMPLETED` or `FAILED`. [Buckets and objects](https://docs.mixpeek.com/docs/ingest/buckets.md) covers object states, retries and duplicates.

## Retrievers

### `photo-search`

Describe a photo in words and get back the photos that match, ranked by what the image shows and what its caption says, fused with fixed weights.

**Stages:** [`feature_search`](https://docs.mixpeek.com/docs/retrieve/stages#feature-search)

**Searches:** `photo-visual`, `photo-captions`

| Input | Type | Required | Description |
| - | - | - | - |
| `query` | text | yes | What you are looking for, in plain words; embedded by SigLIP for the visual search and by text\_extractor for the caption search |
| `user_id` | string | no | Your application's id for the person searching. Unused under static fusion; learned fusion keys personal weights on it |
| `user_segment` | string | no | A coarse group the person belongs to, such as editor or shopper. Learned fusion uses it for people with too few interactions of their own |

## Collections

Each collection runs one extractor over a bucket, or over another collection's documents.

> [accordion] photo-visual
>
> image\_extractor\@v1 over bucket photos: one document per photo, embedded by SigLIP (768 dimensions). The visual arm of photo-search.
>
> **Reads** bucket `photos` with [`image_extractor`](https://docs.mixpeek.com/docs/extract/extractors#image) v1.
>
> **Inputs:** `image` ← `image`
>
> **Copied onto each document:** `title`, `caption`

> [accordion] photo-captions
>
> text\_extractor\@v1 over bucket photos: one document per caption, embedded as text. The caption arm of photo-search.
>
> **Reads** bucket `photos` with [`text_extractor`](https://docs.mixpeek.com/docs/extract/extractors#text) v1.
>
> **Inputs:** `text` ← `caption`
>
> **Copied onto each document:** `title`

## The manifest

Every resource above comes from this file. Change it and apply it again with `?mode=upsert` to update what exists. [Manifests](https://docs.mixpeek.com/docs/manage/manifests.md) documents each field.

```yaml feedback-loop.namespace.yaml expandable theme={null}
# feedback-loop: one manifest spins up a photo library searched by two models at once, the
# starting point for learning fusion weights from what users click.
# Platform manifest schema (GET /v1/discovery/schema). Validate with POST /v1/manifest/validate,
# apply with POST /v1/manifest/apply. Wiring: the photos bucket feeds two collections, one
# embedding each image with SigLIP and one embedding its caption with text_extractor. The
# photo-search retriever queries both and fuses them with fixed weights (dbsf, 0.6 visual,
# 0.4 caption). Switching that stage to fusion: learned is a one-block edit to this file.
# Applying a SECOND time, over a namespace this file already created: use
# POST /v1/manifest/apply?mode=create_missing, which creates what is missing and leaves
# what exists alone. The default, create_only, fails the WHOLE apply and rolls it back if
# any resource already exists. Use mode=upsert to also patch resources that exist but have
# drifted from this file, which is how you apply an edit to the retriever.
version: '1.0'
metadata:
  name: feedback-loop
  description: "Guide template feedback-loop: photos searched by image embedding and caption embedding, fused with static weights, ready to switch to learned fusion driven by interaction signals."
namespaces:
  - name: feedback-loop
    description: "Everything below lives in this namespace."
    feature_extractors:
      - name: image_extractor
        version: v1
      - name: text_extractor
        version: v1
    # Daily spend budget, in dollars of what you are charged (1,000 credits a dollar).
    # New batches pause once the namespace has spent this much today; queries are not capped.
    # Raise it later on the namespace: PATCH /v1/namespaces/<id> {"spend_budget": {"daily_usd": N}}.
    budget:
      daily_usd: 1

buckets:
  - name: photos
    namespace: feedback-loop
    description: "One object per photo: the image, a caption that says what the pixels cannot (place, context), and a title."
    schema:
      properties:
        image:
          type: image
          required: true
        caption:
          type: text
          required: true
        title:
          type: string

collections:
  - name: photo-visual
    namespace: feedback-loop
    description: "image_extractor@v1 over bucket photos: one document per photo, embedded by SigLIP (768 dimensions). The visual arm of photo-search."
    source:
      type: bucket
      bucket: photos
    feature_extractor:
      name: image_extractor
      version: v1
      input_mappings:
        image: image
      field_passthrough:
        - source_path: title
        - source_path: caption
    enabled: true
  - name: photo-captions
    namespace: feedback-loop
    description: "text_extractor@v1 over bucket photos: one document per caption, embedded as text. The caption arm of photo-search."
    source:
      type: bucket
      bucket: photos
    feature_extractor:
      name: text_extractor
      version: v1
      input_mappings:
        text: caption
      field_passthrough:
        - source_path: title
    enabled: true

retrievers:
  - name: photo-search
    namespace: feedback-loop
    description: "Describe a photo in words and get back the photos that match, ranked by what the image shows and what its caption says, fused with fixed weights."
    collections:
      - photo-visual
      - photo-captions
    input_schema:
      query:
        type: text
        required: true
        description: "What you are looking for, in plain words; embedded by SigLIP for the visual search and by text_extractor for the caption search"
      user_id:
        type: string
        required: false
        description: "Your application's id for the person searching. Unused under static fusion; learned fusion keys personal weights on it"
      user_segment:
        type: string
        required: false
        description: "A coarse group the person belongs to, such as editor or shopper. Learned fusion uses it for people with too few interactions of their own"
    stages:
      - stage_name: search
        stage_id: feature_search
        parameters:
          searches:
            - feature_uri: "mixpeek://image_extractor@v1/google_siglip_base_v1"
              query:
                input_mode: text
                value: "{{INPUT.query}}"
              top_k: 50
              weight: 0.6
            - feature_uri: "mixpeek://text_extractor@v1"
              query:
                input_mode: text
                value: "{{INPUT.query}}"
              top_k: 50
              weight: 0.4
          fusion: dbsf
          fuse_on: source_object
          final_top_k: 10
    tags:
      - template:feedback-loop

# Eight public-domain photos from the starter set in the Mixpeek sample bucket, so applying
# reads nothing from a third-party host. Each caption names a place or context the image alone
# does not show, so the visual and caption searches rank the photos differently.
seed:
  - bucket: photos
    max_objects: 8
    objects:
      - {blobs: {image: samples/starter/images/mustang-san-francisco.jpg}, texts: {caption: "A Ford Mustang GT parked on a steep residential street in San Francisco, a classic American muscle car."}, title: "Mustang GT on a San Francisco street"}
      - {blobs: {image: samples/starter/images/thessaloniki-port-tankers.jpg}, texts: {caption: "Three oil tankers moored at the commercial port of Thessaloniki in northern Greece."}, title: "Three tankers in Thessaloniki port"}
      - {blobs: {image: samples/starter/images/boston-beacon-st.jpg}, texts: {caption: "Beacon Street in Boston, lined with brick row houses from the nineteenth century."}, title: "Beacon Street, Boston"}
      - {blobs: {image: samples/starter/images/los-angeles-8th-st.jpg}, texts: {caption: "East 8th Street in downtown Los Angeles, part of the garment district."}, title: "East 8th Street, Los Angeles"}
      - {blobs: {image: samples/starter/images/15th-street-stop.jpg}, texts: {caption: "A public transit stop on 15th Street where commuters wait for the next train."}, title: "15th Street stop"}
      - {blobs: {image: samples/starter/images/street-62.jpg}, texts: {caption: "An ordinary city street on a weekday afternoon."}, title: "City street"}
      - {blobs: {image: samples/starter/images/day-out-in-the-rain.jpg}, texts: {caption: "People out walking with umbrellas during a rainy day."}, title: "A day out in the rain"}
      - {blobs: {image: samples/starter/images/blue-sky-white-snow.jpg}, texts: {caption: "Fresh winter snow under a clear blue sky."}, title: "Blue sky over white snow"}
```

## Hand it to an agent

Paste this prompt into Claude Code, Cursor or another coding agent. To give the agent this whole page instead, use **Copy page** in the menu at the top of the page, or point it at the page's Markdown at `https://mixpeek.com/docs/templates/feedback-loop.md`.

```text Prompt theme={null}
Set up the Mixpeek "Feedback loop with learned fusion" template in my organization. My API key is in MIXPEEK_API_KEY.
1. Save the manifest at the bottom of https://mixpeek.com/docs/templates/feedback-loop as feedback-loop.namespace.yaml.
2. POST it to https://api.mixpeek.com/v1/manifest/validate as the multipart field manifest_file, with the header Authorization: Bearer $MIXPEEK_API_KEY. Fix every entry in errors and validate again.
3. POST the same file to https://api.mixpeek.com/v1/manifest/apply?wait_for_seed=true. Every entry in resources should be created.
4. GET https://api.mixpeek.com/v1/namespaces/feedback-loop and keep namespace_id. Send it as the X-Namespace header on every call below.
5. POST {"inputs": {"query": "oil tankers in a Greek harbor"}} to https://api.mixpeek.com/v1/retrievers/photo-search/execute. Read documents, check that status is completed, and print warnings.
Reference for this template: https://mixpeek.com/docs/templates/feedback-loop.md
```

## How it works

Each photo is searched by two arms: `photo-visual` holds a SigLIP embedding of the `image`, which a text query can match, and `photo-captions` a text embedding of the `caption`, which names places and context the pixels do not show. `photo-search` sends the query to both in one `feature_search` stage. Learned fusion keeps one weight per feature URI, which is why the arms come from two extractors: two searches on one URI share one weight and give the learner nothing to choose between.

The stage starts with fixed weights, 0.6 visual and 0.4 caption:

* `fusion: dbsf` scales each arm's scores to 0 to 1 before weighting, since SigLIP and the text model score on different scales.
* `fuse_on: source_object` adds up evidence per bucket object. A photo found by both arms comes back once.
* `user_id` and `user_segment` are declared in `input_schema` now, unused, so switching to learned fusion later changes no inputs.

These weights are the baseline to beat. Each change below is an edit to the manifest; apply it again with `?mode=upsert`. A published retriever keeps its stages, so clone it to change them.

## Send interaction signals

Send an interaction each time someone clicks, saves or rejects a result.

| Field | Required | What to send |
| - | - | - |
| `feature_id` | yes | The result's `document_id`. |
| `interaction_type` | yes | A list, such as `["click"]` or `["click", "bookmark"]`. |
| `position` | yes | The result's 0-based position in `documents`. |
| `execution_id` | with `retriever_id` | From the execute response. Without it, a retriever interaction gets a 422. |
| `retriever_id` | recommended | From the execute response. |
| `feature_uri` | for learning | The feature URI that found the result. Without it, the weights do not move. |
| `user_id` | for personal weights | Your id for the person. |
| `query_snapshot` | recommended | The search inputs. The demographic fallback reads `user_segment` here. |

This runs a search as one user and records a click on the top result:

```bash cURL theme={null}
RUN=$(curl -s -X POST https://api.mixpeek.com/v1/retrievers/photo-search/execute \
  -H "Authorization: Bearer $MIXPEEK_API_KEY" \
  -H "X-Namespace: $NAMESPACE_ID" \
  -H "Content-Type: application/json" \
  -d '{"inputs": {"query": "a rainy street", "user_id": "user_456", "user_segment": "editor"}}')

echo "$RUN" | jq '{status, warnings, documents: [.documents[] | {document_id, title, score}]}'

curl -X POST https://api.mixpeek.com/v1/retrievers/interactions \
  -H "Authorization: Bearer $MIXPEEK_API_KEY" \
  -H "X-Namespace: $NAMESPACE_ID" \
  -H "Content-Type: application/json" \
  -d "$(echo "$RUN" | jq '{
        feature_id: .documents[0].document_id,
        interaction_type: ["click"],
        position: 0,
        execution_id: .execution_id,
        retriever_id: .retriever_id,
        user_id: "user_456",
        query_snapshot: {query: "a rainy street", user_id: "user_456", user_segment: "editor"}
      } + (if .documents[0].feature_uri then {feature_uri: .documents[0].feature_uri} else {} end)')"
```

Under the static stage, documents carry no `feature_uri`, so these clicks only feed the evaluation dataset below. Under learned fusion, each document carries the `feature_uri` of the arm that contributed most, and the same code sends it. `POST /v1/retrievers/interactions/batch` takes a list.

## Switch to learned fusion

Change `fusion` to `learned` and add a `learning_config`. Learned fusion samples a weight per arm from what users rewarded.

```yaml photo-search stages, learned fusion theme={null}
    stages:
      - stage_name: search
        stage_id: feature_search
        parameters:
          searches:
            - feature_uri: "mixpeek://image_extractor@v1/google_siglip_base_v1"
              query:
                input_mode: text
                value: "{{INPUT.query}}"
              top_k: 50
            - feature_uri: "mixpeek://text_extractor@v1"
              query:
                input_mode: text
                value: "{{INPUT.query}}"
              top_k: 50
          fusion: learned
          learning_config:
            context_features: ["INPUT.user_id"]
            demographic_features: ["INPUT.user_segment"]
            min_interactions: 5
          final_top_k: 10
```

* `weight` and `fuse_on` are gone; learned fusion does not read them. It merges by document, so a photo found by both arms can come back twice.
* `learning_config` can be `{}`: per-user context on `INPUT.user_id`, Thompson sampling and the default reward map. The stage needs at least 2 searches.

With no interactions yet, every arm starts at a uniform Beta(1, 1) prior, so the first searches explore.

## Cold start and user context

Each search uses the most specific context with enough history, in this order (`fallback_strategy: hierarchical`, the default):

| `context_level` | When it applies |
| - | - |
| `personal` | The `user_id` has at least `min_interactions` interactions (default 5, range 1 to 100). |
| `demographic` | Fewer, and `demographic_features` (here `user_segment`) resolves. |
| `global` | Neither applies: one set learned from all users. |
| `shipped` | The evaluation gate shipped a trained weight set. |
| `none` | Shadow mode, or outside the rollout. |

`fallback_strategy: global` skips the demographic step; `context_features: []` learns one global set.

Every execute response under learned fusion carries `learned_fusion_context`, with `gate` (`serve`, `shadow` or `skip`), `sampled_weights`, `context_level`, `interaction_count` and `weights_source`:

```bash cURL theme={null}
curl -s -X POST https://api.mixpeek.com/v1/retrievers/photo-search/execute \
  -H "Authorization: Bearer $MIXPEEK_API_KEY" \
  -H "X-Namespace: $NAMESPACE_ID" \
  -H "Content-Type: application/json" \
  -d '{"inputs": {"query": "a rainy street", "user_id": "user_456", "user_segment": "editor"}}' \
  | jq '{status, warnings, learned_fusion_context, documents: [.documents[] | {document_id, feature_uri, score}]}'
```

## Weight the reward signals

`reward_map` sets how much each interaction type is worth to the arm that found the result. By default `purchase` earns 3.0, `add_to_cart` and `positive_feedback` 2.0, `click` 1.0, `skip` -0.5 and `negative_feedback` -2.0; [Tune relevance](https://docs.mixpeek.com/docs/retrieve/relevance.md) lists every type.

For a photo library, weight downloads above clicks:

```yaml photo-search learning_config, custom rewards theme={null}
          learning_config:
            context_features: ["INPUT.user_id"]
            demographic_features: ["INPUT.user_segment"]
            min_interactions: 5
            reward_map:
              click: 1.0
              long_view: 1.0
              save: 1.5
              download: 2.0
              positive_feedback: 2.0
              negative_feedback: -2.0
              skip: -0.5
```

> [!WARNING]
>
> A `reward_map` you set replaces the default map. A type you leave out earns 0. Every key must be a valid `interaction_type`, or saving the retriever fails.

`max_reward_per_interaction` (default 5.0), `decay_factor` (0.995 per day of age) and `decay_window_days` (365) bound how rewards add up.

## Roll out safely

**1. Shadow mode**

Weights are sampled and recorded with `gate: shadow`; results are ranked by `rrf`.

```yaml photo-search learning_config, shadow mode theme={null}
          learning_config:
            context_features: ["INPUT.user_id"]
            demographic_features: ["INPUT.user_segment"]
            shadow_mode: true
```

**2. Serve a share of traffic**

Turn shadow mode off and set `rollout_pct`. The split hashes `user_id`, so one user always lands on the same side.

```yaml photo-search learning_config, 10 percent rollout theme={null}
          learning_config:
            context_features: ["INPUT.user_id"]
            demographic_features: ["INPUT.user_segment"]
            shadow_mode: false
            rollout_pct: 10
```

**3. Ramp up or turn it off**

Raise `rollout_pct` to 100 once the evaluation below holds up. `rollout_pct: 0` turns it off and keeps its settings.

> [!WARNING]
>
> Searches outside the rollout and in shadow mode are ranked by `rrf` with no weights. Their documents carry no `feature_uri`, so clicks on them do not train the learner.

If learned weights take longer than `circuit_breaker_timeout_ms` (default 1000), the search falls back to static fusion.

## Watch the weights converge

Each execution keeps its `learned_fusion_context`:

```bash cURL theme={null}
curl -s -X POST "https://api.mixpeek.com/v1/retrievers/photo-search/executions/list?limit=20" \
  -H "Authorization: Bearer $MIXPEEK_API_KEY" \
  -H "X-Namespace: $NAMESPACE_ID" \
  -H "Content-Type: application/json" \
  -d '{"status": "completed"}' \
  | jq -r '.results[].execution_id' \
  | while read -r EXECUTION_ID; do
      curl -s "https://api.mixpeek.com/v1/retrievers/photo-search/executions/$EXECUTION_ID" \
        -H "Authorization: Bearer $MIXPEEK_API_KEY" \
        -H "X-Namespace: $NAMESPACE_ID" \
        | jq -c '{created_at, ctx: .learned_fusion_context | {gate, context_level, sampled_weights}}'
    done
```

Weights converge when they move less between searches as `interaction_count` grows. A weight near the 0.95 ceiling means users rarely act on the other arm's results.

## Measure learned against static

`generate-from-interactions` builds a dataset from queries with at least `min_interactions` positive interactions (default 5; use 1 for a few test clicks). `candidates` then scores several stage lists without saving them and returns one `evaluation_id` per candidate. Poll each until `status` is `completed` and compare `overall_metrics`, such as `ndcg_at_10`.

```bash cURL theme={null}
curl -s -X POST https://api.mixpeek.com/v1/retrievers/photo-search/evaluations/generate-from-interactions \
  -H "Authorization: Bearer $MIXPEEK_API_KEY" \
  -H "X-Namespace: $NAMESPACE_ID" \
  -H "Content-Type: application/json" \
  -d '{"dataset_name": "photo-search-clicks", "min_interactions": 1, "lookback_days": 30}' \
  | jq '{dataset_id, dataset_name, query_count}'

SEARCHES='[
  {"feature_uri": "mixpeek://image_extractor@v1/google_siglip_base_v1", "query": {"input_mode": "text", "value": "{{INPUT.query}}"}, "top_k": 50, "weight": 0.6},
  {"feature_uri": "mixpeek://text_extractor@v1", "query": {"input_mode": "text", "value": "{{INPUT.query}}"}, "top_k": 50, "weight": 0.4}
]'

curl -s -X POST https://api.mixpeek.com/v1/retrievers/photo-search/evaluations \
  -H "Authorization: Bearer $MIXPEEK_API_KEY" \
  -H "X-Namespace: $NAMESPACE_ID" \
  -H "Content-Type: application/json" \
  -d "$(jq -n --argjson s "$SEARCHES" '{
        dataset_name: "photo-search-clicks",
        evaluation_config: {k_values: [1, 5, 10]},
        candidates: [
          {name: "static-dbsf", stages: [{stage_name: "search", config: {stage_id: "feature_search",
            parameters: {searches: $s, fusion: "dbsf", fuse_on: "source_object", final_top_k: 10}}}]},
          {name: "learned", stages: [{stage_name: "search", config: {stage_id: "feature_search",
            parameters: {searches: ($s | map(del(.weight))), fusion: "learned", learning_config: {}, final_top_k: 10}}}]}
        ]
      }')" \
  | jq '.candidates'

# Then, for each evaluation_id printed above:
# curl -s https://api.mixpeek.com/v1/retrievers/photo-search/evaluations/$EVALUATION_ID \
#   -H "Authorization: Bearer $MIXPEEK_API_KEY" -H "X-Namespace: $NAMESPACE_ID" | jq '{status, overall_metrics}'
```

Learned fusion samples new weights on each search, so run the `learned` candidate more than once before you read a small gap as a win.

### Let the evaluation gate ship weights

Name the dataset (id or name) in `learning_config.evaluation_dataset_id`. On its evaluation schedule the platform trains a fixed weight set from this retriever's interactions and ships it only when it beats the live configuration on the dataset.

```yaml photo-search learning_config, evaluation gate theme={null}
          learning_config:
            context_features: ["INPUT.user_id"]
            demographic_features: ["INPUT.user_segment"]
            evaluation_dataset_id: photo-search-clicks
```

A shipped set appears as the read-only `learning_config.shipped_weight_set`, and searches report `context_level: shipped`. A refused set leaves the retriever unchanged.

## Next steps

> [card] [Tune relevance](https://docs.mixpeek.com/docs/retrieve/relevance.md)
>
> Interactions, fusion strategies and evaluations.

> [card] [Feature Search](https://docs.mixpeek.com/docs/retrieve/stages.md#feature-search)
>
> Every search, fusion and learning option for the stage this retriever uses.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.