arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2407.13280cs.SEcs.DB
收藏

AI辅助SQL编写在工业规模中的应用

AI-Assisted SQL Authoring at Industry Scale

Chandra Maddila, Negar Ghorbani, Kosay Jabre, Vijayaraghavan Murali, Edwin Kim, Parth Thakkar, Nikolay Pavlovich Laptev, Olivia Harman, Diana Hsu, Rui Abreu, Peter C. Rigby

AI总结:

本文介绍SqlCompose,一个在Meta大规模部署的AI辅助SQL编写系统,通过微调Llama和开发填充中间模型,显著提升SQL生成性能,并表明小型专业模型可超越大型通用模型。

摘要:

SqlCompose将生成式AI引入数据分析领域。SQL是声明式的,具有正式的表模式,并且通常以非线性方式编写。我们解决了这些挑战中的每一个,并开发了一组模型,展示了每个问题的重要性。我们首先在Meta内部开发了一个SQL基准测试,用于进行离线测试。我们评估了公共Llama模型的表现。我们在单行和多行预测中分别获得了53%和24%的BLEU分数。这一表现与先前关于命令式语言的研究一致。然后,我们在内部数据和数据库模式上对Llama进行了微调。SqlComposeSA在BLEU分数上比Llama高出16个百分点。SQL通常包含多个子查询,并以非顺序方式编写。我们开发了SqlComposeFIM,它能够感知需要完成的行的前后上下文。这种填充中间模型比SqlComposeFIM高出35个百分点。我们还测量了模型正确获取表名的频率,SqlComposeFIM在75%的情况下能够做到这一点。除了我们的科学研究外,我们还在Meta内部署了SqlComposeFIM。SqlCompose每周被超过1万名用户使用,包括数据科学家和软件工程师,不到1%的用户禁用了SqlCompose。我们利用用户的反馈来改进SqlCompose。积极的反馈主题包括完成繁琐或重复的SQL子句、建议样板代码,以及帮助消除记住困难SQL语法的需要。最显著的负面主题是表和列名的幻觉,随着SqlComposeFIM的发布,这一问题已得到缓解。尽管SqlCompose模型规模较小(70亿和130亿参数),但它们始终优于公共和内部LLM,这初步表明较小的专业模型可以胜过较大的通用模型。

英文摘要:

SqlCompose brings generative AI into the data analytics domain. SQL is declarative, has formal table schemas, and is often written in a non-linear manner. We address each of these challenges and develop a set of models that shows the importance of each problem. We first develop an internal SQL benchmark to perform offline tests at Meta. We evaluate how well the Public Llama model performs. We attain a BLEU score of 53% and 24% for single- and multi-line predictions, respectively. This performance is consistent with prior works on imperative languages. We then fine-tune Llama on our internal data and database schemas. SqlComposeSA substantially outperforms Llama by 16 percentage points on BLEU score. SQL is often written with multiple sub queries and in a non-sequential manner. We develop SqlComposeFIM which is aware of the context before and after the line(s) that need to be completed. This fill-in-the-middle model outperform SqlComposeFIM by 35 percentage points. We also measure how often the models get the correct table names, and SqlComposeFIM is able to do this 75% of the time. Aside from our scientific research, we also roll out SqlComposeFIM at Meta. SqlCompose is used on a weekly basis by over 10k users including data scientists and software engineers, less than 1% of users have disabled SqlCompose. We use the feedback from users to improve SqlCompose. Interesting positive themes include completing tedious or repetitive SQL clauses, suggesting boilerplate coding, and help in eliminate the need to remember difficult SQL syntax. The most significant negative themes was table and column name hallucinations, which has been reduced with the release of SqlComposeFIM. The SqlCompose models consistently outperform public and internal LLMs, despite being smaller (7 bn and 13 bn), which provides early indications that smaller specialist models can outperform larger general purpose models.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