WorksComputer Science
Small Learned Projections for Semantic-Reversal-Aware Retrieval with Spectral Acceleration: A Four-Domain Empirical Study
Abstract
Dense-embedding retrievers can fail adversarially: when a query is answered by a document A and reversed by a near-copy B that differs from A by a small meaning-changing edit (a "trap"), raw cosine over E5-Large-v2 places B in the top-10 for 82-100% of queries at a pool of 5,000. We study two things. First, a small learned projection W: R^1024 -> R^d (d in {11, 32}), trained by a deterministic recipe on a declared set of cases, that suppresses the trap: for the declared cases, HN@10 = 0.0000 (no trap in the top-10) in all twelve (domain, pool-size) settings across four independent domains (legal, medical, patent, financial) and pools up to 100,000, while the correct paraphrase is retained for 93-99% of cases, under exact nearest-neighbour search. Second, a boundary-conditioned accelerator that serves the projection at that scale: an acceleration of spectral graph retrieval (SpectRAG) that replaces a dense eigendecomposition with a boundary-value solve, holding HN@10 = 0.0000 at n = 100,000 in every domain and retrieving the ~300-query suite in 0.6-1.1 s (~2-4 ms per query on average). Because the lens's output is the stored representation (a few floats per document), a hardened, specialised index per domain or tenant is ~90x smaller and dimension-proportionally faster than the full embedding, making many small declared indexes a practical alternative to one large vector store. The claim is scoped to the declared cases on the measured pools, with no probabilistic bound; the correct-answer rate drops for a reworded query against an unchanged corpus (about 0.79, trap suppression still holding). A projection transfers only partly to other domains, which we report in full. The recipe, lenses, trap sets and evaluation harness are released under AGPL-3.0; the accelerator's implementation is a reserved commercial component, and every HN number is reproducible under exact search.
Introduction
Adversarial trap corpora are the strongest available stress-test for a dense-embedding retriever. Unlike random-negative distractors—which are trivially rejected—a trap document differs from the correct answer by a small meaning-changing edit—often a single token (must vs. must not, 500 mg vs. 5000 mg, comprising vs. consisting of, increased vs. decreased), and a short multi-token edit in the legal corpus. Cosine similarity in the embedding space assigns near-identical scores to and , so routinely appears in the top- retrieved list for any query anchored on . In domains with regulatory or compliance stakes (legal contracts, medical treatment guidelines, patent claim scope, financial disclosures), a trap surfacing in top-10 is a silent operational failure—the retriever confidently returns a document that reverses the intended semantics of the query.
The dense retriever we measure (raw cosine over E5-Large-v2, no task prefixes) is trap-vulnerable in this configuration: without a lens, the trap reaches the top-10 for 82–100 % of queries at a pool of 5 000 documents (§ 6). Whether other encoders and configurations behave the same is not measured here (§ 7.2). Our contribution is a training procedure that produces a small linear projection which keeps the trap out of the top-10 for the cases it is declared for, without collapsing retrieval utility (§ 3.1).
The mechanism is not novel in isolation. Learned linear projections trained with a preservation loss plus a hard-negative hinge term are standard building blocks in the metric-learning literature. What we contribute is:
A precise construction recipe that gives zero trap hits for the declared cases in every domain we measured, with the same code path.
Four-domain empirical validation—legal, medical, patent, financial—with matched methodology and zero per-domain code changes.
A cross-domain transfer experiment. Every trained lens is applied to the other domains’ trap corpora. A lens is built for its own domain’s cases; the experiment marks where it applies. Poor transfer is the expected outcome, but good transfer would not refute the recipe: a lens could also learn structure the domains share.
A complete transfer matrix measuring twelve mismatched-lens/trap-corpus pairs. Eleven stay at ; one sits at , below the 0.30 the pre-registration had set, and is reported as missed.
Reproducibility infrastructure. SHA-256-anchored artefacts, deterministic trap-generation scripts, a preflight duplicate-check guardrail, and an OSS release under AGPL-3.0.
We report enough measurement detail that any reader with a modest CPU-only machine and 24 GB of RAM can reproduce every number in the paper within a working day.
Summary of contributions
6-step recipe (§ 3) → on four domains; complete transfer matrix (§ 6.3): 11 of 12 off-diagonal cells at ; the 12th (Legal on Patent, ) is below the pre-registered 0.30 and reported as missed; a retrain (§ 6.4) explains it but does not pass it. The trap sets, generators, lenses, trainer and harness are released as pelloran-safety-lens under AGPL-3.0.
Related Work
Dense retrieval baselines. E5-Large-v2 (Wang et al. [14]), BGE-Large (Chen et al. [1]), and GTE-Large (Li et al. [7]) are representative of the 1024-dimensional sentence-encoder class, producing -normalisable dense embeddings with cosine as the natural similarity. In this paper we measure only E5-Large-v2 on the four trap corpora; the underlying embedding geometry that produces the trap vulnerability is shared across the class (both and lie inside the same near-token-copy neighbourhood in cosine space), so the same behaviour on BGE / GTE is a hypothesis for further experiments; we have not measured it (see Limitations, § 7.2).
Hybrid dense–sparse retrieval. BM25/dense hybrids (Robertson and Zaragoza [8]; Karpukhin et al. [4]) and ColBERT-style late-interaction models (Khattab and Zaharia [5]) are not, in general, a defence against the specific trap class studied here: our differs from by a single semantically-reversing token (must vs. must not), so BM25 assigns and near-identical lexical scores and hybrid dense–sparse retrievers inherit the dense component’s trap-fall. We report Cell A (raw cosine) as the dense-only baseline and do not run a BM25 experiment because we do not expect it to move on this trap taxonomy; a hybrid comparison on trap classes with wider lexical spread is scoped for follow-up work, not claimed here.
Adversarial IR. The adversarial-retrieval literature is dominated by black-box attack generation on the offensive side (Guo et al. [3]; Song et al. [12]; Wu et al. [16]). Our work sits on the defense side: given a known trap taxonomy, how to train a projection that suppresses trap-fall while preserving utility.
Negation in neural retrieval (NevIR). Weller et al. [15] build a benchmark of document pairs that differ only by a negation and ask retrieval models to rank each pair for a query. Most models rank at or below chance; cross-encoders do best, then late-interaction models, with bi-encoders and sparse models last; fine-tuning on contrastive negation data helps but leaves a large gap. Our trap pairs are of the same kind—one meaning-reversing difference—but cover more contrasts than negation (quantities, claim scope, direction), and our remedy is a small projection on top of a frozen bi-encoder rather than a different retriever architecture. We do not evaluate on NevIR here (§ 7.2).
Metric learning and steering vectors. Preservation-plus-hinge losses are standard in metric learning (Xing et al. [17]; Schroff et al. [10]; Sohn [11]). Steering vectors for language models (Turner et al. [13]; Zou et al. [18]) apply similar structural interventions on model activations. Our lens is closest to a supervised linear steering projection trained on a small triple set with the hinge term operating in the projected space.
Spectral graph retrieval (SpectRAG). Sahinoglu et al. [9] propose SpectRAG, a spectral graph-augmented retriever for multi-hop retrieval-augmented generation. It builds a weighted graph over document chunks whose edges encode semantic similarity, document adjacency, section hierarchy, shared entities, citation links, and similarity between LLM-generated utility questions, and it selects the final context under a fixed token budget. We build directly on this formulation. The serving layer of our pipeline (§ 3.9) is an acceleration of SpectRAG—the same spectral-retrieval formulation, with the dense eigendecomposition replaced by a boundary-conditioned equilibrium solve—which lifts it from a few thousand chunks to the -document pools used here. We do not re-run the original dense SpectRAG at these scales (it does not reach them); we cite it as the method we extend.
Duplicate contamination as a rigour gate. Benchmark inflation from duplicate near-copies is a well-documented failure mode in NLP evaluation [2, 6]. Our data-quality audit (§ 3.5) surfaces a 22 % duplicate rate in an early version of our legal trap corpus that inflated HitC@10 by 16 pp. We ship the resulting preflight guardrail as a hard gate before any lens training run.
Method
What a lens is declared for
A case is one specific contrasting statement pair: a statement , its trap ( with one meaning-reversing change), and a paraphrase of . For example, “Metformin is dosed at 500 mg twice daily for adults with type-2 diabetes”, the same sentence with 5000 mg, and “Adults with type-2 diabetes receive metformin 500 mg BID”. A case is not a contrast type: “dosage flips” in general is a type; the metformin pair is a case.
A lens is declared for a set of cases—an insurer’s contract terms AA, BB and CC, say—and is trained on exactly those. For a declared case it is meant to keep out of the top-10 for a query anchored on , and in it, in the evaluated distractor pools. Cases outside the declared set—including new statement pairs of the same type—are not covered by design: one declares and trains a lens for them (DD, EE), combines lenses, or declares the whole set (AA to EE) from the start.
A trap is unwanted where the reader needs the statement as it stands: answering, compliance and clause retrieval, where returning “must not” for “must” reverses the answer. Where the contradiction itself is sought—a search for conflicting clauses or for a change between versions— is a relevant result, and no lens is applied.
Figure 1 summarises the six deterministic steps of the recipe. Every step is described in detail in the subsections that follow.

