FAILURE MAP
← Case archive

FA-99386 / Embedding vector normalization / Open access

Weighted pooling normalizes token vectors before combining them · case 01

Weighted pooling normalizes token vectors before combining them.

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

ROOT CAUSE

Each token is normalized before weighting, which discards the supplied token magnitudes.

THE FAILURE

Each token is normalized before weighting, which discards the supplied token magnitudes.

Unsuccessful approach: Returning the weighted mean without a final unit-length step leaves a nonunit pooled vector.

Case contract

Return the L2-unit direction of the weighted mean; zero total weight or a zero pooled vector 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]/(sum(x*x for x in v)**0.5) for v,w in zip(vectors,weights))/sum(weights) for j in range(len(vectors[0]))] if vectors and sum(weights) else []
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('magnitudes matter', solve([[N,0],[0,3*N]],[1,1]), [1/10**0.5,3/10**0.5])
check('weighted direction', solve([[N,N],[0,N]],[3,1]), [0.6,0.8])
check('zero total', solve([[N],[2*N]],[0,0]), [])
check('empty', solve([],[]), [])
check('cancels', solve([[N],[-N]],[1,1]), [])
check('singleton', solve([[3*N,4*N]],[N]), [0.6,0.8])
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
magnitudes matter[0.5, 0.5][0.31622776601683794, 0.9486832980505138]Failed
weighted direction[0.5303300858899106, 0.7803300858899106][0.6, 0.8]Failed
zero total[][]Passed
empty[][]Passed
cancels[0.0][]Failed
singleton[0.6, 0.8][0.6, 0.8]Passed

SHA-256 / ecd81a1f1f06c8d4ccb9b0d08f8ab52b34ae6929ba9cd8d98615b7a40535ad94

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(vectors, weights):
    p=[sum(w*v[j] for v,w in zip(vectors,weights)) for j in range(len(vectors[0]))] if vectors else []
    return [x/sum(weights) for x in p] if p and sum(weights) else []
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('magnitudes matter', solve([[N,0],[0,3*N]],[1,1]), [1/10**0.5,3/10**0.5])
check('weighted direction', solve([[N,N],[0,N]],[3,1]), [0.6,0.8])
check('zero total', solve([[N],[2*N]],[0,0]), [])
check('empty', solve([],[]), [])
check('cancels', solve([[N],[-N]],[1,1]), [])
check('singleton', solve([[3*N,4*N]],[N]), [0.6,0.8])
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
magnitudes matter[0.5, 1.5][0.31622776601683794, 0.9486832980505138]Failed
weighted direction[0.75, 1.0][0.6, 0.8]Failed
zero total[][]Passed
empty[][]Passed
cancels[0.0][]Failed
singleton[3.0, 4.0][0.6, 0.8]Failed

SHA-256 / 442299ecbb532c438db08e450c7ae19e056323086b1a5b848adb9fed4454161d

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

Case digest / 7fd98672d7ce8326379a27cf198cb6c48336433056b588ecacbe6e64eb70a233