My embedding search beat keyword search on 1,222 chunks of notes and lost to it on the full collection of 57,562
I built a hybrid retrieval engine over my own working notes. It combines keyword search with embedding-based search, which compares numeric representations of what each passage means, and I measured how well it finds things. On a 1,222-chunk development set the embedding side beat keyword search. On the full collection of 57,562 chunks, a ten-question probe found the reverse: keyword search alone beat every hybrid configuration I tried, and four of the five paraphrased questions returned nothing useful. On paraphrased questions, a labelled evaluation that followed put keyword search ahead on one score and the re-ranked hybrid slightly ahead on another.
Results on the development set and on the full collection
The notes are split into chunks (short passages of text). On a development set of 1,222 chunks from 82 Claude Code sessions, I tested seven paraphrased questions, which describe a memory in different words from the ones I originally wrote. On nDCG@10, a 0-to-1 score of how well the top ten results rank relevant passages, the embedding side scored 0.731 and keyword search 0.436.
The first test on the full collection was a probe: ten questions, five keyword-shaped and five paraphrased, with the top three results judged by hand. The production default returned something useful for five of the ten. Four of the five paraphrased questions, the case the embedding side was built for, returned nothing useful.
| Search method | Rank of the correct answer · 5 paraphrase questions in the probe |
|---|---|
| Keyword (BM25, a standard keyword-ranking formula) | 3 · 1 · 1 · 5 · 1 |
| Embedding | >200 · 7 · 2 · 107 · 1 |
Here the correct answer is any chunk containing a known key term, such as
nohup, so this is a rough check; >200 means no such chunk was in that
method’s top 200. Keyword search alone beat every hybrid configuration in the probe,
the reverse of the development-set result. My working explanation is that at this size
embedding similarity scores stop separating good matches from bad ones.
A labelled evaluation followed: 20 questions written before looking at the notes, the top five results of five configurations pooled, and each result graded by Claude 0 (irrelevant), 1 (related) or 2 (the memory wanted). On the paraphrased questions, keyword search alone scored 0.422 nDCG and 0.300 Hit@1 (the share of questions whose first result was relevant). The hybrid that always re-ranks scored 0.447 and 0.200.
For several of the failed questions, the answer was in a file the index returns for other questions. The collection held the answer, and the system did not connect a paraphrased question to a document it already had.
How the investigation went
- My first explanation was that the larger collection was diluted by lower-quality material. Restricting the search to the single highest-quality source of notes did not improve results in that run, so I rejected that explanation.
- A diagnostic then separated answers that were never retrieved (a recall problem) from answers that were retrieved and ranked too low (a ranking problem). In the probe the misses were ranking problems. In the labelled evaluation, half the paraphrased questions had no relevant passage in any configuration’s top five.
- A query-adaptive router, the component that decides for each question whether to run the expensive re-ranker, had been shipped as the default. It ran the re-ranker only when a question looked like a keyword search, and it had been tuned on a 1,271-chunk snapshot. In the labelled evaluation it scored worst of six configurations on paraphrased questions: 0.000 Hit@1, against 0.200 when the re-ranker always ran. The same day I made always re-ranking the default, at about three seconds per query.
- A code review found that the scorer retrieved deeper than the set of results that had been judged. The re-ranked configuration was returning documents nobody had graded and was marked wrong for them. Fixing the bug raised its paraphrase nDCG from 0.352 to 0.447, above keyword search alone at 0.422.
Evaluation methods used
Questions about the method? Email is best — [email protected] · Back to portfolio