Brifing

Loop Engineering with Adaptive Parsing: Table and Figure Analysis with Azure and Vision LLM

Efficient and accurate parsing strategies in document intelligence systems.

Towards Data Science2 min

1Introduction

Adaptive parsing aims to balance cost and accuracy in document intelligence systems. Lightweight parsers like PyMuPDF are fast but may miss complex structures. This article demonstrates this balance through two real-world cases.

2The Root Problem

Classic OCR systems can silently ignore table structures, leading models to work with incorrect data and produce seemingly reliable wrong answers. Deterministic checks catch some errors but complex ones may slip through.

3Solution Approach

Starting with the lightest parser and escalating to stronger parsers based on pipeline's internal checks. This strategy reduces costs while improving accuracy. Checks are performed on parse output, question, and LLM's footprints.

4Check Cascade

Pre-parse metadata, parse-time outputs, retrieval scoring, and generation checks form a cascade. Each check is cheaper and more reliable than the next, questioning whether the parser produced enough to answer.

5Generation Checks

Two critical checks at generation: LLM's self-evaluation (check 7) and a separate LLM or NLI groundedness check (check 8). Check 7 can be expensive and unstable, requiring careful use.

6Case A: Flat Table Analysis

A query about the 'h' value in Table 3 of the Attention paper reveals PyMuPDF's flat parse miss. Escalating to Azure Layout retrieves the correct answer, showcasing checks 2 and 7 in action.

7Case B: Figure Analysis

Figure 1 on page 3 of the same paper, missed by PyMuPDF, is correctly analyzed by a vision LLM. This highlights adaptive parsing's importance in complex documents.

8LLM Signal Limits

The LLM's self-evaluation signal alone isn't sufficient. Section 4's stress test questions its reliability, emphasizing the need for supporting checks.

9Check 8: Groundedness Check

Check 8 verifies answer-context alignment using a separate LLM or NLI. It's the final defense line at generation, detailed in section 5.

10Real-World Applications

Examples from the Attention paper reflect common scenarios in enterprise documents. Adaptive parsing reduces costs and improves accuracy in such cases.

11Conclusion

Adaptive parsing optimizes document intelligence systems. Starting light and escalating based on checks lowers resource use and error rates, making it indispensable for complex documents.

Original article: Towards Data Science — Adaptif Parsing ile Döngü Mühendisliği: Azure ve Vision LLM ile Tablo ve Şekil Analizi