docling-project / docling-project/docling
Layout model classifies grid-lined forms as Table instead of Form — Heron and Heron-101
- Dominant language
- Python
- Stars
- 66.4k
- Forks
- 4.8k
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 84
Description
## Description
Both `docling-layout-heron` and `docling-layout-heron-101` misclassify PDF forms with grid lines as `Table` instead of `Form`, even though both models have `Form` (label 15) and `Key-Value Region` (label 16) in their `id2label` config.
When the layout model classifies a form region as `Table`, TableFormer then attempts to reconstruct it as a data table, producing severely garbled output with content duplicated across 7-8 identical columns.
## Reproduction
**Input:** Any PDF form with visible grid lines containing key-value pairs (e.g., an order form with fields like Customer, Date, Account Name, Address, etc. laid out in a bordered grid).
**Docling version:** 2.82.0
**Layout models tested:** `docling-layout-heron`, `docling-layout-heron-101`
**Pipeline:** `StandardPdfPipeline` with `TableFormerMode.ACCURATE`
```python
from docling.document_converter import DocumentConverter
result = DocumentConverter().convert("order_form.pdf")
print(result.document.export_to_markdown())
```
**Expected:** The form region should be classified as `Form` or `Key-Value Region`, and the output should preserve key-value pairs:
```
Date: 16/03/2026
Account Name: Scope Furnishing Ltd
Local Address: Lowlands Industrial Estate, ...
```
**Actual:** The form is classified as `Table`, and TableFormer produces output like:
```markdown
| Customer | Customer | Customer | Customer | Customer | Customer | Customer |
|---|---|---|---|---|---|---|
| Date 16/03/2026 | Date 16/03/2026 | Date 16/03/2026 | Date 16/03/2026 | ...
```
Every row's content is duplicated across all columns.
## Analysis
- The `Form` label (15) and `Key-Value Region` label (16) exist in both Heron and Heron-101 config.json
- Neither model fires these labels on grid-lined forms — the grid lines cause the model to predict `Table` instead
- Disabling `do_table_structure=False` doesn't help — the region is still classified as Table and dumped into a single cell
- The embedded text layer is correct (all content is present), only the structural classification is wrong
## Impact
Forms with grid lines are extremely common in business documents (order forms, application forms, invoices with header sections). This misclassification makes Docling unusable for these documents without manual intervention or VLM fallback.
## Environment
- Docling 2.82.0
- GPU: NVIDIA Blackwell RTX PRO 6000
- OS: Ubuntu (Debian-based)
- Python 3.12
Contributor guide
Assessment
This issue has not been assessed yet.