Skip to content

Architectural decisions and optimization history

Architectural decisions are tracked in this directory. Each ADR records the motivation, accepted/rejected options, behavior and compatibility constraints, and evidence available at the time. Later ADRs or addenda explicitly identify decisions they supersede. Benchmark dates and environments matter: historical results describe their measured revisions, rather than the latest commit.

Decision index

ADR Decision Status
0001 Search hot paths, filtering, batching, storage/concurrency, and later performance work Accepted, with subsequent corrections/addenda
0002 Optional IVF indexing per collection Accepted; fan-out cost corrected by 0005
0003 Exact fp16 rescoring and two-stage full-query BM25 Accepted; native scorer in 0004, relative fusion in 0007
0004 Native BM25/tokenizer with Python reference and bit parity Accepted
0005 Parallel IVF shard searches, intersections, and upstream stance Accepted
0006 Free-threaded Python evaluation and flag-selected image Experimental opt-in; reevaluated 2026-11-08
0007 Relative fusion, document filters, small-set exact search, lifecycle and NFS contracts Accepted
0008 Pydantic native ingest JSON parsing with compatibility fallback Accepted
0009 Reuse validated ingest vectors until journal encoding Accepted
0010 Encode hydrated search hits directly; retrieval-only optimization Accepted
0011 Evaluate expansion read batching and sibling-vector reuse Historical; sibling reuse followed up in 0019
0012 Evaluate bounded per-search sibling-vector reuse Historical PR #10 closed unmerged; current port accepted in 0019
0013 Bound and coalesce warm scope-only vector searches Accepted; retrieval baseline from 2026-11-05
0014 Add bounded OR of metadata substring alternatives Accepted; retrieval capability, PR #12
0015 Opt-in metadata keys in every BM25 path, with transactional PATCH Accepted after Sofia DEV validation; merged in PR #14
0016 Reuse a shared native JSON request parser for search Accepted; merged in PR #13 and included in 0.3.0 DEV acceptance
0017 turbovec 1.1.2: staged 4-bit search on, v8 index files (one-way), raggio 0.4.0 Accepted; flat search 2.3× faster on the 2.55M arxiv corpus
0018 Retire deleted directories before name reuse; retry only transient embedding failures Accepted; issues #1/#4 fixed, #2/#5 already addressed
0019 Reuse request-scoped sibling vectors after current-main real-data and regression checks Accepted; historical PR #10 remains preserved
0020 Opt-in metric: "dot" per collection: float32 vectors kept as sent, hits re-ranked by their dot product Accepted; merged in PR #21

ADRs 0011–0012 archive the expansion experiments and sibling-vector reuse from PR #10, closed without merging on 2026-11-05 because Sofia does not use ranked sibling expansion and representative deployment benefit remained unvalidated. The old branch and raw evidence are retained. ADR 0019 later adopts a fresh current-main sibling-reuse port after new measurements; ADR 0013 independently targets Sofia's summary-search path.

Current retrieval baseline

The current runtime is 0.4.0: 0.3.0 with turbovec 1.1.2 (ADR 0017). It was measured against 0.3.0 on 2026-11-08 on both public benchmarks, on images that differ only in raggio's version and turbovec:

  • arxiv, 2.55M vectors: flat search p50 18.5 → 8.0 ms, concurrent QPS 149 → 321 at a third of the CPU per query, recall@10 unchanged, memory 32 MB lower. IVF unchanged.
  • Document benchmark: summary search CPU per query and tails lower, one-document and chunk figures within the spread, about 14 MB more memory, and flat recall@100 0.99988 → 0.99984–0.99986.

Index files move to turbovec's v8 format, which 0.3.0 cannot read (upgrade notes). The README, the arxiv table and the document benchmark show 0.4.0's medians. The 0.3.0 paragraphs below describe the previous baseline.

The previous accepted runtime is 0.3.0, PR #14's 2939c3c including native search JSON parsing from PR #13, merged into main by 2e8082b on 2026-11-05. The user accepted Sofia's DEV title-retrieval and copy-integrity checks and authorized both merges. That report records the image, exact comparison counts, metadata keys, exclusions and legal_knowhow IVF settings (256 partitions, nprobe=32). Future retrieval work starts from this runtime and records equivalent data/index/cache settings. The documentation addendum changes no runtime code.

On the public 2.55M-vector arxiv benchmark, 0.3.0 (f1b0ab3) was re-measured against 19c3293 on 2026-11-07 with the 2026-10 end-to-end protocol, on images that differ only in src/: over six runs per arm, no search, hybrid, recall, memory, disk, cold-start or index-build figure moved beyond the run-to-run spread, and ingest throughput stayed within it (re-measurement, raw tables in bench/results-arxiv-2026-11.md). Until 0.4.0, the README and the arxiv table showed 0.3.0's medians.

