Parsing Images and Tables for RAG: A Practical Guide to Ingesting Non-Textual Knowledge into LLM Systems

    In retrieval-augmented generation (RAG) systems, tables, flowcharts, charts, and scanned images often lose critical information when documents are reduced to plain text. This article explains how to build a verifiable knowledge pipeline for non-textual content: parsing documents into a unified intermediate representation, preserving table structure while generating semantic expressions, indexing images according to their information type, and connecting retrieval results back to original evidence. It covers ingestion design, index structure, query-time strategies, quality evaluation, and a phased rollout plan for teams building production-grade RAG systems.

    Parsing Images and Tables for RAG: A Practical Guide to Ingesting Non-Textual Knowledge into LLM Systems

    1. The Core Problem: What You’re Ingesting Is Verifiable Knowledge, Not Files

    In a typical RAG (retrieval-augmented generation) pipeline, documents are parsed into text, split into chunks by a set of rules, embedded into vectors, and indexed. This path works reasonably well for continuous natural language. But when it encounters tables, flowcharts, statistical charts, and scanned images, simply extracting text is often not enough to preserve the original information.

    Consider an equipment specification table with multi-level headers, merged cells, and footnotes. If you flatten it into a string of text, the system may retrieve “rated power” without knowing which device the value belongs to, what unit it uses, or under what conditions it applies.

    Images pose similar problems. The knowledge in a flowchart comes not only from the text in its nodes, but also from arrow directions and branch relationships. The meaning of a statistical chart comes not only from its title, but also from its axes, legend, and data trends. Recognizing the characters in an image cannot recover these semantics.

    The goal of non-textual content processing, therefore, is not “convert everything into strings,” but to build three layers of capability:

    1. Content is recognizable: the system knows what text, tables, and images exist on each page.
    2. Relationships are preserved: the system knows the connections between text and figures, as well as the internal structure of tables.
    3. Evidence is traceable: information in answers can be traced back to the source document, page, and region.

    A vector database handles semantic recall — it should not be treated as the sole repository of all document information. Original files, structured data, and vector indexes need to work in a coordinated division of labor.

    2. Start with Document Parsing and a Unified Intermediate Representation

    2.1 Distinguish Native Documents from Scanned Documents

    Native digital documents usually contain extractable text objects. You can read the text and its positions first, then restore the reading order through layout analysis. Scanned documents consist mainly of page images and require optical character recognition (OCR) to extract text.

    Real-world files often contain both types of pages — sometimes even a text layer and scanned regions on the same page. The processing strategy should therefore be chosen per page or per region, rather than applying a single method to the whole file.

    Even pages with a text layer shouldn’t be assumed reliable. Hidden text layers can contain misalignment, duplication, or garbled characters, so it’s worth cross-checking against a rendered version of the page to avoid ingesting the same content twice.

    2.2 Recognize Layout Elements and Reading Order

    During parsing, distinguish headings, body text, headers and footers, lists, tables, images, captions, and footnotes as much as possible, and record their positions and relationships.

    Multi-column layouts deserve special attention for reading order. Naively concatenating blocks by coordinates can interleave the left and right columns, producing broken sentences. Headers and footers that repeat on every page can pollute retrieval — decide whether to remove, deduplicate, or store them separately based on their business value.

    Associating images with captions, and tables with titles, is equally important. References like “as shown in the figure below” or “see Table 3” help retrieval return the body text together with the corresponding figure.

    2.3 The Intermediate Representation Should Serve Both Reading and Computation

    Markdown-style text optimized for reading can be used to build retrieval content, but complex tables cannot rely on this representation alone. A more robust approach is to store all of the following:

    • Text content and heading hierarchy;
    • Element type, page number, and page coordinates;
    • Table row/column structure and cell spans;
    • Original image regions and their descriptions;
    • Association IDs linking figures to body text;
    • Parsing status, version, and confidence information.

    Coordinates here refer to positions in the source document or page image, and they don’t carry infinite precision by default. Only by defining the coordinate system, page dimensions, and scaling relationships can they be used for accurate highlighting and evidence display.

    3. Table Ingestion: Preserve Structure First, Then Generate Semantic Expressions

    3.1 Tables Require More Than Character Recognition

    Table parsing must solve both text recognition and structure recognition. Key tasks include determining row and column boundaries, identifying header hierarchies, reconstructing merged cells, and associating units and notes.

    For borderless tables, row/column structure often depends on text alignment and spacing. For tables spanning multiple pages, you need to combine column structure, continuation markers, and context to decide whether to merge — identical column counts on adjacent pages are not sufficient evidence that they belong to the same table.

    Parsing results should also distinguish between blank cells, zero values, missing values, and “not applicable.” These states are not equivalent in business terms, and incorrect normalization directly affects computation and Q&A accuracy.

    3.2 Generate Multiple Representations for the Same Table

    It’s recommended to store three types of content for each table:

    The structured original table.
    Keep complete cells, header paths, units, notes, and source information, used for precise value lookup, filtering, and computation.

    A table-level summary.
    Describe the table’s subject, the objects it covers, metrics, time range, and statistical criteria, helping the retrieval system judge relevance.

    Row-level or partial semantic fragments.
    Transcribe records into short texts with field names, for example:

    “Device A: rated power is 12 kW, input voltage is 380 V, operating ambient temperature is 0–40 °C.”

    This fragment embeds far better than isolated numbers like “12, 380, 0–40,” because it preserves the mapping between values and fields.

    However, semantic fragments are only a retrieval aid and should not replace the original structure. For questions like “what is the maximum value,” “which records meet the condition,” or “compute the quarterly totals,” you should invoke structured queries or computation logic first, rather than letting the generative model estimate from retrieved fragments.

    3.3 Carry Headers and Context into Every Chunk

    Large tables can be split by row groups, but every chunk should carry the necessary context: table name, headers, units, and relevant footnotes. Multi-level headers should be expanded into full field paths, such as “Operating Metrics / Revenue / Current Period.”

    If a footnote changes the statistical criteria for the entire table, it cannot be kept only in the last chunk. Otherwise, when retrieval hits other parts, the model may answer using the wrong criteria.

    For wide tables, you can organize fields around business topics, but stable record identifiers must be preserved so that chunks don’t lose their connection to each other.

    4. Image Ingestion: Choose the Semantic Approach Based on Question Type

    4.1 First Decide Whether an Image Is Worth Indexing

    Not every image contains useful knowledge. Decorative graphics, repeated logos, and irrelevant backgrounds can be deprioritized; flowcharts, architecture diagrams, equipment photos, UI screenshots, and statistical charts should be handled according to their information type.

    Filtering is not about arbitrarily deleting content — it’s about controlling parsing cost and retrieval noise. For materials subject to audit or compliance requirements, keep the original assets and simply apply different weights at the retrieval layer.

    4.2 Text Extraction and Visual Description Complement Each Other

    For screenshots, labels, and text-dense images, extract the text first. For flowcharts, describe node relationships, directions, and branch conditions. For statistical charts, focus on the title, axes, legend, units, and trends.

    When generating image descriptions, clearly separate “what is directly observed” from “what is inferred.” If an image is blurry and a value cannot be confirmed, record it as uncertain rather than filling in a plausible-looking number.

    Trend descriptions also cannot replace precise data. If a user asks for the exact value at a specific point on a chart, you need reliable data extraction results — or hand the original image to a model with visual understanding capabilities for further verification.

    4.3 Text Index vs. Multimodal Index

    There are typically three paths for getting image information into a RAG system:

    • Text-semantic indexing: compute text embeddings from the image’s text, captions, and descriptions. Suitable for knowledge Q&A that is primarily asked in text form.
    • Cross-modal retrieval indexing: use encoders trained with cross-modal alignment, supporting text-to-image or image-to-content queries.
    • Multi-index joint retrieval: maintain separate text and visual indexes, then select evidence through result fusion and re-ranking.

    Note that you cannot directly compare distance between vectors produced by an arbitrary text model and an arbitrary image model. Even if the dimensions match, it doesn’t mean they belong to a compatible semantic space.

    A unified embedding space is therefore not a prerequisite for handling non-textual content. For large volumes of enterprise documents, “semanticize images into text for recall, keep originals for verification” is often the most practical starting point.

    5. Index Design: Connecting Retrieval Text to Original Evidence

    Each index unit should at minimum answer: what the content is, where it comes from, what type it is, and which other elements it relates to.

    A conceptual structure could look like this:

    1. document ID
    2. document version
    3. element ID
    4. element type
    5. page number and position
    6. retrieval text
    7. original asset reference
    8. parent section ID
    9. associated element IDs
    10. access permission info
    11. parsing quality status

    Vectors serve semantic recall; original asset references are used to read images or structured tables; association IDs expand context; version information prevents mixing old and new documents.

    Access control must not be checked only at final display. It should be enforced during both retrieval and evidence reading, preventing unauthorized content from entering the model’s context.

    In addition, page images, structured tables, and retrieval text should reference the same document version as much as possible. If vectors are updated but original evidence is not, the system can produce answers where “the retrieved content is correct, but the cited page is outdated.”

    6. Query Time: From Retrieved Fragments to Organized Evidence

    6.1 Choose a Retrieval Route Based on Question Type

    When asking “what does this metric mean,” prioritize searching body text and table descriptions. When asking “what are the parameters of this device,” focus on the corresponding records. When asking “under what conditions does the process move to the next step,” you need to recall the flowchart along with its related body text.

    Query classification doesn’t need to be complex from day one, but you should avoid routing every question through the same text-vector retrieval path.

    6.2 Combine Keyword, Vector, and Structured Queries

    Vector retrieval is good at discovering semantically related content, but it’s often weak at distinguishing similar IDs, exact values, and special symbols. Keyword retrieval complements exact matching, and structured queries handle filtering, sorting, and aggregation.

    After multi-path recall, deduplicate and re-rank. Raw scores from different retrieval channels are generally not directly comparable and should not be simply added together; use rank-based fusion or a validated unified scoring approach instead.

    6.3 Pass Associated Evidence to the Model

    When a table row is hit, supplement it with headers, units, and relevant footnotes. When an image description is hit, add the caption, surrounding context, and the original image as needed.

    During generation, require the model to answer based on evidence. If evidence is missing, parsing failed, or sources conflict, the system should state the uncertainty rather than using the language model’s fluency to paper over information gaps. User-facing answers should include page or region references for easy verification.

    7. Quality Evaluation: Don’t Judge Parsing by Appearance Alone

    Non-textual RAG needs to evaluate parsing, retrieval, and answering separately.

    Parsing level: focus on key text, cell values, header relationships, merged structures, image associations, and reading order. For high-risk fields such as amounts, dates, and IDs, add format validation and rule checks — but passing rules doesn’t guarantee the content is correct.

    Retrieval level: evaluate whether target figures and tables make it into the candidate results, whether they carry complete context, and whether similar tables or outdated document versions cause false recalls.

    Answering level: check whether answers cite the correct evidence, whether values and units are consistent, whether computations are reproducible, and whether the system can clearly state its limitations when information is insufficient.

    Your test set should include poor-quality scans, multi-column layouts, cross-page tables, multi-level headers, complex legends, and low-resolution images. Testing only on well-formatted documents will lead you to overestimate the system’s real capabilities.

    Phase one: build reliable document parsing and an intermediate representation. Prioritize body text, standard tables, and text within images, while preserving original evidence.

    Phase two: add structured table storage, row-level semantic fragments, image descriptions, and association-aware retrieval. Complete numeric validation and citation display.

    Phase three: introduce cross-modal retrieval, visual verification, and structured computation based on real requirements. At the same time, establish version updating, access control, failure retry, and quality monitoring mechanisms.

    You don’t need to convert every image and table into a single vector space from the start. What matters more is being clear about which information is used for recall, which data is used for precise computation, and which original assets are used for evidence verification.

    The core of non-textual RAG is a verifiable knowledge processing chain: parsing restores content and structure, indexing locates relevant information, queries and computation produce precise results, and the generative model organizes the final expression. Only when these stages work together can images and tables evolve from decorative attachments in documents into genuinely usable knowledge evidence.