feat(90): fail-closed source-evidence table judge — stop silent scanned-page hallucination#91
Merged
Merged
Conversation
…d-page hallucination) On scanned pages (no native words) the VLM can emit a fluent fabricated markdown table that the heuristic judge accepts as success (JCS-18-81 p6 SaaS table in a tax doc). New SourceEvidenceTableJudge wraps the judge chain BEFORE heuristic acceptance, on any output with markdown tables regardless of ps.has_tables: - born-digital (native words) -> defer to NativeTableVerifierJudge (no regression) - scanned -> verify emitted cell tokens against LOCAL non-generative evidence only (page/crop raster, locate_tables regions, optional pytesseract). Numbers need exact normalized-multiset support; alpha-only tables need label-token support; no evidence or unsupported tokens -> UNVERIFIABLE, fail closed (NOT success). - on reject: failed-table marker + page PNG, audit_passed=False, status=ERROR, FailureMode.HALLUCINATION, audit event; scanned-table floor in manifest assembly so a rejected scanned table can't slip into the final .md. No magic thresholds (named/documented constants). Selected via /fanout (grok). 17 new hermetic tests (hallucination reject, alpha/numeric support, unverifiable, manifest floor, born-digital defer); 538-test regression green; ruff clean. Closes #90.
r-uben
force-pushed
the
feat/90-source-evidence-table-judge
branch
from
June 30, 2026 16:11
3ef92ac to
d9e8614
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #90.
Stops the fail-open defect where the VLM fabricates a fluent markdown table on a scanned page (no native words), self-reports
status:success/engine:qwen, and the heuristic judge accepts it (JCS-18-81 p6: a SaaS product table injected into a 1981 tax-policy doc). For a citation corpus, invented content was indistinguishable from a clean extraction downstream.Fix
New
SourceEvidenceTableJudge(src/socr/tables/source_evidence.py) wraps the agentic judge chain before heuristic acceptance, on any output with markdown tables regardless ofps.has_tables:NativeTableVerifierJudge(no regression to the CE OCR is not solved: prioritize reliable tables and figures #56 path).locate_tablesregions, optionalpytesseract). Numbers require exact normalized-multiset support; alpha-only tables require label-token support; no evidence or unsupported tokens → UNVERIFIABLE → fail closed (not success).audit_passed=False,status=ERROR, newFailureMode.HALLUCINATION, audit event; plus a scanned-table floor in manifest assembly so a rejected scanned table can't reach the final.md.No magic thresholds (named/documented constants). Selected via cross-vendor
/fanout(grok).Tests
17 new hermetic tests (no GPU/ollama): scanned hallucination hard-rejected; alpha/numeric support pass/fail; unverifiable-no-evidence; manifest floor; born-digital defer. 538-test regression (agentic/table/manifest/figure/cascade/p1) green; ruff clean.
Impact
Unblocks treating socr output as an authoritative citation corpus for scanned-heavy collections — the held CBO 23k-doc scale-up can proceed once this lands. Related #64, #35, #56.