FAILURE MAP
← Case archive

FA-99456 / Vector retrieval ranking / Open access

Vector retrieval: Equal scores inherit input order instead of ID order · case 01

Equal scores inherit input order instead of ID order.

Verified by executionVariant 1 · 6 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

No identifier tie key is supplied, so stable input order leaks into output.

THE FAILURE

No identifier tie key is supplied, so stable input order leaks into output.

Unsuccessful approach: Length-based ordering is not lexical ordering for equal length identifiers.

Case contract

Rows [id,score] rank by descending score and ascending ID.

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):
    return [r[0] for r in sorted(rows,key=lambda r:-r[1])]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('reverse tied ids',solve([['z',N],['a',N]]),['a','z'])
check('same length ids',solve([['b',N],['a',N]]),['a','b'])
check('tie after leader',solve([['z',N],['x',N+1],['a',N]]),['x','a','z'])
check('three tie',solve([['c',1],['b',1],['a',1]]),['a','b','c'])
check('prefix tie',solve([['aa',N],['ab',N]]),['aa','ab'])
check('unequal scores',solve([['a',N],['z',N+1]]),['z','a'])
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 fixtureActualExpectedOutcome
reverse tied ids['z', 'a']['a', 'z']Failed
same length ids['b', 'a']['a', 'b']Failed
tie after leader['x', 'z', 'a']['x', 'a', 'z']Failed
three tie['c', 'b', 'a']['a', 'b', 'c']Failed
prefix tie['aa', 'ab']['aa', 'ab']Passed
unequal scores['z', 'a']['z', 'a']Passed

SHA-256 / 9bed7f3c7a8f6cdde8246bba0ba63affabb8f9fea724774ae16e78c9b940b62c

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(rows):
    return [r[0] for r in sorted(rows,key=lambda r:(-r[1],-len(r[0])))]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('reverse tied ids',solve([['z',N],['a',N]]),['a','z'])
check('same length ids',solve([['b',N],['a',N]]),['a','b'])
check('tie after leader',solve([['z',N],['x',N+1],['a',N]]),['x','a','z'])
check('three tie',solve([['c',1],['b',1],['a',1]]),['a','b','c'])
check('prefix tie',solve([['aa',N],['ab',N]]),['aa','ab'])
check('unequal scores',solve([['a',N],['z',N+1]]),['z','a'])
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 fixtureActualExpectedOutcome
reverse tied ids['z', 'a']['a', 'z']Failed
same length ids['b', 'a']['a', 'b']Failed
tie after leader['x', 'z', 'a']['x', 'a', 'z']Failed
three tie['c', 'b', 'a']['a', 'b', 'c']Failed
prefix tie['aa', 'ab']['aa', 'ab']Passed
unequal scores['z', 'a']['z', 'a']Passed

SHA-256 / 32394be6fb0ba49c883084dbb2055a492b44c5c6eb9c80aeef78a3f1dd787d0c

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:24.474426+00:00.

Case digest / 846f332fc907d5205ebf6fe88cc22c9f556a7bfc42af321123e9314569ccfd5a