The statistics behind the search mode comparison, in plain terms.
nexusbrain search has three modes: conservative, balanced and tokenmax. They trade cost and speed against how much the search does for each query. To say one mode is better than another, you need more than two averages that look different; you need to know whether the gap is bigger than chance.
This page explains, in plain terms, how the modes are compared: what is measured, how a paired bootstrap estimates the uncertainty, why the Bonferroni correction is applied, and how to read a result. It ends with the commands to record and view a comparison yourself.
longmemeval, a captured NDJSON file for replay).Each mode is run over the same set of test questions from an eval suite. The suites that depend on the search mode are longmemeval (a public long-term memory benchmark) and replay (your own captured queries replayed against the current brain). brainbench does not depend on the search mode, so it is run once and recorded with mode n/a.
Because every mode answers the same questions, results can be compared question by question. That pairing is what makes the statistics below work.
The published method covers 3 modes and 4 metrics, which makes 12 comparisons.
| Retrieval metric | In plain terms | Range |
|---|---|---|
precision@k | Of the top k results, what fraction were relevant. High precision means little junk at the top. | 0 to 1, higher is better |
recall@k | Of all the relevant results that exist, what fraction appeared in the top k. High recall means few missed answers. | 0 to 1, higher is better |
mrr | Mean reciprocal rank: how far down the list the first relevant result is, on average. 1.0 means always first; 0.5 means typically second. | 0 to 1, higher is better |
ndcg@k | Like precision, but with more credit for putting good results near the top. | 0 to 1, higher is better |
jaccard@k | Used by replay: how much two result lists overlap. 1.0 is identical, 0.0 is no overlap. | 0 to 1, higher is more stable |
top1_stability | Used by replay: the share of queries whose first result is the same in both runs. | 0 to 1, higher is more stable |
Suppose balanced scores 0.81 recall and conservative scores 0.78. Is that a real improvement, or would a different set of questions have flipped it? A bootstrap answers this by pretending to rerun the benchmark many times on new question sets, using only the questions you already have.
Paired means each resample keeps both modes' results for the same question together. Hard questions stay hard for both modes, so the comparison measures the difference between modes, not the difference between easy and hard questions.
For each question, take mode A's score minus mode B's score.
Each resample draws the same number of questions at random, with replacement, so some questions appear twice and some not at all. Compute the average difference for that resample.
The middle 95% of them is the 95% confidence interval: the range the true difference probably falls in.
The share of resamples that land on the other side of zero gives the p-value: how likely it is that the gap is just noise.
| Statistic | Meaning | How to read it |
|---|---|---|
p_value | How likely the observed difference between two modes is just noise. | Lower is stronger evidence. Below 0.05 is the common threshold; below 0.01 is strong. |
confidence_interval | The range we are 95% sure the true value falls inside, from bootstrap resampling. | A pair [low, high]. Narrower is more reliable. If 0 is inside the interval for a difference, the difference is not significant. |
Every comparison has a small chance of looking significant by luck. With a 0.05 threshold, that chance is 1 in 20 for each one. Run 12 comparisons and a false win somewhere becomes likely.
The Bonferroni correction fixes this by sharing the 0.05 across all 12 comparisons: a single comparison counts as significant only when its p-value is below 0.05 divided by 12, about 0.0042. Equivalently, multiply each p-value by 12 and compare it with 0.05.
Bonferroni is strict on purpose. It sometimes misses a small real difference, but when it says a mode is better, you can trust the claim.
tokenmax.avg_tokens, cost_per_query_usd and p99_latency_ms show what each mode charges for its results.Comparison results live in .nexusbrain-evals/eval-results.jsonl at the root of your git repo (or the current folder when you are not in a repo). Your personal brain is never touched.
It first prints a cost estimate and the budget caps (default $5 for retrieval and $20 for answer generation). A sweep over the cap is refused unless you pass --yes, and, when not in a terminal, an explicit --budget-usd-retrieval or --budget-usd-answer.
nexusbrain eval run-all --modes conservative,balanced,tokenmax --suites longmemeval,replay --seed 42You should see[eval run-all] cost estimate: and budget caps: lines, then one line per suite and mode such as [eval run-all] <commit>-longmemeval-balanced-42: skipped, then complete. Audit trail: and the results file path.
In this version run-all records longmemeval and replay as skipped placeholders and does not run them for you. Run the suite commands yourself with --mode.
nexusbrain eval longmemeval longmemeval.jsonl --mode conservative --output lme-conservative.jsonl
nexusbrain eval longmemeval longmemeval.jsonl --mode balanced --output lme-balanced.jsonl
nexusbrain eval longmemeval longmemeval.jsonl --mode tokenmax --output lme-tokenmax.jsonlYou should seeOne output file per mode. For replay, use nexusbrain eval replay --against captured.ndjson --mode <mode>.
eval compare reads every line that has run_id, suite and mode, and shows status, ran_at and the numbers in a metrics object. When the same suite and mode appear more than once, the most recent ran_at wins.
{"run_id":"abc1234-longmemeval-balanced-42","ran_at":"2026-09-17T10:00:00Z","suite":"longmemeval","mode":"balanced","commit":"abc1234","seed":42,"status":"completed","metrics":{"recall@10":0.81}}nexusbrain eval compareYou should seeA markdown report starting # Search Mode Comparison, with a section per suite, a table of mode, status, run id and time, then each metric listed per mode to 4 decimals with a Plain English: explanation.
| `eval compare` flag | What it does |
|---|---|
--runs id1,id2 | Only these run ids. |
--modes M1,M2 | Only these modes. |
--suite S | Only one suite: longmemeval, replay or brainbench. |
--md | Markdown output (the default). |
--json | JSON with the records, the grouped view, the metric glossary and the methodology note. |
--input PATH | Read a different results file, or a folder containing eval-results.jsonl. |
eval compare lays the modes side by side and names the method in its JSON output, but it does not compute p-values or confidence intervals itself in this version. Apply the paired bootstrap to the per-question outputs from each suite run to get them.
_No eval-results.jsonl found at <repo>/.nexusbrain-evals/eval-results.jsonl._Run nexusbrain eval run-all first, run the command from inside the same git repo, or point at the file with --input PATH.
_No metric data yet under a suite.The records for that suite are the skipped placeholders from run-all. Add a completed record with a metrics object for each mode, as shown above.
BrainBench is recorded with mode n/a, which the markdown table does not show. Use nexusbrain eval compare --suite brainbench --json and read the records list.
[eval run-all] REFUSED: followed by a message that the estimate exceeds the caps.Pass --yes, and raise the caps with --budget-usd-retrieval N or --budget-usd-answer N. --limit N lowers the estimate by assuming fewer questions per suite.
--modes: <name> is not valid.Use only conservative, balanced and tokenmax, separated by commas.