用智能体自动优化复杂文档处理,准确率提升25%~80%
DocETL: Agentic Query Rewriting and Evaluation for Complex Document Processing
- 通过智能体重写任务指令,分解复杂文档分析为可执行步骤
- 在4个真实任务中,输出准确率比基线高25%至80%
- 适合法律、金融等需高精度处理长文本的场景
分析非结构化数据一直是数据处理中的长期挑战。大语言模型(LLMs)在此领域展现出潜力,催生了基于声明式框架的LLM驱动数据处理方案。然而,这些框架主要关注降低执行成本,而非提升准确性,通常将用户定义的操作直接以单次LLM调用执行,难以应对复杂任务和数据。例如,在长篇法律文件中,LLM可能无法识别所有特定条款(如不可抗力或赔偿条款),需对数据或任务进行分解。为此,我们提出DocETL系统,优化复杂文档处理流水线,同时考虑LLM的局限性。DocETL提供声明式接口供用户定义流水线,并采用基于智能体的方法自动优化,引入新型代理重写指令(rewrite directives),以及优化与评估框架。我们提出:(i) 针对基于LLM的任务设计逻辑重写方法;(ii) 智能体引导的计划评估机制,合成并协调任务特异性验证提示;(iii) 考虑代理生成与评估延迟的高效优化算法。在四个不同非结构化文档分析任务上的评估表明,DocETL找到的方案输出准确率比精心设计的基线高出25%至80%,填补了非结构化数据分析中的关键空白。DocETL已在docetl.org开源,截至2025年3月,GitHub星标数已超1.7k,用户覆盖多个领域。
原文摘要 · Abstract (English)
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.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。