FA-99536 / Vector retrieval ranking / Open access
Vector retrieval: A query vector retrieves its own record · case 01
A query vector retrieves its own record.
ROOT CAUSE
The query identity is not removed before top-k selection.
THE FAILURE
The query identity is not removed before top-k selection.
Unsuccessful approach: Filtering the ID and then skipping the first result loses the true nearest neighbor.
Case contract
Rows [id,distance]; omit query_id then return nearest k IDs.
Why this case matters
An offline vector retrieval toy model isolates one ranking contract from embedding generation, storage, and serving.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(rows, query_id, k):
return [r[0] for r in sorted(rows,key=lambda r:(r[1],r[0]))[:k]]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('self nearest',solve([['self',0],['a',N],['b',N+1]],'self',1),['a'])
check('self after filter',solve([['a',N],['self',0],['b',N+1]],'self',2),['a','b'])
check('query absent',solve([['a',N],['b',N+1]],'self',1),['a'])
check('only self',solve([['self',0]],'self',1),[])
check('zero limit',solve([['self',0],['a',N]],'self',0),[])
check('empty',solve([],'self',N),[])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| self nearest | ['self'] | ['a'] | Failed |
| self after filter | ['self', 'a'] | ['a', 'b'] | Failed |
| query absent | ['a'] | ['a'] | Passed |
| only self | ['self'] | [] | Failed |
| zero limit | [] | [] | Passed |
| empty | [] | [] | Passed |
SHA-256 / f1577c5265713a4315b9b3fd121a4437b91d33013e9df612c3ffc5a2322180ba
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(rows, query_id, k):
return [r[0] for r in sorted((r for r in rows if r[0]!=query_id),key=lambda r:(r[1],r[0]))[1:k+1]]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('self nearest',solve([['self',0],['a',N],['b',N+1]],'self',1),['a'])
check('self after filter',solve([['a',N],['self',0],['b',N+1]],'self',2),['a','b'])
check('query absent',solve([['a',N],['b',N+1]],'self',1),['a'])
check('only self',solve([['self',0]],'self',1),[])
check('zero limit',solve([['self',0],['a',N]],'self',0),[])
check('empty',solve([],'self',N),[])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| self nearest | ['b'] | ['a'] | Failed |
| self after filter | ['b'] | ['a', 'b'] | Failed |
| query absent | ['b'] | ['a'] | Failed |
| only self | [] | [] | Passed |
| zero limit | [] | [] | Passed |
| empty | [] | [] | Passed |
SHA-256 / 07fe0c4c2f4c6e3f81d7fd4ff78f02737ebac768d4da6d7286b81d252b40305c
HELD IN THE MEMBER ARCHIVE
The verified repair and its recorded checks are member-only.
This mechanism has 6 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.
Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.
Member access is invitation-based. Sign in with your invited account to inspect the repair.
Sign in to the archive ↗Verification & scope
Inputs are small exact toy vectors and scores. No production index, ANN recall, embedding quality, or latency claim is implied. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.
Observations recorded using Python 3.12.14 at 2026-09-30T16:48:25.349039+00:00.
Case digest / bdae26ae900fbbb8e97c4427d053d14f81e7ad97b6c6fc8af2ded76cd29be901