Towards Scalable Schema Mapping using Large Language Models

Christopher Buss, Mahdis Safari, Arash Termehchy, Stefan Lee, David MaierarXiv 2025 · DOI

Abstract

Large Language Models (LLMs) show significant promise in automating database schema mapping, yet they suffer from prompt sensitivity and high operational costs. This paper presents a robust framework utilizing bidirectional sampling, stable matching algorithms, and "efficient chunking" to generate high-quality mappings. Evaluation on healthcare datasets demonstrates that this orchestrated approach allows open-source models to rival or outperform proprietary counterparts like GPT-4.

Introduction

Data integration is often characterized as the "janitorial work" of data science. Integrating information from disparate sources—such as clinical trials, research papers, and pharmacy records—requires "schema mappings": logical rules that define how columns in a source schema relate to those in a target schema. Traditionally, this process is manual and labor-intensive, requiring engineers to interpret complex documentation. While LLMs excel at semantic understanding, they face three primary hurdles: inconsistency due to input ordering, the structural complexity of Global-Local-as-View (GLaV) mappings, and the prohibitive cost of repeated API calls.

Methods

The proposed "Schema Mapping Assistant" transitions from static prompting to a sophisticated pipeline designed to maximize consistency and minimize cost.

  • Bidirectional Matching: Rather than a unidirectional Source $\rightarrow$ Target mapping, the model is prompted to map in both directions.
  • Sampling & Aggregation: The system generates multiple candidate mappings by randomly permuting column orders. These "opinions" are reconciled using aggregation functions, most notably the Gale-Shapley Stable Matching algorithm, to identify high-confidence matches.
  • N-1 Prompting: To improve structural focus, the system serializes one target attribute against multiple source attributes in JSON format.
  • Efficient Chunking: Multiple mapping rules are grouped into a single prompt. This exploits "rule overlap" where different rules share tables, allowing the model to process more information while amortizing the token cost of schema descriptions.
The proposed bidirectional matching and aggregation pipeline.

Experimental Setup

The framework was evaluated on three key benchmarks:

  1. MIMIC-OMOP: Real-world healthcare data from the MIMIC-III database mapped to the OMOP Common Data Model.
  2. Synthea-OMOP: Synthetic healthcare records used to test handling of clean but ambiguous data.
  3. Amalgam: A classic bibliography database benchmark used specifically to test complex, multi-table (GLaV) mapping rules.

Key Results

The bidirectional approach demonstrated superior accuracy and efficiency across the tested datasets.

  • Accuracy Gains: On the MIMIC dataset, the "Stable Matching" approach achieved an F1 score of 0.64. This significantly outperformed the rule-based COMA baseline (0.10–0.16) and the GPT-4-based MatchMaker system (0.23).
  • Efficiency: By utilizing "Efficient Chunking" to process seven rules simultaneously, the authors achieved a 2.57x reduction in total token consumption compared to a standard one-rule-at-a-time approach.
  • Robustness: The bidirectional check proved highly effective at filtering "false positives"—mappings that appear plausible in one direction but lack semantic consistency when reversed.
Performance metrics for the MIMIC dataset across different matching methods.

Discussion and Conclusion

A central insight of this work is that LLM sensitivity to input order—often viewed as a flaw—can be leveraged as a feature. By sampling outputs across different permutations, consistency serves as a proxy for confidence. Furthermore, the results indicate that Meta’s Llama-3.1-70B, when utilized within this bidirectional pipeline, can outperform simpler GPT-4 strategies. This suggests that the orchestration of the model is as critical as the model's raw scale.

Future work will address the "decidability trap" in complex GLaV mappings, where determining the logical equivalence of generated SQL queries remains difficult. Additionally, the authors propose "Model-Based Filtering," where a secondary LLM acts as a critic to further refine mapping quality. Ultimately, while the system serves as a powerful assistant, human-in-the-loop verification remains essential for capturing latent business constraints not present in the schema metadata.

Summary updated

BibTeX
@misc{buss2025towards,
  author = {Christopher Buss and Mahdis Safari and Arash Termehchy and Stefan Lee and David Maier},
  title = {{Towards Scalable Schema Mapping using Large Language Models}},
  year = {2025},
  eprint = {2505.24716},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2505.24716},
}
Figure