ChatPaper.aiChatPaper

HtmlRAG: HTML es Mejor que Texto Plano para Modelar el Conocimiento Recuperado en 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

Resumen

Se ha demostrado que la Generación con Recuperación Aumentada (RAG) mejora las capacidades de conocimiento y alivia el problema de la alucinación de los LLMs. La Web es una fuente principal de conocimiento externo utilizada en los sistemas RAG, y muchos sistemas comerciales como ChatGPT y Perplexity han utilizado motores de búsqueda web como sus principales sistemas de recuperación. Típicamente, estos sistemas RAG recuperan resultados de búsqueda, descargan fuentes HTML de los resultados y luego extraen textos simples de las fuentes HTML. Documentos o fragmentos de texto simples se introducen en los LLMs para aumentar la generación. Sin embargo, gran parte de la información estructural y semántica inherente en HTML, como encabezados y estructuras de tablas, se pierde durante este proceso RAG basado en texto simple. Para aliviar este problema, proponemos HtmlRAG, que utiliza HTML en lugar de texto simple como formato de conocimiento recuperado en RAG. Creemos que HTML es mejor que el texto simple para modelar conocimiento en documentos externos, y la mayoría de los LLMs poseen capacidades sólidas para entender HTML. Sin embargo, utilizar HTML presenta nuevos desafíos. HTML contiene contenido adicional como etiquetas, JavaScript y especificaciones CSS, que aportan tokens de entrada adicionales y ruido al sistema RAG. Para abordar este problema, proponemos estrategias de limpieza, compresión y poda de HTML, para acortar el HTML minimizando la pérdida de información. Específicamente, diseñamos un método de poda basado en árboles de bloques de dos pasos que elimina bloques HTML inútiles y conserva solo la parte relevante del HTML. Experimentos en seis conjuntos de datos de preguntas y respuestas confirman la superioridad de usar HTML en 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.
PDF7123November 13, 2024