Skip to content

perf(retrieval): batch map-nav payload loads and add stage timing - #343

Merged
suguanYang merged 2 commits into
mainfrom
fix/wangbinqi/normalize-native-dsn
Aug 28, 2026
Merged

suguanYang merged 2 commits into
mainfrom
fix/wangbinqi/normalize-native-dsn

Conversation

@suguanYang

Copy link
Copy Markdown
Contributor

Summary

Optimize default map-nav retrieval execution while preserving exact retrieval quality.

Changes

  • Batch lazy payload loading per document with one ordered SQL query instead of one query per section.
  • Stream each document through the existing BM25/RRF scorer and release payloads before the next document.
  • Preserve BM25 formulas, channel weights, RRF ordering, tie-breaking, asset remounting, duplicate chunk semantics, and hydration references.
  • Add stage timing logs for snapshot load, episode, and hydration to identify remaining production latency.
  • Keep the psycopg2 DSN normalization fix that resolved the production-only 500 from the original incident.

Verification

  • Full repository suite: 679 passed, 14 warnings.
  • Ruff and Pyright passed.
  • Real local 60k PostgreSQL corpus: about 10 seconds total; exact eager/lazy map and unit score parity.
  • Real local 600k PostgreSQL corpus: about 107 seconds total and 672 MiB peak RSS; exact top-result parity. This is materially better than the previous roughly 176-second run, but still above the 60-second ALB target; further scale work remains tracked in Optimize map-nav retrieval for 600k+ chunk namespaces #340.

Quality guarantee

No ranking, candidate-selection, evidence-budget, or result-assembly policy changes are included. The implementation changes only loading and release mechanics, with exact parity contracts.

@suguanYang
suguanYang merged commit a87134f into main Aug 28, 2026
6 checks passed
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