Skip to content

Eval

A context strategy is a claim about accuracy and cost, so it should come with numbers. ContextEval runs a labeled question set through several configurations.

  • Level 1 makes no model calls. For each configuration and budget it reports recall of the evidence, precision per token, how often distractors and superseded policies get in, tokens per call, and how much of the prompt prefix consecutive calls share.
  • Level 2 also answers every question with a chat model and has a judge grade the answer against a reference.

Run on 2026-10-15 with all-MiniLM-L6-v2 embeddings on the Nimbus corpus that ships with astromesh-rag (commit a86bfba): 60 cases at budgets of 750, 1000 and 2000 tokens.

Terminal window
uv run --extra eval astromesh-context eval --level 1 --embedder st --out results/
configbudgetrecallprecision/tokendistractor ratesuperseded ratenoise sharetokens/callcandidate tokensprefix reusestable tokens
everything7500.5500.0720.3500.0000.040748.7003150.4331.000512.000
everything10000.6530.0680.6500.0000.074996.8503150.4331.000512.000
everything20000.7500.0411.0000.0330.1401980.3833150.4331.000512.000
fixed_slots7500.3330.0470.2830.0000.031694.2003150.4331.000512.000
fixed_slots10000.6060.0710.4670.0000.045893.8333150.4331.000512.000
fixed_slots20000.7250.0480.9000.0330.1011642.4333150.4331.000512.000
scored_knapsack7500.5500.0720.3500.0000.040748.7173150.4331.000512.000
scored_knapsack10000.6530.0680.6500.0000.074996.8503150.4331.000512.000
scored_knapsack20000.7500.0411.0000.0330.1401980.3833150.4331.000512.000
scored_knapsack_density7500.2670.0300.5330.0000.057740.2673150.4331.000512.000
scored_knapsack_density10000.6440.0660.7330.0000.094985.6833150.4331.000512.000
scored_knapsack_density20000.7500.0411.0000.0330.1391971.4173150.4331.000512.000

everything here is truncated to the budget, and candidate tokens is what the sources proposed before any policy ran, so every budget is a squeeze.

  • One budget filled by calibrated score beats fixed per-source slots at tight budgets. Recall is 0.550 against 0.333 for fixed_slots at 750 tokens, 0.653 against 0.606 at 1000 and 0.750 against 0.725 at 2000. The price is more distractors (0.350 against 0.283 at 750, 0.650 against 0.467 at 1000), and at 1000 fixed_slots has slightly better precision per token (0.071 against 0.068).
  • Cross-source dedupe by containment, plus the deprecation flag inherited by the copy that stays, keeps superseded policies out of the window: superseded_rate is 0.000 at 750 and 1000 and 0.033 at 2000 for every configuration. Before this change it was 0.15 to 0.52, in the maintainer’s run at commit 170d40a.
  • prefix reuse is 1.000 on every row by construction: in this eval only the system prompt and the OKF index are stable, and both are pinned. It shows that the ordering keeps the stable block byte-identical across calls, not a cache-hit rate under realistic churn.
  • scored_knapsack ties everything truncated on recall, precision and distractor rate on every row (tokens per call differ by under 0.1 at 750), because both fill by score order. What the knapsack adds over truncation is caps, minimums and floors per source, not a better ranking.
  • Weighting by value per token (scored_knapsack_density, beta=0.5) lost at tight budgets on this corpus: recall 0.267 against 0.550 at 750, 0.644 against 0.653 at 1000, and a tie at 2000. That is why the default is beta=0.

This is one corpus, one embedder and 60 cases. It compares policies against each other; it is not a claim about your data. Run it on yours.

Level 1, no model calls:

Terminal window
astromesh-context eval --level 1 --embedder st --out results/

Level 2, answering and judging with an OpenAI-compatible chat model:

Terminal window
CTX_EVAL_BASE_URL=... CTX_EVAL_API_KEY=... CTX_EVAL_MODEL=... CTX_EVAL_JUDGE_MODEL=... \
uv run --extra eval astromesh-context eval --level 2 --embedder st --out results/

Both need the eval extra.