The Nearest Neighbor Can Be Wrong

Concepts

CHAPTER 10 β€” THE NEAREST NEIGHBOR CAN BE WRONG

PART III β€” RETRIEVAL IS AN EXPERIMENT

PURPOSE

Build the cases where the nearest neighbor is fluent, on-topic, closest, and wrong; install the two principles “similarity is not equivalence” and “retrieval is not verification”; show the geometry is a weak instrument for polarity, role, and time.

CENTRAL QUESTION

When the nearest neighbor is wrong, what kind of wrong is it, and can the geometry tell the difference?

UNIQUE CLAIM

Most near-but-wrong retrieval failures (weaker paraphrase, negation, lexical/entity trap, same-topic-different-claim, relation swap, temporal mismatch, partial support) are invisible to a bi-encoder similarity score because the objective encoded aboutness, not truth/polarity/role/time β€” so top-1 cosine is not a correctness signal, and a distractor of a known type beats the correct answer a third to half the time.

THE OBJECT

Neighborhoods / retrieval failure. Demonstration: RELATE matched (query, correct, distractor) triples where distractors win 22–46% by type with a bi-encoder; a cross-encoder reranker cuts negation and relation-swap partially, temporal barely.

CONCEPTS INTRODUCED

Taxonomy of near-but-wrong (7 types); aboutness vs truth/polarity/role/time; bi-encoder vs cross-encoder reranker (cross-attention over the pair); “similarity is not equivalence”; “retrieval is not verification”; the retrieveβ†’candidatesβ†’verify handoff to the Hallucination book.

CONCEPTS DEVELOPED / REUSED

“Aboutness vs polarity” from Ch1/Ch3 now a full taxonomy; metric-can’t-fix-representation from Ch4 restated for rerankers; hard negatives named here, mined systematically in Ch11; per-type verdict feeds Ch12 policy and Ch15 (one scalar insufficient).

PREREQUISITES

Ch1–9. Retrieval primitive, cosine.

LOCAL INVARIANTS

Never use top-1 similarity as a correctness signal; measure which distractor types a reranker actually fixes; treat retrieved passages as candidates not facts; never report only average retrieval metrics.

FAILURE MODES

Top-1 similarity as correctness; assuming a reranker fixes everything; passing retrieved passages to a model as facts; reporting only averages (hides the tail).

DIAGNOSTIC METHOD

  1. Build labeled (query, correct, distractor-by-type) triples. 2. Bi-encoder top-1: correct vs distractor, tabulated by type. 3. Add reranker, re-tabulate. 4. Record cosine gaps for still-failing cases. 5. Assign each type {trust | rerank | verify}.

RESEARCH-DERIVED IDEAS

Negation insensitivity of sentence embeddings (multiple analyses; “this is not the opposite” line of work); cross-encoder reranking (Nogueira & Cho monoBERT; sentence-transformers cross-encoders); relation-direction / compositionality failures in bi-encoders; temporal robustness gaps in retrieval; BEIR showing model rankings shift across task types. Named without citation metadata; distractor win-rates are MEASURED (Wave 1 row 1.7): bi-encoder 0-16% on clean queries; an NLI reranker raises negation/temporal error.

EXPERIMENT / LAB

Lab 10 (PROPOSED): 100 triples across 5+ distractor types; bi-encoder distractor-wins % by type; + reranker delta; cosine gap for 10 residual failures. Deliverable: per-type verdict (trust / rerank / verify) for the reader’s stack, carried into Ch12.

COMPANION COMPONENT

distractor_probe(space, triples): per_type_error_rate, reranker_delta, cosine_gap_distribution, recommended_stage per type. Run on every new model/corpus registration; verdict attached to the retrieval spec.

READER OUTCOME

Reader can quantify how often each distractor type beats the correct answer in their stack and decide per type whether retrieval alone, reranking, or verification is required.

DEPENDENCIES

Ch1–9.

FORWARD BRIDGE

Ch11 “Hard Negatives” β€” from hand-built distractors to systematic mining of the hardest negatives, and the margin collapse they expose.

