ChatPaper.aiChatPaper

HtmlRAG: HTML é Melhor do que Texto Simples para Modelar Conhecimento Recuperado em Sistemas RAG

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

November 5, 2024
Autores: Jiejun Tan, Zhicheng Dou, Wen Wang, Mang Wang, Weipeng Chen, Ji-Rong Wen
cs.AI

Resumo

A Geração com Recuperação Aprimorada (RAG) tem demonstrado melhorar as capacidades de conhecimento e aliviar o problema de alucinação dos LLMs. A Web é uma fonte importante de conhecimento externo usada em sistemas RAG, e muitos sistemas comerciais como ChatGPT e Perplexity têm utilizado mecanismos de busca na Web como seus principais sistemas de recuperação. Tipicamente, tais sistemas RAG recuperam resultados de busca, baixam fontes HTML dos resultados e então extraem textos simples das fontes HTML. Documentos ou trechos de texto simples são alimentados nos LLMs para aumentar a geração. No entanto, grande parte da informação estrutural e semântica inerente ao HTML, como títulos e estruturas de tabelas, é perdida durante esse processo RAG baseado em texto simples. Para aliviar esse problema, propomos o HtmlRAG, que utiliza HTML em vez de texto simples como formato de conhecimento recuperado em RAG. Acreditamos que o HTML é melhor que o texto simples para modelar conhecimento em documentos externos, e a maioria dos LLMs possui capacidades robustas para entender HTML. No entanto, utilizar HTML apresenta novos desafios. O HTML contém conteúdo adicional como tags, JavaScript e especificações CSS, que trazem tokens de entrada adicionais e ruído ao sistema RAG. Para abordar essa questão, propomos estratégias de limpeza, compressão e poda de HTML, para encurtar o HTML minimizando a perda de informação. Especificamente, projetamos um método de poda baseado em árvore de blocos em dois passos que poda blocos HTML inúteis e mantém apenas a parte relevante do HTML. Experimentos em seis conjuntos de dados de perguntas e respostas confirmam a superioridade do uso de HTML em sistemas RAG.
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 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.

Summary

AI-Generated Summary

PDF7122November 13, 2024