Existing approaches to automatic data transformation are insufficient to meet the requirements in many real-world scenarios, such as the building sector. First, there is no convenient interface for domain experts to provide domain knowledge easily. Second, they require significant training data collection overheads. Third, the accuracy suffers from complicated schema changes. To bridge this gap, we present a novel approach that leverages the unique capabilities of large language models (LLMs) in coding, complex reasoning, and zero-shot learning to generate SQL code that transforms the source datasets into the target datasets. We demonstrate the viability of this approach by designing an LLM-based framework, termed SQLMorpher, which comprises a prompt generator that integrates the initial prompt with optional domain knowledge and historical patterns in external databases. It also implements an iterative prompt optimization mechanism that automatically improves the prompt based on flaw detection. The key contributions of this work include (1) pioneering an end-to-end LLM-based solution for data transformation, (2) developing a benchmark dataset of 105 real-world building energy data transformation problems, and (3) conducting an extensive empirical evaluation where our approach achieved 96% accuracy in all 105 problems. SQLMorpher demonstrates the effectiveness of utilizing LLMs in complex, domain-specific challenges, highlighting the potential of their potential to drive sustainable solutions.
翻译:现有自动数据变换方法难以满足建筑等领域真实场景的需求。首先,缺乏便捷的接口供领域专家轻松提供领域知识;其次,需要大量训练数据采集开销;第三,复杂模式变更导致准确性不足。为弥补这一缺陷,我们提出了一种新方法,利用大语言模型(LLMs)在代码生成、复杂推理和零样本学习方面的独特能力,生成将源数据集变换为目标数据集的SQL代码。我们通过设计一个基于LLM的框架SQLMorpher验证了该方法的可行性。该框架包含提示生成器,可将初始提示与可选领域知识及外部数据库中的历史模式相集成,并实现了基于缺陷检测的迭代提示优化机制,能自动改进提示。本文主要贡献包括:(1) 首创基于LLM的端到端数据变换解决方案;(2) 构建包含105个真实建筑能耗数据变换问题的基准数据集;(3) 开展广泛实证评估,我们的方法在全部105个问题上达到96%的准确率。SQLMorpher证明了大语言模型在复杂领域特定挑战中的应用有效性,凸显了其在推动可持续解决方案方面的潜力。