Quant Memo
Core

Document Parsing Pipelines for Financial Corpora

The unglamorous first stage of any LLM-over-filings system — turning a PDF or HTML filing full of tables, footnotes, and page headers into clean, structured text a model can actually use.

Prerequisites: Chunking Strategies for Long Filings

A 10-K as filed with the SEC is not a clean block of text — it's an HTML or PDF document with running headers, page numbers, footnotes, multi-column tables, and financial statements laid out for a human reader's eye, not a model's tokenizer. Before any embedding, chunking, or question-answering can happen, that raw document has to be turned into structured, machine-readable text. Skip this step or do it carelessly, and every downstream component — retrieval, summarization, feature extraction — inherits the mess: a table of quarterly revenue read as a jumble of numbers with no column labels is worse than useless, because it looks like real data while being silently wrong.

What a parsing pipeline actually does

A typical pipeline runs several stages in sequence. First, layout extraction separates the document into its structural elements — paragraphs, headers, tables, footnotes — usually using a PDF layout model or the semantic tags already present in SEC HTML/XBRL filings. Second, noise removal strips running headers, page numbers, and boilerplate legal disclaimers that repeat on every page and add nothing but clutter to a chunk. Third, table reconstruction turns a visually laid-out grid of numbers back into a row-and-column structure (or a small markdown table) rather than leaving it as space-separated text where "1,234" and "567" might have come from different columns entirely. Finally, section tagging labels each remaining block with its filing section (Item 1, Item 7, Item 8, etc.) so later stages — like chunking — can use that structure as natural cut points.

Worked example: parsing one page of a 10-K

Say a raw PDF page contains, in reading order as extracted by a naive text-only tool: a repeated header "ACME CORP 10-K 2024", a paragraph of risk-factor prose, a revenue table with three columns (segment, this year, last year) that a naive extractor flattens into one line of numbers, and a footnote in 6-point font referencing an accounting policy. A parsing pipeline processes this as: drop the repeated header (seen on every page, adds no information); keep the risk-factor paragraph as a clean text block tagged "Item 1A"; reconstruct the table as | Segment | 2024 | 2023 | rows rather than a run of numbers with no labels, so a later query like "what was segment B's revenue in 2023" can actually be answered; and either keep the footnote attached to its table (since footnotes often qualify the exact numbers above them) or tag it separately so it isn't silently dropped. Get the table step wrong and a downstream system might report last year's number as this year's — a parsing bug that looks like a data bug three stages later.

Raw PDF/HTML Layout extraction Noise removal Table reconstruction Section tagging
Each stage fixes a specific kind of mess — raw text alone conflates all of these and passes the errors downstream.

What this means in practice

Every point-in-time NLP or LLM system over financial filings — sentiment scoring, structured extraction, RAG — sits on top of a parsing pipeline like this one, and its quality is usually the single biggest determinant of whether the fancier model on top works well. Tables are the most common failure point: a model that reads text beautifully but garbles a balance sheet table will produce confident, plausible-sounding, and wrong numeric answers, which is far more dangerous than an obvious parsing failure that at least looks broken.

Parsing turns a visually formatted filing into structured, machine-readable text — separating real content from repeated boilerplate and reconstructing tables into rows and columns. Every later NLP or LLM stage inherits whatever this stage gets wrong, and numeric table errors are the most dangerous kind because they look correct.

Related concepts

Practice in interviews

Further reading

  • Loughran and McDonald, Textual Analysis in Accounting and Finance: A Survey
ShareTwitterLinkedIn