Surprisal sampling: embedding-backed strategies #944

Closed
opened 2026-10-27 13:38:24 +00:00 by sam · 0 comments
Owner

Implement the embedding-backed surprisal strategy behind the Sampler seam that wave 1 of the curator epic ships (cheap strategies: recency, random, all, staleness proxy). Surprisal scores memories by how surprising they are so the sampled reasoner's agentic budget is spent on the memories most likely to matter. DEFERRED by design: gated behind the embeddings capability (sibling issue 'Embeddings capability (prerequisite for surprisal sampling)') — pick up only after that lands.

Acceptance Criteria

A Sampler implementation behind the same interface as the cheap strategies; selection is deterministic given fixed inputs. Algorithm: sample up to a candidate cap; build a k-NN graph over embedding vectors; row-normalize the adjacency with self-loops; power-iterate to the stationary distribution; surprisal = -log(stationary probability of the nearest point); select the highest-surprisal items. Degradation: content with no embedding is skipped; an embedding failure aborts sampling and falls back to free exploration - a sampling failure must never fail or crash a curator pass. Cost: the graph build is quadratic in the candidate cap; the cap is a named constant with a documented bound. Tests use synthetic vectors via httptest, never a live embedding service.

Close reason

Closed


Imported from beads archie-core-1786637500776-416-600a66e5 · GitHub #437 · type task · priority P2 · created 2026-08-08 · closed 2026-10-05

Implement the embedding-backed surprisal strategy behind the Sampler seam that wave 1 of the curator epic ships (cheap strategies: recency, random, all, staleness proxy). Surprisal scores memories by how surprising they are so the sampled reasoner's agentic budget is spent on the memories most likely to matter. DEFERRED by design: gated behind the embeddings capability (sibling issue 'Embeddings capability (prerequisite for surprisal sampling)') — pick up only after that lands. ### Acceptance Criteria A Sampler implementation behind the same interface as the cheap strategies; selection is deterministic given fixed inputs. Algorithm: sample up to a candidate cap; build a k-NN graph over embedding vectors; row-normalize the adjacency with self-loops; power-iterate to the stationary distribution; surprisal = -log(stationary probability of the nearest point); select the highest-surprisal items. Degradation: content with no embedding is skipped; an embedding failure aborts sampling and falls back to free exploration - a sampling failure must never fail or crash a curator pass. Cost: the graph build is quadratic in the candidate cap; the cap is a named constant with a documented bound. Tests use synthetic vectors via httptest, never a live embedding service. ### Close reason Closed --- _Imported from beads `archie-core-1786637500776-416-600a66e5` · GitHub #437 · type task · priority P2 · created 2026-08-08 · closed 2026-10-05_
sam added the mediumtask labels 2026-10-27 13:38:24 +00:00
sam self-assigned this 2026-10-27 13:38:24 +00:00
sam closed this issue 2026-10-27 13:38:24 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sam/archie#944