Skip to main content
QUICK REVIEW

[Paper Review] Does Prompt Formatting Have Any Impact on LLM Performance?

Jia He, Mukund Rungta|arXiv (Cornell University)|Nov 15, 2024
Digital Rights Management and SecurityComputer Science19 citations
TL;DR

The paper shows that prompt formatting significantly affects GPT-based model performance across tasks, with no universal best format; larger models like GPT-4 are more robust to formatting changes than GPT-3.5.

ABSTRACT

In the realm of Large Language Models (LLMs), prompt optimization is crucial for model performance. Although previous research has explored aspects like rephrasing prompt contexts, using various prompting techniques (like in-context learning and chain-of-thought), and ordering few-shot examples, our understanding of LLM sensitivity to prompt templates remains limited. Therefore, this paper examines the impact of different prompt templates on LLM performance. We formatted the same contexts into various human-readable templates, including plain text, Markdown, JSON, and YAML, and evaluated their impact across tasks like natural language reasoning, code generation, and translation using OpenAI's GPT models. Experiments show that GPT-3.5-turbo's performance varies by up to 40\% in a code translation task depending on the prompt template, while larger models like GPT-4 are more robust to these variations. Our analysis highlights the need to reconsider the use of fixed prompt templates, as different formats can significantly affect model performance.

Motivation & Objective

  • Investigate whether different human-readable prompt templates (Plain text, Markdown, YAML, JSON) affect GPT model performance across diverse tasks.
  • Assess sensitivity of GPT-3.5 and GPT-4 to prompt format changes using standardized benchmarks.
  • Evaluate consistency of model outputs when prompts vary.
  • Explore transferability of top-performing formats between different GPT models and families.

Proposed method

  • Format the same task contexts into four prompt templates: Plain text, Markdown, YAML, JSON.
  • Evaluate GPT-3.5-turbo-0613, GPT-3.5-turbo-16k-0613, GPT-4-1106-preview, and GPT-4-32k-0613 via Azure OpenAI.
  • Use NL2NL, NL2Code, and Code2Code benchmarks (MMLU, NER Finance, HumanEval, FIND, CODEXGLUE, HumanEval-X).
  • Compute sensitivity via max/min performance across templates and one-sided matched-pairs t-tests (p-values reported).
  • Measure consistency across prompts using the Shu et al. (2023) consistency metric (C).
  • Assess transferability between models using Intersection-over-Union (IoU) of top-prompts.
Figure 1: An example to demonstrate how prompt formatting impacts GPT-35-turbo-16k-0613 model’s performance based on our experiments on multiple choice questions related to international law from the MMLU benchmark ( Hendrycks et al. ( 2020 ) ). Texts inside " $<>$ " are replaced by actual contexts.
Figure 1: An example to demonstrate how prompt formatting impacts GPT-35-turbo-16k-0613 model’s performance based on our experiments on multiple choice questions related to international law from the MMLU benchmark ( Hendrycks et al. ( 2020 ) ). Texts inside " $<>$ " are replaced by actual contexts.

Experimental results

Research questions

  • RQ1How much does prompt format influence GPT model performance across tasks?
  • RQ2Are GPT models able to produce consistent outputs when prompted with different formats?
  • RQ3Is there a universally optimal prompt format across GPT models, or is format effect highly model-specific?
  • RQ4How does model size (GPT-3.5 vs GPT-4) impact sensitivity and consistency to prompt formatting?
  • RQ5To what extent do top-format templates transfer between models or model families?

Key findings

  • Prompt format sensitivity is statistically significant across models and tasks (p-values < 0.01 in most cases).
  • GPT-3.5-turbo variants show large performance differences depending on format (examples include up to 200% improvement when changing from Markdown to plain text in FIND; similar large swings in MMLU and HumanEval).
  • GPT-4 models exhibit greater robustness to prompt-format changes than GPT-3.5, with higher consistency across formats (consistency scores often > 0.5 on MMLU).
  • There is no single universally superior prompt format; format preferences vary by model (e.g., GPT-3.5-turbo favors JSON, GPT-4 favors Markdown).
  • Top-format templates are not highly transferable across different GPT model families (IoU often < 0.2 across families, though higher within the same model variant).
  • Larger models (GPT-4) tend to produce more consistent outputs across different prompts than smaller models (GPT-3.5).
(a) GPT-35-Turbo-0613
(a) GPT-35-Turbo-0613

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.