Small Learned Projections for Semantic-Reversal-Aware Retrieval with Spectral Acceleration: A Four-Domain Empirical Study

媒体报道 Hugging Face Papers 原文语言:中文

论文摘要(作者报告,未经本站复测):Dense-embedding retrievers can fail adversarially: when a query is answered by a…

全文

Small Learned Projections for Semantic-Reversal-Aware Retrieval

with Spectral Acceleration

A Four-Domain Empirical Study

Sayed Amir Karim Affiliation: Pelloran Research Email: opensource@pelloran.com

v0.16 preprint · 2026-11-13

Abstract

Dense-embedding retrievers can fail adversarially: when a query is answered by document AA and reversed by a near-copy BB that differs from AA by a small meaning-changing edit (a “trap”), raw cosine over E5-Large-v2 places BB in the top-10 for 82–100 % of queries at a pool of 5 0005\,000. We study two things. First, a small learned projection W:ℝ1024→ℝdW\colon\mathbb{R}^{1024}\to\mathbb{R}^{d} (d∈{11,32}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\text{HN}@10=0.0000 (no trap in the top-10) in all twelve (domain,pool-size)(\text{domain},\text{pool-size}) settings across four independent domains—legal, medical, patent, financial—and pools to 100 000100\,000, while the correct paraphrase is retained for 93–99 % of cases (HitC​@​10\text{HitC}@10), under exact nearest-neighbour search. Second, a boundary-conditioned accelerator that serves the projection at that scale: an acceleration of spectral graph retrieval (Sahinoglu et al., 2026) that replaces a dense eigendecomposition with a boundary-value solve, holding HN​@​10=0.0000\text{HN}@10=0.0000 at n=100 000n=100\,000 in every domain, retrieving the ∼300{\sim}300-query suite in 0.60.6–1.11.1 s (∼2{\sim}2–44 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 ∼90×{\sim}90\times smaller and dimension-proportionally faster than the full embedding, making many small declared indexes a practical alternative to one large general-purpose vector store (§8).

The claim is scoped to the declared cases on the measured pools, with no probabilistic bound; the high HitC​@​10\text{HitC}@10 (0.930.93–0.990.99) is for those declared cases, and drops for a reworded query against an unchanged corpus (HitC​@​10≈0.79\text{HitC}@10\approx 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​@​10\text{HN}@10 number is reproducible under exact search.

1 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 BB differs from the correct answer AA 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 AA and BB, so BB routinely appears in the top-kk retrieved list for any query anchored on AA. 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 0005\,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:

1.

A precise construction recipe that gives zero trap hits for the declared cases in every domain we measured, with the same code path.

2.

Four-domain empirical validation—legal, medical, patent, financial—with matched methodology and zero per-domain code changes.

3.

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.

4.

A complete 4×44\times 4 transfer matrix measuring twelve mismatched-lens/trap-corpus pairs. Eleven stay at HN​@​10∈[0.44,0.85]\text{HN}@10\in[0.44,0.85]; one sits at HN​@​10=0.2957\text{HN}@10=0.2957, below the 0.300.30 the pre-registration had set, and is reported as missed.

5.

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.

2 Related Work

Dense retrieval baselines.

E5-Large-v2 (Wang et al., 2023), BGE-Large (Chen et al., 2024), and GTE-Large (Li et al., 2023) are representative of the 1024-dimensional sentence-encoder class, producing L2L_{2}-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 A and B 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, 2009; Karpukhin et al., 2020) and ColBERT-style late-interaction models (Khattab and Zaharia, 2020) are not, in general, a defence against the specific trap class studied here: our BB differs from AA by a single semantically-reversing token (must vs. must not), so BM25 assigns AA and BB 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., 2019; Song et al., 2020; Wu et al., 2022). 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. (2024) 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., 2003; Schroff et al., 2015; Sohn, 2016). Steering vectors for language models (Turner et al., 2023; Zou et al., 2023) apply similar structural interventions on model activations. Our lens is closest to a supervised linear steering projection trained on a small A/B/CA/B/C triple set with the hinge term operating in the projected space.

Spectral graph retrieval (SpectRAG).

