Struc-Bench: Are Large Language Models Really Good at Generating Complex Structured Data?

Xiangru Tang, Yiming Zong, Jason Phang, Yilun Zhao, Wangchunshu Zhou, Arman Cohan, Mark GersteinarXiv 2023

TL;DR

While Large Language Models (LLMs) excel at generating natural language, they frequently stumble when tasked with producing complex structured tables in formats like HTML or LaTeX. This paper introduces STRUC-BENCH, a new benchmark to evaluate this capability, along with FORMATCOT, a structure-aware instruction tuning method that enables a smaller LLaMA-7B model to outperform GPT-4 in generating complex tabular data.

What Problem Does This Paper Address?

State-of-the-art LLMs like GPT-4 are remarkably capable text generators, but their ability to output complex, structurally sound tabular data remains a major bottleneck. For applications like automated report generation or coding assistants, models must accurately organize information from multiple sources into coherent, strictly formatted structures.

Previous evaluation efforts have primarily focused on simple Information Extraction (IE) tasks or text-to-data generation using smaller pre-trained models. Furthermore, standard evaluation metrics like BLEU or ROUGE rely on word overlap, making them poorly suited for measuring structural correctness (e.g., missing columns, misaligned cells, or broken syntax in LaTeX/HTML). This paper addresses the lack of systematic benchmarks, specialized evaluation metrics, and effective training methods for complex structured table generation.

Methods

The authors propose a complete workflow to improve and evaluate structured data generation:

Figure 1: Overview of our workflow: We commenced by creating datasets of raw text tables, HTML tables, and LATEX tables. Subsequently, LLaMA-7B was trained using the training data constructed by FORMATCOT. Finally, our benchmarks validate the effectiveness of the current LLMs to generate such tables.
  1. FORMATCOT (Format Chain-of-Thought): To help models understand structural requirements explicitly, the authors use a self-instruct method where GPT-3.5 generates detailed, format-specific instructions (e.g., text alignment, borderlines, attributes) based on target tables. These guidelines are then appended to the training inputs.
  2. Instruction Tuning: The authors fine-tune a LLaMA-7B model on these enriched instructions, simulating a user-agent interaction where the model learns to balance content fidelity with strict format adherence.
  3. New Evaluation Metrics: To move beyond simple word overlap, the paper introduces two metrics split into content and format components:
  4. P-Score (Prompting Score): A model-based metric where GPT-3.5 uses Chain-of-Thought reasoning to independently score content and structural similarity on a 0-10 scale.
  5. H-Score (Heuristical Score): A hand-crafted metric that uses string-matching algorithms (like Levenshtein distance) on normalized, parsed table components to evaluate structural integrity.

Datasets

The authors introduced STRUC-BENCH, a comprehensive benchmark consisting of three distinct table formats, focusing on tables larger than 3x3 to ensure complexity:

  • Raw Text Tables: Sourced from the RotoWire sports dataset (3.4k training, 728 test samples).
  • LaTeX Tables: Sourced from GitHub repositories via The Stack dataset (5.3k training, 500 test samples).
  • HTML Tables: Sourced similarly from The Stack (5.4k training, 499 test samples).

For the LaTeX and HTML datasets that lacked paired natural language descriptions, the authors used GPT-3.5 to synthetically construct descriptions to serve as input prompts.

Key Insights and Ideas

  • The Structural Coherence Gap: Even advanced models like GPT-4 struggle with long-term structural coherence. Human evaluation revealed that only 9% of GPT-4's outputs and a mere 3% of GPT-3.5's outputs were entirely free of structural or element errors.
  • Format Planning Matters: Decomposing table generation into two distinct phases—Content Selection and Format Planning—via explicit format instructions significantly alleviates formatting errors.
  • Smaller Models Can Win: Massive scale isn't strictly necessary for specialized structural tasks. By injecting format awareness during instruction tuning, a 7B-parameter model can successfully out-format proprietary giants.

Key Results

The fine-tuned LLaMA-7B model (Ours-7B) demonstrated substantial performance gains over baseline models:

  • Raw Text Tables: Ours-7B achieved a SacreBLEU score of 90.6, dramatically outperforming GPT-4 (68.13) and GPT-3.5 (56.92). It also dominated in both Content and Format P-Scores and H-Scores.
  • LaTeX Generation: Ours-7B led across all metrics, achieving a Content P-Score of 8.94 compared to GPT-4's 8.78.
  • HTML Generation: GPT-4 maintained a very slight edge in traditional text-similarity metrics (SacreBLEU of 79.25 vs. Ours-7B's 77.50), but Ours-7B surpassed GPT-4 in structural evaluation metrics, achieving a Format H-Score of 2.49 versus GPT-4's 2.29.

Limitations and Future Work

The authors note several limitations and open directions for future research:

  • Optimal Formats: The study did not investigate which specific tabular representations (e.g., JSON vs. Markdown vs. HTML) are inherently easiest for LLMs to process and generate.
  • Numerical Reasoning: LLMs still struggle with table generation tasks that require implicit mathematical calculations (such as calculating totals or averages from text).
  • Domain Specificity: Future benchmarks need to target highly specialized domains (e.g., financial or medical tables) that carry unique structural conventions.
  • Multimodal Expansion: Extending this work to multimodal models that can map visual tables (images) directly to structured code formats.

Summary updated

BibTeX
@misc{tang2023struc,
  author = {Xiangru Tang and Yiming Zong and Jason Phang and Yilun Zhao and Wangchunshu Zhou and Arman Cohan and Mark Gerstein},
  title = {{Struc-Bench: Are Large Language Models Really Good at Generating Complex Structured Data?}},
  year = {2023},
  eprint = {2309.08963},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2309.08963},
}
Figure