arXiv:2411.02959cs.IR2024-11中稿 · WWW 2025 main conf…被引 56

用HTML替代纯文本提升RAG系统知识建模能力

HtmlRAG: HTML is Better Than Plain Text for Modeling Retrieved Knowledge in RAG Systems

  • 直接使用原始HTML而非提取的纯文本作为知识输入
  • 在6个问答数据集上准确率提升,最高达4.2%绝对增益
  • 适合关注网页知识融合与检索增强生成的开发者

检索增强生成(RAG)能提升大模型的知识能力并缓解幻觉问题。网络是当前RAG系统的主要外部知识来源,多数商业系统通过网络搜索获取结果,并下载其HTML页面后提取纯文本用于后续生成。然而这一过程会丢失大量HTML中的结构化和语义信息,如标题层级、表格结构等。为此,我们提出HtmlRAG,主张在RAG中使用原始HTML而非纯文本来建模外部知识。我们认为大多数大模型已具备理解HTML的能力,但直接使用HTML会引入标签、脚本和样式等额外内容,增加输入长度与噪声。为此,我们设计了HTML清洗、压缩及两步式基于块-树结构的剪枝策略,在显著缩短输入的同时最小化信息损失。在六个问答数据集上的实验验证了使用HTML的优越性。

原文摘要 · Abstract (English)

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 RAG systems 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 a two-step block-tree-based pruning strategy, to shorten the HTML while minimizing the loss of information. Experiments on six QA datasets confirm the superiority of using HTML in RAG systems.

RAG知识增强网页理解

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。