SLOT: Structuring the Output of Large Language Models

Zhengyuan Shen, Darren Yow-Bang Wang, Soumya Smruti Mishra, Zhichao Xu, Yifei Teng, Haibo Ding

TL;DR

This paper introduces SLOT, a model-agnostic approach that transforms unstructured LLM outputs into precise structured formats like JSON. By fine-tuning a lightweight language model as a post-processing layer, SLOT achieves high schema accuracy and content fidelity, outperforming existing methods and enabling smaller models to achieve comparable or better structured output generation capabilities.

What Problem Does This Paper Address?

Large Language Models (LLMs) are increasingly used in applications requiring structured outputs, such as agents and information extraction. However, LLMs often produce outputs that deviate from predefined schemas, significantly hindering reliable application development. Existing solutions either rely on constrained decoding, which can be restrictive and model-specific, or require extensive post-training of each LLM, which is neither scalable nor feasible for diverse LLM ecosystems. This paper addresses the challenge of achieving reliable structured output generation across various LLMs and schema specifications in a flexible and scalable manner.

Methods

The core of SLOT is a model-agnostic approach that uses a lightweight language model as a post-processing layer. This fine-tuned model takes the unstructured output from a primary LLM and transforms it into a precise structured format (specifically focusing on JSON Schema in this paper). Unlike methods that modify the LLM itself (e.g., post-training) or impose strict decoding constraints, SLOT operates independently of the LLM's architecture or weights. This allows it to be applied to any textual LLM output, regardless of the original LLM's task specialization or output constraints. The approach leverages Supervised Fine-Tuning (SFT) on a carefully curated dataset to teach the lightweight model to map unstructured text to the target schema.

Datasets

The authors introduce SLOTBENCH, a benchmark dataset designed for training and evaluating structured output generation. SLOTBENCH is created through a combination of synthetic data generation and the curation of existing public datasets. The synthetic data is generated using a pipeline that leverages Claude-3.5-Sonnet, ensuring broad coverage across various domains, text styles, and schema complexities. The paper also evaluates SLOT on five public datasets:

  • WebNLG: For structured data-to-text generation.
  • E2E NLG: For restaurant domain descriptions with attribute-value structures.
  • WikiBio: For biographical sentences paired with infobox-style structured data.
  • ToTTo: A table-to-text dataset.
  • HF GitHub Issues: A challenging benchmark for real-world scenarios, capturing diverse software issue elements.

Key Insights and Ideas

  • Model-Agnosticism is Key: The success of SLOT hinges on its ability to work with any LLM without modification. This is crucial for environments with diverse LLM deployments.
  • Lightweight Models Can Be Powerful: The paper demonstrates that even small, fine-tuned models (like Llama-3.2-1B) can achieve impressive structured output capabilities, rivaling or exceeding much larger proprietary models when equipped with SLOT.
  • Synergy of SFT and Constrained Decoding: Combining SLOT (which uses SFT) with constrained decoding methods (like XGrammar) yields near-perfect results, highlighting how these approaches can complement each other. SFT teaches semantic understanding and structure, while constrained decoding enforces structural validity.
  • Synthetic Data is Crucial: The diversity and complexity of the synthetic data generated for SLOTBENCH play a significant role in the model's performance, especially for schema accuracy.
  • Dataset Complexity Matters: Performance varies significantly across datasets, with the HF GitHub Issues dataset posing the most challenge due to its deeply nested structures and technical content.

Key Results

  • SLOT, when applied to a fine-tuned Mistral-7B model, achieves near-perfect schema accuracy (99.5%) and content similarity (94.0%), significantly outperforming Claude-3.5-Sonnet.
  • Even a compact model like Llama-3.2-1B with SLOT can match or exceed the structured output capabilities of larger proprietary models. For instance, Llama-3.2-1B with SFT achieves 88.9% schema accuracy and 81.7% content similarity, comparable to Claude-3.5-Haiku and exceeding Claude-3.5-Sonnet.
  • Mistral-7B-v0.2 with SLOT reaches 98.2% schema accuracy and 92.9% content similarity, surpassing all proprietary baselines.
  • The combination of SLOT (SFT) and XGrammar on Mistral-7B-v0.2 achieved 99.5% schema accuracy and 94.0% content similarity.

Limitations and Future Work

  • Data Synthesis Focus: The current data synthesis approach primarily focuses on cases where the input schema and gold structured output capture the majority of entities and relationships. Scenarios where only a subset of information needs structuring, or complex filtering/transformation is required, were not extensively explored.
  • Latency Analysis: While latency was considered, detailed results were not reported, as they can be hardware-dependent.
  • End-to-End Testing: An ideal evaluation would involve end-to-end testing where the input text is generated by a preceding LLM, rather than emulated LLM outputs.
  • Future Work: The authors suggest investigating more sophisticated data synthesis strategies, exploring advanced post-training methodologies, and developing more efficient algorithms for handling extremely complex schemas and maintaining coherent structural representations across deep hierarchies. They also plan to explore preference tuning and reinforcement learning.

Summary updated

Abstract

Structured outputs are essential for large language models (LLMs) in critical applications like agents and information extraction. Despite their capabilities, LLMs often generate outputs that deviate from predefined schemas, significantly hampering reliable application development. We present SLOT (Structured LLM Output Transformer), a model-agnostic approach that transforms unstructured LLM outputs into precise structured formats. While existing solutions predominantly rely on constrained decoding techniques or are tightly coupled with specific models, SLOT employs a fine-tuned lightweight language model as a post-processing layer, achieving flexibility across various LLMs and schema specifications. We introduce a systematic pipeline for data curation and synthesis alongside a formal evaluation methodology that quantifies both schema accuracy and content fidelity. Our results demonstrate that fine-tuned Mistral-7B model with constrained decoding achieves near perfect schema accuracy (99.5%) and content similarity (94.0%), outperforming Claude-3.5-Sonnet by substantial margins (+25 and +20 percentage points, respectively). Notably, even compact models like Llama-3.2-1B can match or exceed the structured output capabilities of much larger proprietary models when equipped with SLOT, enabling reliable structured generation in resource-constrained environments.
BibTeX
@inproceedings{shen2025slot,
  author = {Zhengyuan Shen and Darren Yow-Bang Wang and Soumya Smruti Mishra and Zhichao Xu and Yifei Teng and Haibo Ding},
  title = {{SLOT: Structuring the Output of Large Language Models}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2025},
}
Figure