Figure 1. The six-step lens training recipe. Steps 1–3 prepare the domain data; step 4 is the rigour guardrail; step 5 trains the safety lens; step 6 is the transfer experiment.
Trap corpus construction
Every trap corpus consists of unique test cases, each a triple :
— the anchor. A factually correct short clause (6–30 words) in the target domain’s vocabulary.
— the trap. Identical to except for one meaning-flipping token (or a small closed set of tokens for compound trap types). Length within ±20% of .
— the utility target. A paraphrase of preserving intent, using different surface phrasing.
Shape invariants. All three of , , are within 6–30 words, with the max-to-min word-count ratio bounded by 2.0. In the medical, patent and financial corpora differs from by one meaning-flipping token; in the broader legal corpus the change is a short meaning-altering edit (one to a few tokens). uses different phrasing but preserves the anchor concept.
Domain-specific taxonomies. The medical, patent and financial corpora each use four approximately-balanced single-token flip types; the legal corpus uses a broader, unbalanced taxonomy of 23 contract-clause trap types (the five largest shown below). The table groups flips by (type, example edit):
| Domain | Flip type | Example pair |
| Legal | numeric unit (102) | a measurement-unit edit |
| numeric threshold (46) | a threshold / boundary edit | |
| temporal scope (45) | a date / window edit | |
| anchor format (33) | a clause-reference edit | |
| conditional trigger (33) | must must not | |
| Medical | dosage | 500 mg 5000 mg |
| contraindication | indicated contraindicated | |
| population | adults pediatric | |
| drug substitution (LASA) | metformin metoprolol | |
| Patent | claim-scope | comprising consisting of |
| enablement | enabled disabled | |
| art | novel prior art | |
| mechanism substitution | encrypt decrypt | |
| Financial | direction | increased decreased |
| polarity | gain loss | |
| polarity | asset liability | |
| period | Q1 Q4 | |
| party | lender borrower |
Table 9.
Each corpus contains unique triples— per type for the medical, patent and financial domains; the legal set spreads its 299 cases across 23 types (largest 102, several with only a handful). We construct them via deterministic Python generators, shipped in the OSS release as scripts/gen_*_triples_*.py.
Distractor pool
For each domain we assemble a distractor pool of short (8–30 word) clauses in the target domain, sentence-split from a public corpus. Matched-shape distractors are essential—mixing sentence-length with paragraph-length distractors makes the retrieval geometry noise-dominated (Appendix § 11, failure mode 3).
Sources per domain:
Legal: LexGLUE, sentence-split.
Medical: PubMed abstracts, sentence-split, unique.
Patent: HuggingFace BIGPATENT abstracts, sentence-split across eight USPTO categories, 182 335 unique.
Financial: five HuggingFace financial NLP datasets combined and sentence-split, 177 561 unique.
Embedding
We use intfloat/e5-large-v2 (Wang et al., [14]). No task prefix (passage: / query:) applied. -normalisation after encoding. 1024-dimensional output. The training procedure is architecture-agnostic; the choice of E5 here is representative rather than load-bearing.
Preflight duplicate-check guardrail
Before training, we compute SHA-256 hashes of every triple’s flattened f32 embedding bytes and refuse to proceed if % of case rows are byte-identical duplicates. This is a hard gate. In an early experiment on the legal corpus we discovered a 22% duplicate rate that had silently inflated HitC@10 by 16 percentage points; the guardrail enforces the discipline at generation time. Preflight-check code and threshold rationale ship in the OSS release.
Lens training
The lens is a matrix with . Training minimises:
where:
is the mean-squared error between the pre- and post-projection pairwise cosine similarities, over a sampled batch of distinct document pairs (all , not only positive pairs). It preserves the geometry that makes retrieval work.
is the per-triple . It pushes the trap away from the query in the projected space while keeping the utility target close.
, , , . The regulariser is the mean of the squared entries of , not a summed norm, so is scaled to that convention.
Optimiser: Adam, learning rate , pairs_per_epoch = 8000, epochs = 200, seed = 42 (fully deterministic). Warm-starting from a prior lens (--init-aqwt) shortens convergence and closes the last percentage points of hn_loss. For a new domain from cold-start, and typically produces near-zero hn_loss; a second warm-start round with the same configuration or eliminates the residual. destabilises training (see Appendix § 12).
Training wall-clock: approximately 90 s per lens on a modern multi-core CPU (an AMD EPYC server, no GPU). No gradient checkpointing or mixed precision required.
Cross-domain transfer experiment
The final step of the recipe. Take the freshly trained domain- lens and measure it on the trap corpora of the other domains. A lens is built for its own domain’s cases, so we expect it to do much worse there; the experiment shows where a lens applies. It is not a validity test: a lens that also separated another domain’s traps would have learned structure the domains share, not failed. Our pre-registration had set HN@10 off-domain as a criterion. We report that criterion as it was written (§ 6.3), but no longer treat it as a condition for the recipe’s validity.
Determinism and reproducibility infrastructure
Every step of the recipe is deterministic given a fixed seed and pinned dependencies:
Trap generators emit the identical 301-triple corpus for a given seed = 42.
E5 embedding is deterministic in fp32.
Preflight duplicate check is a pure hash operation.
Adam with fixed seed is deterministic in CPU-only mode.
The measurement harness reports raw counts, not probabilistic estimates.
Every artefact (trap corpus, distractor pool, lens weight matrix, measurement JSON) is anchored by SHA-256 in Appendix A. Re-running the pipeline with the same seed and pinned dependencies reproduces the SHA exactly.
Serving at scale: a boundary-conditioned spectral retrieval accelerator
The lens is a reranking primitive. To serve it over pools of documents we pair it with a spectral retrieval accelerator. SpectRAG ([9]) selects context by a spectral analysis of a similarity graph over document chunks. Building that spectral structure densely requires an eigendecomposition of the graph Laplacian—an offline, per-corpus cost of that, in our measurements, exhausts memory well before and so caps the corpus size a dense build can index.
Our accelerator keeps the spectral-retrieval formulation but avoids the dense eigendecomposition. Writing the graph Laplacian in block form with a small boundary set (the query-anchored seeds) and interior , the equilibrium field over the interior is the discrete harmonic extension
the Dirichlet solution (Schur complement) of the boundary conditions. The interior field scores the interior nodes and the retrieval ranking is read off from it, so one boundary-value solve replaces the per-query spectral scoring.
Fixed boundary, varying values. The boundary set is fixed at the corpus level (a small set of anchor vertices); a query sets only the boundary values —its similarities to the boundary documents—changing the right-hand side but not . The factorisation of is therefore computed once per corpus and reused by every query, which is a solve against that fixed factorisation.
Three costs separate:
Graph build — assembling the sparse Laplacian over the pool: offline, per corpus.
Factorisation of — offline, per corpus, amortised over all queries.
Per-query solve — the boundary setup and the triangular or iterative solves that produce .
A conditional complexity claim. We do not claim near-linearity unconditionally. If is banded with a bandwidth bounded independently of , a banded Cholesky factorisation and each triangular solve are —linear in for fixed ; equivalently, an unfactorised Krylov solve costs for sparsity and iteration count , near-linear when and stay bounded on the retrieval graph (with preconditioning where needed). Our engine’s construction keeps the interior Laplacian in this bounded-bandwidth regime; that construction is the proprietary part and is not disclosed. The claim is therefore conditional on the stated bounded-bandwidth (resp. bounded-iteration) assumption—not a theorem about arbitrary retrieval graphs; the measured wall-clock is in § 6.2.
The accelerator is an optional, swappable backend. The lens emits -normalised -dimensional vectors; of the two backends we measure—the accelerator and the exact-nearest-neighbour substitute shipped in pelloran-safety-lens—both return the same HN@10 on these pools. (A projection does not by itself guarantee that an arbitrary downstream retriever selects the same documents; we claim this only for the two backends we compared.) The accelerator supplies the latency and the 100 000-document reach (Cell D, § 6.2); the safety property does not depend on it.
Cell-based Measurement Framework
We measure retrieval quality with four cells per pool-size configuration:
Cell A — raw E5 cosine, no lens, no graph. The baseline every dense-retrieval system starts from.
Cell B — 3-stage cascade: a utility projection () top- lens top-10. Pure projections, no graph.
Cell C — lens projection with exact nearest-neighbour search over the projected pool. This is the open, reproducible safety measurement: every HN@10 number in § 6 is from this cell, and it reproduces in pelloran-safety-lens.
Cell D — the same lens served by the spectral accelerator of § 3.9 (the deployed pipeline). HN@10 is identical to Cell C; Cell D adds the 0.6–1.1 s suite retrieval (2–4 ms per query) and the 100 000-document reach of § 6.2. Its numbers are measured and SHA-anchored; its retriever is a reserved commercial component.
For each cell we report:
HN@10 — hard-negative rate at , defined as the fraction of queries where the trap appears in the top-10 retrieved documents.
HitC@10 — correct-answer rate at , defined as the fraction of queries where the paraphrase appears in the top-10.
Cell D is the deployed pipeline; Cell C is its open, exact-search reproduction, with identical HN@10. The domain-agnostic claim is carried by Cells C and D together. Cells A and B are reference points.
Scope note. The spectral accelerator underlying Cell D is out-of-scope for this paper; only its interface is documented (the mathematics of why it is near-linear is given in § 3.9). The lens produced by the recipe in § 3 operates independently of this retriever and can be paired with any retrieval backend that consumes -normalised -dimensional embeddings. Readers reproducing the paper use the exact-nearest-neighbour backend on the projected pool (Cell C): every HN@10 number in § 6 is measured that way, with the package’s exact search. The accelerator’s latency (Cell D) requires the commercial retriever or an equivalent near-linear spectral backend.
Figure 2 contrasts the cells by the operations each applies between the shared E5-Large-v2 embedding of the query and the returned top-10 documents.