ANTI-CLAIMS / LIMITS

Does not claim retrieval is unreliable in general (fine on easy relations) or that a given model fails a given type β€” per-model measurement. Claim: top-1 cosine is not a truth signal.

Explain this chapter with AI

Copy this prompt into ChatGPT, Claude, Gemini, a local model, or another AI.

Apply this chapter with AI

Copy this prompt into ChatGPT, Claude, Gemini, a local model, or another AI.

Part III β€” Retrieval Is an Experiment

The result that is closest and wrong

Query:

Is Dublin the capital of Ireland?

Top retrieved passage, cosine 0.91:

Dublin is not, and has never been, the capital of Ireland β€” that
distinction belongs to the older seat of government at Tara.

Fluent, on-topic, confidently phrased, geometrically the closest thing in the corpus β€” and false. A model handed this passage as context may repeat its claim. The retrieval system did its job perfectly: it found the nearest vector. “Nearest” was not “correct.”

When the nearest neighbor is wrong, what kind of wrong is it β€” and can the geometry tell the difference?

A taxonomy of near-but-wrong

  • Paraphrase that is not equivalent. “The drug reduced symptoms” vs. “The drug reduced symptoms in a subgroup.” High similarity, different claim strength.
  • Negation. “X is true” vs. “X is false.” Near-identical strings; near-identical vectors in most models (Chapter 1).
  • Lexical / entity trap. Query about “Apple’s 2019 revenue” retrieves a passage rich in “Apple,” “2019,” “revenue” that is actually about a different metric or a forecast.
  • Same topic, different claim. Both passages are about the treaty; one describes what it proposed, one what was ratified.
  • Relation swap. “A acquired B” vs. “B acquired A.” Same entities, same verb, reversed roles.
  • Temporal mismatch. Correct claim, wrong year. “The population is 1.4M” (2005) retrieved for a 2024 query.
  • Partial support. The passage supports part of the query and is silent or contradictory on the rest.

Each of these is a different failure, and β€” crucially β€” most embedding models place all of them close to the query, because the objective encoded aboutness, not truth, polarity, role, or time.

Near-but-wrong type Example Separable by a bi-encoder cosine? What actually helps
Paraphrase not equivalent “reduced symptoms” vs “…in a subgroup” no claim-level decomposition
Negation “X is true” vs “X is false” no β€” near-identical vectors a model trained for polarity (NLI)
Lexical / entity trap query terms present, wrong metric weakly reranker, then verification
Same topic, different claim what a treaty proposed vs what was ratified no claim decomposition + verification
Relation swap “A acquired B” vs “B acquired A” rarely β€” cross-encoder does better cross-encoder reranker
Temporal mismatch right claim, wrong year no, unless dates are salient tokens date-aware metadata filter
Partial support supports part, silent/contradictory on the rest no β€” a single score cannot claim-level checking

Two principles this chapter installs

Similarity is not equivalence. A high score means “these occupy nearby regions under this representation,” not “these say the same thing.”

Retrieval is not verification. Finding a passage that mentions a claim is not confirming the claim. The retrieval step and the checking step are different operations, and an embedding does only the first.

This is the clean handoff to the Hallucination book’s territory: retrieval delivers candidates; something else must decide what they support.

Can the geometry tell the difference? Sometimes, weakly

  • Polarity/negation: most general-purpose models β€” no. NLI-trained or instruction-tuned retrieval models β€” partially. Measurable per model.
  • Relation swap: usually no for bi-encoders; cross-encoder rerankers do better because they attend across the pair.
  • Temporal: no, unless dates are salient tokens and the model weights them.
  • Partial support: no from a single similarity score; needs claim-level decomposition.

The honest summary: a bi-encoder similarity score is a weak instrument for all of these. Rerankers, decomposition, and verification are the tools that help β€” and they are separate stages.

Demonstration: the near-but-wrong subsets of RELATE

