Executable Schema Contracts: From Automatic Ingestion to Multi-Source Retrieval

Padmaja Jonnalagedda, Yuguang Yao, Xiang Gao, Hilaf Hasson, Kamalika DasarXiv 2026 · arXiv

TL;DR

This paper introduces a system that automatically discovers a unified "executable schema contract" from raw, heterogeneous data sources (like PDFs, JSON logs, and SQL tables). This schema serves as a shared control plane, guiding both the automated construction of a knowledge graph and the query-time routing of a QA agent, delivering massive accuracy gains over standard RAG and generic LLM agents.

What Problem Does This Paper Address?

In the real world, valuable knowledge rarely sits neatly in a single database. Instead, it is scattered across a messy mix of structured SQL tables, semi-structured JSON logs, and unstructured documents like PDFs or internal wikis.

When trying to build Question Answering (QA) systems over this data, engineers hit a wall. Standard Retrieval-Augmented Generation (RAG) works well for simple single-document lookups but fails miserably on complex, multi-hop queries that require joining information across different sources. Conversely, building a structured Knowledge Graph (KG) solves the join problem but traditionally requires expensive, manual schema engineering that breaks the moment the underlying data evolves. Fully open-ended LLM agents attempt to bypass schemas entirely, but they are brittle, slow, and prone to hallucinating non-existent data fields.

The authors tackle this "data-to-answer" automation problem by asking: Can we automatically discover a schema from raw data and use it as a strict, executable contract to unify both data ingestion and query retrieval?

Methods

The proposed framework operates in three tightly coupled stages, all driven by a single induced schema ($\Sigma$):

  1. Schema Induction: The system profiles raw data sources to build a closed-world field catalog. This catalog acts as a boundary, forcing the LLM to only use actual, attested data fields and preventing structural hallucinations. Crucially, the system uses deterministic, statistical analysis (not LLMs) to infer identity keys, foreign keys, and source hierarchies. LLMs are reserved strictly for semantic discovery (identifying entity types and relationships) in a two-pass architecture.
  2. Schema-Guided Construction: Using the discovered schema as a control plane, the system automatically extracts, deduplicates, and links data into a provenance-aware Neo4j knowledge graph. Because the schema drives the ingestion rules, changing the schema updates the graph database automatically without rewriting code.
  3. Schema-Guided Retrieval: At query time, a multi-tool agent uses the schema to parse the user's question and intelligently route it. Instead of relying on open-ended LLM reasoning at every step, the agent follows a strict preference order: structured lookups for discrete values, vector search for unstructured text, and graph traversal for multi-hop relationships.

The system also includes a monotonic query-time schema extension protocol. If a user query introduces a novel concept not captured during initial ingestion, the system can dynamically extend the schema in-memory to handle the query on the fly.

Figure 1: End-to-end pipeline. Raw heterogeneous sources (tables, JSON, text) are profiled and fed to an automatic schema generator producing a closed-world field catalog and unified executable schema Σ. Σ drives (i) schema- guided KG ingestion – extraction, deduplication, cross-source linking, provenance tracking – into a typed Neo4j graph, and (ii) a schema-guided QA agent routing queries across structured lookup, graph traversal, and vector retrieval, returning grounded answers with source citations. Dashed paths indicate optional query-time extension.

Datasets

The system was evaluated using zero-shot GPT-4.1 across four diverse, publicly available QA benchmarks:

  • BlendQA: Focuses on multi-source, multi-hop reasoning over a mix of text passages and structured facts.
  • HybridQA: Requires bridging tabular data with linked Wikipedia passages.
  • TAT-QA: A financial QA dataset containing hybrid tabular and textual content requiring numerical reasoning.
  • ComplexTR: Tests temporal multi-hop reasoning over structured records with time-scoped relations.

