Dataset Viewer
The dataset could not be loaded because the splits use different data file formats, which is not supported. Read more about the splits configuration. Click for more details.
Couldn't infer the same data file format for all splits. Got {NamedSplit('train'): ('imagefolder', {}), NamedSplit('validation'): ('pdffolder', {}), NamedSplit('test'): ('pdffolder', {})}
Error code:   FileFormatMismatchBetweenSplitsError

Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.

CADP-Bench

A test benchmark for Compilable Academic Document Parsing.

CADP-Bench is a test benchmark for evaluating the reconstruction of academic document pages into contextual LaTeX and executable chart code. It covers continuous text together with four types of structured academic elements: tables, mathematical equations, charts, and pseudocode. The task emphasizes preserving document structure, surrounding context, and the ability to compile generated outputs back into a page for verification.

Related paper: Code as Representation: A Compilable Parsing Paradigm for Academic Documents.

Paper | PDF | Dataset repository

Benchmark overview

The benchmark contains 1,630 page-level test samples across five academic domains. Every sample in the index includes at least two structured element categories. Each sample is associated with a reference page PDF, a page-level LaTeX annotation, and a source directory containing the surrounding document context and supporting resources.

The release occupies approximately 11.9 GB, excluding local version-control metadata and caches. All samples constitute the benchmark's test set and are indexed in a single data.json file.

Domain distribution

Domain subject Samples
Computer Science cs 1,047
Physics phy 251
Quantitative Biology bio 222
Statistics stat 65
Economics eco 45
Total 1,630

Element counts and difficulty

The following statistics are computed from the current data.json annotations. Element-level difficulty labels are 1 = Simple, 2 = Medium, and 3 = Hard. Counts refer to individual elements, not pages; a page can contain multiple elements.

Element Simple (1) Medium (2) Hard (3) Total
Table 803 644 395 1,842
Equation 340 536 147 1,023
Pseudocode 40 71 27 138
Chart 316 975 200 1,491

Data construction

As described in the paper, CADP-Bench is constructed from academic PDFs and their corresponding LaTeX sources collected from arXiv. The construction workflow includes source preparation and compilation checks, selection of pages containing multiple structured elements, alignment of page content with LaTeX annotations, chart reconstruction, and human verification.

The retained document context supports evaluation of generated content within the original source environment, including document classes, packages, macros, references, and related assets.

Repository structure

CADP-Bench/
|-- README.md
|-- .gitattributes
|-- data.json
|-- pdf_data/
|   `-- <sample_id>.pdf
`-- data/
    `-- <sample_id>/
        |-- main_flat.tex
        `-- ... source files and supporting resources
  • data.json: a JSON object mapping sample IDs to annotations and metadata.
  • pdf_data/: 1,630 reference page PDFs, with paths specified by page_path.
  • data/<sample_id>/: 1,630 sample directories containing document sources and supporting resources, such as figures, styles, bibliographies, and chart reference code where applicable.
  • main_flat.tex: the consolidated LaTeX source for the sample's document context.

Sample IDs follow the pattern <arxiv_id_with_version>_page<page_number>, for example 2201.04663v3_page11.

Annotation schema

data.json is a dictionary keyed by sample ID, rather than a list of rows or a JSONL file.

Field Type Description
arxivid string Source arXiv identifier, including its version.
page_num integer Page number in the source document.
page_path string Reference page PDF path, relative to the repository root.
latex_code string Reference LaTeX annotation for the target page content.
image_paths list of strings Referenced image paths, relative to data/<sample_id>/.
insert_node integer Stored insertion-position metadata for reconstructing content in the source context.
subject string Academic domain: cs, phy, bio, stat, or eco.
type list of strings Element categories present: table, figure, equation, and/or algorithm.
table_num, equation_num, algorithm_num integer Counts of tables, equations, and pseudocode elements, respectively.
figure_num integer, optional Number of chart elements.
table, equation, algorithm list of strings Element-level reference LaTeX annotations.
table_scores, equation_scores, algorithm_scores list of integers Element-level difficulty labels for the corresponding category.
figure_scores list of integers, optional Chart difficulty labels.
layout_score integer, optional Stored page-layout annotation.

