← Documentation / SQL Reference

DOI 1.11 — The masking blind spot theorem

Old DBBuilt on the earlier, JOIN-based pipeline. Not every model was affected by its data-integrity bug — Standard and High-Fidelity needed correction, SwinIR and Digital-Art were confirmed unaffected. See Superseded Files.

query_doi111_verification_windows.sql

Verifies the σgt=0 ⇒ S=1 identity against all four models in a single session (all four databases ATTACHed together, results combined with UNION ALL), confirming zero exceptions.

This file runs three groups of queries, one after another, against all four models' databases opened together in one session:

Screen recording: hallucination_4model.mp4.

ATTACH 'D:/verification/output_std/alignment_axis_images_std.duckdb'         AS db_std     (READ_ONLY);
ATTACH 'D:/verification/output_swinir/alignment_axis_images_swinir.duckdb'   AS db_swinir  (READ_ONLY);
ATTACH 'D:/verification/output_high/alignment_axis_images_high.duckdb'       AS db_high    (READ_ONLY);
ATTACH 'D:/verification/output_digital/alignment_axis_images_digital.duckdb' AS db_digital (READ_ONLY);

ATTACH 'path' AS alias (READ_ONLY) opens an additional database file into the current session and gives it a short name, so later queries can write db_std.blocks instead of switching which single file is open. All four are opened read-only, so nothing this file does can modify the data it's checking.

SELECT 'std' AS src_model, COUNT(*) AS total_blocks FROM db_std.blocks
UNION ALL
SELECT 'swinir', COUNT(*) FROM db_swinir.blocks
UNION ALL
SELECT 'high', COUNT(*) FROM db_high.blocks
UNION ALL
SELECT 'digital', COUNT(*) FROM db_digital.blocks;

Part 0 is just context, not the theorem check itself: how many rows (blocks, noTTA and TTA combined) does each model's database contain? COUNT(*) counts rows, and stacking four SELECTs with UNION ALL prints one labeled row per model instead of four separate results.

SELECT 'std' AS src_model,
    COUNT(*) FILTER (WHERE model='notta')                 AS n_sigma0_notta,
    COUNT(*) FILTER (WHERE model='notta' AND ssim_s<>1.0) AS exceptions_notta,
    COUNT(*) FILTER (WHERE model='tta')                    AS n_sigma0_tta,
    COUNT(*) FILTER (WHERE model='tta' AND ssim_s<>1.0)   AS exceptions_tta
FROM db_std.blocks WHERE sigma_gt = 0
UNION ALL
-- ...the same four columns, repeated for db_swinir, db_high, db_digital

This is the actual test (see Glossary for sigma_gt). WHERE sigma_gt = 0 narrows the query down to blocks where the ground-truth block is perfectly flat. COUNT(*) FILTER (WHERE ...) counts rows matching an extra condition without writing a separate query for each one: n_sigma0_notta is how many σgt=0 blocks exist under noTTA, and exceptions_notta is how many of those have ssim_s <> 1.0 (the structure term S not exactly 1). The theorem this report proves predicts both exception counts should be exactly 0, for every model — and that is exactly what running this against the real databases confirms.

SELECT 'std' AS src_model,
    COUNT(*)                                        AS n,
    ROUND(AVG(comp_sharpness_processed_block), 4)   AS avg_sharpness,
    ROUND(STDDEV(comp_sharpness_processed_block), 4) AS std_sharpness,
    ROUND(MAX(comp_sharpness_processed_block), 4)   AS max_sharpness
FROM db_std.blocks
WHERE model = 'notta' AND is_comp_zero = FALSE AND sigma_gt = 0
UNION ALL
-- ...the same four columns, repeated for db_swinir, db_high, db_digital

A follow-up question, not the theorem itself: among those same flat-ground-truth blocks, is the reconstruction always flat too, or does the model sometimes invent detail out of nothing? is_comp_zero = FALSE excludes the case where the reconstruction is itself completely degenerate, and the average/max of comp_sharpness_processed_block across the remaining blocks measures how much sharpness the model hallucinated into an area that should have none.