RAS: 基于上下文学习的反射增强缩放用于可执行Cypher查询生成
RAS: Reflection-Augmented Scaling with In-Context Learning for Executable Cypher Query Generation
AI总结:
提出反射增强缩放(RAS)方法,利用执行错误反馈进行上下文学习,在Text2Cypher任务中显著降低查询执行错误率。
摘要:
推理时缩放可以减少结构化查询生成中的错误,但为查询代码生成分配计算资源的方法仍未充分探索。我们研究Text2Cypher,其中语言模型生成针对属性图数据库执行的Cypher查询。不可执行查询构成了与语义不准确性不同的独特语法失败:语法错误会触发数据库生成的系统错误消息。这些错误消息通常在推理时被丢弃,而不是通过上下文学习(ICL)加以利用。我们比较了两种推理方法:独立缩放(IS),执行无记忆重采样;以及反射增强缩放(RAS),通过ICL使每次新尝试基于先前的执行反馈。在三个Neo4j数据集和五个代码专用语言模型上,RAS在n=5时将查询执行错误率降低了41-50%,优于IS的32-38%。执行错误不仅仅是需要丢弃的失败,而是可操作的反馈,围绕它们组织推理时计算是实现可执行性比缩放独立样本更高效的途径。
英文摘要:
Inference-time scaling can reduce errors in structured query generation, but methods to allocate the compute for query code generation remains underexplored. We study Text2Cypher, where language models generate Cypher queries that execute against property graph databases. Non-executable queries constitute a distinct syntactic failure separate from semantic inaccuracy: a syntax error triggers a system-generated error message from the database. These error messages are typically discarded at inference time rather than leveraged through in-context learning (ICL). We compare two inference methods: Independent Scaling (IS), which performs memoryless resampling, and Reflection-Augmented Scaling (RAS), which conditions each new attempt on prior execution feedback via ICL. Across three Neo4j datasets and five code-specialized language models, RAS reduces the Query Execution Error Rate by 41--50% at n{=}5, outperforming IS at 32--38%. Execution errors are not merely failures to discard but actionable feedback, and structuring inference-time compute around them is a more efficient path to executability than scaling independent samples.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。