不训练也能精准生成SQL,靠的是记忆纠错和多样分解。
Memo-SQL: Structured Decomposition and Experience-Driven Self-Correction for Training-Free NL2SQL
- 用三种策略分解问题,让每次推理路径不同。
- 在BIRD数据集上达68.5%执行准确率,超越零微调方法。
- 无需训练或调用接口,适合资源有限的部署场景。
现有NL2SQL系统存在两大缺陷:一是仅依赖正确示例进行上下文学习,忽视历史错误修正对自我纠错的指导价值;二是测试时扩展常随意分解问题,导致多次运行生成相同SQL,削弱集成效果。此外,这些方法普遍存在精度与效率的权衡:高性能需大量计算,快速版本则牺牲质量。本文提出Memo-SQL,一种无需训练的框架,通过结构化分解与经验感知自纠错解决上述问题。不依赖随机分解,采用实体级、层级式与原子序列三种明确策略,促进推理多样性。纠错环节构建动态记忆库,存储成功查询与历史错误-修复对,通过检索增强提示,在推理时将相关案例引入上下文,无需微调或外部API。在BIRD数据集上,Memo-SQL实现68.5%执行准确率,成为当前开放的零微调方法新基准,且资源消耗低于先前测试时扩展方法的十分之一。
原文摘要 · Abstract (English)
Existing NL2SQL systems face two critical limitations: (1) they rely on in-context learning with only correct examples, overlooking the rich signal in historical error-fix pairs that could guide more robust self-correction; and (2) test-time scaling approaches often decompose questions arbitrarily, producing near-identical SQL candidates across runs and diminishing ensemble gains. Moreover, these methods suffer from a stark accuracy-efficiency trade-off: high performance demands excessive computation, while fast variants compromise quality. We present Memo-SQL, a training-free framework that addresses these issues through two simple ideas: structured decomposition and experience-aware self-correction. Instead of leaving decomposition to chance, we apply three clear strategies, entity-wise, hierarchical, and atomic sequential, to encourage diverse reasoning. For correction, we build a dynamic memory of both successful queries and historical error-fix pairs, and use retrieval-augmented prompting to bring relevant examples into context at inference time, no fine-tuning or external APIs required. On BIRD, Memo-SQL achieves 68.5% execution accuracy, setting a new state of the art among open, zero-fine-tuning methods, while using over 10 times fewer resources than prior TTS approaches.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。