Figure 2. The measurement cells. All share the same E5-Large-v2 embedding of the query and differ in the operations applied to the pool before the top-10 is returned. Cell A is the dense-retrieval baseline; Cell B is the lens-only 3-stage cascade; the lens column feeds two interchangeable backends—Cell C (exact nearest-neighbour, open and reproducible) and Cell D (the spectral accelerator, reserved commercial; dashed box)—which return the same HN@10 (see § 4 scope note).
Experiments
Domains and sizes
Every corpus passes the 0.00 % preflight duplicate gate.
Pool sizes
Every domain is measured at approximately , 50k, and 100k (query cases + a same-domain distractor slice); exact pool sizes vary by a few hundred rows depending on how the underlying dedup-guardrailed AQTC binary is sized per domain, and are reported explicitly in the column of Table 1 in § 6. The pools are nested: the package’s pool builder (embed_and_pack.py) cuts each pool as the first documents of one fixed distractor list, for Medical, Patent and Financial; the Legal pools come from an earlier build whose record does not state it.
Hardware
All Cell C measurements on a single M4 laptop (10 CPU cores, no GPU). Lens training on an AMD EPYC server (CPU-only). No specialised hardware required.
Results
The lens on its declared cases: four domains, three pool sizes (exact nearest-neighbour search)
The headline table. Each row is one (domain, pool-size) pair, for the lens’s declared cases (§ 3.1). HN@10 = 0.0000 means that for none of the declared cases does the trap enter the top-10, among a pool of documents the lens never saw; the declared cases’ own phrasings are the trained ones. The result is zero observed trap hits on the declared training cases across the measured pools. We state no probabilistic bound on it: the cases are the ones the lens was trained and selected on, not an independent sample. The three pool sizes reuse the same cases.
| Domain | HN@10 (lens) | HitC@10 (lens) | HitC@10 (raw cosine) | |
| Legal | 5 897 | 0.0000 | 0.9866† | 0.6722 |
| Legal | 50 897 | 0.0000 | 0.9866† | 0.6722 |
| Legal | 100 897 | 0.0000 | 0.9833 | 0.6722 |
| Medical | 5 900 | 0.0000 | 0.9733 | 0.9867 |
| Medical | 50 900 | 0.0000 | 0.9700 | 0.9867 |
| Medical | 100 900 | 0.0000 | 0.9700 | 0.9867 |
| Patent | 5 903 | 0.0000 | 0.9701 | 0.9601 |
| Patent | 50 903 | 0.0000 | 0.9635 | 0.9601 |
| Patent | 100 903 | 0.0000 | 0.9568 | 0.9601 |
| Financial | 5 903 | 0.0000 | 0.9601 | 1.0000 |
| Financial | 50 903 | 0.0000 | 0.9468 | 1.0000 |
| Financial | 100 903 | 0.0000 | 0.9269 | 1.0000 |
Table 1 (PDF p. 11). Cell C — the lens under exact nearest-neighbour search: HN@10 and HitC@10 at for the declared cases, four domains three pool sizes, with raw cosine (HitC@10, Cell A) for reference. The open, reproducible measurement (pelloran-safety-lens, results/pool_sizes/).
Every number in the table is from the reproducibility package’s own measurement (pelloran-safety-lens, results/pool_sizes/, commit 9382839, Zenodo 10.5281/zenodo.24345474; the SHA-256 of each result file is in Appendix A), with exact nearest-neighbour search over the projected pool. The pool is the declared cases’ own rows plus the distractors: (the query’s , the trap and the paraphrase of every case). This table is Cell C (exact nearest-neighbour search). The served pipeline (Cell D, Table 2) runs the accelerator and reports the corresponding HitC@10, lower by up to at the largest pool (Patent at 100k: 0.9269 under the accelerator vs. 0.9568 here); HN@10 = 0.0000 in both. Cell B (the lens-only cascade) is tabulated in the same-pool runtime comparison (Table 3, § 6.2)—and is not part of pelloran-safety-lens. The last column is Cell A’s HitC@10: raw cosine on the same pools, the same encoder, no E5 prefixes, measured by the same exact search (miss_diagnostic.py --raw; results/raw_cosine/, hashes in Appendix A). Against raw cosine the lens raises HitC@10 in Legal at every size (0.6722 → 0.9866 at 5k, 0.9833 at 100k). In Patent it raises it at 5k (0.9601 → 0.9701) and 50k (0.9601 → 0.9635), and lowers it at 100k (0.9568). It costs some in Medical (0.9867 0.9733 at 5k) and Financial (1.0000 0.9601).
| Domain | HN@10 | HitC@10 | Suite wall | |
| Legal | 5 897 | 0.0000 | 0.9799 | 0.03 s |
| Legal | 50 897 | 0.0000 | 0.9866 | 0.26 s |
| Legal | 100 929 | 0.0000 | 0.9498 | 0.62 s |
| Medical | 5 300 | 0.0000 | 0.9733 | 0.05 s |
| Medical | 50 300 | 0.0000 | 0.9700 | 0.45 s |
| Medical | 100 300 | 0.0000 | 0.9633 | 1.06 s |
| Patent | 5 300 | 0.0000 | 0.9701 | 0.05 s |
| Patent | 50 300 | 0.0000 | 0.9535 | 0.43 s |
| Patent | 100 300 | 0.0000 | 0.9269 | 1.03 s |
| Financial | 5 300 | 0.0000 | 0.9601 | 0.05 s |
| Financial | 50 300 | 0.0000 | 0.9435 | 0.48 s |
| Financial | 100 300 | 0.0000 | 0.9203 | 1.05 s |
Table 2. Cell D: the lens served by the spectral accelerator. HN@10 and HitC@10 at , and the retrieval wall-clock, for four domains three pool sizes. The wall-clock is the measured elapsed time for the retrieval of the full -query suite on a laptop CPU (the corpus is preembedded; query embedding is excluded); the per-query figure is this divided by the number of queries — e.g. Legal 100k 0.62 s/299 ms — a suite average, not an isolated single-query latency. Measured and SHA-anchored (Appendix § 10); not part of pelloran-safety-lens. Sources: sealed internal runs, one per domain (Legal, Medical, Patent, Financial).
| pool | backend | wall-clock | HN@10 | HitC@10 |
| 5 897 | Cell B cascade (exact) | 3.85 s | 0.0836 | 0.9900 |
| 5 897 | Cell D accelerator | 0.027 s | 0.0000 | 0.9799 |
| 50 897 | Cell B cascade (exact) | 35.33 s | 0.0970 | 0.9900 |
| 50 897 | Cell D accelerator | 0.261 s | 0.0000 | 0.9866 |
| 100 929 | Cell B cascade (exact) | 72.04 s | 0.0970 | 0.9900 |
| 100 929 | Cell D accelerator | 0.620 s | 0.0000 | 0.9498 |
Table 3. Sealed same-pool runtime (Legal, dedup pools): the lens-only 3-stage cascade (Cell B, exact scoring) and the spectral accelerator (Cell D) on the identical pool. Wall-clock is the retrieval of the whole 299-case suite (per-query average = suite / 299). The accelerator is 116–143 faster and holds HN@10 = 0.0000; its HitC@10 cost vs. the cascade’s exact scoring is 1–4 points, growing with pool size.
What grows with the pool. With a fixed projection, exact nearest-neighbour search and unchanged document vectors, adding documents to a nested pool can only keep a trap’s rank or push it down. A trap outside the top-10 at 5k therefore stays outside it at 50k and 100k, so for the three nested domains the stable HN@10 = 0.0000 across the growing pools is expected, close to trivial; for Legal it is measured at each size. The informative scaling result is HitC@10: the correct paraphrase has to survive twenty times more competition. From 5k to 100k it is retained for 98.66 98.33 % of the cases in Legal, 97.33 97.00 % in Medical, 97.01 95.68 % in Patent, and 96.01 92.69 % in Financial.
Without the lens (Cell A, raw cosine), a trap reaches the top-10 for 82–100 % of queries at in all four domains (HN@10 = 0.8127 Legal, 0.9967 Medical, 0.9967 Patent, 0.9900 Financial), and for 81–100 % at 50k and 100k (Legal 0.8161 and 0.8161, Medical and Patent 0.9967, Financial 0.9867; results/raw_cosine/). Legal’s slightly lower value at 5k is one trap that ties at rank 10 with identical clauses of other cases; the exact search’s sort breaks the tie differently in that pool. The lens closes this gap to 0.0000 across all twelve (domain, pool) configurations.
Summary: for the declared cases, twelve out of twelve production-scale measurements at HN@10 = 0.0000 among up to 100 000 unseen documents, with HitC@10 across every configuration.
Key finding — For the declared cases, twelve out of twelve production-scale (domain, pool) configurations reach HN@10 = 0.0000 among up to 100 000 unseen documents. Without the lens, a trap reaches the top-10 for 82–100 % of queries at . With the lens, HN@10 = 0.0000 in all twelve configurations, with HitC@10 .
Cell D — the served pipeline: the safety property at production scale
Table 1 measures the lens under exact nearest-neighbour search (Cell C): the utility ceiling, fully reproducible. Table 2 reports Cell D—the same lenses served by the spectral accelerator of §3.9. The accelerator reaches the 100 000-document pools, where a dense spectral build does not. HN@10 is unchanged (0.0000 at every scale); at the largest pools its HitC@10 sits a little below Cell C’s exact-search value, discussed after the table.
| Domain | Query cases | Distractor pool | Lens dim | Trap taxonomy |
| Legal | 299 | LexGLUE sentence-split | 11 | 23 types (largest 102) |
| Medical | 300 | PubMed sentence-split, ∼200k | 32 | 4 × 75 |
| Patent (USPTO) | 301 | BIGPATENT sentence-split, 182k | 32 | 4 × 75 |
| Financial (SEC-adjacent) | 301 | 5 HF financial datasets, 178k | 32 | 4 × 75 |
Table 1.
Across the four domains Cell D holds HN@10 = 0.0000 at every pool size, retains HitC@10 , and retrieves the full -query suite over a 100 000-document pool in 0.6–1.1 s on a laptop CPU — a per-query average of –4 ms, not an isolated single-query latency. The sealed same-pool runtime comparison is Cell D (accelerator) against the lens-only 3-stage cascade (Cell B, exact scoring over the pool), both on the identical Legal dedup pool (Table 3): the accelerator is 116–143 faster, and on that pool its HN@10 is 0.0000 — better than the cascade’s 0.08–0.10 — while its HitC@10 sits 1.0, 0.3 and 4.0 points below the cascade’s exact scoring at 5k, 51k and 100k. This is not a factor against the original dense SpectRAG, nor against the open full-pool exact nearest-neighbour backend (Cell C), whose timing is not sealed; it is Cell B vs. Cell D, one pool each.
At the largest pools Cell D’s HitC@10 sits below Cell C’s exact-search value (e.g. Legal 0.9833 → 0.9498 at 100k). We do not isolate the cause: Cell C is measured on the open, re-baselined pools of pelloran-safety-lens and Cell D on the sealed original pools; the two differ in build (and, for three domains, in size), so the Cell-C-vs-D difference mixes the accelerator’s approximate interior partitioning with the different pool construction. No sealed same-pool comparison against the open full-pool exact-NN backend (Cell C) exists, and we do not run one here; the sealed same-pool numbers in Table 3 are the cascade (Cell B), not Cell C. An optional citation-fusion stage recovers the Legal value to 0.9833 at 100k and is a reserved component, not evaluated here. Every Cell D number is measured and SHA-anchored; the accelerator is not part of pelloran-safety-lens, and the HN@10 = 0.0000 safety result reproduces openly as Cell C.
Key finding — Served by the spectral accelerator (Cell D), the lens holds HN@10 = 0.0000 at in all four domains, retrieving the ∼300-query suite in 0.6–1.1 s (∼2–4 ms per query on average), and 116–143× faster than the lens-only 3-stage cascade (Cell B) on the same Legal pool (Table 3), where a dense spectral build does not reach these pool sizes. The safety property is identical to the exact-search Cell C and reproduces openly; the latency is the accelerator’s measured, SHA-anchored contribution.
Complete cross-domain transfer matrix
Every lens applied to every domain’s trap corpus at , all twelve off-diagonal cells now measured. Diagonal cells are matched-domain (expected HN@10 = 0.0000). Off-diagonal cells apply a lens to another domain’s cases; the pre-registration had set HN@10 for them. All twelve off-diagonal cells were measured through the same miss_diagnostic.py code path that produced the four on-diagonal 0.0000 results, so all sixteen numbers are apples-to-apples comparable. Figure 3 plots the matrix as a heatmap; the numeric values follow in Table 4.
| Lens ↓ / Trap corpus → | Legal | Medical | Patent | Financial |
| Legal C02 () | 0.0000 | 0.5467 | 0.2957* | 0.4385 |
| Medical D2c () | 0.7191 | 0.0000 | 0.6877 | 0.7674 |
| Patent v3 () | 0.6120 | 0.7333 | 0.0000 | 0.5382 |
| Financial v4 () | 0.6221 | 0.8467 | 0.6312 | 0.0000 |
Table 4. Cross-domain transfer matrix, numeric values. Corresponds to the heatmap in Figure 3.
Figure 3. Cross-domain transfer matrix at . Diagonal cells (matched-domain) reach HN@10 = 0.0000; eleven of twelve off-diagonal cells stay in the [0.44, 0.85] band; the twelfth (Legal C02 lens on Patent traps, marked ∗) sits at HN@10 = 0.2957, below the 0.30 the pre-registration had set (dashed marker on the colorbar), and is reported as missed.
Diagonal: 4 / 4 cells at HN@10 = 0.0000.
Off-diagonal, at or above the pre-registered 0.30: 11 / 12 cells, HN@10 , mean .
Off-diagonal, below it: 1 cell (marked *), the Legal C02 lens on the Patent trap corpus, HN@10 = 0.2957. The pre-registered criterion is missed in this cell.
The criterion is missed by 0.0043, and we report it as missed. One plausible reading, not a test: the Legal lens (, the narrowest in the panel, trained on the legal taxonomy) is closer to the Patent taxonomy (claim-scope reversals inside legalistic clauses) than to the medical or financial ones. §6.4 reports a follow-up retrain. The lens does reduce the Patent traps, from raw cosine’s 0.9967 to 0.2957, but it still leaves ∼89 of the 301 in the top-10.
Every off-diagonal cell lies below the target domain’s raw cosine (0.82–1.00 at this size): the lenses carry some structure the domains share and transfer partly across them, but none reaches the declared-case level off-domain.
Key finding — A lens reaches HN@10 = 0.0000 on the cases it was declared for. Applied to another domain it transfers partly: every off-diagonal cell is below raw cosine, eleven of twelve at HN@10 ∈ [0.44, 0.85], and the twelfth, HN@10 = 0.2957, is below the pre-registered 0.30 and reported as missed. None reaches the matched-domain 0.0000.
Follow-up — the Legal lens retrained at
Motivated by the one off-diagonal cell below the pre-registered 0.30 in § 6.3 (Legal C02 at applied to Patent traps, HN@10 = 0.2957), we retrained the Legal lens at with the exact hyperparameter set used for Medical D2c / Patent v3 / Financial v4 (, margin = 0.10, seed = 42, cold-start followed by a warm-start round). The training history is not that of the lens (C02 has a longer warm-start lineage) and we ran one seed, so this does not isolate the dimension as the only variable; it is a follow-up observation. Figure 4 plots the results at ; numeric values follow in Table 5.
Figure 4. The Legal lens retrained at . The dashed horizontal line marks the 0.30 the pre-registration had set. Cross-domain HN@10 rises uniformly by +0.11 to +0.16 across all three foreign corpora when the Legal lens is retrained at instead of (matching the other three domain lenses). The rise is not selective on Patent, which fits a capacity reading better than a Legal–Patent affinity; with one seed and a different training history it is not a proof. Both the and Legal lenses hold matched-domain HN@10 = 0.0000.
| Corpus | Legal C02 () HN@10 | Legal v2 HN@10 | |
| Legal (matched) | 0.0000 | 0.0000 | +0.0000 |
| Medical | 0.5467 | 0.7233 | +0.1766 |
| Patent | 0.2957 | 0.4086 | +0.1129 |
| Financial | 0.4385 | 0.5648 | +0.1263 |
Table 5. The Legal lens at and , numeric values. Corresponds to the bars in Figure 4.
Three things to notice. First, both lenses hold matched-domain HN@10 = 0.0000, so the retrain adds cross-domain separation at no matched-domain cost. Second, on every foreign corpus the cross-domain HN@10 rises uniformly by 0.11 to 0.18, not selectively on Patent. Third, the rank order across the three foreign corpora (Medical > Financial > Patent) is preserved between and —Patent stays the softest cross-domain target for the Legal lens, now above the 0.30 the pre-registration had set.
The uniform rise fits a capacity reading better than a Legal–Patent affinity. With one seed and a different training history this is an explanation, not a test: the pre-registered criterion for the lens stays missed.
The Legal lens is retained as an alternative configuration and archived alongside C02 in Appendix § 10. Both hold matched-domain HN@10 = 0.0000; the lens additionally lifts the one sub-threshold cross-domain cell above 0.30. Which to deploy in a Legal-domain production stack is an operator choice, not a mechanism question.
Key finding. Retrained at , the Legal lens moves the Legal Patent cell from HN@10 = 0.2957 to HN@10 = 0.4086, with +0.11 to +0.18 on all three foreign corpora. This explains the missed cell; it does not retroactively pass the pre-registered criterion, and one seed with a different training history does not isolate the dimension.
Wall-clock at production scale
CPU-only single-core measurements on M4 (10-core Apple Silicon, no GPU). Cell D (the spectral accelerator) at pool:
The lens projection itself is a single matrix multiply per query, so the wall-clock is dominated by the downstream retriever. All four domains run the ∼300-query retrieval suite in 0.6–1.1 s at on a laptop CPU — a per-query average of ∼2–4 ms. All reported wall-clocks are CPU; we claim no GPU figure.
Reproducibility note. The wall-clock numbers above assume the proprietary accelerator (Cell D). Readers reproducing the paper with the open-source substitute (exact nearest-neighbour search on the projected -dimensional pool) obtain HN@10 = 0.0000 on all twelve configurations of § 6; its time per query was not measured beside Figure 5. Both backends we tested—the accelerator and the open exact-nearest-neighbour substitute—return zero observed trap hits on their respective pools; we do not claim independence from an arbitrary retriever (the observation is limited to the two backends compared).
Figure 5. Cell D retrieval wall-clock for the ∼300-query suite at on a laptop CPU. All four domains run the whole suite in under 1.1 s (a per-query average of ∼2–4 ms). The lens itself is a single matmul (∼1 ms); the rest is the downstream accelerator (Cell D). One pool size is shown; it makes no claim about how the time grows with .
Baselines: random projection and PCA at the same dimension
Is the lens’s HN@10 = 0.0000 merely a consequence of reducing to ? Two trap-agnostic projections at the same output dimension say no. A random Gaussian projection (seed 42) and unsupervised PCA (fit on the distractors only, no label leakage), at , were measured through the same exact-nearest-neighbour code as
Cell C (open, reproducible, SHA-anchored). All sixteen (baseline, domain) cells leave the trap in the top-10 for far more than the pre-registered 0.30:
| projection | Legal | Medical | Patent | Financial |
| random projection, | 0.5251 | 0.7000 | 0.6478 | 0.6478 |
| random projection, | 0.7659 | 0.9600 | 0.9668 | 0.9236 |
| PCA, | 0.5418 | 0.8167 | 0.8472 | 0.5748 |
| PCA, | 0.6020 | 0.9367 | 0.9668 | 0.6445 |
| trained lens | 0.0000 | 0.0000 | 0.0000 | 0.0000 |
Table 6. Trap-fall rate HN@10 of trap-agnostic projections at the shipped dimensions, versus the trained lens, on the four matched-domain 5k pools (exact search).
Reduction to alone leaves the trap in the top-10 for 53–97 % of the declared cases; the lens reaches 0.0000. The trap immunity is a property of what the lens learned, not of the projection to .
Robustness to rewording (Legal)
The declared cases can be stated in words the lens was not trained on. We rewrite the declared Legal cases with a fixed, fully-listed carrier lexicon under a per-case check that keeps each case’s trap-discriminating tokens byte-identical, so the one-token trap edit is preserved by construction; the check proves preserved token differences, not full semantic equivalence. Two tests measure different things.
Joint rewording (query and corpus together). Applying the lexicon identically to , and rewrites the query and the stored documents consistently; 194 of the 299 cases admit such a safe rewrite. The rewordings are faithful (mean E5 cosine to the source 0.99) but deliberately mild — the safe lexicon never touches a discriminator, so this is a lower bound on the stress. Here the shipped lens holds HitC@10 = 0.9845 and HN@10 = 0.0155 (3 of 194 cases), against 0.0052 (1 of 194) on the trained phrasings; without the lens the trap reaches the top-10 for about 81 % of these cases. Declaring the phrasings closes the residual: an improved lens fine-tuned from the shipped one on the declared cases plus one reworded variant reaches HN@10 = 0.0000 on the declared phrasings and 0.0103 on a second, held-out variant (vs. 0.0258 for the shipped lens), at about one point of HitC@10 on the originals — the concept-scoped method by design, not a post-hoc fit to the evaluation.
Query-only rewording (the practical case). Here the query vector is the reworded but the search pool is the unchanged original corpus — the original , , and distractors, with no reworded row in it (the case’s own original is still excluded from its ranking). This asks whether a differently-worded user query still finds the right passage in an unchanged corpus. The safety property holds — HN@10 = 0.0052 (1 of 194) — but utility drops: HitC@10 = 0.7938 for the shipped lens, down from 0.9845 under joint rewording, because the reworded query matches the original paraphrase less well. The improved lens scores 0.8763 on these same queries, but this phrasing (v1) is in its training set, so that figure is fit to declared wordings, not generalization: on a phrasing it was not trained on (v2), the two lenses are comparable — shipped 0.8093, improved 0.7784 — i.e. declaring and fitting helps the declared wordings, not arbitrary unseen queries. So the lens’s trap suppression is robust to query rewording, but its retrieval utility on reworded queries is markedly lower (–) and does not improve for undeclared phrasings. These absolute counts are small and the observation is correspondingly limited.
Discussion
Interpretation of the results
Shared structure, partial transfer. The matrix (§ 6.3) does not show a purely domain-specific lens. Every foreign lens lowers HN@10 below raw cosine—the Legal lens takes Patent from 0.9967 to 0.2957—so the lenses carry some structure the domains share. None reaches the declared-case 0.0000 off-domain: full suppression holds for the declared cases only.
“It’s a per-corpus artefact.” Four independent corpora, four independent trap taxonomies, four independent distractor sources—same result. Reproducing this on a fifth independent domain (bioinformatics, semiconductor process, insurance-policy, or scientific-claim traps) with the same recipe would push the “not artefact” claim past reasonable doubt; this is our next experimental milestone.
What the evidence does not establish
Limitations at a glance
Constructed traps. The 299–301 test cases per domain are hand-authored matched-shape traps—single-token in three domains, short edits in legal. This is a deliberate stress test, not a natural-language corpus. Transfer to naturally-occurring adversarial examples (multi-token flips, long-form contradictions) is not established here.
Single encoder tested. All reported numbers use E5-Large-v2. The training procedure is architecture-agnostic in principle; behaviour on BGE-Large / GTE-Large is a hypothesis for further experiments, not measured.
Outside the declared set, by design. Cases outside a lens’s declared set—including new statement pairs of the same type—are not covered (§ 3.1); one declares and trains a lens for them, or combines lenses.
No full transfer to a new domain. A foreign lens lowers HN@10 but does not reach 0.0000 (§ 6.3); a new domain’s cases need their own lens, trained on in-domain triples.
Cell D latency is proprietary. The 0.6–1.1 s suite retrieval (Cell D; –4 ms per query) relies on our commercial spectral accelerator (§ 3.9); its numbers are measured and SHA-anchored, but the implementation is not released. The open-source exact-nearest-neighbour substitute (Cell C) reproduces every HN@10 number; its time per query was not measured here.
Other components out of scope. A proprietary enterprise retriever and additional re-ranking and fusion components are out of scope and not part of this release; Cell B’s retrieval quality is tabulated only on Legal, in the same-pool comparison (Table 3); the other domains’ cascade quality is not, to keep the claim isolated to the lens projection.
No E5 task prefixes. We embed without the query: / passage: prefixes that the E5 model card recommends; results with the recommended prefixes are not measured.
Some baselines still open. The projection without its preservation or hinge term, a cross-encoder reranker, an evaluation on NevIR [15], and several seeds for the follow-up are not part of this paper. Random projection and PCA at the same (§ 6.6) and the cascade-versus-accelerator timing on the same pool (§ 6.2) are now measured.
Determinism in the tested environment. The bit-identical re-runs hold for the pinned dependencies on the CPUs we tested; other hardware or library versions may differ in the last digits of a float.
The Limitations box above lists the points a critical reader should flag; a few of them warrant longer discussion.
Constructedness is intentional. The 299–301 test cases per domain are hand-authored matched-shape traps (single-token in three domains, short multi-token edits in legal)—adversarial constructions, not sampled from a natural distribution of retrieval failures. This is deliberate: the paper’s claim is that a specific stress-test class (small meaning-reversing edits inside short clauses of the target-domain vocabulary) is fully suppressible with a small learned projection. Natural-language adversarial transfer (multi-token flips, long-form contradictions, real user queries that misfire) is a separate empirical question and is future work. We prefer the stress-test framing because it is falsifiable: any single uncured test case with the trap in top-10 counts as a failure of the claim.
Retrieval-utility ceiling. Under exact search (Cell C) HitC@10 ranges from 0.93 to 0.99 across the domains; under the accelerator (Cell D) it is 0.92 to 0.99. On the sealed dedup pools, where the lens-only 3-stage cascade (Cell B, exact scoring) and the accelerator (Cell D) ran on the identical pool (Table 3), the accelerator’s cost versus the cascade’s exact scoring is −1.0, −0.3 and −4.0 percentage points of HitC@10 at 5k, 51k and 100k — small, growing with pool size (the approximate interior partitioning) — while it holds HN@10 = 0.0000 and runs 116–143× faster than the cascade on that pool (0.62 s vs. 72 s at 100k). The open full-pool exact-NN backend (Cell C) was not timed on that pool (§ 6.2). This is operationally useful but not perfect retrieval. The remaining misses are typically in the “C-paraphrase differs too much from A” pattern — a data-quality issue in the trap corpus that we address with miss-driven curation (documented in the reproducibility repository as the curate_*_paraphrases.py scripts).
Retrieval speed as a contribution. The 0.6–1.1 s suite retrieval wall-clock at (Cell D, § 6.2) is the accelerator’s contribution: the boundary-conditioned equilibrium solve of § 3.9 serves the lens where a dense spectral build does not reach the pool at all, and—on the same Legal pool—116–143× faster than the lens-only 3-stage cascade (Table 3). These numbers are measured and SHA-anchored; the accelerator’s implementation is reserved for commercial use, and an exact-nearest-neighbour substitute (Cell C) reproduces every HN@10 number as the open reproducibility path. The safety claim does not depend on the accelerator; the scale-and-latency claim does.
Limits of the transfer experiment
Four domains and twelve mismatched pairs are a finite sample. The matrix shows where each lens applies; it does not prove that the recipe cannot fail in another domain. Our best hypothesis for where it might: domains whose traps do not admit clean small edits, or where the shape is hard to keep (long-form narrative, multi-paragraph reasoning). The fifth-domain candidates in §9 are chosen partly to probe this. For the Legal Patent cell, §6.4 reports the follow-up, which lifts that cell above 0.30 while both the and lenses keep matched-domain HN@10 = 0.0000.
Reproducibility protocol summary
Any reader with 24 GB of RAM, a modern multi-core CPU, and access to a 1024-dimensional dense encoder can reproduce the claim within a working day:
Construct 300 matched-shape (, , ) triples in the target domain (2–3 hours of deterministic-script authoring; template provided).
Build a sentence-split distractor pool from a domain corpus (target unique 8–30-word clauses).
Embed with E5-Large-v2, no prefix, -normalise.
Run the preflight duplicate check (
preflight_dedup_check.py). Abort if duplicates.Train the safety lens at or 32, or 17, margin = 0.10, seed = 42 (
steering_lens_train.py). Warm-start a second round if HN@10 is not yet 0.0000.Measure Cell C at pool sizes {5k, 50k, 100k}. Optionally apply the lens to two other domains’ trap corpora, to see where it applies.
Wall-clock: approximately one working day end-to-end on a single CPU server.
Deployment footprint: small, specialised, hardened indexes
A deployed application stores only the lens-projected vectors, not the 1024-D embeddings. For the Legal lens that is floats per document — 44 bytes against 4096, a 93× smaller index; the domains are 32× smaller. Exact nearest-neighbour cost scales with the dimension, so search in the projected space is proportionally cheaper, and at these dimensions an exact scan is realistic again rather than an approximate index. On the cases the lens is declared for, this smaller index is also safer than raw-cosine search over the full embedding (HN@10 = 0.0000 versus 0.81–1.00); where the raw encoder is weak it is also more accurate (Legal HitC@10 0.99 vs. 0.67). The projected store is application-specific by construction: one declared lens and one index per scope, and the 1024-D embedding cannot be recovered from it.
Implication — a deployment pattern, not a benchmark. Because a specialised, semantic-reversal-hardened index becomes this small and this cheap to search, running many of them — one per domain, tenant, or compliance boundary, each with its own declared lens — becomes a rational alternative to a single large general-purpose vector database (Figure 6): cheaper to store, faster to search, hardened per scope, versionable, and trivially isolatable into separate processes or tenants. It inverts the usual “reach for a bigger generalist encoder” reflex — a tiny learned projection makes specialisation the cheap option. We state this as the architecture the measured footprint enables; a cost or multi-store benchmark is future work. The query-only result (§ 6.7) bounds it: utility holds for the declared cases, not for arbitrary undeclared query phrasings.

