MoMQ用专家混合模型统一生成多数据库方言的SQL,解决语法差异和数据不均衡问题。
MoMQ: Mixture-of-Experts Enhances Multi-Dialect Query Generation across Relational and Non-Relational Databases
- 采用多层级路由与方言专家组,隔离不同数据库语法干扰。
- 引入共享专家缓解低资源方言数据不足,提升整体生成效果。
- 支持关系型与非关系型数据库,适合云平台统一查询管理场景。
自然语言转结构化查询语言(SQL)的进展得益于大语言模型(LLMs)的发展。开源LLM针对特定数据库方言(如MySQL)表现优异,但云服务提供商需要支持多方言的统一数据库管理服务(如Azure Cosmos DB、AWS Amazon Aurora、阿里云Lindorm)。这催生了多方言查询生成的需求,对LLM带来挑战:方言间语法差异大,且数据分布不均。为此,本文提出MoMQ——一种基于专家混合的跨关系型与非关系型数据库的多方言查询生成框架。MoMQ为每种方言配置专家组,并采用多层级路由策略处理方言特异性知识,减少生成过程中的干扰;同时引入共享专家组,促进高资源方言向低资源方言的知识迁移,缓解数据不平衡问题。此外,我们构建了一个高质量的多方言查询生成基准测试集,覆盖MySQL、PostgreSQL、Neo4j的Cypher、NebulaGraph的nGQL等。大量实验表明,即使在资源不均衡情况下,MoMQ仍表现出色且稳健。
原文摘要 · Abstract (English)
The improvement in translating natural language to structured query language (SQL) can be attributed to the advancements in large language models (LLMs). Open-source LLMs, tailored for specific database dialects such as MySQL, have shown great performance. However, cloud service providers are looking for a unified database manager service (e.g., Cosmos DB from Azure, Amazon Aurora from AWS, Lindorm from AlibabaCloud) that can support multiple dialects. This requirement has led to the concept of multi-dialect query generation, which presents challenges to LLMs. These challenges include syntactic differences among dialects and imbalanced data distribution across multiple dialects. To tackle these challenges, we propose MoMQ, a novel Mixture-of-Experts-based multi-dialect query generation framework across both relational and non-relational databases. MoMQ employs a dialect expert group for each dialect and a multi-level routing strategy to handle dialect-specific knowledge, reducing interference during query generation. Additionally, a shared expert group is introduced to address data imbalance, facilitating the transfer of common knowledge from high-resource dialects to low-resource ones. Furthermore, we have developed a high-quality multi-dialect query generation benchmark that covers relational and non-relational databases such as MySQL, PostgreSQL, Cypher for Neo4j, and nGQL for NebulaGraph. Extensive experiments have shown that MoMQ performs effectively and robustly even in resource-imbalanced scenarios.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。