MEASURED on RELATE v0.1, Wave 1 row 1.7 β€” artifact experiments/embeddings-from-first-principles/wave1/artifacts/distractor-winrate.json. Bi-encoder all-mpnet-base-v2; reranker is an NLI cross-encoder (cross-encoder/nli-deberta-v3-base) standing in for a retrieval cross-encoder.

RELATE includes matched sets: for each query, a grade-3 correct answer and near-but-wrong distractors of a known type. Take the fraction of triples where the distractor outscores the correct answer.

distractor type            bi-encoder distractor-win-rate   + NLI reranker
relation-swap                        16%                        8%
same-topic-different-claim           16%                       27%
entity trap                           4%                       26%
negation                              4%                       34%   ← reranker makes it worse
temporal-mismatch                     0%                       38%   ← reranker makes it worse

MEASURED: against clean restatement queries a general bi-encoder holds up better than the earlier illustration guessed β€” the distractor wins 0–16% of the time, not a third to a half. But look at the second column: an NLI reranker, the obvious “second stage,” increases the negation and temporal-mismatch error, because “does this statement answer the question” and “does this statement entail the question” come apart exactly on polarity and time. The bi-encoder’s real weakness is not the raw win-rate β€” it is the margin (Chapter 11, row 1.8: relation-swap margin +0.03) and the fact that no single similarity number separates “supports the query” from “is about the query” (Chapter 14). A reranker helps only if it was trained for the distinction you are missing.

What this chapter establishes and what it does not

Establishes: a taxonomy of near-but-wrong retrieval failures; that most are invisible to a bi-encoder similarity score because the objective encoded aboutness; the two principles (similarity β‰  equivalence, retrieval β‰  verification); that rerankers help unevenly and verification is a separate stage.

Does not establish: that retrieval is unreliable in general (on easy relations it is fine), or that any given model fails a given type (measure it). It establishes that “top-1 cosine” is not a truth signal and should never be used as one.

Lab 10: how often does a distractor win?

PROPOSED, not executed.

Setup. Build 100 query triples: (query, correct answer, near-but-wrong distractor of a labeled type). Cover 5+ distractor types.

Task.

  1. Bi-encoder top-1: does the correct answer or the distractor win? Tabulate by type.
  2. Add a cross-encoder reranker over top-k. Re-tabulate.
  3. For 10 cases where the distractor still wins, record the cosine gap β€” how close was it?
Distractor type bi-encoder distractor-wins % + reranker % median cosine gap
negation
relation swap
temporal
lexical trap
partial support

Success criterion. A per-type verdict for your stack: “trust top-1”, “needs reranking”, or “needs verification”. Carry it into Chapter 12’s policy.

Companion component: the distractor probe

distractor_probe(space, triples):
  per_type_error_rate:   {negation: .., relation_swap: .., ...}
  reranker_delta:        improvement per type
  cosine_gap_distribution: how close the wrong answers are
  recommended_stage:     {trust | rerank | verify}  per type

The Observatory runs this against a labeled probe set whenever a new model or corpus is registered, and attaches the per-type verdict to the retrieval spec.

Failure modes

  • Using top-1 similarity as a correctness signal. It is an aboutness signal.
  • Assuming a reranker fixes everything. It fixes some types partially; measure which.
  • Passing retrieved passages to a model as “facts”. They are candidates; the Hallucination book’s containment/verification stages decide what they support.
  • Reporting only average retrieval metrics. The average hides the near-but-wrong tail entirely.

What this chapter established

  • Seven types of near-but-wrong retrieval failure, each a distinct error.
  • Most are invisible to a bi-encoder similarity score because the training objective encoded aboutness, not truth/polarity/role/time.
  • Two installed principles: similarity is not equivalence; retrieval is not verification.
  • Rerankers help unevenly; verification is a separate stage.
  • The distractor probe: per-type error rates and a {trust | rerank | verify} verdict feeding retrieval policy.

Next

We built distractors by hand and by type. The next chapter makes it systematic: mine the corpus for the hardest negatives automatically, and watch the margin that easy benchmarks report collapse under them.