FAILURE MAP
← Case archive

FA-99366 / Embedding vector normalization / Open access

Weighted pooling divides by token count · case 01

Weighted pooling divides by token count.

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

ROOT CAUSE

Weighted vector contributions are summed but the total weight is ignored.

THE FAILURE

Weighted vector contributions are summed but the total weight is ignored.

Unsuccessful approach: Dividing by the number of vectors is only correct when weights sum to that count.

Case contract

Pool equal-width vectors with nonnegative weights into a weighted mean; total weight zero or no vectors returns empty.

Why this case matters

A small embedding preparation contract can be checked without a model or retrieval system.

1 / The failure

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

N = 1
observations = []
def solve(vectors, weights):
    return [sum(w*v[j] for v,w in zip(vectors,weights)) for j in range(len(vectors[0]))] if vectors else []
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unequal weights', solve([[0,N],[N,2*N]],[1,3]), [3*N/4,7*N/4])
check('equal weights', solve([[N,0],[0,N]],[1,1]), [N/2,N/2])
check('zero total', solve([[N],[2*N]],[0,0]), [])
check('empty rows', solve([],[]), [])
check('one vector', solve([[N,2*N]],[N]), [N,2*N])
check('weighted zero vector', solve([[0,N],[2*N,0]],[0,1]), [2*N,0])
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
unequal weights[3, 7][0.75, 1.75]Failed
equal weights[1, 1][0.5, 0.5]Failed
zero total[0][]Failed
empty rows[][]Passed
one vector[1, 2][1, 2]Passed
weighted zero vector[2, 0][2, 0]Passed

SHA-256 / 15934326bc3ff8357e02746e19ce524292aaeff8dfb989bb643a21a201273ba9

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(vectors, weights):
    return [sum(w*v[j] for v,w in zip(vectors,weights))/len(vectors) for j in range(len(vectors[0]))] if vectors else []
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unequal weights', solve([[0,N],[N,2*N]],[1,3]), [3*N/4,7*N/4])
check('equal weights', solve([[N,0],[0,N]],[1,1]), [N/2,N/2])
check('zero total', solve([[N],[2*N]],[0,0]), [])
check('empty rows', solve([],[]), [])
check('one vector', solve([[N,2*N]],[N]), [N,2*N])
check('weighted zero vector', solve([[0,N],[2*N,0]],[0,1]), [2*N,0])
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
unequal weights[1.5, 3.5][0.75, 1.75]Failed
equal weights[0.5, 0.5][0.5, 0.5]Passed
zero total[0.0][]Failed
empty rows[][]Passed
one vector[1.0, 2.0][1, 2]Passed
weighted zero vector[1.0, 0.0][2, 0]Failed

SHA-256 / 82cf7bf7535ea1abe512f6caf6b3372f3ff51b44e913f1ccb269513250f3b1ea

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 finite toy vectors or token rows; this contract makes no claim about model quality or production embedding behavior. 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:23.555583+00:00.

Case digest / ee2bacd62414b1563c9b4b94333d6cba5e4e9be6ac8996b36335048bddfc5781