RESEARCH · Implemented

Sparse Evidence Attention for Bounded Context Assembly

A source-backed account of eight-signal selection and bounded prompt assembly.

MLAI Research · Abbey · JUNE 2026 · 3 min read · research note

Practical summary

Prototype project recall or document assistance without placing every available record in a prompt.

Status

The described source behavior is implemented; customer outcomes and deployment readiness are not established.

Reviewed 2026-09-30

Practical context

A source-backed account of eight-signal selection and bounded prompt assembly.

Prototype project recall or document assistance without placing every available record in a prompt.

Implementation and research boundary

SEA combines semantic, keyword, metadata, recency, authority, graph, contradiction and task-fit signals. Task-aware scoring adjusts selected task weights before bounded selection. The learning loop separately persists adaptive persona-router weights; these are not evidence that the eight retrieval weights were trained on a quality benchmark.

The recall path estimates token cost from bytes and limits the assembled preamble by bytes. Task-aware retrieval scoring and the persisted adaptive persona router are separate mechanisms. No measured answer-quality improvement is asserted.

Score construction and its interpretation

The eight dimensions are semantic, keyword, metadata, recency, authority, graph, contradiction and task fit, in that order. Default weights sum to one. Code-repair, project-recall and benchmark-review adjustments are additive and are not renormalized by adjust_weights_for_task; the final score is clamped. A score of one is therefore a saturated heuristic, not calibrated confidence. In generic-store recall, self-asserted authority metadata is observed but not trusted: those candidates are scored with inferred authority.

s(c)=\mathrm{clamp}_{[0,1]}\left(\sum_{i=1}^{8}w_i x_i(c)\right)
w=(0.30,0.15,0.15,0.10,0.10,0.10,0.05,0.05)

Selection under several budgets

The selector orders candidates by descending score and breaks ties by stable record identifier. Duplicate identifiers do not consume budget twice. A candidate is rejected when the record cap or estimated token budget would be exceeded. The per-cluster diversity cap has an explicit exception for scores at least 0.92; it is not an unconditional diversity guarantee. Returned selected and rejected identifier lists share an aggregate reason, not a detailed per-candidate explanation.

Token estimates use snippet byte length divided by four, rounded upward with a minimum of one. Prompt construction applies its own byte limit afterward. For example, under a ten-token budget, candidates costing eight and five estimated tokens cannot both fit; greedy order may select the first and reject the second even if another combination would be preferable.

\widehat{T}(x)=\max(1,\lceil |x|_{\mathrm{bytes}}/4\rceil)
\sum_{c\in S}\widehat{T}(c)\leq B

Evaluate retrieval and generation separately

Build fixtures for duplicate hits, tied scores, absent timestamps, self-asserted authority, conflicting records and an empty store. Keyword overlap counts significant query tokens matching case-insensitive substrings; it is not a unique-set intersection metric. Recency is relative to the latest candidate timestamp, not automatically wall-clock age. Inspect selected identifiers and the final prompt bytes before evaluating the resulting answer with a separate rubric. The EMA router update in the learning loop does not establish that evidence relevance improves over time.

Evaluation before adoption

Use a documented corpus with relevant, irrelevant, conflicting and missing evidence. Review selected context and bounded behavior alongside answer quality; a successful selection test alone is not a hallucination-reduction result.

Limitations

  • Token costs are estimates; the implementation also enforces a prompt-byte boundary.
  • Scoring heuristics do not guarantee relevance, truth or improved answer quality.
  • The recall path estimates token cost from bytes and limits the assembled preamble by bytes. Task-aware retrieval scoring and the persisted adaptive persona router are separate mechanisms. No measured answer-quality improvement is asserted.

Supporting sources