Domain sql generation method and device based on large language model decoding intervention and readable storage medium
By constructing a vector library and a weighted scoring function, the accuracy and security issues of natural language to SQL conversion in the field of water supply networks were solved, enabling efficient and secure data querying.
CN122412450APending Publication Date: 2026-07-17SOYEA TECH
View PDF 0 Cites 0 Cited by
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SOYEA TECH
- Filing Date
- 2026-05-21
- Publication Date
- 2026-07-17
Smart Images

Figure CN122412450A_ABST
Abstract
本申请涉及一种基于大语言模型解码干预的领域SQL生成方法、设备及可读存储介质。该方法获取用户自然语言指令后,从DDL Schema和SQL Template双向量库中检索匹配的表结构与查询模板拼接为提示词,输入本地大模型解码。在模型解码阶段,拦截当前步候选Token及其原始概率分布,利用预设的加权评分函数对候选Token进行重排序,该函数综合评估了Token的大模型原始概率、与表结构的语义相似度、在查询模板中的词频以及安全约束得分。最后基于重排序的概率采样生成完整SQL语句。本发明深入大模型底层推理逻辑,结合滑动窗口子词拼接技术,有效抑制了模型幻觉,大幅提升了垂直领域NL2SQL转换的准确性与安全性。
Need to check novelty before this filing date? Find Prior Art