Many templatized documents are programmatically generated from structured data following a visual template. Such documents include invoices, tax documents, financial reports, and purchase orders. Effective data extraction from these documents is crucial to support downstream analytical tasks. Current data extraction tools often struggle with complex document layouts, incur high latency and/or cost on large datasets, and require significant human effort. The key insight of our tool, TWIX, is to infer the underlying template used to create such documents, and then extract the data, rather than extracting directly from documents. To do so, TWIX first infers the underlying fields, such as columns of tabular portions or keys in co-located key-value pairs, by leveraging their consistent location patterns (e.g., two fields in the same template repeatedly co-occur within a fixed distance apart across multiple records). TWIX then assembles these fields into a template by enforcing visual constraints, such as vertically aligning table rows with their column headers for tabular regions, and horizontally aligning keys with their values for key-value pairs. TWIX then uses this inferred template to accurately and efficiently extract data from templatized documents at a low cost. On one benchmark with 34 diverse real-world datasets, TWIX outperforms state-of-the-art structured data extraction tools (Evaporate, Textract, and Azure Document Intelligence), and vision-based LLMs like GPT-4-Vision, by over 25% in precision and recall. Another benchmark with 30 large datasets demonstrates TWIX's scalability: it is 520X faster and 3,786X cheaper than the most competitive compared tool, for extracting data from large document collections with over 2000 pages.
翻译:许多模板化文档是根据结构化数据通过视觉模板程序化生成的。这类文档包括发票、税务文件、财务报表和采购订单。从这些文档中高效抽取数据对于支撑下游分析任务至关重要。当前的数据抽取工具在处理复杂文档布局时往往存在困难,在大规模数据集上会产生高延迟和/或高成本,且需要大量人工干预。我们的工具TWIX的核心思想在于:通过推理生成文档的底层模板来抽取数据,而非直接从文档中进行抽取。具体而言,TWIX首先利用字段间存在的一致位置模式(例如同一模板中的两个字段在多个记录中持续以固定距离共现)来推断底层字段,如表格部分的列或并列键值对中的键。随后,TWIX通过施加视觉约束将这些字段组装成模板——对表格区域垂直对齐表格行与列标题,对键值对水平对齐键与值。TWIX利用该推断出的模板,能够以低成本、高精度高效地从模板化文档中抽取数据。在包含34个多样化真实世界数据集的基准测试中,TWIX的精确率和召回率均比现有最先进的结构化数据抽取工具(Evaporate、Textract和Azure Document Intelligence)以及基于视觉的大语言模型(如GPT-4-Vision)高出25%以上。另一项包含30个大型数据集的基准测试证明了TWIX的可扩展性:在从超过2000页的大规模文档集合中抽取数据时,其速度是最具竞争力对比工具的520倍,成本仅为其1/3786。