Docling vs. multimodal LLMs: invoice extraction tutorial

Build switchable invoice extraction with Docling and a vision model, including PDF page conversion, LangGraph workflow nodes and JSON parsing.

Player not loading? Watch on YouTube

This tutorial extends an invoice extraction app with two processing modes. The Docling route converts a document to Markdown before an LLM extracts invoice fields. The multimodal route sends images directly to the model. For PDFs, the app converts each page to an image and builds a prompt that asks the model to process every page.

The implementation covers a cached Docling converter, temporary file cleanup, shared extraction state and a LangGraph workflow. Its load-document node either extracts text or leaves that step empty for the vision route. The extraction node invokes the model with temperature zero and JSON output, then parses the response into extracted fields. The Streamlit interface provides upload controls, document previews and expandable results, including the Markdown used in Docling mode.

The speaker favors direct multimodal extraction after the examples shown, particularly for complicated layouts. These demonstrations do not establish a general accuracy ranking. In the later two-page test, the speaker notices inconsistent item counts but does not check every entry. Combining Docling text with document images remains an untested suggestion. A future installment would add user-defined fields for documents beyond invoices; that feature is a plan, rather than part of this implementation.