Document Data Processing


Document Data Processing

Anna
Welcome! Today we’re exploring two ideas that come together in a powerful way: document intelligence and AI agents. Let’s begin with a simple point that’s easy to overlook: writing is a technology.

Hope
Right. From cave paintings and hieroglyphics to cuneiform, Gutenberg’s movable type, photocopies, and digital documents like PDFs, people have used written records to preserve important information. We may not think of an alphabet or a document as technology, but writing has transformed how people store and share knowledge.

Anna
And it matters especially now, because we live in a data-driven world. Developers want technology to support decision-making, but much of the information that could help is stored in documents—and documents are unstructured data.

Hope
So the challenge is to turn raw documents into structured, usable data. That doesn’t mean documents are simple containers of plain text. They can combine titles, short and long passages, paragraphs, punctuation, numbers, dates, and tables.

Anna
And the complexity can scale up quickly. A document might be hundreds of pages long, or include tables that continue across page breaks. Some tables may have thousands of rows, and a single file might even contain several combined documents.

Hope
That’s why simply recognizing the words isn’t enough. Optical character recognition, or OCR, uses computer vision to identify characters and words in an image and convert them into text. Some OCR tools can also recognize tables, but page breaks and complex layouts can cause trouble.

Anna
And even when OCR successfully produces text, it hasn’t necessarily understood what that text means or how the pieces relate. It may have turned the document into a lot of text without preserving its semantic structure.

Hope
There’s another important complication: documents rarely stand alone. Their meaning often depends on how they relate to other documents. We can think about those relationships as hierarchies—both vertical and horizontal.

Anna
Let’s make that concrete with a legal and financial example. A master service agreement might sit above a statement of work. That statement of work could be amended, followed by another statement of work and another amendment. A statement of work might also lead to a purchase order, which could eventually be associated with an invoice.

Hope
That’s a vertical relationship: understanding the whole requires looking across a connected set of documents. A purchase order or invoice may make more sense when we know which agreement and statement of work it belongs to.

Anna
Horizontal relationships connect different document types or stages of work. In research, an original paper might be cited by a later research result, and that result might be cited by a third paper. The chain can extend into a patent filing and eventually product documentation.

Hope
So the documents show not only the development of ideas, but also how research can connect to patents and products. Another example comes from shipping: a bill of lading, a certificate of insurance, a receipt from the recipient, and possibly a claim if the goods arrived damaged.

Anna
To understand that claim, we may need to connect it to the shipment and the insurance document. And to understand the shipment itself, we may need to connect the relevant shipping records and communications. The key point is that a collection of documents can form a meaningful whole.

Hope
So far, we’ve framed document processing as a data problem: documents contain language and other data types, and their meaning can depend on relationships across files. The big newer tool in this story is the family of GPT models.

Anna
GPT stands for generative pre-trained transformer. These models build on neural-network techniques and use transformers to process language. A useful starting idea is that the model takes inputs and produces likely outputs.

Hope
Those language inputs are handled as tokens. The process includes embedding, which turns vocabulary into mathematical representations. Transformers then work with those representations in a much richer, higher-dimensional space than a simple one-dimensional view of distance between words.

Anna
The material also describes attention and normalization as ways of handling groupings and organizing representations, moving from vectors to larger matrices and smaller groups of matrices. The details involve substantial mathematics, but the big idea is that the model processes relationships among pieces of language.

Hope
Then softmax helps assign probabilities to possible outputs. In plain terms, the model uses computations over the input tokens to help determine which output tokens are most likely. The model generates an output based on those probabilities.

Anna
And there are also ways to influence the form or style of an answer—for example, asking for a particular voice. Once the model has worked through the representations and selected output tokens, those tokens can be projected back into vocabulary we can read.

Hope
The source also emphasizes the scale of the language-model problem: language has a large, mostly finite vocabulary, while numbers can take many possible forms. It describes open-source language models as involving hundreds of billions of parameters, illustrating just how large these systems can be.

Anna
Now let’s connect that technology back to documents. Suppose we have a document with a thousand words, but our data model needs only twenty or fifty key facts. It might seem like the job is simply to shrink the document down to those facts.

Hope
But the processing path often expands the information before it contracts it. OCR can produce far more data than the original visual representation; natural language processing adds further analysis, and an LLM works with additional representations. Eventually, extraction brings the result back to the smaller set of fields we care about.

Anna
That distinction matters. The goal isn’t just to throw away everything except a few sentences. We use several stages to interpret the document and its contents, then map what we’ve learned into a structured data model.

Hope
And that’s where agents enter the picture. An agent can be assigned a particular task in the overall workflow. For example, an inspection agent could examine file properties such as checksums, word spacing, length, size, and the kinds of content inside.

Anna
An OCR agent could use a selected OCR engine to convert image data into text, alphanumeric data, and tables. Some people are also exploring whether multimodal language models can take on some OCR work.

Hope
A vectorization agent could break the document into chunks or token groupings and work with a chosen LLM to create vector representations. A splitter agent could examine what has been processed and decide where a file should be divided into separate documents—especially if several documents were combined before processing.

Anna
Then an extraction agent can map the processed information to the important fields in the data model. It may rely on prompts, including automated prompts, that are designed around the specific data points we want to capture.

Hope
And a matching agent can use the available metadata to connect documents. That’s how the workflow can help identify those vertical relationships—like agreements, work orders, and invoices—and horizontal relationships—like research results, patents, or shipping records.

Anna
A traditional workflow is often sequential and deterministic: one stage’s output becomes the next stage’s input, then that output moves down the line. Agentic workflows can still involve stages, but they offer a different way to organize the work.

Hope
For instance, agents might be triggered by an event, such as new data arriving in an area where they’re allowed to operate. They may also inspect each other’s work and carry out their own specialized tasks, rather than relying only on one fixed sequence.

Anna
That possibility brings greater autonomy, which may support efficiency in computing resources and scalability. But it also means entering a more non-deterministic space: the behavior may not be as fixed as in a traditional workflow, and that can open up possibilities we haven’t yet considered.

Hope
So the full picture is: documents are valuable but unstructured; OCR can make their contents readable without fully understanding their meaning; language models can help process language; and specialized agents can inspect, split, vectorize, extract, and connect documents.

Anna
And the final aim is not just to process one file in isolation. It’s to turn complicated document collections into structured data and meaningful relationships that can support decision-making. That’s the promise of bringing document intelligence and AI agents together.

Ask anything
We've read this whole study set, so questions about it get the best answers.