Change one field across 5,183 documents
This experiment compares two SQLite FTS5 lexical indexes on the BEIR SciFact test split; it does not test vector retrieval or final answer quality.[1][3]
A document that falls from fifth to sixth disappears from the context of an assistant that reads five results. We saw exactly that in a retrieval experiment on SciFact. Adding titles to indexed abstracts increased the number of queries with a relevant result from 220 to 226 out of 300. Before shipping a similar change, inspect the two queries that lost their evidence.
We used the SciFact test split distributed by BEIR. Its relevance judgments associate queries with document IDs. Both runs ranked the same English queries with SQLite FTS5's BM25 lexical search. The first indexed each abstract. The second put the title and abstract in the same indexed field. Tokenization, query construction, tie breaking and the five-result cutoff stayed fixed. The scores below measure this change to a lexical index. We did not run a Kinfra embedding benchmark.
| Indexed content | Queries with a hit in the top five | Hit rate | MRR@5 | Recall@5 |
|---|---|---|---|---|
| Abstract | 220 / 300 | 73.33% | 0.6055 | 0.7109 |
| Title and abstract | 226 / 300 | 75.33% | 0.6269 | 0.7276 |
A query counts as a hit when at least one judged relevant document appears in its first five results. MRR@5 also captures rank: if the first relevant document appears second, the query contributes one half. A miss contributes zero. Average those contributions across all queries. A query can have several relevant documents, so the hit rate here does not measure the fraction of all relevant documents recovered.
Inspect the queries that crossed the cutoff
The two runs shared 218 hits. Eight queries gained a hit, two lost one and 72 had no hit in either run. The public query IDs below let you inspect three changes yourself. For these examples we also examined ranks beyond the fifth result.
| Query ID | First relevant rank with abstract | First relevant rank with title added |
|---|---|---|
| 54 | 3 | 8 |
| 415 | 5 | 6 |
| 261 | 6 | 5 |
Queries 415 and 261 each moved just one place. One lost its evidence and the other gained it. If your product shows only three results, query 261 still has no visible hit. Set the cutoff to the number of results the reader actually sees or the answer generator actually consumes. A miss means that none of those results has a positive judgment in the dataset. A reviewer can still inspect an unjudged document.
Reproduce the comparison
Download the original scifact.zip from the BEIR dataset list. Leave the archive intact, save the script below as score.py and run python3 score.py scifact.zip. It requires Python 3 with FTS5-enabled SQLite. Our run used SQLite 3.51.0. The script reads the test judgments, deduplicates the English alphanumeric query terms and joins them with OR. Equal BM25 scores are resolved by numeric document ID.
import csv
import io
import json
import re
import sqlite3
import sys
import zipfile
from collections import defaultdict
with zipfile.ZipFile(sys.argv[1]) as archive:
def records(name):
return [json.loads(line) for line in archive.read("scifact/" + name).splitlines()]
docs = records("corpus.jsonl")
queries = {r["_id"]: r["text"] for r in records("queries.jsonl")}
labels = defaultdict(set)
qrels = archive.read("scifact/qrels/test.tsv").decode()
for row in csv.DictReader(io.StringIO(qrels), delimiter="\t"):
if int(row["score"]) > 0:
labels[row["query-id"]].add(int(row["corpus-id"]))
def run(with_title):
db = sqlite3.connect(":memory:")
db.execute("CREATE VIRTUAL TABLE docs USING fts5(body)")
for doc in docs:
body = doc["text"]
if with_title:
body = doc["title"] + " " + body
db.execute("INSERT INTO docs(rowid, body) VALUES (?, ?)", (int(doc["_id"]), body))
hits = set()
reciprocal = []
recalls = []
for qid, gold in labels.items():
words = dict.fromkeys(re.findall(r"[a-z0-9]+", queries[qid].lower()))
expression = " OR ".join('"' + w + '"' for w in words)
ranked = [row[0] for row in db.execute("SELECT rowid FROM docs WHERE docs MATCH ? ORDER BY bm25(docs), rowid LIMIT 5", (expression,))]
recalls.append(len(set(ranked) & gold) / len(gold))
rank = next((i for i, doc_id in enumerate(ranked, 1) if doc_id in gold), 0)
reciprocal.append(1 / rank if rank else 0)
if rank:
hits.add(qid)
db.close()
return hits, sum(reciprocal) / len(reciprocal), sum(recalls) / len(recalls)
baseline, baseline_mrr, baseline_recall = run(False)
candidate, candidate_mrr, candidate_recall = run(True)
print("docs", len(docs), "queries", len(labels))
print("abstract", len(baseline), round(baseline_mrr, 4), "recall@5", round(baseline_recall, 4))
print("title+abstract", len(candidate), round(candidate_mrr, 4), "recall@5", round(candidate_recall, 4))
print("gained", len(candidate - baseline), "lost", len(baseline - candidate))
print("new hits", sorted(candidate - baseline, key=int))
print("lost hits", sorted(baseline - candidate, key=int))Recall@5 averages the fraction of positively judged documents retrieved for each query. Query 261, for example, has two positive document IDs, 1122279 and 10697096, both included in its recall denominator. The runs are deterministic and do not use random sampling. The downloaded archive used for this run has SHA-256 536e14446a0ba56ed1398ab1055f39fe852686ecad24a6306c80c490fa8e0165.
Run the same acceptance check on Kinfra embeddings
For a product decision, start with actual questions from your knowledge base. Ask someone familiar with the material to identify documents that support an answer. Save the current search rankings. Then embed the same document snapshot and the same queries with kinfra-text-embedding-4b using the POST /v1/embeddings request on the SmarToken model page. Hold document IDs, chunking, access filters and result count fixed. If a document has several chunks, decide whether to score chunks or deduplicated documents and apply that choice to both runs.
Pass the ordered IDs from vector search through the same scoring step. Read the gained and lost query lists before interpreting the averages. Review regressions on questions where a missing source matters, such as a return deadline or a setup instruction. The public test gives you a reproducible baseline. The paired rankings on your own content tell you whether the proposed change helps your users.
Hit@5, Recall@5 and the scope of this test
This experiment evaluates document-level lexical retrieval on the BEIR SciFact test split, not a complete vector RAG pipeline or answer quality. Hit@5 asks whether at least one positively judged document appears in a query’s first five results. Recall@5 instead measures the fraction of that query’s judged relevant documents recovered within those five. If one of two relevant documents appears, Hit@5 is 1 and Recall@5 is 0.5.
MRR@5 averages the reciprocal rank of the first relevant result, assigning zero when none appears in the first five. If a claim is split into several searches, merge, deduplicate and rank candidates before scoring the final five; an any-hit across three separate top-five lists examines up to 15 results and is a different metric.