Skip to main content
QUICK REVIEW

[Paper Review] Let Me Speak Freely? A Study on the Impact of Format Restrictions on Performance of Large Language Models

Zhi Rui Tam, Cheng-Kuang Wu|arXiv (Cornell University)|Aug 5, 2024
Topic ModelingComputer Science4 citations
TL;DR

This study investigates how format restrictions—such as JSON, XML, and YAML—impact the performance of large language models (LLMs). It finds that constrained generation significantly degrades reasoning abilities, with stricter formats causing greater performance drops, and proposes relaxed prompting strategies to maintain both format consistency and high model performance.

ABSTRACT

Structured generation, the process of producing content in standardized formats like JSON and XML, is widely utilized in real-world applications to extract key output information from large language models (LLMs). This study investigates whether such constraints on generation space impact LLMs abilities, including reasoning and domain knowledge comprehension. Specifically, we evaluate LLMs performance when restricted to adhere to structured formats versus generating free-form responses across various common tasks. Surprisingly, we observe a significant decline in LLMs reasoning abilities under format restrictions. Furthermore, we find that stricter format constraints generally lead to greater performance degradation in reasoning tasks.

Motivation & Objective

  • To investigate whether format restrictions in structured generation degrade LLM performance in reasoning and knowledge tasks.
  • To compare the impact of different structured generation methods: constrained decoding (JSON-mode), format-restricting instructions (FRI), and NL-to-format prompting.
  • To identify the root causes of performance degradation under format constraints and propose mitigation strategies.
  • To provide empirical evidence on the trade-off between format adherence and model quality across diverse tasks and LLMs.

Proposed method

  • Constrained decoding (JSON-mode) was applied via API flags to enforce valid JSON output during generation.
  • Format-Restricting Instructions (FRI) directed LLMs to generate responses in specific formats like JSON, XML, and YAML using explicit format constraints.
  • NL-to-Format prompting decoupled content generation from formatting by first generating natural language, then converting to target schema.
  • Zero-shot prompting was used across multiple datasets, including GSM8K, Last Letter, Shuffled Objects, DDXPlus, Sports, Task280, and MultiFin.
  • Performance was evaluated using standard metrics (accuracy, F1) with statistical reporting across multiple runs and standard deviations.
  • Models tested included GPT-3.5-turbo, Gemini 1.5 Flash, Claude 3 Haiku, LLaMA 3 8B, and Gemma2-9B-IT across reasoning and classification tasks.
Figure 1: GPT-3.5-turbo prompted with GSM8K math questions in standard natural language answered correctly, but failed when format restrictions were applied.
Figure 1: GPT-3.5-turbo prompted with GSM8K math questions in standard natural language answered correctly, but failed when format restrictions were applied.

Experimental results

Research questions

  • RQ1Does restricting LLMs to structured formats like JSON, XML, or YAML degrade their reasoning performance?
  • RQ2How does the strictness of format constraints affect model performance across different tasks?
  • RQ3What are the underlying causes of performance degradation under format restrictions?
  • RQ4Can relaxed prompting strategies maintain high performance while still producing structured outputs?

Key findings

  • GPT-3.5-turbo's GSM8K accuracy dropped from 76.60% in natural language to 49.25% under JSON-mode, indicating a 27.35 percentage point decline.
  • Gemini 1.5 Flash showed a 20.12-point drop in Last Letter accuracy when switching from natural language (65.45%) to JSON-mode (77.02%), though this was an outlier in the trend.
  • LLaMA 3 8B's GSM8K score fell from 74.73% (natural language) to 48.90% under JSON-mode, a 25.83-point degradation.
  • NL-to-Format prompting consistently outperformed both FRI and JSON-mode in reasoning tasks, achieving the highest average accuracy across all models.
  • In classification tasks, JSON-mode often outperformed natural language for some models (e.g., Gemini 1.5 Flash on DDXPlus), but this was not consistent across all models and tasks.
  • YAML formatting showed the highest variance and worst performance in reasoning tasks, with LLaMA 3 8B achieving only 9.57% on Shuffled Objects.
Figure 2: When comparing reasoning related task such as GSM8K, Last Letter and Shuffled Objects, we found more relaxed prompts typically yields better results as JSON-mode performs the worse in most case followed by FRI, NL to Format and Natural Language (NL)
Figure 2: When comparing reasoning related task such as GSM8K, Last Letter and Shuffled Objects, we found more relaxed prompts typically yields better results as JSON-mode performs the worse in most case followed by FRI, NL to Format and Natural Language (NL)

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.