Skip to content

feat: add retrieval parity foundation - #359

Merged
hurttlocker merged 6 commits into
mainfrom
feat/retrieval-parity-foundation
Mar 24, 2026
Merged

hurttlocker merged 6 commits into
mainfrom
feat/retrieval-parity-foundation

Conversation

@hurttlocker

Copy link
Copy Markdown
Owner

Summary

Build the first retrieval-parity foundation layer for Cortex:

  • add deterministic query strategy classification
  • make RRF strategy-aware across BM25 / semantic / entity / temporal channels
  • add a temporal retrieval channel in RRF
  • add bounded scene expansion after fusion
  • group evidence blocks in ask / answer
  • default ask and answer to rrf
  • add normalized benchmark scoring helpers for parity reporting

What Shipped

Retrieval routing

  • internal/search/strategy.go
  • strategy labels: default, temporal, entity, comparison, bridge
  • strategy-specific RRF weights
  • explain output now surfaces the strategy decision

Retrieval channels

  • internal/search/rrf.go
  • internal/search/temporal_channel.go
  • temporal channel added to RRF
  • entity graph auto-enable is now query-shape aware instead of globally blunt

Evidence expansion / packing

  • internal/search/scene.go
  • internal/ask/engine.go
  • internal/answer/engine.go
  • bounded same-scene neighbor expansion
  • grouped evidence rendering for reader models

Product defaults

  • cmd/cortex/main.go
  • ask and answer now default to rrf

Benchmark helpers

  • internal/benchscore/score.go
  • normalized answer / normalized exact-match helpers for scorer parity work

Benchmark

Benchmark note:

  • docs/research/retrieval-parity-foundation-benchmark-2026-03-23.md

Same fresh LoCoMo-only DB and same public conv-30 81-question slice used in v1.4.0:

  • rrf_default (--mode rrf --rerank off): 11.90% F1, 6461.61 ms, 0 degraded
  • rrf_rerank_daemon (--mode rrf --rerank on): 15.03% F1, 9706.82 ms, 0 degraded

Comparison to prior notes:

  • vs v1.4.0 baseline A: 11.81% -> 11.90%
  • vs v1.4.0 reranker path C: 13.26% -> 15.03%
  • vs prior best reference 15.77%: now -0.74

Important diagnostic read:

  • category 1 moved the most: 27.46% F1 with daemon-backed rerank
  • category 2 remains the main ceiling blocker
  • category 4 is improved from the plain baseline but not a dramatic jump

Validation

  • go test ./internal/search ./cmd/cortex
  • go test ./internal/search ./internal/ask ./internal/answer ./cmd/cortex
  • go test ./...
  • go vet ./...

Notes

I left unrelated untracked local artifacts out of this branch:

  • docs/research/slm-v3-benchmark-2026-03-23.md
  • scripts/bench/run_slm_locomo_benchmark_2026_03_23.py
  • scripts/bench/__pycache__/

@hurttlocker
hurttlocker merged commit ad0a465 into main Mar 24, 2026
4 checks passed
@hurttlocker
hurttlocker deleted the feat/retrieval-parity-foundation branch March 24, 2026 00:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant