Repository navigation
docs: add SPRIG paper and RAG retrieval research - #36
Conversation
Adds the SPRIG paper (arXiv:2602.23372v1, "Democratizing GraphRAG: Linear, CPU-Only Graph Retrieval for Multi-Hop QA") with an analysis summary in the docs/ convention, plus three research notes on CTRA's RAG backend. docs/ - 2602.23372v1.pdf + .md — SPRIG: a CPU-only, linear-time, token-free GraphRAG pipeline benchmarked against BM25, dense, RRF and cross-encoder reranking under a 4 GB budget. Closest published work to the CTRA RAG decision. research/ - rag-alternatives-hybrid-retrieval.md — the hybrid (BM25 + dense + reranker) case, with throughput measured on the target hardware (3,000 real CTG trials; scripts in notes/bench_rag_hardware/, untracked). GLiNER-BioMed-large runs at 1.16 chunk/s here vs the 35 doc/s T4 figure the plan assumed. - rag-synthesis-sprig-schemagraph.md — how SPRIG and the schemagraph implementation would combine if the backend were rebuilt. - linearrag-improvements.md — twelve in-place improvements to the existing LinearRAG implementation, keeping GLiNER. No source changes; documentation and research only. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
GLiNER variant sweep — resultsThe benchmark referenced under "Open items" has finished. It inverted the prediction in 120 real CTG chunks (mean 1,147 chars), GTX 1650 Ti fp16, batch 8, threshold 0.4, production call path (
Three findings1. The bi-encoder is not the win. It helps only at 2. Model scale is the real lever. 3. Also corrected: label count is not a cost leverCutting 16 → 6 labels gave 1.08x, not the superlinear saving item 11 predicted. The quadratic term in What this changesItem 10 becomes the one decidable item on the list today: throughput is measured, and unlike the retrieval question, the harness already exists — Scripts and raw JSON are in |
Summary
Adds the SPRIG paper (arXiv:2602.23372v1, Democratizing GraphRAG: Linear, CPU-Only Graph Retrieval for Multi-Hop QA) to
docs/with an analysis summary in the existing convention, plus three research notes on the RAG backend.Documentation and research only — no source changes.
Why SPRIG
It is the closest published work to CTRA's RAG-backend decision: a CPU-only, linear-time, token-free GraphRAG pipeline (lightweight NER -> entity co-occurrence graph -> Personalized PageRank), benchmarked against BM25, dense retrieval, RRF and cross-encoder reranking under a strict 4 GB memory budget.
Three findings bear directly on CTRA:
GraphRRF- PPR seeded from a fused BM25+dense candidate list - is the best R@10 on both datasets (0.867 / 0.794). Meanwhile score-side fusion (RRF+PPR) is worse than not fusing at all. The gain comes from richer seeds feeding traversal.Hardware measurements
research/rag-alternatives-hybrid-retrieval.mdsections 1 and 3 replace the plan's extrapolations with numbers measured on the target machine, using 3,000 real Phase 2/3 trials pulled from the ClinicalTrials.gov v2 API and converted with the repo's own_ctg_to_passages:GLiNER runs at 2.30 doc/s here against the 35 doc/s on T4 recorded in
docs/ner-evaluation-guide.md- 15.2x slower, because the GTX 1650 Ti (Turing TU117) has no Tensor Cores. Two secondary findings change component choices: ONNX int8 runs slower than fp32 on this CPU (i7-10750H, AVX2 only, no AVX512-VNNI), and the MiniLM-L6 cross-encoder is unusable at 2.1 s/query, so the reranker must be TinyBERT-L2 (222 ms).Benchmark scripts and raw JSON live in
notes/bench_rag_hardware/with a repro README.notes/is gitignored, so they are not in this PR - say the word if they should be tracked alongside the docs that cite them.Research notes
rag-alternatives-hybrid-retrieval.mdcalculate_passage_scores- an O(passages x activated_entities) Pythonstr.count()scan - and an in-RAM embedding-store design that does not fit the corpus regardless of GPU. Includes a provenance audit confirming the vendored code is upstream LinearRAG, essentially unmodified.rag-synthesis-sprig-schemagraph.mdschemagraphimplementation would combine if the backend were rebuilt. Notes that_primekg_to_passagescurrently flattens 4M curated typed relations into prose, then spends GPU-days on NER to re-infer them from co-occurrence.linearrag-improvements.mdused_sentence_hash_idsis consumed in dict-iteration order, making retrieval non-deterministic.Open items (not in this PR)
src/ctra/rag/eval/is NER-only; the TREC-CT 2021 results quoted indocs/ner-evaluation-guide.mdexist as prose, not code (grep -ri trecfinds nothing undersrc/,scripts/ortests/). Every quality claim in these notes is undecidable without it.docs/ner-evaluation-guide.md:143lists this as supported but it appears never to have been run. Results will be posted here when available.Caveats
en_core_web_smNER. The numbers justify ordering the work, not settling it for CTRA.max_iter=5at 0.85 damping, so ~44% of initial error survives; its graph-only results are probably a pessimistic bound.🤖 Generated with Claude Code