Skip to content

Tagged retrieval background ​

INFO

This page records measurements and published work. It is not required reading: the tags reference defines the concepts, and the troubleshooting procedure tells what to do.

The published work that frames tagged retrieval, the hypotheses that we fixed before the benchmark, and what tagging and curation cost. The results workbook holds the measurements.

What does published work show? ​

Four sources frame the practice. Every figure below was read from the cited source on 2026-11-16.

Contextual Retrieval. Anthropic prepends a chunk-specific explanation, written by Claude 3 Haiku, to each chunk before embedding it and before building the BM25 index. The context is usually 50 to 100 tokens. Results are the failure rate at top 20 (1 minus recall@20), averaged over codebases, fiction, ArXiv papers and science papers, with Gemini Text 004 as the best embedder:

ConfigurationFailure rate at top 20Reduction
Baseline (embeddings and BM25)5.7%
Contextual embeddings3.7%35%
Contextual embeddings and contextual BM252.9%49%
Both, plus a reranker1.9%67%

Three details matter. The cost is one language model call per chunk, which prompt caching brings to about $1.02 per million document tokens under the assumptions of the post. The post tried 5, 10 and 20 chunks and found 20 the best, which is the basis for our default top-K of 20. And the authors report that generic document summaries gave very limited gains, so the benefit comes from chunk-specific disambiguation, not from any text about the document. The cookbook ships the code set that we reuse: 90 files from 9 repositories, 737 chunks, and 248 queries with golden chunks.

Metadata as text. Yousuf et al., ECIR 2026 compare metadata flattened into the embedded text as a prefix or a suffix, a dual encoder, late fusion, and metadata-aware query reformulation, on SEC filings. They report that prefixing and the unified embedding consistently beat plain-text baselines. Their embedding-space analysis attributes the gain to higher cohesion within a document, less confusion between documents, and a wider gap between relevant and irrelevant chunks. They tested one corpus type, so how far the result carries is an open question.

Free structure against a language model call. Two preprints from single teams, without independent reproduction as far as we know, compare a model call per chunk with structure that costs nothing:

  • Upgrade the Retriever First (arXiv v4, October 2026, a confirmatory study with a plan published before indexing, 951 Qasper and 235 FreshStack questions, eight retrievers). Under a hybrid retriever, enrichment by a 7B model beats a free section-path prefix by 5.5 recall points on Qasper, but the gain on FreshStack (2.7) does not survive the Holm adjustment. Under the two strongest retrievers, the intervals fall within the equivalence margins. Under BM25 enrichment gains 8.7 points. The authors withdrew their v1 and v2 results.
  • Structure-aware chunking with title-chain prefixes reports MRR@5 rising from 0.374 to 0.463 on 1,600 queries over a production Markdown knowledge base, with zero model calls. It warns that a prefix on/off ablation can corrupt the relevance annotation, because stripping the prefix removes the signal that annotators need.

They set the bar: a deterministic prefix has to be compared with a model call, not only with no prefix.

Other sources. MultiHop-RAG (Tang and Yang, 2024) has 2,556 multi-hop queries over news articles with metadata (author, category, publication date, source, title), under the ODC-BY licence. It serves as a corpus with native tags. A 2025 paper by Dadopoulos and Ladas is cited in the tracking issue, but the only match found is an SSRN paper on annual reports whose page returned HTTP 403. It stays uncited until someone confirms what it measures.

What do we expect, and what did our runs find? ​

The hypotheses were fixed before the benchmark, each one falsifiable, and negative results are reported. The verdicts come from the performance workbook, which gives every run with its intervals.

IdHypothesisVerdict
H1Tags reduce failure@20 on tag-rich corporaHolds when queries use the words the tags carry, and can fail otherwise
H2Gains are larger for small static embedders than for large transformersNot supported
H3Tagged BM25 adds gain on top of tagged embeddingsHolds in part
H4Tags recover at least 50% of the gain of model-written contexts at near-zero costNot supported
H5Corpus statistics predict which tags helpHolds for the share of queries that mention a tag's values, not for embedding separation

Two results differ from the published work. Tags placed before the chunk text moved the scores of a transformer far more than tags placed after it, in both directions. And a title-like tag, unique to each document, did no harm.

Constraints on reading the results:

  • The code set has native tags only through a join on the evaluation file (repository, path).
  • The engineering-brain corpus has one front matter key per page, topic, which is nearly an identifier, so its useful tags are derived by a language model and live under their own key.
  • Every fastembed 0.9.1 model truncates input at 512 tokens, so a long prefix can push chunk text out of the window.

