Skip to main content
QUICK REVIEW

[论文解读] DocETL: Agentic Query Rewriting and Evaluation for Complex Document Processing

Shreya Shankar, Chambers, Tristan|arXiv (Cornell University)|Oct 16, 2024
Semantic Web and Ontologies被引用 4
一句话总结

DocETL 是一种声明式系统,通过基于代理的查询重写与评估,提升大型语言模型(LLMs)驱动的复杂文档处理流水线的准确性。通过应用新颖的重写指令、代理引导的计划评估以及优化算法,DocETL 在非结构化文档任务上的输出质量比手工设计的基线高出 1.34 倍至 4.6 倍。

ABSTRACT

Analyzing unstructured data has been a persistent challenge in data processing. Large Language Models (LLMs) have shown promise in this regard, leading to recent proposals for declarative frameworks for LLM-powered processing of unstructured data. However, these frameworks focus on reducing cost when executing user-specified operations using LLMs, rather than improving accuracy, executing most operations as-is (in a single LLM call). This is problematic for complex tasks and data, where LLM outputs for user-defined operations are often inaccurate, even with optimized prompts. For example, an LLM may struggle to identify {\em all} instances of specific clauses, like force majeure or indemnification, in lengthy legal documents, requiring decomposition of the data, the task, or both. We present DocETL, a system that optimizes complex document processing pipelines, while accounting for LLM shortcomings. DocETL offers a declarative interface for users to define such pipelines and uses an agent-based approach to automatically optimize them, leveraging novel agent-based rewrites (that we call rewrite directives), as well as an optimization and evaluation framework. We introduce (i) logical rewriting of pipelines, tailored for LLM-based tasks, (ii) an agent-guided plan evaluation mechanism that synthesizes and orchestrates task-specific validation prompts, and (iii) an optimization algorithm that efficiently finds promising plans, considering the latencies of agent-based plan generation and evaluation. Our evaluation on four different unstructured document analysis tasks demonstrates that DocETL finds plans with outputs that are 25 to 80% more accurate than well-engineered baselines, addressing a critical gap in unstructured data analysis. DocETL is open-source at docetl.org, and as of March 2025, has amassed over 1.7k GitHub Stars, with users spanning a variety of domains.

研究动机与目标

  • 解决现有基于 LLM 的声明式框架在复杂文档处理中优先考虑成本降低而非准确性的关键缺陷。
  • 通过将单体操作分解为更准确、模块化的流水线,克服 LLM 在处理长篇复杂文档时的局限性,如遗漏条款或生成幻觉内容。
  • 开发一种系统,通过 LLM 代理自主优化文档处理流水线,而非依赖静态、用户提供的提示。
  • 实现对异构、长篇文档(如法律或警方记录)中信息的高质量、全面提取与摘要,其中准确性至关重要。
  • 提供一种灵活、开源的框架,支持模板化文档之外的多样化非结构化数据工作负载,扩展基于 LLM 的 ETL 流水线的适用范围。

提出的方法

  • 引入新颖的重写指令,将复杂且易出错的 LLM 操作逻辑分解为更简单、更准确的子操作,专为文档处理而优化。
  • 采用基于代理的框架,合成并评估特定任务的验证提示,以评估重写后流水线计划的质量。
  • 使用优化算法,在时间约束下探索有希望的流水线计划,利用生成过程中的机会性重写。
  • 应用验证代理判断流水线计划是否已充分优化,若需要则触发进一步重写。
  • 支持基于声明式 YAML 的接口,供用户指定文档处理流水线,抽象低层实现细节。
  • 协调一个反馈回路,使新合成的操作立即进入进一步重写与评估,实现迭代优化。
Figure 1. Optimization for a pipeline designed to accomplish the task in Example 1.1 . The diagram illustrates the system mid-optimization of the initial map operation. DocETL employs LLMs to synthesize new plans using novel rewrite directives. The process begins with an LLM verifier determining if
Figure 1. Optimization for a pipeline designed to accomplish the task in Example 1.1 . The diagram illustrates the system mid-optimization of the initial map operation. DocETL employs LLMs to synthesize new plans using novel rewrite directives. The process begins with an LLM verifier determining if

实验结果

研究问题

  • RQ1如何系统性地重写基于 LLM 的文档处理流水线,以提升在复杂、长篇文档上的准确性?
  • RQ2哪些类型的逻辑重写指令在将单体 LLM 操作分解为准确、模块化组件方面最为有效?
  • RQ3通过使用特定任务验证提示的代理引导计划评估,能否显著提升 LLM 在文档分析任务中的输出质量?
  • RQ4在现实世界文档处理中,一种在计划质量与生成时间之间取得平衡的优化算法,能在多大程度上超越手工设计的基线流水线?
  • RQ5与静态提示工程相比,代理驱动的迭代重写过程在输出全面性与准确性方面表现如何?

主要发现

  • 在三个不同的非结构化文档分析任务中,DocETL 的输出质量(以准确性和全面性衡量)比精心设计的基线高出 1.34 倍至 4.6 倍。
  • 该系统的代理引导计划评估机制成功识别并缓解了长文档中常见的 LLM 失效问题,如遗漏条款或生成幻觉内容。
  • 重写指令有效实现了复杂操作的分解,降低了 LLM 上下文过载的可能性,提升了整体理解能力。
  • 优化算法在实际时间限制内高效探索了计划空间,找到高质量流水线而无需穷举搜索。
  • 该框架在多种领域(包括法律、医疗和社会科学文档分析)中表现出强健性,经由真实世界用例验证。
  • 截至 2024 年 10 月,DocETL 在 GitHub 上已获得超过 800 颗星,表明其在多样化应用领域中获得了广泛采用与实用价值。
Figure 2. Iterative folding in a reduce operation, illustrating the step-by-step evolution of both the scratchpad and accumulated output when processing multiple batches of documents. New input is integrated with the previous scratchpad state, updating mention counts and the intermediate output for
Figure 2. Iterative folding in a reduce operation, illustrating the step-by-step evolution of both the scratchpad and accumulated output when processing multiple batches of documents. New input is integrated with the previous scratchpad state, updating mention counts and the intermediate output for

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。