ChatDB中NL2SQL的语法树约束解码优化方法及系统

By optimizing the syntax tree constraint decoding method of NL2SQL in ChatDB, and utilizing a fuzzy column name mapper and dynamic pruning strategy, the problem of decreased SQL generation accuracy caused by high recall rate in existing technologies is solved, and high-precision conversion is achieved in complex query scenarios.

CN122019580BActive Publication Date: 2026-07-17ZHEJIANG FULIN TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
ZHEJIANG FULIN TECH CO LTD
Filing Date
2026-04-13
Publication Date
2026-07-17

AI Technical Summary

Technical Problem

Existing technologies introduce a large amount of semantic noise when converting natural language into structured query language (SQL) in order to ensure high recall. This leads to a significant decrease in the accuracy of SQL generation in complex query scenarios. In particular, when dealing with queries containing complex logic such as nesting, the number of candidate field combinations explodes, resulting in the generation of illusory SQL with logical errors.

Method used

We adopt the syntax tree constraint decoding optimization method of NL2SQL in ChatDB, generate an initial candidate field set through a fuzzy column name mapper, and combine semantic confidence score and dynamic pruning threshold with a real-time pruning strategy to ensure high recall while improving generation accuracy.

Benefits of technology

While maintaining a high recall rate, it significantly improves the accuracy of complex SQL generation, avoids the generation of phantom SQL, ensures that the decoding process can continue under any circumstances, and enhances the system's fault tolerance and stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122019580B_ABST
    Figure CN122019580B_ABST
Patent Text Reader

Abstract

本发明涉及自然语言处理和数据库技术领域,具体为ChatDB中NL2SQL的语法树约束解码优化方法及系统,包括:S1、接收自然语言查询,并与数据库元数据进行匹配,生成初始候选字段集;S2、启动大型语言模型并采用预设的SQL语法树作为解码约束,当解码至待填充字段的语法树节点时,为初始候选字段集中的各候选字段计算语义置信度分数;S3、计算动态剪枝阈值;S4、生成精炼候选字段子集;S5、将精炼候选字段子集提供给大型语言模型,在SQL语法树的约束下完成当前节点的填充,解码直至生成完整的SQL查询语句;本发明解决了现有技术中高召回率与高精度之间的固有矛盾。
Need to check novelty before this filing date? Find Prior Art