Key Insights and Ideas

  • Statistical Before Semantic: LLMs are notoriously bad at calculating uniqueness, cardinality, and value distributions. A key insight of this paper is to let classical data profiling handle structural intelligence (like finding foreign keys) before letting the LLM loose on semantic extraction.
  • The Schema as a Control Plane: Instead of optimizing data ingestion and query retrieval in isolation, using the schema as an explicit contract ensures that the retrieval agent uses the exact same typed vocabulary and link paths established during data ingestion.
  • Two-Stage Reliability Gating: To prevent hallucinations, the agent performs a pre-retrieval check to see if the query's entities fall within known value dictionaries, and a post-retrieval grounding filter to ensure answers are strictly backed by evidence. This allows for principled abstention rather than guessing.
Figure 3: Schema-guided QA agent. Given Q and Σ′, the agent parses entity types and constraints, routes via Σ′’s preference order, applies pre-/post-retrieval reliability gating (c = clink · cnode · cground), and synthesizes the grounded answer.

Key Results

In controlled zero-shot comparisons using identical LLM backbones and data sources, the Schema-Guided approach consistently outperformed strong baselines like standard RAG and decomposition-based methods (ProbTree, CoK, AtomR):

  • Accuracy Boosts: On HybridQA, the system achieved a massive 58.3% Exact Match (EM), outperforming the state-of-the-art AtomR baseline by +19.8 EM and standard RAG by over 51%.
  • Cross-Source Routing: On BlendQA, it outperformed AtomR by +2.6 EM and standard RAG by +10.2 EM.
  • Ablation Studies: Removing schema-conditioned routing (the "w/o schema guidance" ablation) caused performance on BlendQA to plummet from 29.3 EM to 20.0 EM, proving that agentic iteration alone isn't enough—the schema guidance is what drives the accuracy gains.
  • Cross-Model Generalization: The authors swapped the underlying LLM backbone with Claude Haiku 4.5 and Llama 3.3 70B, finding consistent performance gains across all model families.

Limitations and Future Work

  • Schema Realization vs. Coverage: While the system is excellent at discovering schemas, actually populating rare or temporally complex entity types during KG construction remains a bottleneck. The graph sometimes misses borderline entities, though the agent mitigates this by falling back to vector search.
  • Extension Latency: Dynamically extending the schema at query time adds an average of ~3.4 seconds of overhead. While highly effective for accuracy, this latency might be prohibitive for strict real-time applications.
  • Enterprise Scale: The framework has only been validated on public benchmarks. Testing it against massive production enterprise data with noisier sources and stricter data governance remains an open area for future work.

Summary updated

Abstract

Real-world data spans tables, documents, and semi-structured files with implicit semantics. Querying this data requires integrating evidence across inconsistent schemas and formats, yet existing approaches either demand costly manual engineering or bypass structure entirely. We present a system that automatically discovers an executable schema from raw multi-source data and uses it as a shared contract for knowledge graph construction and query-time retrieval. A closed-world field catalog constrains LLM-based schema discovery to attested fields; deterministic structural analysis infers identity keys, foreign keys, and source hierarchy; and the resulting schema drives extraction, deduplication, and cross-source linking into a provenance-aware knowledge graph. At query time the schema -- optionally extended via a monotonic protocol -- conditions a multi-tool agent routing retrieval across structured lookup, graph traversal, and vector search, returning grounded answers with traceable citations. In controlled zero-shot comparisons using the same LLM, data, and evaluation harness, the system improves over retrieval-only and decomposition-based baselines across four QA benchmarks, with ablations showing that schema-conditioned routing, structural intelligence, and schema-guided construction each contribute to the gains.
BibTeX
@misc{jonnalagedda2026executable,
  author = {Padmaja Jonnalagedda and Yuguang Yao and Xiang Gao and Hilaf Hasson and Kamalika Das},
  title = {{Executable Schema Contracts: From Automatic Ingestion to Multi-Source Retrieval}},
  year = {2026},
  eprint = {2606.05415},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2606.05415},
}

Loading related content...

Figure