Figure 6. Deployment footprint. The lens’s output is the stored representation: a few floats per document instead of 1024. A specialised, semantic-reversal-hardened index per domain or tenant (HN@10 = 0 on its declared cases, smaller, dimension-proportional search) becomes a practical alternative to one large general-purpose embedding store. The pattern is enabled by the measured footprint; the comparison is architectural, not a benchmark.
Related Ongoing Work
pelloran-safety-lens. Reproducibility package, released under AGPL-3.0 at https://github.com/pelloran-inc/pelloran-safety-lens. Contains the full 6-step recipe implementation, the four domains’ trap sets, deterministic generators, lens trainer, measurement harness for Cell A (raw cosine) and the lens (with exact nearest-neighbour search in place of the proprietary accelerator of Cell D), duplicate-check guardrail, and the cross-domain transfer tool. All four distractor pools rebuild from pinned public sources (DATA.md): the medical pool from the CC0 jmhb/pubmed_bioasq_2022, the legal pool from LexGLUE and the public-domain SEC EDGAR corpus. The model and dataset revisions and the library versions are pinned, and the SHA-256 of every pool binary and result ships with the package. Anyone may use, study, modify and share the package under AGPL-3.0, whose terms require that the source code of a modified version be offered to all its users, including users who reach it over a network. A commercial licence without these terms, and a licence for the proprietary accelerator, are available from [email protected].
Domain expansion. Fifth-domain candidates under active discussion: bioinformatics protein-annotation traps, semiconductor process-flow traps, insurance-claim/policy traps, and scientific-claim traps. Each additional domain extends the transfer matrix in §6.3.
Encoder generalisation. Reproducing the four-domain matrix with BGE-Large and GTE-Large as the base encoder, to confirm that the recipe is encoder-agnostic rather than E5-specific.
Pipeline composition. Further re-ranking and fusion stages on top of the projection are out of scope and not part of this release; they are left to a future paper on pipeline composition rather than the per-domain generalisation claim.
Reproducibility SHA anchors
| Artefact | SHA-256 (12-char prefix) |
| Legal lens (C02, — § 6.3 matrix) | 321e6c55fa27... |
| Legal lens ( v2 warm — § 6.4 ablation) | 4858ce2dbaf4... |
| Medical lens (D2c curated) | f356d51ef515... |
| Patent lens (v3 curated) | 47a82d868935... |
| Financial lens (v4 ) | f9c80a7df4db... |
| Legal k pool (AQTC binary) | 66d6c68a4ed9... |
| Medical k pool (AQTC binary) | 308db6274430... |
| Patent k pool (AQTC binary) | dc02dcff8000... |
| Financial k pool (AQTC binary) | d2304d1b9fb0... |
| Legal result, 5k (results/pool_sizes) | 573a643b0286... |
| Legal result, 50k (results/pool_sizes) | f61d0275c6e0... |
| Legal result, 100k (results/pool_sizes) | 061fa3ec664e... |
| Medical result, 5k (results/pool_sizes) | 202ba413f21f... |
| Medical result, 50k (results/pool_sizes) | f301ac805086... |
| Medical result, 100k (results/pool_sizes) | 4a14b762bc0b... |
| Patent result, 5k (results/pool_sizes) | 93eb20762f48... |
| Patent result, 50k (results/pool_sizes) | b24ae1c50ddc... |
| Patent result, 100k (results/pool_sizes) | 879c51aa9357... |
| Financial result, 5k (results/pool_sizes) | b980a69a66cf... |
| Financial result, 50k (results/pool_sizes) | 1b9bed2f18aa... |
| Financial result, 100k (results/pool_sizes) | c36b9a948744... |
| Legal raw cosine, 5k (results/raw_cosine) | 9eec929d6f3e... |
| Legal raw cosine, 50k (results/raw_cosine) | f3cbecc6175b... |
| Legal raw cosine, 100k (results/raw_cosine) | ee87987558ee... |
| Medical raw cosine, 5k (results/raw_cosine) | f1c5f735f388... |
| Medical raw cosine, 50k (results/raw_cosine) | e248f5d0fb9e... |
| Medical raw cosine, 100k (results/raw_cosine) | 492402782b1b... |
| Patent raw cosine, 5k (results/raw_cosine) | a0fc1b03567b... |
| Patent raw cosine, 50k (results/raw_cosine) | 012a1cbbd25d... |
| Patent raw cosine, 100k (results/raw_cosine) | 8532b8675be4... |
| Financial raw cosine, 5k (results/raw_cosine) | 126ef73977ed... |
| Financial raw cosine, 50k (results/raw_cosine) | 6e85892473ab... |
| Financial raw cosine, 100k (results/raw_cosine) | 03c5f60daa2c... |
| Cell D — served-pipeline results (accelerator; sealed, not in pelloran-safety-lens) | |
| Legal Cell D, 5k | 0fce281a7b57... |
| Legal Cell D, 50k | d0fdb728bb79... |
| Legal Cell D, 100k | c727d1d2f227... |
| Medical Cell D, 5k | 794e928d1266... |
| Medical Cell D, 50k | 1d03c26f5dcc... |
| Medical Cell D, 100k | b15e28efac3a... |
| Patent Cell D, 5k | 4139691fcefa... |
| Patent Cell D, 50k | 8e803cd200eb... |
| Patent Cell D, 100k | bf7d29beb2fa... |
| Financial Cell D, 5k | b5abe016ac6d... |
| Financial Cell D, 50k | 9cb53cc5beb3... |
| Artefact | SHA-256 (12-char prefix) |
| Financial Cell D, 100k | 1930bcc40e2e... |
| v0.16 additions — baselines, rewording robustness, same-pool runtime | |
| Baseline random projection | 8b6ba63afabc... |
| Baseline random projection | 69a13747ca99... |
| Improved Legal lens | 9e4eb107b065... |
| Same-pool Cell B/D runtime log | fb2a64ce1a4f... |
Table 7. SHA-256 prefixes for every selected lens weight matrix and every k trap-corpus AQTC binary referenced in § 6, every result file of the results table (pelloran-safety-lens, commit 9382839), and every Cell D served-pipeline result (sealed internal runs, one per domain; not shipped in pelloran-safety-lens). Prefixes normalised to 12 hex characters; full digests ship with pelloran-safety-lens (open cells) or with the sealed internal artifacts (Cell D).
Failure modes we documented so nobody repeats them
Three implementation errors that reduce the declared-case zero-trap result to noise. Each surfaced in our earlier runs as a false negative on the domain-agnostic claim.
Reusing a lens across domains. A lens trained on domain transfers to domain only partly: it lowers ’s HN@10 below raw cosine but does not reach 0.0000 (§ 6.3). For ’s cases, declare and train a lens on ’s triples.
Shape-mismatched trap triples. If is a 15-word question and are 500-word paragraphs, cosine geometry is dominated by length rather than by the adversarial flip. HitC@10 collapses to noise. Match shape.
Shape-mismatched distractors. Short-clause with paragraph-length distractors produces a query-vs-paragraph mismatch that dominates retrieval geometry. Sentence-split the distractor pool to matched clause length.
Shape dominates size. In our medical work, 100 matched-shape triples produced HitC@10 = 0.95 while 400 shape-mismatched triples produced HitC@10 = 0.03—a 32× spread traceable entirely to shape discipline. This is a hard operational lesson and the reason § 3.1 leads with the shape invariants.
Hyperparameter sensitivity
We report the hyperparameter probes that landed each domain’s selected lens, so that future replicators can budget training time appropriately. In all cases and margin worked; only needed per-domain calibration.
| Domain | Cold | Warm | Warm | |
| Legal | stable () | 0.0000 | not needed | not tested |
| Medical | stable () | 0.0000 | not needed | not tested |
| Patent | residual () | 0.0000 | not needed | not tested |
| Financial | residual (0.0012) | 0.0002 | (winner) | diverged @ ep. 200 |
Table 8. Per-domain training-loss convergence at each probe actually run. “stable” means the training reached inside 200 epochs; “residual” means training completed but with a non-zero final loss.
Financial required all three probes and revealed the training regime’s upper bound at 20. This is the only domain where was insufficient after warm-start; the cause is that financial-native flips (direction, polarity, period, party) place trap tokens in contexts where E5 embedding proximity is inherently tighter than in the other three domains. Reproducers should budget a second warm-start round when the first cold-start run leaves residual hn_loss.
References
- [1]Jianlv Chen, Shitao Xiao, Peitian Zhang, Kun Luo, Defu Lian, and Zheng Liu. BGE M3-Embedding: Multi-lingual, multi-functionality, multi-granularity text embeddings through self-knowledge distillation. arXiv preprint arXiv:2402.03216, 2024. URL https://arxiv.org/abs/2402.03216.
- [2]Jesse Dodge, Maarten Sap, Ana Marasović, William Agnew, Gabriel Ilharco, Dirk Groeneveld, Margaret Mitchell, and Matt Gardner. Documenting large webtext corpora: A case study on the colossal clean crawled corpus. In Proceedings of EMNLP, pages 1286–1305, 2021.
- [3]Chuan Guo, Jacob Gardner, Yurong You, Andrew Gordon Wilson, and Kilian Weinberger. Simple black-box adversarial attacks. In Proceedings of ICML, pages 2484–2493, 2019.arxiv.org/abs/1905.07121
- [4]Vladimir Karpukhin, Barlas Oğuz, Sewon Min, Patrick Lewis, Ledell Wu, Sergey Edunov, Danqi Chen, and Wen-tau Yih. Dense passage retrieval for open-domain question answering. In Proceedings of EMNLP, pages 6769–6781, 2020.arxiv.org/abs/2004.04906
- [5]Omar Khattab and Matei Zaharia. ColBERT: Efficient and effective passage search via contextualized late interaction over BERT. In Proceedings of SIGIR, pages 39–48, 2020.arxiv.org/abs/2004.12832
- [6]Katherine Lee, Daphne Ippolito, Andrew Nystrom, Chiyuan Zhang, Douglas Eck, Chris Callison-Burch, and Nicholas Carlini. Deduplicating training data makes language models better. In Proceedings of ACL, pages 8424–8445, 2022.arxiv.org/abs/2107.06499
- [7]Zehan Li, Xin Zhang, Yanzhao Zhang, Dingkun Long, Pengjun Xie, and Meishan Zhang. Towards general text embeddings with multi-stage contrastive learning. arXiv preprint arXiv:2308.03281, 2023. URL https://arxiv.org/abs/2308.03281.
- [8]Stephen Robertson and Hugo Zaragoza. The probabilistic relevance framework: BM25 and beyond. Foundations and Trends in Information Retrieval, 3(4):333–389, 2009.
- [9]Zafer Sahinoglu, Abdulazeez Mohammed, Buse Yaren Kazangirler, and Cahit Berkay Kazangirler. SpectRAG: Weighted chunk graphs for token-budgeted context selection in multi-hop retrieval-augmented generation. arXiv preprint arXiv:2610.36991, 2026. URL https://arxiv.org/abs/2610.36991.
- [10]Florian Schroff, Dmitry Kalenichenko, and James Philbin. FaceNet: A unified embedding for face recognition and clustering. In Proceedings of CVPR, pages 815–823, 2015.DOI
- [11]Kihyuk Sohn. Improved deep metric learning with multi-class N-pair loss objective. In Advances in Neural Information Processing Systems, volume 29, pages 1857–1865, 2016.
- [12]Congzheng Song, Alexander M. Rush, and Vitaly Shmatikov. Adversarial semantic collisions. In Proceedings of EMNLP, pages 4198–4210, 2020.arxiv.org/abs/2011.04743
- [13]Alexander Matt Turner, Lisa Thiergart, David Udell, Gavin Leech, Ulisse Mini, and Monte MacDiarmid. Activation addition: Steering language models without optimization. arXiv preprint arXiv:2308.10248, 2023. URL https://arxiv.org/abs/2308.10248.
- [14]Liang Wang, Nan Yang, Xiaolong Huang, Binxing Jiao, Linjun Yang, Daxin Jiang, Rangan Majumder, and Furu Wei. Text embeddings by weakly-supervised contrastive pre-training. arXiv preprint arXiv:2212.03533, 2023. URL https://arxiv.org/abs/2212.03533.
- [15]Orion Weller, Dawn Lawrie, and Benjamin Van Durme. NevIR: Negation in neural information retrieval. In Proceedings of the 18th Conference of the European Chapter of the Association for Computational Linguistics (Volume 1: Long Papers), pages 2274–2287, 2024. arXiv:2305.07614.arxiv.org/abs/2305.07614
- [16]Chen Wu, Ruqing Zhang, Jiafeng Guo, Maarten de Rijke, Yixing Fan, and Xueqi Cheng. PRADA: Practical black-box adversarial attacks against neural ranking models. ACM Transactions on Information Systems, 41(4), 2022.arxiv.org/abs/2204.01321
- [17]Eric P. Xing, Andrew Y. Ng, Michael I. Jordan, and Stuart Russell. Distance metric learning with application to clustering with side-information. In Advances in Neural Information Processing Systems, volume 15, pages 521–528, 2003.
- [18]Andy Zou, Long Phan, Sarah Chen, James Campbell, Phillip Guo, Richard Ren, Alexander Pan, Xuwang Yin, Mantas Mazeika, Ann-Kathrin Dombrowski, Shashwat Goel, Nathaniel Li, Michael J. Byun, Zifan Wang, Alex Mallen, Steven Basart, Sanmi Koyejo, Dawn Song, Matt Fredrikson, J. Zico Kolter, and Dan Hendrycks. Representation engineering: A top-down approach to AI transparency. arXiv preprint arXiv:2310.01405, 2023. URL https://arxiv.org/abs/2310.01405.


