haiku.rag/evaluations
Yiorgis Gozadinos 8e93b639bc
Migrate existing databases to the full index set
Adds the 0.75.0 upgrade, which brings a pre-existing database up to the index
set `_init_tables` now creates. It rewrites no table data, so unlike the earlier
data migrations its cost is the index builds alone, each of which reads the
column it indexes.

`ensure_indexes` ensures an index of the declared *type* covers each declared
column, rather than checking that the column is indexed at all. The distinction
is what makes it safe to run against a database of unknown provenance:

- A wrong-typed index no longer satisfies the check. A BTree on `label` covers
  the column while losing the low-cardinality equality lookup the Bitmap is for.
- Nothing is dropped or converted away from. Two index types over one column can
  be deliberate, serving different query shapes, so an index this function did
  not declare survives even on a column it does. The one thing it overwrites is
  an index at LanceDB's default name, `{column}_idx`, which is the name it
  creates itself.
- A column already carrying the declared type is skipped, so a database with the
  full set migrates instantly rather than re-sorting every indexed column.
- Undeclared columns are untouched, so a vector index on `chunks` survives.

It returns the columns it acted on, because a change is not always visible from
outside: adding a Bitmap beside an existing BTree leaves the column indexed
before and after.

The version bump to 0.75.0 is required, not incidental: `_set_initial_version`
stamps a new database with the installed package version, so a migration
numbered above it would be pending the moment the database was created.

`test_client_update_document_replaces_rows_with_bounded_versions` turns
auto_vacuum off. Indexing `documents` means a background vacuum now has an index
to maintain on that table, so `optimize()` writes a version where it previously
had nothing to do, and it landed inside the window the test measures. The
document update itself is still one version, so the bound stays exact.
2026-08-17 16:34:58 +03:00
..
configs Point the mtrag reference config at the measured baseline model 2026-08-17 10:56:27 +03:00
evaluations Exclude fully unjudged conversations from the macro pass rate 2026-08-17 11:19:59 +03:00
scripts Add T²-RAGBench leaderboard submission exporter 2026-06-08 11:51:02 +03:00
tests Exclude fully unjudged conversations from the macro pass rate 2026-08-17 11:19:59 +03:00
LICENSE Restructure into uv workspace to support minimal and full installations 2025-11-04 17:59:12 +02:00
pyproject.toml Migrate existing databases to the full index set 2026-08-17 16:34:58 +03:00
README.md Add MTRAG ClapNQ multi-turn evaluation 2026-08-17 10:53:16 +03:00

Haiku RAG - Evaluations

Internal benchmarking and evaluation scripts for haiku.rag.

This package is not published to PyPI and is only used for development and testing purposes.

Overview

Contains evaluation scripts for benchmarking RAG retrieval and QA performance. Available datasets:

  • HotpotQA (hotpotqa) — multi-hop QA over Wikipedia paragraphs (distractor validation split, 7,405 questions, two gold documents per question)
  • MTRAG ClapNQ (mtrag_clapnq, mtrag_clapnq_rewrite) — IBM's multi-turn RAG benchmark, ClapNQ (Wikipedia) domain: 183,408 passages, 208 retrieval queries with binary qrels, 224 generation tasks. The base key retrieves with the raw last user turn; the _rewrite variant uses the human standalone rewrites (both share one database). Retrieval reports Recall@5/@10, nDCG@5/@10, and MAP against IBM's published setup. QA replays each task's reference conversation prefix as message history and answers the final turn; the judge sees the conversation as a transcript, citation MAP is scored only on turns with gold passages, and refusal precision/recall is reported against the answerability labels. Generation scores are internal (our judge and rubric), not comparable with IBM's published generation numbers. The mtrag_clapnq_live key replays whole conversations (one case per conversation, --limit counts conversations) through a single capability session, carrying the model's own answers and tool history across turns; it reports the same outcomes per turn plus micro (per-turn) and macro (per-conversation) aggregates.
  • OpenRAG Bench, two variants:
    • orb_text — text embedder (qwen3-embedding:4b, 2560-dim) with VLM picture descriptions baked into chunk content at ingest. Use for text-only retrieval/QA against figure-rich corpora.
    • orb_multimodal — multimodal embedder (qwen3-vl-embedding-8b, 4096-dim) with picture vectors in the same space as text. Use for cross-modal retrieval (text-as-query → figure hits, image-as-query) and vision QA where the figure itself is the answer.

Usage

After installing the package, you can run evaluations using the evaluations command:

# Run retrieval + QA benchmarks
evaluations run hotpotqa
evaluations run orb_text

# Use a custom config file
evaluations run hotpotqa --config /path/to/haiku.rag.yaml

# Override the database path
evaluations run hotpotqa --db /path/to/custom.lancedb

# Skip database population and run only benchmarks
evaluations run hotpotqa --skip-db

# Skip specific benchmarks
evaluations run hotpotqa --skip-retrieval
evaluations run hotpotqa --skip-qa

# Limit the number of test cases
evaluations run hotpotqa --limit 100

Choosing the target

evaluations run benchmarks --target rag-capability by default. Use --target analysis-capability to benchmark the analysis capability against the same datasets and judge:

evaluations run hotpotqa --target rag-capability
evaluations run hotpotqa --target analysis-capability --capability-model ollama:gpt-oss

--capability-model "provider:name" overrides the capability model independently from the judge (defaults to qa.model, or analysis.model when set for the analysis-capability target). A citation retrieval metric (cited_map) is computed alongside QA accuracy from the URIs the capability registered via the cite tool.

Debugging runs in Logfire

With LOGFIRE_TOKEN set, runs ship spans under service_name = 'evals'. The debug-evals skill in .claude/skills/ turns these into ready-made Logfire queries (recent runs, per-case pass rate and cited_map, failing and slowest cases) for use from Claude Code.

Pre-built Databases

Download pre-built evaluation databases from HuggingFace:

evaluations download hotpotqa
evaluations download all
evaluations download hotpotqa --force

Upload databases (maintainer only):

evaluations upload hotpotqa
evaluations upload all

Database Storage

By default, evaluation databases are stored in the haiku.rag data directory:

  • Linux: ~/.local/share/haiku.rag/evaluations/dbs/
  • macOS: ~/Library/Application Support/haiku.rag/evaluations/dbs/
  • Windows: C:/Users/<USER>/AppData/Roaming/haiku.rag/evaluations/dbs/

You can override this with the --db option.