One search that answers any shape of question about the code #2
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Due date
No due date set.
Dependencies
No dependencies set
Reference
azer/ripsem-forge-archive!2
Loading…
Reference in a new issue
No description provided.
Delete branch "retrieval/experiment-run"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Turns
searchinto a single retrieval primitive that answers "where is the codethat does X" whether X is an identifier, an error string, a half-remembered name,
or a plain-language description. Previously only one of those shapes worked well
depending on which retriever you happened to hit.
What changed
A lexical arm, fused with the vector arm.
src/lexical.rsadds code-awareBM25 over per-chunk term vectors, and
searchmerges the two retrievers by rankfusion rather than exposing them as separate tools. An adjacent "second opinion"
tool is one agents skip, so there is one ranked call and no exhaustive regex mode.
A symbol layer.
src/symbol.rsnames the declaration each chunk belongs toand carries that name as a searchable term, so a result can say which function it
is rather than just which byte range.
Documentation indexed as records of its own. Doc comments and docstrings
become separate short records pointing at the same declaration. This is the
single largest gain in the run (0.679 → 0.733, every corpus improved), and a 2×2
showed why: doc records alone +0.009, BM25 length normalisation alone +0.009,
together +0.054. A doc record is a short document naming a declaration, which is
exactly what the length term rewards.
Declarations ranked above the prose describing them. Chunks belonging to a
declaration now outrank those that do not (0.735 → 0.785, every corpus and every
query shape improved). This came from dumping the results for every unanswered
question rather than theorising: 18 of 50 top-5 slots were documentation or
manifests and 9 were tests, against 23 of code. Both retrievers prefer prose
honestly — a changelog repeats the question's words better than the function does.
Deduplication and tie-breaking. One result per place instead of per record,
and ranking ties broken by confidence.
Indexing fixes. Machine-written files (lockfiles, generated output) are
excluded by default, and internal-path filters are judged relative to the index
root instead of the process CWD.
Measurement
tests/retrieval_quality.rsis the substance of this branch: 73 labelled queriesin 4 shapes across 4 pinned corpora (ripsem's own
src, requests v2.34.2,gorilla/mux v1.8.1, got v14.4.5), 2304 chunks.
Reading cost to reach the answer: 439 bytes, against 14410 for the whole file it
lives in.
Which arm is stronger reverses between repositories — BM25 wins on Go and
Rust, the embedding model wins decisively on Python (requests: 0.747 vs 0.531),
TypeScript is level. An earlier README claim that BM25 beats the model on real
code was an artefact of only ever measuring ripsem's own Rust source. Merged is
not best on every corpus (it costs 0.034 on requests); it wins because nothing
tells you in advance which arm a given repository needs.
Reviewer notes
ripsem's live source and moved with every commit, so two runs a few commits
apart were not comparable — that confounding sent two decisions the wrong way.
Never compare numbers across a corpus change.
index in place and cargo parallelises tests, so a whole-file run had two
measurements overwriting each other and reporting plausible wrong numbers. The
harness mutex that serialises them is load-bearing; don't replace it with
--test-threads=1.rule preferring source is partly rewarded by construction.
missesdiagnostic test is deliberately kept. It distinguishes "absentfrom every arm at any depth" (an indexing problem) from "sitting at rank 40" (a
scoring problem) — a distinction the aggregate MRR cannot make.
docs:only, recording measured dead ends so they are notretried: a larger embedding model (bge-base-en-v1.5 is the best arm alone at
0.564 vs 0.547 and the worst merged at 0.628 vs 0.679), a context header on the
embedded text, and arm-competence weighting.
Open problems
Descriptions in the reader's own words remain the weakest shape at 0.595, and
eight labelled questions still miss the top five — only one of those is a true
retrieval failure, the rest are indexed but ranked below five. Messages are still
better served by lexical alone (1.000 vs 0.944) and misremembered names by vector
alone (0.750 vs 0.702): rank fusion counts absence from an arm as evidence
against a hit, so a silent arm votes down what the other found. Nothing folds
plurals, so
modelsdoes not reachModelInfo.