Repository navigation
Description
Correction
The first version of this issue said the evaluation needs a provider and an API key. That was wrong: cora's embeddings are local. brain.embedding is auto, hashing (256d hashing trick, default, no dependency) or pretrained (768d static token vectors distilled from nomic-embed-code, compiled in behind the pretrained-embed feature). No network or key is involved, and the vector signal is optional: keyword and graph signals work without it.
What problem does this solve?
Split out of #717 (item 3). cora brain now reduces a question to its content words, returns results in rank order and reports which signals answered, but the quality of the vector signal was never measured. With the default hashing embedding the vector hits are weak, and the signal is only halved in the fusion as a stopgap.
Proposed solution
- Build a fixed question set with the expected answer symbols, from this repository and from real tasks on a multi-crate workspace (the questions in cora code intelligence on tole (0.20.0): measured accuracy, noise and what to optimise tole#669), kept as a regression fixture with a scoring script (top-k hit rate and rank of the expected symbol). Runs offline.
- Compare on that set, all CPU-only:
hashing(current default) andpretrained(current static nomic vocabulary);- a Model2Vec static code model,
minishlab/potion-code-16M-v2(16.2M parameters, 256 dimensions, MIT, distilled from CodeRankEmbed), loaded with themodel2vec-rscrate, which can load from bytes and quantize to int8. Its published training corpus has six languages and no Rust, so the Rust result must be measured, not assumed; - optionally a transformer code model through ONNX (
jinaai/jina-embeddings-v2-base-code, 161M parameters, 30 languages including Rust, supported byfastembed-rs) as an opt-in heavy backend, to see what the extra cost buys.
- Tune the RRF constant and the per-signal weights (keyword, vector, graph) on the set and decide whether the half weight for the hashing embedding stays.
- Record model, dimensions, index time, binary or download size and hit rate in the docs.
Alternatives considered
Keep hashing and the fixed half weight. That is the current state; it is cheap but unmeasured.
Before submitting
- Follow-up of feat(code-intel): rank
exploreexact matches first, drop std-method noise fromquery, check whybrainreturns unrelated vector hits, grouparchbelow the top directory #717; the keyword, ordering, diagnostics and warnings parts are done in the mergedbrainchange.
Activity
[-]feat(code-intel): evaluate a code embedding model and the RRF weights for `brain` on a fixed question set[/-][+]feat(code-intel): evaluate local code embedding backends and the RRF weights for `brain` on a fixed question set[/+]chore(spike): evaluate local code embeddings against cora's backends (#…
feat(code-intel): make the potion-code-16M-v2 code model the default …
chore(spike): compare one global vector file against one file per pro…
chore(spike): stop prod_brain.py on a failed run instead of scoring i…
chore(spike): keep the embedding and vector-layout spikes as a record (…