Skip to content

Add page-level retrieval ranking evaluation - #24

Merged
sakshammaurya merged 1 commit into
mainfrom
feat/retrieval-ranking-evaluation
Nov 15, 2026
Merged

sakshammaurya merged 1 commit into
mainfrom
feat/retrieval-ranking-evaluation

Conversation

@sakshammaurya

Copy link
Copy Markdown
Owner

Summary

  • add dependency-free page-level Precision@K, Recall@K, MRR@K, and binary nDCG@K
  • support validated configurable ranking cutoffs while preserving existing dataset defaults
  • integrate per-case ranking results and separate macro-averaged ranking summaries into the existing evaluator
  • collapse duplicate chunks from the same document page at their first occurrence
  • exclude cases with no relevant pages from ranking aggregates and report eligible/excluded counts
  • document ranking order, relevance granularity, assumptions, trade-offs, and limitations

Relevance and ranking contract

  • relevance identity: (document_id, page_number)
  • ranking source: ordered sources returned by /v1/ask
  • measured stage: post-similarity-threshold evidence visible to generation
  • v2 cutoffs: K = 1, 3, 5
  • Precision@K denominator remains K when fewer results are returned
  • unsupported cases with empty expected pages are excluded from ranking averages

Validation

  • python -m pytest tests/test_retrieval_metrics.py tests/test_evaluate.py tests/test_evaluation.py -q: 48 passed
  • python -m pytest -m "not integration" -q: 92 passed, 6 deselected
  • python -m ruff check app evals tests: passed
  • git diff --check: passed

Scope and limitations

  • no production API, SQL retrieval behavior, prompts, model settings, or dependencies changed
  • historical benchmark artifacts were not overwritten
  • API top_k is applied to chunks before page deduplication, so duplicate chunks can leave fewer than K unique pages
  • binary page relevance cannot grade one relevant page as more useful than another
  • equal-distance database ties have no explicit secondary ordering
  • ranking metrics do not establish semantic answer correctness, factual faithfulness, or citation support

@sakshammaurya
sakshammaurya merged commit 99d758c into main Nov 15, 2026
2 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