lexical-vs-semantic-retrieval: a reproducible benchmark of keyword (BM25/TF-IDF) vs dense embedding retrieval on a 100-document helpdesk corpus
This archive contains the code, data and results of a controlled benchmark comparing classic keyword retrieval (BM25, TF-IDF) with dense embedding retrieval (BAAI/bge-small-en-v1.5, 384 dimensions, running locally via fastembed/ONNX — no paid API) on a synthetic-but-realistic helpdesk corpus. The corpus holds 100 short support notes for an imaginary developer cloud platform, written in one voice across ten topics (auth, rate limits, errors, webhooks, SDKs, databases, deployments, observability, networking, billing). 36 evaluation queries are split evenly into three flavors: lexical (they contain the exact identifier their answer uses, e.g. ERR_GATEWAY_TIMEOUT), semantic (pure paraphrases with near-zero word overlap) and ambiguous (multi-hop). All relevance judgments are hand-graded. Seed 42. Measured results: overall Precision@1 — BM25 0.528, TF-IDF 0.528, embeddings 0.722; MRR@10 0.591 vs 0.812; nDCG@10 0.516 vs 0.760. By query type (BM25 vs embeddings P@1): lexical 1.000 vs 1.000, semantic 0.250 vs 0.667, ambiguous 0.333 vs 0.500. Head-to-head on the rank of the first relevant document, embeddings won 16, tied 17 and lost 3 — every loss occurring when the query echoed the document's exact phrasing. Mean query latency on CPU: 0.20 ms (BM25) vs 8.49 ms (embeddings). Contents: data/ (corpus, queries, judgments), src/ (retrievers + evaluation harness), results/ (metrics.json, per-query outputs), paper/ (short paper in Markdown, LaTeX and PDF), substack/ (essay), and a Makefile entry point — "make eval" reproduces every number above.
Authors
- maissara guersas
Publication Details
- Journal
- Zenodo (CERN European Organization for Nuclear Research)
- Published
- 2026-11-25
- DOI
- https://doi.org/10.5281/zenodo.24531643
- Primary Topic
- Information Retrieval and Search Behavior
- Type
- article
- Field-Weighted Citation Impact
- 0.00