Jump to the manifest
feedback-loop.namespace.yaml: apply it with one API call, then read the walkthrough below to change it.At a glance
How the pieces connect
Buckets hold what you upload, collections turn it into searchable documents, and retrievers answer queries over the collections.Deploy it
1
Get the manifest
2
Validate it
Validate runs every check apply runs and creates nothing. Fix each entry in
errors, then run it again.3
Apply it
Apply creates every resource in one call. The response lists each resource with its outcome in
wait_for_seed=true also waits until the sample objects are processed, so the first query below has documents to return.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 runphoto-search. Check status and warnings along with documents: a run that times out still answers 200, with status degraded.
Add your own data
Each object you add to a bucket is processed by every collection that reads it. This adds one object tophotos. NAMESPACE_ID is the id from the namespace lookup above.
PENDING until processing finishes, then COMPLETED or FAILED. Buckets and objects 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
Searches: photo-visual, photo-captions
Collections
Each collection runs one extractor over a bucket, or over another collection’s documents.photo-visual
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 v1.Inputs: image ← imageCopied onto each document: title, captionphoto-captions
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 v1.Inputs: text ← captionCopied onto each document: titleThe manifest
Every resource above comes from this file. Change it and apply it again with?mode=upsert to update what exists. Manifests documents each field.
feedback-loop.namespace.yaml
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 athttps://mixpeek.com/docs/templates/feedback-loop.md.
Prompt
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: dbsfscales each arm’s scores to 0 to 1 before weighting, since SigLIP and the text model score on different scales.fuse_on: source_objectadds up evidence per bucket object. A photo found by both arms comes back once.user_idanduser_segmentare declared ininput_schemanow, unused, so switching to learned fusion later changes no inputs.
?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.
This runs a search as one user and records a click on the top result:
cURL
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
Changefusion to learned and add a learning_config. Learned fusion samples a weight per arm from what users rewarded.
photo-search stages, learned fusion
weightandfuse_onare gone; learned fusion does not read them. It merges by document, so a photo found by both arms can come back twice.learning_configcan be{}: per-user context onINPUT.user_id, Thompson sampling and the default reward map. The stage needs at least 2 searches.
Cold start and user context
Each search uses the most specific context with enough history, in this order (fallback_strategy: hierarchical, the default):
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:
cURL
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 lists every type.
For a photo library, weight downloads above clicks:
photo-search learning_config, custom rewards
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.photo-search learning_config, shadow mode
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.photo-search learning_config, 10 percent rollout
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.circuit_breaker_timeout_ms (default 1000), the search falls back to static fusion.
Watch the weights converge
Each execution keeps itslearned_fusion_context:
cURL
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.
cURL
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) inlearning_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.
photo-search learning_config, evaluation gate
learning_config.shipped_weight_set, and searches report context_level: shipped. A refused set leaves the retriever unchanged.
Next steps
Tune relevance
Interactions, fusion strategies and evaluations.
Feature Search
Every search, fusion and learning option for the stage this retriever uses.

