Caption linked to the wrong picture when a figure's caption sits in a side column (right on 2.111.0, wrong on 2.152.0)

Open
#5,569 4 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

@Kylinny is already working on this.

Since Nov 25, 2026.

  • #5571 by @Kylinny — open

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
40/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
python
Domain
data

Research direction

The payload names no source file, so start from the reproduction script: convert the same single-page PDF with docling 2.111.0 and 2.152.0 and compare PictureItem.captions for each picture. Find where caption-to-picture association changed between those releases, since the boxes match and only the link differs. Done means picture B links to the caption directly below it, and the two side-column captions no longer cross-link. The reporter has offered to share the page privately.

Written by the indexing model from the issue text.

Description

bug pdf priority:medium
Bug

On a textbook page with two figures, PictureItem.captions points to the caption of the other figure on 2.152.0. The same page is correct on 2.111.0. Picture boxes are identical in both versions (IoU > 0.99); only the caption link changes.

Page layout (PDF points, bottom-left origin, page 1 of a 6-page excerpt):

  • Picture A: l=73, t=709, r=354, b=564 (top of page, wide). Its caption "Figure 15-7 …" is printed to its right, in the margin column (l=381).
  • Picture B: l=382, t=359, r=512, b=220 (lower, in the margin column). Its caption "Figure 15-8 …" is printed directly below it (l=381).
Picture A Picture B
2.111.0 no caption "Figure 15-8 …" (correct)
2.152.0 no caption "Figure 15-7 …" (wrong: that is A's caption)

Both caption texts are detected with label caption in both versions. So on 2.152.0 picture B takes the first caption of its column instead of the one below it, and "Figure 15-8" is left unlinked.

Two related cases from the same run (20 excerpts, 129 pictures matched by IoU between versions):

  • a caption directly below its picture keeps label caption but is no longer in picture.captions (linked on 2.111.0);
  • a caption that was caption on 2.111.0 becomes plain text on 2.152.0, so the picture has none.
Steps to reproduce
from docling.datamodel.base_models import InputFormat
from docling.datamodel.pipeline_options import PdfPipelineOptions
from docling.document_converter import DocumentConverter, PdfFormatOption

opts = PdfPipelineOptions()
opts.do_ocr = False
conv = DocumentConverter(format_options={InputFormat.PDF: PdfFormatOption(pipeline_options=opts)})
doc = conv.convert("page.pdf").document
for pic in doc.pictures:
    print(pic.prov[0].bbox, [c.resolve(doc).text[:40] for c in pic.captions])

Run under both versions and compare. The page is from a copyrighted textbook, so I cannot attach it here; I can share it privately with a maintainer, and I am happy to test a patch.

Docling version

Wrong: docling 2.152.0, docling-core 2.108.0, docling-ibm-models 4.0.4, docling-parse 7.27.1.
Right: docling 2.111.0, docling-core 2.92.0, docling-ibm-models 3.13.3, docling-parse 7.16.0.

Python version

Python 3.12, Linux x86_64, CPU only.

Dominant language
Python
Stars
71k
Forks
5.4k
Avg merge
2d 22h
Merged PRs (30d)
161

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from docling-project/docling

All issues in docling-project/docling

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.