Sahinoglu et al. (2026) 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 10510^{5}-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 (Dodge et al., 2021; Lee et al., 2022). Our data-quality audit (§3.5) surfaces a 22 % duplicate rate in an early version of our legal trap corpus that inflated HitC​@​10\text{HitC}@10 by 16 pp. We ship the resulting preflight guardrail as a hard gate before any lens training run.

3 Method

3.1 What a lens is declared for

A case is one specific contrasting statement pair: a statement AA, its trap BB (AA with one meaning-reversing change), and a paraphrase CC of AA. For example, AA “Metformin is dosed at 500 mg twice daily for adults with type-2 diabetes”, BB the same sentence with 5000 mg, and CC “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 BB out of the top-10 for a query anchored on AA, and CC 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—BB 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.

3.2 Trap corpus construction

Every trap corpus consists of NN unique test cases, each a triple (A,B,C)(A,B,C):

•

AA — the anchor. A factually correct short clause (6–30 words) in the target domain’s vocabulary.

•

BB — the trap. Identical to AA except for one meaning-flipping token (or a small closed set of tokens for compound trap types). Length within ±20%\pm 20\,\% of AA.

•

CC — the utility target. A paraphrase of AA preserving intent, using different surface phrasing.

Shape invariants.

All three of A,B,CA,B,C are within 6–30 words, with the max-to-min word-count ratio bounded by 2.02.0. In the medical, patent and financial corpora BB differs from AA by one meaning-flipping token; in the broader legal corpus the change is a short meaning-altering edit (one to a few tokens). CC 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 ↔\leftrightarrow must not

Medical dosage 500 mg ↔\leftrightarrow 5000 mg

contraindication indicated ↔\leftrightarrow contraindicated

population adults ↔\leftrightarrow pediatric

drug substitution (LASA) metformin ↔\leftrightarrow metoprolol

Patent claim-scope comprising ↔\leftrightarrow consisting of

enablement enabled ↔\leftrightarrow disabled

art novel ↔\leftrightarrow prior art

mechanism substitution encrypt ↔\leftrightarrow decrypt

Financial direction increased ↔\leftrightarrow decreased

polarity gain ↔\leftrightarrow loss

polarity asset ↔\leftrightarrow liability

period Q1 ↔\leftrightarrow Q4

party lender ↔\leftrightarrow borrower

Each corpus contains ∼300{\sim}300 unique triples—∼75{\sim}75 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.

3.3 Distractor pool

For each domain we assemble a distractor pool of ≥50 000\geq 50\,000 short (8–30 word) clauses in the target domain, sentence-split from a public corpus. Matched-shape distractors are essential —mixing sentence-length A/B/CA/B/C with paragraph-length distractors makes the retrieval geometry noise-dominated (Appendix B, failure mode 3).

Sources per domain:

•

Legal: LexGLUE, sentence-split.

•

Medical: PubMed abstracts, sentence-split, ∼200 000{\sim}200\,000 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.

3.4 Embedding

We use intfloat/e5-large-v2 (Wang et al., 2023). No task prefix (passage: / query:) applied. L2L_{2}-normalisation after encoding. 1024-dimensional output. The training procedure is architecture-agnostic; the choice of E5 here is representative rather than load-bearing.

3.5 Preflight duplicate-check guardrail

