PDF Heading Level Classifier: heading detection for PDF to Markdown

Assigns heading level 1, 2 or 3 to every heading block detected in PDFs. A small LightGBM model for #, ## and ### structure in PDF to Markdown output, compiled into PDFluent SDK 1.3.0 and on by default with no separate install. PDFluent 1.3.0 ranks above every engine on the published opendataloader-bench leaderboard (as of 3 November 2026)*.

*Overall score 0.9168 (quality="auto", keep_furniture=True, Linux) against the engines listed in the benchmark README on 3 November 2026; submitted as pull request #37 (https://github.com/opendataloader-project/opendataloader-bench/pull/37). Other engines have submissions open that are not yet on the leaderboard.

Use it in two lines

pip install pdfluent
import pdfluent; print(pdfluent.open("report.pdf").extract_markdown())  # headings come out as #, ## and ###

The model is compiled into SDK 1.3.0 and on by default.

Inspect the weights without the SDK

To inspect the weights without the SDK:

import gzip, json

model = json.load(gzip.open("model.json.gz"))      # LightGBM dump_model() JSON
manifest = json.load(open("manifest.json"))

print(manifest["classes"])        # level 1, level 2, level 3
print(model["feature_names"])     # the features the SDK computes per heading block
print(model["num_class"], len(model["tree_info"]))

What you get

  • Assign heading level 1, 2 or 3 to every heading block the SDK detects
  • Trained on arXiv (CC BY 4.0, CC0), PubMed Central (CC BY) and synthetic pages
  • One feature row per heading block in, class scores for level 1, 2 and 3 out
  • Weights published here for inspection, with the attribution list for every training paper

Inputs and outputs

The model takes a feature row per heading block from the PDFluent SDK. Features include font size, position and neighbouring blocks. It outputs a level per heading. It is compiled into the PDFluent SDK since version 1.3.0 and runs by default there. No separate install is needed. The SDK handles heading detection and feature extraction.

Description
Input One feature row per detected heading block. Feature names: feature_names in model.json.gz and features in manifest.json.
Output Class scores for level 1, level 2, level 3.

Training data and provenance

Trained from scratch on arXiv papers under CC BY 4.0 and CC0 1.0, PubMed Central papers under CC BY, and synthetic pages. Heading labels use annotations from DocLayNet, FinTabNet and PubTables-1M. Attribution details are in attribution.json, PMC-AUTHORS.json and PROVENANCE.md. No page images or paper text are redistributed.

The CC BY attribution list is attribution.json; PMC-AUTHORS.json adds author names. PROVENANCE.md explains how the files relate. The weights match the model compiled into SDK 1.3.0 (weights_sha256 in manifest.json, digests in SHA256SUMS).

Limitations

Validated only on a held-out part of the same development data, not on a separate sealed benchmark. Synthetic layouts did not improve performance. Behaviour on unrelated PDFs is not established. Only assigns levels, does not detect headings. Requires the PDFluent SDK's heading detection and feature extraction to be useful.

Licence in plain words

The heading level classifier is part of the PDFluent SDK, licensed under AGPL-3.0-only or the PDFluent Commercial Licence at your option. The model weights are available under these licences. See https://pdfluent.com/license for terms.

Try PDFluent

Run pip install pdfluent to process your PDFs into structured Markdown. The docs at pdfluent.com/docs show how to use extract_markdown with the classifier.

Citation

@misc{pdfluent_heading_level_classifier_2026,
  author       = {{Innovation Trigger B.V.}},
  title        = {PDFluent heading level classifier: heading_level_979},
  year         = {2026},
  publisher    = {Hugging Face},
  url          = {https://huggingface.co/PDFluent/pdf-heading-level-classifier},
  note         = {PDFluent, https://pdfluent.com}
}

Links

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Collection including PDFluent/pdf-heading-level-classifier