Skip to content
The Chat Archive
gpt-4o-search-preview-high-loc· OpenAI LMArena Search Arena 24K

what is the best text format for entering documents into LLM? markdown, rst, or…

  1. User

    what is the best text format for entering documents into LLM? markdown, rst, or something else?

  2. Assistant

    When preparing documents for input into Large Language Models (LLMs), the choice of text format can significantly influence the model's performance. Recent research has explored how different formats affect LLM outputs:

    • Prompt Formatting Impact: A study titled "Does Prompt Formatting Have Any Impact on LLM Performance?" examined the effects of various prompt templates, including plain text, Markdown, JSON, and YAML, on tasks like natural language reasoning, code generation, and translation. The findings revealed that models like GPT-3.5-turbo exhibited performance variations of up to 40% in code translation tasks depending on the prompt format, whereas larger models like GPT-4 demonstrated greater robustness to these variations[1].

    • HTML in Retrieval-Augmented Generation (RAG): Another study, "HtmlRAG: HTML is Better Than Plain Text for Modeling Retrieved Knowledge in RAG Systems," investigated the use of HTML over plain text in RAG systems. The research found that incorporating HTML, with its inherent structural and semantic information, improved the modeling of retrieved knowledge. However, the study also noted challenges such as additional content like tags and scripts, which necessitate cleaning and compression strategies to minimize noise and token overhead[2].

    Based on these insights, the optimal text format for LLM input depends on the specific application and the model in use. For tasks where structural information is crucial, formats like HTML may offer advantages, provided that extraneous content is effectively managed. For other applications, plain text or Markdown might suffice, especially if the model demonstrates robustness to formatting variations. It's advisable to experiment with different formats to determine which yields the best performance for your particular use case.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.

Identical first prompt