Basics · Prefix Protocol Ablation, Pooling & 512-Token Ceiling

Inside E5-large-v2: query: / passage: protocol, pooling & 512 tokens

Measure live why E5 demands asymmetric "query: " and "passage: " prefixes, verify mean pooling + L2 normalization against [CLS] on 1024-d vectors, and audit the full 512-token BERT positional limit.

Model status

A · Live 4-mode E5 prefix protocol ablation

The E5 model card warns that omitting or misassigning query: and passage: shifts embeddings away from the contrastive retrieval subspace. Run the same triplet under all 4 prefix protocols live.

Live 4-mode E5 prefix protocol comparison
Prefix protocol cos(Q, Positive) cos(Q, Distractor) Margin (Pos − Dist) Δ vs Asymmetric
Initialise e5-large-v2 above to run the 4-mode prefix ablation.

B · Mean vs CLS pooling & L2 normalization verification

intfloat/e5-large-v2 pools all non-padding token states with attention-masked mean pooling and L2-normalizes to unit length. Compare all 4 pooling/norm combinations live on 1024-d vectors.

Mean vs CLS pooling and L2 normalization ablation table
Pooling · Normalize cos(A, Pos) cos(A, Dist) Margin (Pos − Dist) dot(A, Pos) |cos − dot| ‖A‖ L2 norm
Run the pooling ablation to measure live 1024-d norms and margins.

C · 512-token BERT positional limit & tail-drop audit

Unlike 256-token MiniLM models, E5-large-v2 uses the full 512-token BertModel context window — tokens past 512 are dropped outright. Adjust filler blocks before the needle sentence and measure 128 → 512 budgets.

Live cosine score across 128, 256, 384, and 512 token budgets
Budget cap Full doc tokens Kept tokens cos(query, passage) Note
Click Audit 128 → 512 budgets to measure positional truncation.

Show the code

Show the code: exact WordPiece token budget slicing up to 512 tokens (worker.js)
Show the code: cosine vs dot-product equivalence verifier (e5-core.mjs)