DBAutoDoc: Automated Discovery and Documentation of Undocumented Database Schemas via Statistical Analysis and Iterative LLM Refinement

📄 arXiv: 2603.23050v1 📥 PDF

作者: Amith Nagarajan, Thomas Altman

分类: cs.DB, cs.AI

发布日期: 2026-03-24


💡 一句话要点

DBAutoDoc:通过统计分析和迭代LLM优化自动发现和文档化未文档化的数据库模式

🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)

关键词: 数据库模式理解 自动化文档生成 大型语言模型 统计分析 迭代优化

📋 核心要点

  1. 现有数据库系统普遍缺乏文档,导致理解和维护困难,现有方法难以有效解决。
  2. DBAutoDoc通过迭代式LLM优化和统计分析,利用模式依赖图传播语义校正,实现模式理解。
  3. 实验表明,DBAutoDoc在基准数据库上取得了96.1%的加权分数,显著优于仅使用LLM的方法。

📝 摘要(中文)

大量关键数据库系统缺乏充分的文档。主键缺失,外键约束因性能原因被删除,列名是难以理解的缩写,并且不存在实体关系图。我们提出了DBAutoDoc,一个通过结合统计数据分析与迭代式大型语言模型(LLM)优化来自动发现和文档化未文档化的关系数据库模式的系统。DBAutoDoc的核心思想是模式理解本质上是一个迭代的、图结构的问题。DBAutoDoc从神经网络中的反向传播中汲取结构灵感,通过模式依赖图传播语义校正,经过多次优化迭代直到描述收敛。这种传播是离散的和语义的,而不是数学的,但结构类比是精确的:早期迭代产生类似于随机初始化的粗略描述,并且随着上下文在图中流动,连续的传递会锐化全局图景。该系统在论文中详细介绍了四个具体贡献。在一套基准数据库上,使用综合指标,DBAutoDoc在两个模型系列(Google的Gemini和Anthropic的Claude)上实现了96.1%的总体加权分数。消融分析表明,确定性管道比仅使用LLM的外键检测提高了23个点的F1分数,证实了该系统的贡献是实质性的,并且独立于LLM预训练知识。DBAutoDoc已作为开源软件发布,包含所有评估配置和提示模板,以实现完全的可重复性。

🔬 方法详解

问题定义:论文旨在解决大量数据库系统缺乏文档的问题,这些系统缺少主键、外键约束,列名含义模糊,且缺乏实体关系图。现有方法,例如人工文档编写,成本高昂且容易出错。利用LLM直接进行文档生成效果不佳,无法充分利用数据库模式的内在结构信息。

核心思路:DBAutoDoc的核心思路是将数据库模式理解视为一个迭代的、图结构的问题。借鉴神经网络反向传播的思想,通过在模式依赖图上传播语义校正信息,逐步优化模式的描述。这种迭代优化的过程能够充分利用数据库模式的结构信息,提高文档生成的准确性和一致性。

技术框架:DBAutoDoc的整体框架包含以下几个主要阶段:1) 统计数据分析:对数据库中的数据进行统计分析,例如计算列之间的相关性,推断主外键关系。2) LLM初始描述生成:利用LLM对数据库模式进行初步的描述生成。3) 模式依赖图构建:根据数据库模式的结构信息,构建模式依赖图。4) 迭代优化:在模式依赖图上传播语义校正信息,利用LLM对模式描述进行迭代优化,直到描述收敛。

关键创新:DBAutoDoc的关键创新在于将数据库模式理解问题转化为一个迭代的图结构优化问题。通过借鉴神经网络反向传播的思想,利用模式依赖图传播语义校正信息,实现了模式描述的逐步优化。这种方法能够充分利用数据库模式的结构信息,提高文档生成的准确性和一致性。与直接使用LLM生成文档相比,DBAutoDoc能够更好地理解数据库模式的内在结构和语义关系。

关键设计:DBAutoDoc的关键设计包括:1) 模式依赖图的构建:模式依赖图的节点表示数据库中的表和列,边表示表和列之间的依赖关系,例如主外键关系。2) 语义校正信息的传播:语义校正信息通过LLM生成,用于修正模式描述中的错误或不一致之处。3) 迭代优化的停止条件:迭代优化过程在模式描述收敛时停止,例如当连续两次迭代之间的描述差异小于某个阈值时。

📊 实验亮点

DBAutoDoc在基准数据库上取得了显著的实验结果。使用综合指标,DBAutoDoc在Google的Gemini和Anthropic的Claude两个模型系列上实现了96.1%的总体加权分数。消融分析表明,确定性管道比仅使用LLM的外键检测提高了23个点的F1分数,证明了DBAutoDoc的有效性和独立性。开源发布保证了结果的可复现性。

🎯 应用场景

DBAutoDoc可应用于各种需要数据库文档的场景,例如数据库维护、数据治理、数据集成和数据迁移。它可以帮助数据库管理员和开发人员更好地理解和管理数据库,提高开发效率和数据质量。此外,DBAutoDoc还可以用于自动化生成数据库文档,降低文档编写的成本和时间。

📄 摘要(原文)

A tremendous number of critical database systems lack adequate documentation. Declared primary keys are absent, foreign key constraints have been dropped for performance, column names are cryptic abbreviations, and no entity-relationship diagrams exist. We present DBAutoDoc, a system that automates the discovery and documentation of undocumented relational database schemas by combining statistical data analysis with iterative large language model (LLM) refinement. DBAutoDoc's central insight is that schema understanding is fundamentally an iterative, graph-structured problem. Drawing structural inspiration from backpropagation in neural networks, DBAutoDoc propagates semantic corrections through schema dependency graphs across multiple refinement iterations until descriptions converge. This propagation is discrete and semantic rather than mathematical, but the structural analogy is precise: early iterations produce rough descriptions akin to random initialization, and successive passes sharpen the global picture as context flows through the graph. The system makes four concrete contributions detailed in the paper. On a suite of benchmark databases, DBAutoDoc achieved overall weighted scores of 96.1% across two model families (Google's Gemini and Anthropic's Claude) using a composite metric. Ablation analysis demonstrates that the deterministic pipeline contributes a 23-point F1 improvement over LLM-only FK detection, confirming that the system's contribution is substantial and independent of LLM pre-training knowledge. DBAutoDoc is released as open-source software with all evaluation configurations and prompt templates included for full reproducibility.