title: HtmlRAG: HTML is Better Than Plain Text for Modeling Retrieved Knowledge
    in RAG Systems
summary: Retrieval-Augmented Generation (RAG) has been shown to improve knowledge
  capabilities and alleviate the hallucination problem of LLMs. The Web is a
  major source of external knowledge used in RAG systems, and many commercial
  systems such as ChatGPT and Perplexity have used Web search engines as their
  major retrieval systems. Typically, such RAG systems retrieve search results,
  download HTML sources of the results, and then extract plain texts from the
  HTML sources. Plain text documents or chunks are fed into the LLMs to augment
  the generation. However, much of the structural and semantic information
  inherent in HTML, such as headings and table structures, is lost during this
  plain-text-based RAG process. To alleviate this problem, we propose HtmlRAG,
  which uses HTML instead of plain text as the format of retrieved knowledge in
  RAG. We believe HTML is better than plain text in modeling knowledge in
  external documents, and most LLMs possess robust capacities to understand HTML.
  However, utilizing HTML presents new challenges. HTML contains additional
  content such as tags, JavaScript, and CSS specifications, which bring extra
  input tokens and noise to the RAG system. To address this issue, we propose
  HTML cleaning, compression, and pruning strategies, to shorten the HTML while
  minimizing the loss of information. Specifically, we design a two-step
  block-tree-based pruning method that prunes useless HTML blocks and keeps only
  the relevant part of the HTML. Experiments on six QA datasets confirm the
  superiority of using HTML in RAG systems.
paper_authors._id: 672ad53b6f6797b288015187
paper_authors.name: Jiejun Tan
paper_authors.status: claimed_verified
paper_authors.statusLastChangedAt: 2024-11-15T09:37:15.301Z
paper_authors._id: 62e52483a944e2a56cd2c6ca
paper_authors.avatarUrl: https://cdn-avatars.huggingface.co/v1/production/uploads/62e52483a944e2a56cd2c6ca/pG44O-1qD00q5CEJMMyFQ.jpeg
paper_authors.fullname: Jiejun Tan
paper_authors.type: user
paper_authors.user: zstanjj
paper_authors._id: 672ad53b6f6797b288015188
paper_authors.name: Zhicheng Dou
paper_authors._id: 672ad53b6f6797b288015189
paper_authors.name: Wen Wang
paper_authors._id: 672ad53b6f6797b28801518a
paper_authors.name: Mang Wang
paper_authors._id: 672ad53b6f6797b28801518b
paper_authors.name: Weipeng Chen
paper_authors._id: 672ad53b6f6797b28801518c
paper_authors.name: Ji-Rong Wen
paper_title: HtmlRAG: HTML is Better Than Plain Text for Modeling Retrieved Knowledge
    in RAG Systems
paper_summary: Retrieval-Augmented Generation (RAG) has been shown to improve knowledge
  capabilities and alleviate the hallucination problem of LLMs. The Web is a
  major source of external knowledge used in RAG systems, and many commercial
  systems such as ChatGPT and Perplexity have used Web search engines as their
  major retrieval systems. Typically, such RAG systems retrieve search results,
  download HTML sources of the results, and then extract plain texts from the
  HTML sources. Plain text documents or chunks are fed into the LLMs to augment
  the generation. However, much of the structural and semantic information
  inherent in HTML, such as headings and table structures, is lost during this
  plain-text-based RAG process. To alleviate this problem, we propose HtmlRAG,
  which uses HTML instead of plain text as the format of retrieved knowledge in
  RAG. We believe HTML is better than plain text in modeling knowledge in
  external documents, and most LLMs possess robust capacities to understand HTML.
  However, utilizing HTML presents new challenges. HTML contains additional
  content such as tags, JavaScript, and CSS specifications, which bring extra
  input tokens and noise to the RAG system. To address this issue, we propose
  HTML cleaning, compression, and pruning strategies, to shorten the HTML while
  minimizing the loss of information. Specifically, we design a two-step
  block-tree-based pruning method that prunes useless HTML blocks and keeps only
  the relevant part of the HTML. Experiments on six QA datasets confirm the
  superiority of using HTML in RAG systems.
paper_ai_summary: HtmlRAG enhances Retrieval-Augmented Generation (RAG) systems by using HTML instead of plain text, improving knowledge modeling and reducing information loss through HTML cleaning, compression, and pruning.
paper_ai_keywords: Retrieval-Augmented Generation RAG Web search engines LLMs HTML plain text headings table structures HtmlRAG HTML cleaning compression pruning block-tree-based pruning QA datasets