Unstructured data formats account for over 80% of the data currently stored, and extracting value from such formats remains a considerable challenge. In particular, current approaches for managing unstructured documents do not support ad-hoc analytical queries on document collections. Moreover, Large Language Models (LLMs) directly applied to the documents themselves, or on portions of documents through a process of Retrieval-Augmented Generation (RAG), fail to provide high accuracy query results, and in the LLM-only case, additionally incur high costs. Since many unstructured documents in a collection often follow similar templates that impart a common semantic structure, we introduce ZenDB, a document analytics system that leverages this semantic structure, coupled with LLMs, to answer ad-hoc SQL queries on document collections. ZenDB efficiently extracts semantic hierarchical structures from such templatized documents, and introduces a novel query engine that leverages these structures for accurate and cost-effective query execution. Users can impose a schema on their documents, and query it, all via SQL. Extensive experiments on three real-world document collections demonstrate ZenDB's benefits, achieving up to 30% cost savings compared to LLM-based baselines, while maintaining or improving accuracy, and surpassing RAG-based baselines by up to 61% in precision and 80% in recall, at a marginally higher cost.
翻译:非结构化数据格式占当前存储数据的80%以上,从这类格式中提取价值仍是一项重大挑战。特别是,当前管理非结构化文档的方法不支持对文档集合进行即席分析查询。此外,直接对文档本身应用大语言模型(LLM),或通过检索增强生成(RAG)流程对文档片段应用LLM,均无法提供高精度的查询结果,且在仅使用LLM的情况下还会产生高昂成本。鉴于文档集合中的许多非结构化文档通常遵循相似的模板,从而赋予其共同的语义结构,我们提出了ZenDB——一种利用这种语义结构并结合LLM来回答文档集合上的即席SQL查询的文档分析系统。ZenDB能够高效地从这些模板化文档中提取语义层级结构,并引入一种新颖的查询引擎,利用该结构实现精确且经济高效的查询执行。用户可以通过SQL为文档定义模式并进行查询。在三个真实世界文档集合上的大量实验表明,ZenDB具有显著优势:与基于LLM的基线方法相比,可节省高达30%的成本,同时保持或提升精度;并在精度上以微小成本优势超越基于RAG的基线方法达61%,在召回率上达80%。