What does tagging cost? ​

Nothing measurable at index time, and a few percent of file size. Embedding time per chunk with tags is within the noise of the baseline for every embedder, because a prefix of a few words adds few tokens, and the search time is the same. A 50-word LLM context is not that cheap to embed: it made bge-small 31% slower (69 to 91 ms per chunk), on top of one model call per chunk to write it.

EmbedderEmbedding, baselineEmbedding, with tagsQuery embeddingSearch, p50
potion-2560.2 to 0.3 ms per chunk0.2 to 0.6 ms0.1 to 0.3 ms29 to 42 ms
MiniLM-38421 to 29 ms21 to 22 ms4.6 to 13 ms25 to 37 ms
bge-small-38469 to 114 ms74 to 108 ms4.6 to 12 ms24 to 36 ms
e5-large-1024804 ms827 ms44 ms28 ms
bge-large-1024799 ms841 ms41 ms26 ms

Embedding times come from a fresh embedder on 100 chunks of each condition, because runs share vectors between conditions. The search time excludes the query embedding, which the table lists, and is the median of the hybrid search at top 5, 10 and 20. The index file grew by 0 to 9% with tags, up to 17.8 MB from 17.1 MB on the news set, and 17.1 MB from 15.7 MB for bge-small on engineering pages, since tags add a column and, with keyword matching, a longer keyword index. A set of tags whose words overflow the model's window costs relevance instead: the tags report warns when it estimates that prefix and chunk exceed it, and for 137 of the 5,293 engineering chunks it did with the default model.

What does curation cost? ​

About $128 of model calls for four corpora, once. Everything ran on Claude Haiku 4.5 through Amazon Bedrock's eu. inference profile, and Bedrock billed $128.24: $57.15 on demand and $71.10 in batch jobs. That covered a context for each of 25,005 sections in 658 pages, 617 generated questions, the schema and two tagging passes of 252 pages, and 37,063 relevance judgements. The Anthropic code set, run on demand with the page cached across its sections, cost $1.92 for 737 sections, about $0.0026 per section. Of the batch spend, about $50 went to section contexts, most of it for FinanceBench's filings even with each long filing cut to 12,000 characters of context per section, and the remaining $20 or so to the judge.

CorpusPagesSections with a contextChunksMedian context
Anthropic code set9073773750 words
LegalBench-RAG2327,1997,19962 words
FinanceBench8411,94827,92260 words
Engineering pages, private2525,1215,29351 words

The cost grows with sections times page length, because each section's prompt carries its page. Prompt caching removes most of the repeated page on demand, and batch jobs cost half the on-demand price, with their own quotas: on demand, the curation hit Bedrock's daily token quota, while the batch jobs, the largest with 37,063 requests, all finished within about 30 minutes. Answers are cached by content, so curating again after an edit costs only the pages that changed. The context makes each embedded text about 50 words longer; the timings of these runs are not reported, because two runs shared the machine.

What does it cost? ​

The cost grows with the number of sections times the length of their pages, because the prompt of each section carries its page. Caching the page across sections removes most of that on demand, and batch halves the rest. Measured on four corpora, from 737 to 27,922 chunks, Bedrock billed $128.24 once for all of the curation, and the code set of Anthropic cost $1.92 for 737 sections, about $0.0026 per section. The figures are in the performance workbook.

Embedding the contexts costs more than embedding short tags, because a context is about 50 words where a tag is a few. With bge-small, it made the embedding 31% slower. Run --dry-run first, and multiply the number of sections by the cost per section of the workbook, to know the order of magnitude before you start.

What gain can you expect? ​

A context written for each section helped on every corpus that we measured. The gains in Pass@20 on the context-dependent questions, with the default static model, MiniLM and bge-small, were +0.088, +0.071 and +0.074 on engineering pages, up to +0.147 on contracts, and up to +0.242 on SEC filings. With the default static model on the two public corpora, the gain did not survive the correction for multiple tests. The full table, with its intervals, is in the performance workbook. The commands that reproduce it on public corpora are in the reproduction procedure. The contexts of Anthropic's code set and of LegalBench-RAG are published as packs, so that you can check the result with no model call.

Compared with the first layer, a context costs model calls and 17% to 21% more time to embed with the default static model. The result for you depends on your pages. Hence the need to measure with your own questions.

Next steps ​