Skip to content

VLM doclang fallback - #159

Merged
artiz merged 2 commits into
docling-project:masterfrom
artiz:claude/vlm-doclang-fallback
Jul 26, 2026
Merged

VLM doclang fallback#159
artiz merged 2 commits into
docling-project:masterfrom
artiz:claude/vlm-doclang-fallback

Conversation

@artiz

@artiz artiz commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

No description provided.

artiz and others added 2 commits July 25, 2026 08:19
…ocling-project#153)

The VLM pipeline routes non-DocTags model output through the DocLang XML
reader, which is a strict parser: a model that leaves a <heading>/<text>
unclosed produces markup it rejects with `expected 'heading' tag, not
'doclang'`, and that error propagated all the way out — dropping the entire
normal_4pages fixture from the docling-project#153 corpus run ("rust side failed").

The DocTags path never hard-fails on hostile model output (docling-project#152: best-effort
document out); the DocLang fallback now matches it. parse_doclang_fragments
tries the strict reader first (well-formed DocLang keeps its heading levels
and table structure) and, on a parse error, salvages the fragments through
the tolerant DocTags parser, which degrades broken/unknown tags to text and
never errors. Two regression tests cover both branches.

Refs docling-project#153

Signed-off-by: artiz <artem.kustikov@gmail.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EY5KAiquN4YpVf2PXEQkVT
…-project#153)

picture_classification scored 1.3% similarity in the live VLM corpus run.
Root-causing it deterministically: our DocTags parser reproduces docling's
groundtruth Markdown for that fixture byte-for-byte (pictures with captions
before the image placeholder, multi-page <page_break>, reading order), so
the divergence is live-model / render variance — which the harness itself
flags as expected ("triage as render, not parser") — not a defect on our
side. Add an end-to-end regression test through convert_vlm that feeds the
model's exact DocTags for the document and asserts the Markdown matches the
groundtruth, so our side of the comparison stays provably correct. Image
leg, so it needs no pdfium and runs in CI everywhere.

Refs docling-project#153

Signed-off-by: artiz <artem.kustikov@gmail.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EY5KAiquN4YpVf2PXEQkVT
@artiz
artiz merged commit 68963db into docling-project:master Jul 26, 2026
10 checks passed
@artiz
artiz deleted the claude/vlm-doclang-fallback branch July 26, 2026 17:41
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