spike: the rag store on Cozo-SQLite HNSW, measured against the design's pass bar (macula-ci-images#19) #1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "ceres/19-rag-cozo-spike"
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?
Purpose (spike): decide, with measurements, whether Cozo 0.7.6's persisted HNSW index on its SQLite
engine is good enough to replace mcl-rag's barrel_vectordb index — macula-io/macula-ci-images#19,
step 1c, design §2 (mcl-rag). Nothing is deployed and no service file changes: this branch is the
instrument and its report. No merge needed; the decision it informs is recorded on #19.
DECIDED 2026-11-23 "Yes, build it (Recommended)" (off-rocksdb-design-go), carried by the Supervisor's
"come on, delegate some work!".
What is here
spike/export/export_chunks.erl— opens a COPY of today's store with the ship image's own barreland writes one JSON line per vector:
{"id","type","topics","vec"}. Never the live store.spike/cozo-hnsw/— a Rust program oncozo = "0.7"withstorage-sqlite(Cargo.lock committed:cozo 0.7.6). Builds the index from the export, then measures every line of the pass bar and writes
them to a JSON report.
spike/cozo-hnsw/src/bin/— four follow-up probes that explain a number on the FINISHED databaserather than re-measure it:
probe_replace_unique(replace with donors no other row shares),probe_heal(why a row is unfindable, and:rm+:putvs a repeat:put),probe_paths(fourwrite paths on disjoint sets, each check repeated after a reopen),
probe_scan(the exactbrute-force fallback, timed at three sizes).
spike/VERDICT.md— the pass bar line by line, each number with the command that produced it,plus the engine facts that cost a run each.
Verdict (full table and commands in
spike/VERDICT.md)The exact scan is taken, on its own merits: it meets the bar with no index to trust, and it is the
design's own fallback. Cozo is not condemned by this spike — where measured it does what the design
wanted (33 ms open instead of 39 minutes) — and its delete/replace line is not proven either way:
0.8% self-miss at k: 10 is the index's own recall@10, only two rows were shown unreachable at
k: 200, there is no never-rewritten control, Cozo 0.7.6's
:putmakes the four write paths one, andno probe writes a new vector.
:replacerefusing the indexed relation is an engine fact, not anupsert path.
Notes for the reviewer
result a Cozo defect,
:replaceis out of the reasons, the README's older aggregate is replaced bythis round's numbers, and the log name is corrected. The limits that remain are named in
spike/VERDICT.md: measured at k: 10 / ef: 50, no never-rewritten control, one write path, nonew-vector write,
probe_replace_uniquedoes not reopen.has_actionsfalse), and its workflows are still the github.com shape. The instrument is reproducible from
spike/README.mdon msi00; the report it produced, with its sha256, is named inspike/VERDICT.md.The export's shapes are taken from the pinned deps, not guessed: barrel:open returns {ok, Db}, fold_docs calls the fun as Fun(Doc, Acc) -> {ok, Acc}, and vector_get returns a {ok, #{vector := [float()]}}. A doc that does not fit is counted and named, never allowed to end a run that spent the store's open first. The Cozo side needed its own corrections, each found by running it: the sqlite engine takes a database FILE, the option is keep_pruned_connections, a search query goes in as vec($q), a filter may only read symbols the search binds (so topics is bound), :put demands every column, and $rows is a list of rows. Also measured honestly what the design's bar can flatter: every query is a stored vector, so recall_at_10_excluding_self drops the free self-hit; the sqlite open is lazy, so the restart number is open plus the first answered query; and a search that ERRORS after a delete is counted, not skipped.Landed --no-ff at
50e62d66(parentsd15f57f1main,2fca69b7PR head) by Terra.Reviews ran by direct message: Uranus PASS r=2 d15f57f..fd028d5 (with Ceres PASS of the reviewer fix), Uranus PASS r=3 fd028d5..2fca69b (README line 1 = evidence record). mcl-rag has no CI, so there are no runs. Main read back by ls-remote =
50e62d66.