Open-Source Approaches for Structured Data in RAG Workflows

    This article explains why structured data such as tables, charts, and semi-structured configurations cannot be handled with document-style RAG, and how to design a tiered pipeline instead. It covers data classification and preprocessing, hybrid retrieval that combines semantic search, scalar filtering, keyword matching, and graph-based lookup, reranking, context assembly, and verifiable citations. It also outlines a vendor-neutral checklist for selecting open-source components and a layered evaluation strategy for acceptance and iteration.

    1. The Starting Problem: Why Structured Data Breaks Document-Style RAG

    The requirement comes from a common engineering scenario: you already have curated tables, charts, and semi-structured configuration files, and you want to feed them into a Retrieval-Augmented Generation (RAG) pipeline and wire the whole thing together in a visual workflow orchestration platform. Many teams’ first instinct is to “chunk every file, embed it, and load it into a vector store,” but that path usually performs poorly on structured data, for three reasons.

    First, semantic granularity is mismatched. The natural unit for a passage of prose is a sentence or paragraph, while the semantic unit of a table is a row, a combination of fields, or even several rows that together form one complete business fact. Fixed-length chunking splits headers from data rows, and the retrieved fragments cannot explain themselves.

    Second, numbers and text are not equally searchable. When a user asks “which product line had the lowest gross margin in East China last quarter,” that is fundamentally a sorting and aggregation query, and vector similarity is nearly powerless here. A question like “what is the definition of gross margin” is a genuine semantic retrieval problem. Mixing both kinds of questions in a single path inevitably sacrifices one for the other.

    Third, a chart is a bimodal object. A bar chart carries both pixel information and the underlying data plus axis semantics. Describing only the image loses exact values; extracting only the data loses the intuitive sense of trend.

    So the right way to bring structured data into RAG is not “embed everything uniformly,” but classify first, divide and conquer second, and finally converge in a multi-path retrieval layer.

    2. Data Tiering and Preprocessing: The Stage That Sets the Ceiling

    Divide the ingestion targets into four categories and design a separate pipeline for each.

    Category 1: Well-formed tables. The core action is row-level semanticization. Generate a self-explanatory passage for each row, binding column names to values and adding the entity context that is needed. Example logic:

    1. def row_to_text(row, table_meta):
    2. pairs = [f"{col}:{row[col]}" for col in table_meta.columns if row[col] not in (None, "")]
    3. return f"table={table_meta.name}; topic={table_meta.topic}; " + "; ".join(pairs)

    At the same time, keep the original structured values in storage that supports scalar filtering, producing a dual-write structure of “text vector index + scalar index.” The upper layer can then filter numerically first and rank semantically afterward.

    Category 2: Semi-structured configurations and nested data. First perform a structure flattening pass that collapses nested levels into path-based key-value pairs, then generate summary nodes for the key subtrees. Summary nodes are responsible for being retrieved, atomic nodes are responsible for being cited, and the two are linked by a unique identifier, which avoids answers that miss the question yet cannot be traced to a source.

    Category 3: Charts. Use a “three views per chart” strategy: the original image, the underlying data table obtained by rendering or parsing, and a text description containing the title, axes, units, and the direction of the conclusion. All three share the same identifier, can be matched separately at retrieval time, and are injected on demand at generation time, covering both exact values and trend expression.

    Category 4: Unstructured explanatory documents. Regular chunking is fine here, but keep the heading hierarchy as metadata so hierarchical filtering is possible later.

    Two things that are often overlooked must be enforced during preprocessing. One is metadata standards: at minimum source, timestamp, permission labels, and data-definition version. The other is idempotency and incremental updates: use content fingerprints to detect changes and recompute only the affected fragments; otherwise the high update frequency of table data will push indexing cost to an unacceptable level.

    A single retrieval path cannot cover both problem types, so the common engineering practice is multi-path retrieval followed by fusion.

    • Path A: semantic retrieval, for definition and explanation questions;
    • Path B: scalar filtering and aggregation, for range, sorting, and grouping questions, executed by conditional branches or script nodes in the orchestration platform;
    • Path C: keyword retrieval, covering proper nouns, identifiers, and abbreviations that dense vectors are insensitive to;
    • Path D: graph or path-based key retrieval, for multi-hop relational questions.

    In the fusion stage, normalize first and then apply weights, and hand the result to a reranking model for fine ordering. Reranking is the highest-value step per unit of effort: widen retrieval to dozens of candidates, then compress to the top few with a cross-encoder. This usually works better than repeatedly tuning vector model parameters.

    Make the routing decision explicit rather than hoping the model figures it out. A practical decision order: first check whether the query contains numeric comparison, a time range, or aggregation intent, and route to the structured path on a hit; then check whether it is a terminology explanation, and route to the semantic path on a hit; if neither matches, run multiple paths in parallel. Writing this logic as a standalone node makes problem localization clear and allows isolated regression testing.

    A schematic orchestration skeleton:

    1. input -> intent and metadata parsing -> branch{structured query | semantic retrieval | hybrid}
    2. -> multi-path retrieval -> normalized fusion -> reranking -> context assembly -> generation -> citation backfill

    Context assembly must respect a budget: set a quota for each type of evidence, present structured results as compact tables, and keep source headings on text evidence, so a long context does not dilute the key information.

    4. Generation and Trustworthy Citations

    Structured scenarios demand more verifiability than chit-chat scenarios. Three practices: first, every number in an answer must point back to a specific table, a specific row, or a specific chart; second, the definition version and update time must be output along with the answer, to prevent answering a new question with data under an outdated definition; third, when the retrieved evidence is insufficient to support a conclusion, have the pipeline explicitly return “data missing” instead of letting the model interpolate and guess. Leave numeric computation to the structured path or script nodes as much as possible, and let the model only organize language and explain; this division of labor significantly reduces the chance of arithmetic errors.

    5. A Neutral Approach to Selecting Open-Source Components

    Rather than pointing at specific projects, a capability-based checklist is more reliable:

    1. Deep document and layout understanding: look at table structure reconstruction, scanned document handling, and preservation of section hierarchy;
    2. Inference and embedding supply layer: look at whether multiple model types are supported, whether on-premises deployment is possible, and how flexible resource scheduling is;
    3. Retrieval engine capability: look at hybrid retrieval, scalar filtering, permission filtering, and incremental updates;
    4. Orchestration and delivery layer: look at branch routing, script nodes, observability, and version rollback;
    5. Storage and operations foundation: general cloud capabilities such as container platforms, object storage, log services, and monitoring and alerting can carry this.

    Containerized deployment does lower the setup barrier considerably, but three costs must be reserved for: persistent volume planning for model weights and index data, matching GPU or memory capacity to the number of concurrent paths, and the reproducibility problems caused by drift in image and dependency versions. Pinning versions, externalizing configuration, and completing health checks pay off far better than debugging after the fact.

    6. Acceptance and Continuous Iteration

    Build a layered evaluation set: structured query, terminology explanation, chart interpretation, and multi-hop synthesis categories in fixed proportions, measuring retrieval hit rate, numeric accuracy, and citation verifiability separately. After launch, watch three curves closely: the relationship between retrieval length and latency, the incremental gain from reranking, and index update lag. When numeric accuracy falls short, fix preprocessing and routing first rather than continuing to swap models; that priority order has been validated repeatedly in practice.

    The difficulty of bringing structured data into RAG has never been “getting it in,” but making each type of data retrieved, computed, and cited in its most natural form. Proceed tier by tier, and the workflow can be both flexible and trustworthy.