Explain the product path's zero overlap and fix the report writer
The frozen baseline showed the unmodified RetrievalService agreeing with an equivalent BM25 index on 0% of its top ten results. Reproduced by hand: its top ten atoms came from one document's pages, so a source-level ranking cannot overlap it. - bench/systems.py: live_product_rankings also counts distinct sources behind the product's top-k atoms. - bench/run.py: scale probes no longer filtered by gold (a source prefix keeps almost no gold, so the 500/2,000/10,000 rows were silently skipped); scale_arm_names reads only latency dicts, which is what crashed write_markdown on the note field; the unanswerable share is computed instead of hard-coded. - bench/tests/test_joint.py: 60 tests total, including the writer regression. Verification: pytest bench/tests -q -> 60 passed; ruff check bench/ -> all checks passed; mypy (fresh cache) -> no issues in 25 source files.
This commit is contained in:
1 parent
29163632af
commit
61f6506104
6 files changed
+891
-17
No files matched your search
+12
-3
@@ -388,8 +388,15 @@ def _best_atom_text(atoms: Sequence[Atom], source_ids: Sequence[str]) -> list[tu
|
||||
return [(source_id, longest.get(source_id, "")) for source_id in source_ids]
|
||||
|
||||
|
||||
def live_product_rankings(db_home: Path, queries: Sequence[str], top_k: int = 10) -> tuple[list[list[str]], list[float]]:
|
||||
"""Rankings from the unmodified RetrievalService, with per-query wall time."""
|
||||
def live_product_rankings(
|
||||
db_home: Path, queries: Sequence[str], top_k: int = 10
|
||||
) -> tuple[list[list[str]], list[int], list[float]]:
|
||||
"""Rankings from the unmodified RetrievalService, with per-query wall time.
|
||||
|
||||
The second list counts how many distinct sources the product's top-k atoms came
|
||||
from: the product ranks atoms and never diversifies, so ten slots can be filled by
|
||||
fragments of one document, and that is invisible once the hits are collapsed.
|
||||
"""
|
||||
from ely_eye.config import Settings
|
||||
from ely_eye.db import Database
|
||||
from ely_eye.retrieval import RetrievalService
|
||||
@@ -397,6 +404,7 @@ def live_product_rankings(db_home: Path, queries: Sequence[str], top_k: int = 10
|
||||
settings = Settings(home=db_home)
|
||||
service = RetrievalService(settings=settings, database=Database(settings))
|
||||
rankings: list[list[str]] = []
|
||||
distinct: list[int] = []
|
||||
timings: list[float] = []
|
||||
for query in queries:
|
||||
started = time.perf_counter()
|
||||
@@ -408,5 +416,6 @@ def live_product_rankings(db_home: Path, queries: Sequence[str], top_k: int = 10
|
||||
source_id = hit.atom.source_id
|
||||
if source_id not in sources:
|
||||
sources.append(source_id)
|
||||
distinct.append(len({hit.atom.source_id for hit in hits}))
|
||||
rankings.append(sources[:top_k])
|
||||
return rankings, timings
|
||||
return rankings, distinct, timings
|
||||
Reference in new issue
Block a user