The schema uses figure for charts and algorithm for pseudocode. Fields for absent elements may contain empty lists. In the current release, 342 samples omit figure_num, figure_scores, and layout_score. Use sample.get("figure_num", 0) and sample.get("figure_scores", []) when reading chart annotations.

The 1/2/3 difficulty mapping above applies to element-level score lists. Keep layout_score separate: it is optional and the current release also contains a value of 0.

Getting started

Download

Install the download client:

pip install -U huggingface_hub

Download the dataset into a local directory:

from huggingface_hub import snapshot_download

snapshot_download(
    repo_id="seuai-wangjun/CADP-Bench",
    repo_type="dataset",
    local_dir="./CADP-Bench",
)

If you already have the dataset locally, skip this step. The download API is documented in the Hugging Face download guide.

Read a sample

Run the following from the parent directory of CADP-Bench, or adjust root to your dataset location. Reading the index uses only the Python standard library.

import json
from pathlib import Path

root = Path("./CADP-Bench")
with (root / "data.json").open("r", encoding="utf-8") as f:
    samples = json.load(f)

sample_id = "2201.04663v3_page11"
sample = samples[sample_id]
source_dir = root / "data" / sample_id

page_pdf = root / sample["page_path"]
source_tex = source_dir / "main_flat.tex"
image_files = [source_dir / path for path in sample["image_paths"]]

print("Samples:", len(samples))
print("Sample:", sample_id)
print("Domain:", sample["subject"])
print("Element types:", sample["type"])
print("Reference page:", page_pdf)
print("Source context:", source_tex)
print("Referenced images:", image_files)
print("Chart count:", sample.get("figure_num", 0))
print("Table difficulty:", sample["table_scores"])
print("Reference LaTeX preview:", sample["latex_code"][:300])

Task and evaluation

The CADP task takes a target page image as input and predicts contextual LaTeX for its text and structured elements, together with executable code for its charts. Reference page PDFs are provided in pdf_data/; render them into page images using the preprocessing configuration of your evaluation setup.

The paper evaluates predictions using a re-injection compilation protocol:

  1. Execute the model-predicted chart code to produce the required chart assets.
  2. Insert the predicted LaTeX into the corresponding source context, with references to those assets.
  3. Compile and render the reconstructed document, then compare the target page with the reference.

The protocol measures executability and structural, textual, and visual fidelity. Reported metrics include execution rate, TEDS for tables, CDM for equations, Pseudocode Reconstruction Score (PRS), reading order, PageIoU, Visual Reconstruction Fidelity (VRF), and pixel similarity. The paper assigns a score of zero to samples that fail re-injection compilation.

This repository provides the dataset assets and annotations. The examples above cover downloading and reading the release; they are not an end-to-end implementation of the paper's evaluation protocol.

Usage notes

  • Preserve each sample's directory structure when resolving its referenced resources or compiling its source.
  • The consolidated source is document context, while latex_code is the target-page annotation; they serve different roles in reconstruction.
  • Some supplied chart reference scripts retain machine-specific output paths. Adapt those paths before executing the scripts on another machine.
  • Reading the provided pages, assets, and annotations does not require running the chart reference scripts.
  • The benchmark focuses on arXiv academic documents and pages with multiple structured element types; results should be interpreted within that scope.

Citation

If you use CADP-Bench in your research, please cite the paper using the arXiv-provided BibTeX entry:

@misc{jin2026coderepresentationcompilableparsing,
  title={Code as Representation: A Compilable Parsing Paradigm for Academic Documents},
  author={Rihui Jin and Jun Wang and chengyuan zhu and Liang Mingyu and Yue Gao and Li Yunxuan and Kuicai Dong and Guilin Qi and Lin Ren and Yongrui Chen and Xinbang Dai and Jiaqi Li and Tongtong Wu and Gholamreza Haffari},
  year={2026},
  eprint={2608.17550},
  archivePrefix={arXiv},
  primaryClass={cs.CV},
  url={https://arxiv.org/abs/2608.17550},
}

License

The repository's declared license is CC BY 4.0, as specified in the dataset card metadata.

Downloads last month
12

Paper for seuai-wangjun/CADP-Bench