Skip to content

feat(core): diversify retrieval results by document - #160

Merged
jb-thery merged 2 commits into
developfrom
feature/retrieval-diversification
Aug 19, 2026
Merged

feat(core): diversify retrieval results by document#160
jb-thery merged 2 commits into
developfrom
feature/retrieval-diversification

Conversation

@jb-thery

Copy link
Copy Markdown
Member

Summary

  • Diversify final retrieval results by document so one file cannot consume the top-k window.
  • Preserve requested result counts through internal over-retrieval and deterministic ranked backfill.
  • Keep lexical fallback complete for corpora larger than one configured scan batch.

Changes

Added

  • Add maxChunksPerDocument across configuration, TypeScript, CLI search and ask, MCP, evaluation, portable status, and score explanations.
  • Add unit and integration coverage for dominant-document ranking, configurable caps, mono-document backfill, path filters, context hydration, and batched lexical fallback.

Changed

  • Apply document diversification after scoring and abstention, before final truncation and context hydration.
  • Scan every eligible fallback row in bounded batches instead of rejecting corpora above hybridTextScanLimit.
  • Include the document cap in ranking-policy and quality-report fingerprints.
  • Refresh compatible workspace dependencies and pin patched sharp and protobufjs transitive releases.

How to Test

  • Run pnpm validate.
  • Run the XS local-hash quality benchmark with the quality retrieval profile; both seeded passes should be reproducible and pass 100/100 cases with recall@10 of 1.000.
  • Compare a representative rgr search with the default cap and --max-chunks-per-document 100; the default should increase distinct documents without reducing the requested result count.

Release highlights:
- Keep runtime, build, and publishing dependencies current and vulnerability-free.

Release details:
- Upgrade compatible dependencies across Core, Chat, TTS, and the landing site.
- Pin patched sharp and protobufjs transitive versions.
- Align PDF cleanup and Chat runtime metadata with the updated packages.

Verification:
- pnpm validate
- pnpm audit --audit-level moderate
Release highlights:
- Return broader document coverage without reducing the requested result count.
- Keep lexical fallback complete when the corpus exceeds one scan batch.

Release details:
- Add a configurable document cap with internal over-retrieval and ranked backfill.
- Apply diversification to CLI, MCP, ask, evaluation, portable status, and explanations.
- Scan fallback batches across the full eligible corpus and document MMR tradeoffs.

Verification:
- pnpm validate
- Quality benchmark: 100/100 cases, reproducible, recall@10 1.000.
- Manual CLI: 10/10 distinct documents by default versus 6/10 uncapped.
@jb-thery jb-thery self-assigned this Aug 19, 2026
@jb-thery
jb-thery merged commit e2b7f85 into develop Aug 19, 2026
14 of 15 checks passed
@jb-thery
jb-thery deleted the feature/retrieval-diversification branch August 19, 2026 10:02
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