Skip to content

Add KB Arena retrieval strategies as a custom BEIR runner#214

Open
xmpuspus wants to merge 1 commit into
beir-cellar:mainfrom
xmpuspus:add-kb-arena
Open

Add KB Arena retrieval strategies as a custom BEIR runner#214
xmpuspus wants to merge 1 commit into
beir-cellar:mainfrom
xmpuspus:add-kb-arena

Conversation

@xmpuspus

Copy link
Copy Markdown

Adds examples/retrieval/evaluation/custom/evaluate_kb_arena.py showing how to run KB Arena's nine retrieval strategies against BEIR datasets using BEIR's canonical IR metrics (NDCG, MAP, Recall, Precision).

What it does

  • Wraps any KB Arena Strategy (BM25, naive vector, contextual vector, QnA pairs, knowledge graph, hybrid RRF, RAPTOR, PageIndex, rerank-vector) as a BEIR BaseSearch backend
  • Translates BEIR's corpus dict into KB Arena's Document/Section model
  • Runs the strategy's index + query under retriever-lab's LLM-stub patch so BM25 and other retrieval-only paths consume no API tokens
  • Returns the standard {query_id: {doc_id: score}} mapping that EvaluateRetrieval.retrieve expects

Default run

Downloads SciFact (smallest BEIR split) and evaluates KB Arena's BM25Strategy end-to-end with no embedding-provider or LLM keys required. The script header documents how to swap in any of the eight other strategies; vector strategies require an embedding provider per KB Arena's README.

Why this matters

KB Arena's value-add over BEIR's existing dense and lexical examples is comparing architectures rather than embedding models. Wiring it up here lets BEIR users score (e.g.) RAPTOR vs PageIndex vs hybrid RRF on standard BEIR splits, with KB Arena handling the architectural-strategy differences and BEIR's evaluator providing the canonical metrics.

About KB Arena

  • MIT, on PyPI as kb-arena, archived on Zenodo (concept DOI 10.5281/zenodo.20319678)
  • v0.8.1 released 2026-05-21, 617 tests, Python 3.11+
  • Uses Pydantic v2; the integration above relies only on the documented public Strategy, Document, and Section types plus a single retriever-lab helper

Happy to iterate on naming, file location, or to expose the LLM-stub context manager as a fully public API on the KB Arena side if reviewers prefer.

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