根据查询复杂度智能分配生成策略,显著降低Text-to-SQL的计算成本。
EllieSQL: Cost-Efficient Text-to-SQL with Complexity-Aware Routing
- 按查询复杂度动态选择高效或高精度生成路径
- 减少40%以上令牌消耗,性能保持不变
- 适合关注资源效率与实际部署的开发者
Text-to-SQL可将自然语言查询自动转为SQL,使非技术用户无需掌握SQL即可访问数据库。尽管基于大模型的方法在排行榜上表现优异,但其不可持续的计算开销——常被忽视——已成为当前以榜单为导向研究中的‘显性难题’,限制了真实场景部署和广泛应用。为此,我们提出EllieSQL,一种基于复杂度感知的路由框架,根据预估复杂度将查询分配至合适的生成流水线。我们探索多种路由策略,让简单查询走高效方法,复杂查询保留高耗时方案。借鉴经济学思想,引入“性能的令牌弹性”(TEP)指标,衡量性能提升对令牌投入的响应程度,反映成本效益。实验表明,相较于始终使用最先进方法,采用Qwen2.5-0.5B-DPO路由的EllieSQL在Bird开发集上性能不变的前提下,令牌使用量减少超40%,TEP值提升超过2倍。这不仅推动了成本高效的Text-to-SQL发展,也呼吁社区在评估时兼顾资源效率,助力可持续进步。代码与模型已公开于https://elliesql.github.io/。
原文摘要 · Abstract (English)
Text-to-SQL automatically translates natural language queries to SQL, allowing non-technical users to retrieve data from databases without specialized SQL knowledge. Despite the success of advanced LLM-based Text-to-SQL approaches on leaderboards, their unsustainable computational costs--often overlooked--stand as the "elephant in the room" in current leaderboard-driven research, limiting their economic practicability for real-world deployment and widespread adoption. To tackle this, we exploratively propose EllieSQL, a complexity-aware routing framework that assigns queries to suitable SQL generation pipelines based on estimated complexity. We investigate multiple routers to direct simple queries to efficient approaches while reserving computationally intensive methods for complex cases. Drawing from economics, we introduce the Token Elasticity of Performance (TEP) metric, capturing cost-efficiency by quantifying the responsiveness of performance gains relative to token investment in SQL generation. Experiments show that compared to always using the most advanced methods in our study, EllieSQL with the Qwen2.5-0.5B-DPO router reduces token use by over 40% without compromising performance on Bird development set, achieving more than a 2x boost in TEP over non-routing approaches. This not only advances the pursuit of cost-efficient Text-to-SQL but also invites the community to weigh resource efficiency alongside performance, contributing to progress in sustainable Text-to-SQL. Our source code and model are available at https://elliesql.github.io/.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。