The request shapes these ADRs target are measured publicly by the document retrieval benchmark (2026-11-07; 25,000 Wikipedia articles as summary + chunk documents; bench/prep_wiki.py, bench/bench_docs.py, raw tables in bench/results-docs-2026-11.md): against 19c3293, one-document search p50 197 → 2.9 ms (vector) and 200 → 5.5 ms (hybrid) with the doc_id filter of ADR 0007; concurrent summary and k=100/1000 throughput 1.2–1.6x at a third to a half of the server CPU per query (ADRs 0013, 0010); single-query latency of those unchanged; quality identical; about 110 MB more server memory after the workload set.

Historical performance baseline

The user accepted PR #11 on 2026-11-05 after its Sofia deployment evaluation. Tested runtime 1cdae1d is merged into main by 01b160f; subsequent report updates change documentation only. The baseline report retains the screenshot, setup, exact displayed metrics and comparison limits: about 22% more concurrent summary QPS and 27% less CPU/query, with no claimed single-query or controlled working-set improvement. Keep these historical benchmarks labeled by their measured revision and settings; the 0.3.0 acceptance adds quality evidence without a new deployment performance measurement.

The subsequent ADR 0019 adds bounded ranked-expansion reuse. The published benchmark rows above retain their original measured revisions; the separate reevaluation records this optimization's results.

Work from the November 2026 optimization review

Work Implementation / decision Documentation and evidence
turbovec 1.1.2 (raggio 0.4.0) Lock bump, no code change; v7 → v8 index conversion on first sync ADR 0017; tests/test_turbovec_upgrade.py with a 1.0.0-written DATA_DIR fixture; raw tables in bench/results-turbovec-2026-11.md
Python 3.14 reevaluation and opt-in PYTHON=3.14t selects the guarded free-threaded image; Python 3.12 remains the default Setup and pros/cons, idle-host evaluation, full tables, raw evidence in bench/python314-2026-11-08/
Rust rewrite assessment Keep the Python/native architecture; no service rewrite Archived assessment, measured at da432a6; original raw experiments retained locally in C:/DevOps/raggio-rust-evaluation-20261104/
Native ingest JSON parsing b6311a5, merged by 96b55ed in PR #7 ADR 0008; bench/results-ingest-json.json
Avoid ingest vector-list copies 7b3eb14, merged by 813b6da in PR #8 ADR 0009; large/small raw results under bench/
Search response encoding a872161, merged by 6327693 in PR #9; only the search response path changes ADR 0010, endpoint parity tests and paired search results under bench/; Sofia deployment follow-up
Expansion experiments and sibling reuse PR #10, closed without merging; branch perf/sibling-vector-reuse retained at 614c4b8 Archived ADR 0011 and ADR 0012, with original results/source links and closure rationale
Current-main sibling-vector reuse Fresh port accepted after Wikipedia, control and exact-parity gates ADR 0019, reevaluation, and raw paired recordings under bench/sibling-reevaluation-2026-11-08/
Warm scope search batching 1cdae1d, merged by 01b160f in PR #11; bounded independent cohorts for cached scope allowlists ADR 0013, paired benchmarks, exact parity/resource/lifecycle tests and accepted Sofia baseline
Alternative title/source substrings PR #12; contains_any with 1–256 scalar alternatives, OR within a key and AND across keys ADR 0014, API grammar and title/literal/validation regression tests
Metadata in keyword retrieval 2939c3c, merged by 2e8082b in PR #14; immutable fts_keys, stored suffix and generated single BM25 text ADR 0015, local cost evaluation, accepted DEV baseline, integrity/parity/lifecycle tests and raw results
Document retrieval evaluation and native search parsing a197726, merged by e5d42be in PR #13; shared native JSON route helper and rejected persistent vector cache ADR 0016, evaluation report, parser/API parity tests and raw benchmarks
Dot-product collections PR #21; metric fixed at creation, default cosine unchanged; a dot collection keeps float32 vectors as sent and re-ranks the scan's candidates by their dot product with the query as sent ADR 0020; tests/test_dot_metric.py; default-collection A/B against main in bench/results-dot-metric-2026-11.md (bench/dot_metric_ab.py); query-check addendum in bench/results-dot-query-check-2026-11.json (bench/dot_query_check.py)

From 2026-11-04, ingestion is considered sufficiently fast for its frequency. Further optimization work focuses on search/retrieval latency, CPU and memory, including vector, text, hybrid, filtering and result expansion.

Future performance changes must update an ADR (or add one), link it here, and retain the comparison protocol, raw measurements and relevant correctness gates. Investigations that reject a change should record that result too.

Archived development histories

These tags preserve the original histories after branch cleanup on 2026-11-08. Their journals and plans describe the work and evidence at their dated revisions; use the current ADRs for accepted behavior and current execution decisions.

History Archive Disposition
Performance-program journal, original specs, plans, and research archive/performance-program-2026-11-08, at 41ed0d3; journal Retains the histories of docs/planB-race-rerun and its ancestor docs/perf-plans-2026-09
Original benchmark-hardening commits archive/bench-hardening-2026-11-08, at eccdc6c Implementation already incorporated into main through ff48930; old local branch retired
Initial expansion-read and sibling-vector-reuse probes archive/expansion-retrieval-2026-11-08, at f87e1d1 research/expansion-retrieval retired; the later perf/sibling-vector-reuse branch is retained for separate review