Skip to content

Give the coarse profile scanning evidence and probe images in one pass - #607

Merged
EricNGOntos merged 2 commits into
mainfrom
feat/wuchengke/2026-12-04
Dec 4, 2026
Merged

EricNGOntos merged 2 commits into
mainfrom
feat/wuchengke/2026-12-04

Conversation

@EricNGOntos

Copy link
Copy Markdown
Contributor

Summary

  • Scanning evidence for the coarse profile. The text probe (before the coarse VLM call) now records per-page image coverage and image count. Sampled page rows add invisible_text_length, image_coverage, image_count and drop the text-only is_blank_like flag; doc_stats adds invisible-text and image-coverage distributions (statistics only, no sampling extrema).
  • Prompt. is_scanned is decided from screenshots and measurements together: a page is scanned when its screenshot shows clearly more text than its visible text layer holds and images cover most of it; a visible text layer that matches the screenshot means digital, even with large images. No thresholds or document-specific examples.
  • Page kind rename. The geometry-only kind normal (defined as "enough native text", which misled the model on scans) is now portrait. Persisted labels other than landscape still read as portrait.
  • One-pass image probe. Image placements come from page.get_image_info() instead of one get_image_rects call per image, in the text probe and the asset probe. The asset probe only derives the has_asset gate; boxes are not kept.

Why

Since the asset probe moved after the coarse call, the model saw no image data, every page labelled as having native text, and every textless page as blank-like. TAOCP (clean scan, no text layer) was judged digital in 2 of 5 runs.

Verification

Check Before After
TAOCP is_scanned (deepseek-flash) true 2/5 true 10/10
Sydney / standards PDF / slide deck — digital 8/8, 5/5, 5/5
Asset probe, TAOCP image lookup 16.0s 0.15s
has_asset pages (TAOCP / Sydney / standards / deck) 665 / 356 / 88 / 76 identical, page by page
Bootstrap probe, TAOCP 0.74s 0.71s
  • make check passes. tests/unit + tests/contract: 1066 passed, 3 skipped, 1 failed: test_pymupdf_child_runs_below_worker_priority_and_reports_its_cpu fails the same way on clean main in a full run (passes alone); it is order-dependent and unrelated to this change.
  • New unit test: a full-page image gives coverage 1.0 at the text probe.

🤖 Generated with Claude Code

EricNGOntos and others added 2 commits December 4, 2026 01:15
The coarse profile decides is_scanned from page screenshots, but since the
asset probe moved after it the model saw no image measurements, every page
labelled "normal" (defined as having native text) and every textless page as
blank-like. A clean scan such as TAOCP was judged digital in 2 of 5 runs.

- The text probe now records image coverage and image count, so the coarse
  call sees them; doc_stats adds invisible-text and image-coverage
  distributions (no sampling extrema).
- The coarse prompt explains the evidence: a page is scanned when its
  screenshot shows clearly more text than its visible text layer holds and
  images cover most of it; a matching visible text layer means digital.
  Sampled page rows add invisible text, image coverage and image count and
  drop the text-only blank flag.
- The geometry-only page kind "normal" is renamed "portrait"; persisted
  labels other than landscape still read as portrait.
- Image placements come from one get_image_info pass instead of a
  get_image_rects call per image, in both probes (TAOCP asset probe 16s ->
  0.15s; has_asset unchanged on all pages of four test documents).

TAOCP is now judged scanned in 10 of 10 runs; Sydney, a standards document
and a slide deck stay digital in 18 of 18.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eout test

The test bounded the whole worker run, settlement included, by the budget
plus 0.32s. The settlement's database work takes about 0.1s locally but
0.8s on the CI runner, so the test failed there without any regression.

It now measures how long the blocked native wait lasted and asserts the
deadline ended it before its own end. Settlement keeps its own deadline;
missing it makes the run return "pending", which the test already rejects.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@EricNGOntos
EricNGOntos merged commit 2554ce2 into main Dec 4, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant