FA-99491 / Vector retrieval ranking / Open access
Vector retrieval: Unequal vector norms distort cosine ranking · case 01
Unequal vector norms distort cosine ranking.
ROOT CAUSE
Raw dot products are ranked without accounting for candidate and query magnitudes.
THE FAILURE
Raw dot products are ranked without accounting for candidate and query magnitudes.
Unsuccessful approach: Dividing by the norm product instead of its square root over-penalizes large vectors.
Case contract
Rows are [id,dot,query_norm_squared,vector_norm_squared], with positive norms and valid dot products. Rank by signed cosine dot/sqrt(query_norm_squared*vector_norm_squared), then 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
import math
N = 1
observations = []
def solve(rows):
return [r[0] for r in sorted(rows,key=lambda r:(-r[1],r[0]))]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('large norm lowers cosine',solve([['a',3.5,4,4],['b',4,4,16]]),['a','b'])
check('small cosine despite dot',solve([['a',8,1,64],['b',3,1,16]]),['a','b'])
check('negative cosine',solve([['a',-2,1,16],['b',-1,1,1]]),['a','b'])
check('equivalent cosine lexical',solve([['z',2,1,4],['a',1,1,1]]),['a','z'])
check('scaled vectors',solve([['a',N,N,N],['b',2*N,4*N,4*N]]),['a','b'])
check('three norm scales',solve([['c',1,1,16],['a',3,1,9],['b',2,1,4]]),['a','b','c'])
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 |
|---|---|---|---|
| large norm lowers cosine | ['b', 'a'] | ['a', 'b'] | Failed |
| small cosine despite dot | ['a', 'b'] | ['a', 'b'] | Passed |
| negative cosine | ['b', 'a'] | ['a', 'b'] | Failed |
| equivalent cosine lexical | ['z', 'a'] | ['a', 'z'] | Failed |
| scaled vectors | ['b', 'a'] | ['a', 'b'] | Failed |
| three norm scales | ['a', 'b', 'c'] | ['a', 'b', 'c'] | Passed |
SHA-256 / a7035dd2328828f0aa930dc058cea4b5a4e4b34e96020ef79863696024924dbf
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(rows):
return [r[0] for r in sorted(rows,key=lambda r:(-(r[1]/(r[2]*r[3])),r[0]))]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('large norm lowers cosine',solve([['a',3.5,4,4],['b',4,4,16]]),['a','b'])
check('small cosine despite dot',solve([['a',8,1,64],['b',3,1,16]]),['a','b'])
check('negative cosine',solve([['a',-2,1,16],['b',-1,1,1]]),['a','b'])
check('equivalent cosine lexical',solve([['z',2,1,4],['a',1,1,1]]),['a','z'])
check('scaled vectors',solve([['a',N,N,N],['b',2*N,4*N,4*N]]),['a','b'])
check('three norm scales',solve([['c',1,1,16],['a',3,1,9],['b',2,1,4]]),['a','b','c'])
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 |
|---|---|---|---|
| large norm lowers cosine | ['a', 'b'] | ['a', 'b'] | Passed |
| small cosine despite dot | ['b', 'a'] | ['a', 'b'] | Failed |
| negative cosine | ['a', 'b'] | ['a', 'b'] | Passed |
| equivalent cosine lexical | ['a', 'z'] | ['a', 'z'] | Passed |
| scaled vectors | ['a', 'b'] | ['a', 'b'] | Passed |
| three norm scales | ['b', 'a', 'c'] | ['a', 'b', 'c'] | Failed |
SHA-256 / 53d3d307f0d305c88d83ce94d8d57c0b781ee1314d4c92130a51fd7fc96962fe
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.913743+00:00.
Case digest / 9b6b3e352054855d5bc21ee0d24eaca4d6ccbb779192c40f39b05c68bfca48f8