Before training, we compute SHA-256 hashes of every triple’s flattened f32 embedding bytes and refuse to proceed if ≥5%\geq 5\,\% 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\text{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.

3.6 Lens training

The lens is a matrix W∈ℝ1024×dW\in\mathbb{R}^{1024\times d} with d∈{11,24,32}d\in\{11,24,32\}. Training minimises:

ℒ⁡(W)=α⋅ℒpreserve​(W)+β⋅ℒhinge​(W)+λ⋅mean⁡(W2)\mathcal{L}(W)=\alpha\cdot\mathcal{L}_{\text{preserve}}(W)+\beta\cdot\mathcal{L}_{\text{hinge}}(W)+\lambda\cdot\operatorname{mean}(W^{2})

where:

•

ℒpreserve​(W)\mathcal{L}_{\text{preserve}}(W) is the mean-squared error between the pre- and post-projection pairwise cosine similarities, over a sampled batch of distinct document pairs (all i<ji<j, not only positive pairs). It preserves the geometry that makes retrieval work.

•

ℒhinge​(W)\mathcal{L}_{\text{hinge}}(W) is the per-triple max⁡(0,cos⁡(Aproj,Bproj)−cos⁡(Aproj,Cproj)+margin)\max\bigl(0,\;\cos(A_{\text{proj}},B_{\text{proj}})-\cos(A_{\text{proj}},C_{\text{proj}})+\text{margin}\bigr). It pushes the trap BB away from the query AA in the projected space while keeping the utility target CC close.

•

α=1.0\alpha=1.0, β∈{10,15,17}\beta\in\{10,15,17\}, margin∈{0.05,0.10,0.12}\text{margin}\in\{0.05,0.10,0.12\}, λ=×10−4\lambda=1\!\times\!10^{-4}. The regulariser is the mean of the squared entries of WW, not a summed norm, so λ\lambda is scaled to that convention.

Optimiser: Adam, learning rate ×10−35\!\times\!10^{-3}, pairs_per_epoch=8000\text{pairs\_per\_epoch}=8000, epochs=200\text{epochs}=200, seed=42\text{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, d=32d=32 and β=15\beta=15 typically produces near-zero hn_loss; a second warm-start round with the same configuration or β=17\beta=17 eliminates the residual. β=20\beta=20 destabilises training (see Appendix C).

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.

3.7 Cross-domain transfer experiment

The final step of the recipe. Take the freshly trained domain-XX 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≥0.30\text{HN}@10\geq 0.30 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.

3.8 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\text{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.

3.9 Serving at scale: a boundary-conditioned spectral retrieval accelerator

The lens is a reranking primitive. To serve it over pools of 10510^{5} documents we pair it with a spectral retrieval accelerator. SpectRAG (Sahinoglu et al., 2026) 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 O⁡(n3)O(n^{3}) that, in our measurements, exhausts memory well before n=100 000n=100\,000 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 BB (the query-anchored seeds) and interior II, the equilibrium field over the interior is the discrete harmonic extension

TIeq=−LI​I−1LI​BTB⟺LI​Ix=−LI​BTB,T_{I}^{\mathrm{eq}}=-\,L_{II}^{-1}\,L_{IB}\,T_{B}\qquad\Longleftrightarrow\qquad L_{II}\,x=-\,L_{IB}\,T_{B},

the Dirichlet solution (Schur complement) of the boundary conditions. The interior field TIeqT_{I}^{\mathrm{eq}} 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 TBT_{B}—its similarities to the boundary documents—changing the right-hand side −LI​B​TB-L_{IB}\,T_{B} but not LI​IL_{II}. The factorisation of LI​IL_{II} 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 LI​IL_{II} — offline, per corpus, amortised over all queries.

•

Per-query solve — the boundary setup and the triangular or iterative solves that produce TIeqT_{I}^{\mathrm{eq}}.

A conditional complexity claim.

We do not claim near-linearity unconditionally. If LI​IL_{II} is banded with a bandwidth bb bounded independently of nn, a banded Cholesky factorisation and each triangular solve are O⁡(n​b2)O(n\,b^{2})—linear in nn for fixed bb; equivalently, an unfactorised Krylov solve costs O⁡(n​s​m)O(n\,s\,m) for sparsity ss and iteration count mm, near-linear when ss and mm 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 L2L_{2}-normalised dd-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\text{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 000100\,000-document reach (Cell D, §6.2); the safety property does not depend on it.

4 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 (WuW_{u}) →\to top-kk →\to lens →\to 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\text{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\text{HN}@10 is identical to Cell C; Cell D adds the 0.60.6–1.11.1 s suite retrieval (∼2{\sim}2–44 ms per query) and the 100 000100\,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 k=10k=10, defined as the fraction of queries where the trap BB appears in the top-10 retrieved documents.

•

HitC@10 — correct-answer rate at k=10k=10, defined as the fraction of queries where the paraphrase CC appears in the top-10.

Cell D is the deployed pipeline; Cell C is its open, exact-search reproduction, with identical HN​@​10\text{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 L2L_{2}-normalised dd-dimensional embeddings. Readers reproducing the paper use the exact-nearest-neighbour backend on the projected pool (Cell C): every HN​@​10\text{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\text{HN}@10 (see §4 scope note).

5 Experiments

5.1 Domains and sizes

Domain Query cases Distractor pool Lens dim Trap taxonomy

Legal 299 LexGLUE sentence-split 11 23 types (largest 102)

Medical 300 PubMed sentence-split, ∼200{\sim}200k 32 4 ×\times 75

Patent (USPTO) 301 BIGPATENT sentence-split, 182k 32 4 ×\times 75

Financial (SEC-adjacent) 301 5 HF financial datasets, 178k 32 4 ×\times 75

Every corpus passes the 0.00%0.00\,\% preflight duplicate gate.

5.2 Pool sizes

Every domain is measured at approximately n=5​kn=5\text{k}, 50​k50\text{k}, and 100​k100\text{k} (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 nn 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 NN 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.

5.3 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.

6 Results

6.1 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)(\text{domain},\text{pool-size}) pair, for the lens’s declared cases (§3.1). HN​@​10=0.0000\text{HN}@10=0.0000 means that for none of the ∼300{\sim}300 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.

Table 1: Cell C — the lens under exact nearest-neighbour search: HN​@​10\text{HN}@10 and HitC​@​10\text{HitC}@10 at k=10k=10 for the declared cases, four domains ×\times three pool sizes, with raw cosine (HitC​@​10\text{HitC}@10, Cell A) for reference. The open, reproducible measurement (pelloran-safety-lens, results/pool_sizes/).

Domain nn HN​@​10\text{HN}@10 (lens) HitC​@​10\text{HitC}@10 (lens) HitC​@​10\text{HitC}@10 (raw cosine)

Legal 5 897 0.0000 0.9866†\dagger 0.6722

Legal 50 897 0.0000 0.9866†\dagger 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

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 nn is the declared cases’ own rows plus the distractors: n=3×cases+distractorsn=3\times\text{cases}+\text{distractors} (the query’s AA, the trap BB and the paraphrase CC 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\text{HitC}@10, lower by up to ∼0.03{\sim}0.03 at the largest pool (Patent at 100​k100\text{k}: 0.92690.9269 under the accelerator vs. 0.95680.9568 here); HN​@​10=0.0000\text{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\text{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\text{HitC}@10 in Legal at every size (0.6722→0.98660.6722\to 0.9866 at 5​k5\text{k}, 0.98330.9833 at 100​k100\text{k}). In Patent it raises it at 5​k5\text{k} (0.9601→0.97010.9601\to 0.9701) and 50​k50\text{k} (0.9601→0.96350.9601\to 0.9635), and lowers it at 100​k100\text{k} (0.95680.9568). It costs some in Medical (0.9867→0.97330.9867\to 0.9733 at 5​k5\text{k}) and Financial (1.0000→0.96011.0000\to 0.9601).

†\dagger The identical Legal HitC​@​10=0.9866\text{HitC}@10=0.9866 at n=5​kn=5\text{k} and n=50​kn=50\text{k} is not a copy: the same four paraphrase misses land outside top-10 at both pool sizes; the fifth miss only appears at n=100​kn=100\text{k} where the additional 50k distractors dilute the ranking enough to push one borderline CC below rank 10. HitC on Legal is more robust to pool growth than on the other three domains because the LexGLUE distractor pool is lexically farther from the legal A/C pairs than PubMed / BIGPATENT / financial-news are from their in-domain triples. nDCG@10 is not reported here because our miss-diagnostic harness does not compute the full ranking required and cross-pipeline nDCG numbers from our earlier runs are inconsistent; readers wanting nDCG can substitute an exact-NN backend plus a full-ranking metric library on the projected pool.

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 5​k5\text{k} therefore stays outside it at 50​k50\text{k} and 100​k100\text{k}, so for the three nested domains the stable HN​@​10=0.0000\text{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\text{HitC}@10: the correct paraphrase has to survive twenty times more competition. From 5​k5\text{k} to 100​k100\text{k} it is retained for 98.66→98.33%98.66\to 98.33\,\% of the cases in Legal, 97.33→97.00%97.33\to 97.00\,\% in Medical, 97.01→95.68%97.01\to 95.68\,\% in Patent, and 96.01→92.69%96.01\to 92.69\,\% in Financial.

Without the lens (Cell A, raw cosine), a trap reaches the top-10 for 82–100 % of queries at n=5 000n=5\,000 in all four domains (HN​@​10=0.8127\text{HN}@10=0.8127 Legal, 0.99670.9967 Medical, 0.99670.9967 Patent, 0.99000.9900 Financial), and for 81–100 % at 50​k50\text{k} and 100​k100\text{k} (Legal 0.81610.8161 and 0.81610.8161, Medical and Patent 0.99670.9967, Financial 0.98670.9867; results/raw_cosine/). Legal’s slightly lower value at 5​k5\text{k} 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.00000.0000 across all twelve (domain,pool)(\text{domain},\text{pool}) configurations.

Summary: for the declared cases, twelve out of twelve production-scale measurements at HN​@​10=0.0000\text{HN}@10=0.0000 among up to 100 000100\,000 unseen documents, with HitC​@​10∈[0.93,0.99]\text{HitC}@10\in[0.93,0.99] across every configuration.

6.2 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 000100\,000-document pools, where a dense spectral build does not. HN​@​10\text{HN}@10 is unchanged (0.00000.0000 at every scale); at the largest pools its HitC​@​10\text{HitC}@10 sits a little below Cell C’s exact-search value, discussed after the table.

Table 2: Cell D: the lens served by the spectral accelerator. HN​@​10\text{HN}@10 and HitC​@​10\text{HitC}@10 at k=10k=10, and the retrieval wall-clock, for four domains ×\times three pool sizes. The wall-clock is the measured elapsed time for the retrieval of the full ∼300{\sim}300-query suite on a laptop CPU (the corpus is pre-embedded; query embedding is excluded); the per-query figure is this divided by the number of queries — e.g. Legal 100​k100\text{k} 0.62​s/299≈2​ms0.62\,\text{s}/299\approx 2\,\text{ms} — a suite average, not an isolated single-query latency. Measured and SHA-anchored (Appendix A); not part of pelloran-safety-lens. Sources: sealed internal runs, one per domain (Legal, Medical, Patent, Financial).

Domain nn HN​@​10\text{HN}@10 HitC​@​10\text{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

Across the four domains Cell D holds HN​@​10=0.0000\text{HN}@10=0.0000 at every pool size, retains HitC​@​10∈[0.92,0.99]\text{HitC}@10\in[0.92,0.99], and retrieves the full ∼300{\sim}300-query suite over a 100 000100\,000-document pool in 0.60.6–1.11.1 s on a laptop CPU — a per-query average of ∼2{\sim}2–44 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 116116–143×143\times faster, and on that pool its HN​@​10\text{HN}@10 is 0.00000.0000 — better than the cascade’s 0.080.08–0.100.10 — while its HitC​@​10\text{HitC}@10 sits 1.01.0, 0.30.3 and 4.04.0 points below the cascade’s exact scoring at 5​k5\text{k}, 51​k51\text{k} and 100​k100\text{k}. 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.

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/\,299). The accelerator is 116116–143×143\times faster and holds HN​@​10=0.0000\text{HN}@10=0.0000; its HitC​@​10\text{HitC}@10 cost vs. the cascade’s exact scoring is 11–44 points, growing with pool size.

pool nn backend wall-clock HN​@​10\text{HN}@10 HitC​@​10\text{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

At the largest pools Cell D’s HitC​@​10\text{HitC}@10 sits below Cell C’s exact-search value (e.g. Legal 0.9833→0.94980.9833\to 0.9498 at 100​k100\text{k}). 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.98330.9833 at 100​k100\text{k} 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\text{HN}@10=0.0000 safety result reproduces openly as Cell C.

6.3 Complete 4×44\times 4 cross-domain transfer matrix

Every lens applied to every domain’s trap corpus at n=5 000n=5\,000, all twelve off-diagonal cells now measured. Diagonal cells are matched-domain (expected HN​@​10=0.0000\text{HN}@10=0.0000). Off-diagonal cells apply a lens to another domain’s cases; the pre-registration had set HN​@​10≥0.30\text{HN}@10\geq 0.30 for them. All twelve off-diagonal cells were measured through the same miss_diagnostic.py code path that produced the four on-diagonal 0.00000.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.

Figure 3: Cross-domain transfer matrix at n=5 000n=5\,000. Diagonal cells (matched-domain) reach HN​@​10=0.0000\text{HN}@10=0.0000; eleven of twelve off-diagonal cells stay in the [0.44,0.85][0.44,0.85] band; the twelfth (Legal C02 lens on Patent traps, marked ∗) sits at HN​@​10=0.2957\text{HN}@10=0.2957, below the 0.300.30 the pre-registration had set (dashed marker on the colorbar), and is reported as missed.
Figure 3: Cross-domain transfer matrix at n=5 000n=5\,000. Diagonal cells (matched-domain) reach HN​@​10=0.0000\text{HN}@10=0.0000; eleven of twelve off-diagonal cells stay in the [0.44,0.85][0.44,0.85] band; the twelfth (Legal C02 lens on Patent traps, marked ∗) sits at HN​@​10=0.2957\text{HN}@10=0.2957, below the 0.300.30 the pre-registration had set (dashed marker on the colorbar), and is reported as missed.

Figure 3: Cross-domain transfer matrix at n=5 000n=5\,000. Diagonal cells (matched-domain) reach HN​@​10=0.0000\text{HN}@10=0.0000; eleven of twelve off-diagonal cells stay in the [0.44,0.85][0.44,0.85] band; the twelfth (Legal C02 lens on Patent traps, marked ∗) sits at HN​@​10=0.2957\text{HN}@10=0.2957, below the 0.300.30 the pre-registration had set (dashed marker on the colorbar), and is reported as missed.

Table 4: Cross-domain transfer matrix, numeric values. Corresponds to the heatmap in Figure 3.

Lens ↓\downarrow / Trap corpus →\to Legal Medical Patent Financial

Legal C02 (d=11d\!=\!11) 0.0000 0.5467 0.2957∗0.2957^{\ast} 0.4385

Medical D2c (d=32d\!=\!32) 0.7191 0.0000 0.6877 0.7674

Patent v3 (d=32d\!=\!32) 0.6120 0.7333 0.0000 0.5382

Financial v4(d=32d\!=\!32) 0.6221 0.8467 0.6312 0.0000

•

Diagonal: 4 / 4 cells at HN​@​10=0.0000\text{HN}@10=0.0000.

•

Off-diagonal, at or above the pre-registered 0.300.30: 11 / 12 cells, HN​@​10∈[0.44,0.85]\text{HN}@10\in[0.44,0.85], mean ≈0.65{\approx}0.65.

•

Off-diagonal, below it: 1 cell (marked ∗), the Legal C02 lens on the Patent trap corpus, HN​@​10=0.2957\text{HN}@10=0.2957. The pre-registered criterion is missed in this cell.

The criterion is missed by 0.00430.0043, and we report it as missed. One plausible reading, not a test: the Legal lens (d=11d=11, 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.99670.9967 to 0.29570.2957, but it still leaves ∼89{\sim}89 of the 301 in the top-10.

Every off-diagonal cell lies below the target domain’s raw cosine (0.820.82–1.001.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.

6.4 Follow-up — the Legal lens retrained at d=32d=32

Motivated by the one off-diagonal cell below the pre-registered 0.300.30 in §6.3 (Legal C02 at d=11d=11 applied to Patent traps, HN​@​10=0.2957\text{HN}@10=0.2957), we retrained the Legal lens at d=32d=32 with the exact hyperparameter set used for Medical D2c / Patent v3 / Financial v4 (β=15\beta=15, margin=0.10\text{margin}=0.10, seed=42\text{seed}=42, cold-start followed by a warm-start round). The training history is not that of the d=11d=11 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 n=5 000n=5\,000; numeric values follow in Table 5.

Figure 4: The Legal lens retrained at d=32d=32. The dashed horizontal line marks the 0.300.30 the pre-registration had set. Cross-domain HN​@​10\text{HN}@10 rises uniformly by +0.11+0.11 to +0.16+0.16 across all three foreign corpora when the Legal lens is retrained at d=32d=32 instead of d=11d=11 (matching the other three dom

正文以来源语言显示。

参考来源

← 返回每日AI报告