Open source / Sovereign Legal AI / Qwen2.5-3B & 7B · CaseHOLD · CUAD · ContractNLI

Scaling from 3B to 7B still leaves 95% fake legal citations, until a 57.1%-depth Cache-Miss Interrupt steps in.

Privileged M&A agreements and litigation filings often cannot leave private GPUs, pushing legal engineering teams toward self-hosted small open-weights models (Qwen2.5-3B-Instruct, Qwen2.5-7B-Instruct). Evaluated on public Harvard CaseHOLD, ContractNLI, and CUAD SEC agreements, unguarded 3B and 7B models still fabricated federal appellate citations 95.0% to 100.0% of the time on Mata v. Avianca famous-party traps, while second-pass LLM verifiers added up to 11.19 seconds per contract. Extending LatchGate to sovereign legal workloads achieves 0.9838 to 0.9925 closed-book citation AUROC (91.7% to 93.3% accuracy via a deterministic Cache-Miss Interrupt at 0.0% landmark recall tax) and 0.9737 to 0.9801 long-context contract grounding AUROC at 0.0% benign false-positive rate and 182× to 194× lower latency.

0.9925 / 0.9838closed-book citation AUROC (3B / 7B)
95% → 5%Mata v. Avianca fake citations on 7B (0% on 3B)
0.9801 / 0.97375.6k-7.1k token contract grounding AUROC
193.9×faster than second-pass LLM contract verifier

Turning parametric uncertainty into an Epistemic Cache-Miss Interrupt.

In Mata v. Avianca, attorneys were sanctioned after submitting non-existent federal appellate citations pairing real airlines and real treaties with invented reporter volumes. Using an identical prompt template across 120 cases (memorized Supreme Court landmarks, real Harvard CaseHOLD tail cases, and Mata-style famous-corporation traps), scaling from 3B to 7B barely reduced unguarded citation fabrication.

01Same PromptZero phrasing leakage
→
0257.1% DepthPre-citation residual + 16k SAE
→
03Penalize FameCancel entity-familiarity latents
→
04Cache-MissRoute trigger to verified docket
WHY SCALING ALONE FAILS

100.0% (3B) & 95.0% (7B) Fake Citations

When queried on famous corporate parties paired with non-existent reporter citations, unguarded Qwen2.5-3B fabricated 20/20 test citations and Qwen2.5-7B still fabricated 19/20 (95.0%), proving entity familiarity suppresses refusal heuristics across scale.

57.1%-DEPTH EPISTEMIC SEPARATION

0.9925 & 0.9838 Held-Out AUROC

Mid-network hidden states cleanly separate genuine parametric recall from confabulation (+9.9 to +11.9 AUROC points above black-box token logit entropy at 0.8938 / 0.8650), with our confounder-penalized 16k JumpReLU SAE span hybrid reaching 0.9475 / 0.9600 on the Mata subset.

CACHE-MISS INTERRUPT + DOCKET LOOKUP

91.7% & 93.3% Accuracy at 0.0% Tax

Calibrating conformal thresholds strictly on training landmarks preserves 100% of memorized landmark recall (55.0% → 55.0% on 3B, 65.0% → 65.0% on 7B) while routing cache misses to a deterministic docket lookup lifts end-to-end accuracy to 91.7% and 93.3%.

Two-panel Study 1 chart showing 0.99 and 0.98 held-out AUROC for 57%-depth probes and 0.92 to 0.94 for 16k Span SAE Hybrid versus 0.89 and 0.86 for token logit entropy on the left, and Mata v. Avianca fabricated citations dropping from 100% to 0% on 3B and 95% to 5% on 7B with 91.7% and 93.3% Cache-Miss Interrupt accuracy on the right

182× to 194× faster contract verification under matched partner-pressure confounders.

Across 140 strictly document-disjoint SEC commercial filings (CUAD) and multi-exhibit NDA bundles (ContractNLI, median 5,616 tokens, P90 7,146 tokens), both false-clause sycophancy traps and genuinely supported restrictive-covenant confounders use the exact same "URGENT CLOSING MEMO" managing-partner framing so no detector can cheat on prompt tone.

ZERO-SHORTCUT GROUNDING SIGNAL

0.9801 (3B) & 0.9737 (7B) AUROC

Even with identical managing-partner urgency framing on benign confounders, Layer 57.1% dense_latch packs trigger on 0/46 held-out benign and confounder contracts (0.0% empirical FPR) across both models.

THE SOVEREIGN 7B SWEET SPOT

60.9% Recall & Zero Steering Collapse

On 6k-7k token multi-exhibit packets, 3B succumbs to partner pressure (95.8% unguarded → 33.3% at strict 0% FPR) while unconditional Always-On steering collapses recall to 0.0% on both models. Stepping up to 7B + LatchGate delivers 60.9% grounded recall + 0.9737 audit AUROC.

ZERO SECOND-PASS PREFILL

57.7 ms vs. 11,187 ms (193.9× Speedup)

Chunking base-decoder prefill in 1,536-token windows skips 2.49 GB intermediate lm_head buffers (capping 7B NF4 peak VRAM at 9.5 GiB) while checking grounding 182.0× (3B) to 193.9× (7B) faster than a second-pass LLM judge.

Two-panel Study 2 chart showing false-clause hallucination rates and grounded clause recall across Qwen2.5-3B and Qwen2.5-7B on the left, and log-scale verification latency comparing 2,813 ms and 11,187 ms post-hoc LLM verifiers against 15.5 ms and 57.7 ms in-stream LatchGate on the right

Four SHA-256-verified .lgate packs with dual compliance threshold profiles.

Shipped in latchgate v0.1.2 and hosted on Hugging Face Hub (danielgaskins/latchgate-packs), every legal pack embeds both strict_zero_fpr (default conformal 0.0% benign FPR) and attorney_review_5pct_fpr (higher-sensitivity human-review routing) inside gate.metadata["threshold_profiles"].

pip install "latchgate[llm,hub]"

# Recommend and deterministically verify the legal stack on CPU in < 1 second:
latchgate recommend --model Qwen/Qwen2.5-7B-Instruct --failure-mode legal --json
latchgate verify qwen2.5-7b-legal-citation --json
latchgate verify qwen2.5-7b-legal-grounding --json

Included in legal-latchgate

  • Public-corpus builders for Harvard casehold/casehold, chenghao/cuad_qa SEC contracts, and kiddothe2b/contract-nli
  • Identical-template closed-book citation evaluator with 16k JumpReLU SAE familiarity-confounder penalty & Cache-Miss Interrupt simulator
  • Memory-safe 1,536-token chunked base-decoder prefill keeping 8k-token Qwen2.5-7B under 9.5 GiB VRAM
  • 4-page two-column academic preprint PDF, unit test suite (pytest), and reproducible summary JSON

Deployment boundaries

  • Requires self-hosted open-weights forward passes (Transformers, vLLM, SGLang); for closed commercial APIs without hidden-state access, use mendmark-evals
  • Conformal 0.0% false-trigger guarantees hold on calibrated contract/citation distributions; re-run latchgate verify and held-out controls whenever swapping model weights or LoRA adapters
  • Cache-Miss Interrupt flags unmemorized citations so your retrieval connector queries an authoritative docket index rather than inventing case text

04 / REPRODUCE OR PILOT IT

Inspect the legal benchmark, install the packs, or discuss a private VPC pilot.

All benchmark code, held-out JSON telemetry, and pre-calibrated .lgate checkpoints are MIT-licensed on GitHub, PyPI, and Hugging Face Hub.