GO TO A SECTION

↑ ↓ to navigate · Enter to openExplore all sections →
FDEInterviews logo
EMNLP 2024 (Industry)

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

Asking for JSON lowered reasoning scores for several models. Much of the worst drop was output that failed to parse, and JSON mode let GPT-3.5 write its answer before its reasoning.

Breakdown by FDE Interviews · 10 min read · Updated

About the original · 2024
AUTHORS
Tam, Wu, Tsai, Lin, Lee, Chen
FROM
Appier AI Research, National Taiwan University
PUBLISHED
Aug 2024 · EMNLP 2024 (Industry)
CITED BY
151Semantic Scholar · Nov 2026
IN THIS BREAKDOWN · 10 SECTIONS

You can read 23% of this breakdown.

01

The paper in one minute

Applications ask models for JSON because free text is hard to parse reliably. There are three common ways to get it. JSON mode constrains decoding so the output is valid JSON. Format-restricting instructions ask for JSON, XML or YAML following a given schema, without enforcing it. NL-to-Format lets the model answer in natural language, then makes a second call to convert the answer into the format. The paper asks whether these restrictions change how well the model answers.

The authors test three reasoning tasks (GSM8K math, concatenating the last letters of words, tracking shuffled objects) and four classification tasks (medical diagnosis among 49 conditions in DDXPlus, financial text in MultiFin, sports plausibility, and a stereotype task known to be sensitive to formatting). Models are GPT-3.5 Turbo, Claude 3 Haiku, Gemini 1.5 Flash, LLaMA 3 8B Instruct and Gemma 2 9B Instruct. Each schema has two fields, reasoning and answer. Every setting uses nine prompt variants, and answers are extracted by an LLM so that a parser's fragility does not decide the score.

On reasoning tasks, stricter restriction usually meant lower accuracy, with JSON mode often worst. One cause was field order: in GPT-3.5's JSON-mode responses on Last Letter, the answer key came first every time, so the model answered before reasoning. NL-to-Format matched free text. Adding a schema to a format instruction lowered scores and raised variance for three of four models on GSM8K. On classification, JSON mode often helped, which the authors attribute to it narrowing the answer space. They also report that parse failures were not the main cause in general and could be fixed with a repair prompt, and that GPT-4o-mini's strict JSON Schema mode came close to free text.

THE IDEA, VISUALLY
GSM8K: FREE TEXT VS JSON VS JSON + SCHEMA Gemini 1.5 Flash text 89.3 JSON 89.7 +schema 89.2 Claude 3 Haiku text 86.5 JSON 87.0 +schema 23.4 GPT-3.5 Turbo text 76.0 JSON 74.7 +schema 49.3 LLaMA 3 8B text 75.1 JSON 64.7 +schema 48.9 mean of 9 prompt wordings; line = one standard deviation CLAUDE 3 HAIKU'S JSON DROP IS MOSTLY PARSING free text 86.5 parse fails as wrong (expected) 34.5 JSON + schema, measured 23.4 60.1% of its GSM8K JSON responses did not parse; one repair call added 44.8 points (Figure 5). FIELD ORDER DECIDES WHEN IT REASONS {"reasoning": "40 x 10 + 5 x 12 = 460", "answer": 460} {"answer": 490, "reasoning": "regular pay plus overtime"} reason, then answer answer first, reason after GPT-3.5's JSON mode put the answer key first on 100% of Last Letter responses. Put reasoning first in the schema and reject responses that reverse it. arXiv 2408.02442, Appier AI Research and National Taiwan University
Left: GSM8K accuracy, averaged over nine prompt wordings, for free text, JSON without a schema and JSON with a schema (Table 1); whiskers show one standard deviation across wordings. JSON alone costs little except for LLaMA 3 8B; adding a schema hurt Claude 3 Haiku and GPT-3.5 most. Right: Haiku's collapse to 23.4% sits beside a 60% rate of unparseable JSON on GSM8K (Table 3), and a second call that only repaired the format recovered 44.8 points (Figure 5). Below: the key-order failure, where JSON mode wrote the answer field before the reasoning field.
Research notes: the problem, approach and results
100%

GPT-3.5 JSON-mode responses on Last Letter that put the answer key before the reasoning key (Section 4.1)

86.5% to 23.4%

Claude 3 Haiku on GSM8K, free text against JSON with a schema; 22.9-point spread across wordings (Table 1)

+44.8 pts

Haiku's GSM8K JSON score after a second call repaired unparseable output (Figure 5)

THE PROBLEM

Production LLM features usually ask for structured output, JSON, XML or YAML, so code can parse the answer. Benchmarks of format following check whether the format is right, not whether asking for a format changes how well the model answers.

THE IDEA

Compare four levels of restriction on the same tasks: constrained JSON mode, instructions to answer in a format with a schema, answering in natural language and then converting, and plain natural language. Average over nine prompt wordings and use an LLM to extract answers so parsing does not decide the score.

THE RESULT

On reasoning tasks, stricter formats generally scored lower; JSON mode often scored worst, partly because it placed the answer before the reasoning. On classification tasks, JSON mode helped or matched. Answering freely and converting afterwards kept free-text accuracy.

02

Why it matters to an FDE

Order the schema so reasoning comes first. If a schema lists the answer before the reasoning, a model generating left to right commits to the answer first. Put a reasoning field before the answer field, and check that responses keep that order.

Count parse failures separately from wrong answers. A drop in accuracy after switching to JSON can be the model reasoning worse, or it can be output that does not parse. They have different fixes: prompt changes and repair calls for the second, schema design or a two-step flow for the first.

Consider answering first and formatting second. For reasoning-heavy tasks, a free-text answer followed by a cheap conversion call kept free-text accuracy in this study. It costs a second call, which is often cheaper than the accuracy lost.

Use constrained decoding where it narrows the answer. For classification into fixed labels, JSON mode or an enum in a schema can improve accuracy by ruling out invalid labels.

Evaluate the exact format you will ship. The paper shows results can move by tens of points between format instructions and between prompt wordings. Run your evaluation through the same output contract the product uses, over several wordings.

THE FULL BREAKDOWN

Understand the mechanism. Try it on a real problem.

Unlock this breakdown and 290 more papers.

Premium opens every paper in full, plus every answer, concept, course and guide on the site. One payment for six months of access.

6 months · One payment · No auto-renewal

Get Premium · ₹2,000 / $25
  • ◇1 architecture diagram
  • </>1 runnable code experiment
  • ▦2 results tables
  • ?5 interview questions with answers
  1. 03Key takeaways

    The three restriction methods, results by task type, schema effects, parsing, key order and limits

    Free account
  2. 04How it works

    The three methods, tasks and models, the schema, prompt variants, the LLM parser and the ablations

    Premium
  3. 05The numbers that matter

    Table 1 with and without schemas, Table 2 for strict schema mode, Table 3 parse rates and Figure 5

    Premium
  4. 06Try it yourself

    Put each gap in standard errors, separate parsing from reasoning, and ship a key-order guard

    Premium
  5. 07Where it breaks

    Small, older models, a two-field schema, an LLM parser, prompt choices and slips

    Premium
  6. 08Using it on a deployment

    Schema design, a two-step flow for reasoning, enums for labels, validation and repair

    Premium
  7. 09Interview angles

    Five questions this paper prepares you for, with answer hints

    Premium
Back to the paper library →