Basics · Pooling Ablation, Pair Margin & 256-Token Sequence Ceiling

Inside all-MiniLM-L12-v2: mean vs cls pooling & token limits

The raw BERT backbone outputs 384-d vectors for every token. See live how mean pooling + L2 normalization affects semantic discrimination versus [CLS] pooling, test 12-layer causal margins, and inspect the 256-token SentenceTransformer ceiling.

Model status

A · Live mean vs cls pooling & normalize ablation

SentenceTransformers trained all-MiniLM-L12-v2 specifically with pooling: "mean" and normalize: true. Compare all 4 combinations live on an anchor, positive paraphrase, and topical distractor to measure discrimination margin and pre-norm vector lengths.

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
Initialise all-MiniLM-L12-v2 above to run the 4-mode pooling ablation.

B · 12-layer MiniLM-L12 causal separation probe (vs L6 reference)

Run live 12-layer inference on causal and multi-clause triplets where lexical overlap misleads keyword matchers, alongside published MiniLM-L6 architectural context (without faking unrun L6 weights).

12-layer MiniLM-L12 candidate cosine scores
Candidate Role Live L12 Cosine Text
Run a 12-layer depth preset to see live candidate scores.

C · 256-token SentenceTransformer limit vs 512-token BERT ceiling

Adjust how many telemetry filler blocks precede the resolution sentence, then run budgets from 128 → 512 tokens. SentenceTransformers trained all-MiniLM-L12-v2 up to 256 tokens; tokens past 512 are dropped outright.

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

Show the code

Show the code: exact WordPiece token budget slicing (worker.js)
Show the code: cosine vs dot-product equivalence verifier (minilm-l12-core.mjs)