用知识图谱增强代码思维链,提升数学推理与编程准确性。
KG-Augmented Executable CoT for Mathematical Coding
- 构建结构化任务图,结合知识图谱检索数学库知识。
- 在多个基准上准确率提升6至10个百分点。
- 适合需要高精度数学推理与可验证代码的场景。
近年来,大语言模型在自然语言处理任务中表现优异,但在数学推理和代码生成等复杂推理任务中仍面临挑战。为此,我们提出一种新型框架KGA-ECoT,通过知识图谱增强代码思维链,提升代码生成能力,并借助可执行代码改善数学推理。KGA-ECoT将问题分解为结构化任务图,利用高效的GraphRAG从数学库中精准检索知识,并生成可验证的代码以确保计算正确性。在多个数学推理基准上的评估表明,KGA-ECoT显著优于现有提示方法,绝对准确率提升达数个百分点至超过10个百分点。进一步分析证实,GraphRAG在提升代码质量方面起关键作用,外部代码执行则保障了推理精度。这些发现共同确立了KGA-ECoT在复杂数学推理任务中的强健性与高度泛化能力。
原文摘要 · Abstract (English)
In recent years, large language models (LLMs) have excelled in natural language processing tasks but face significant challenges in complex reasoning tasks such as mathematical reasoning and code generation. To address these limitations, we propose KG-Augmented Executable Chain-of-Thought (KGA-ECoT), a novel framework that enhances code generation through knowledge graphs and improves mathematical reasoning via executable code. KGA-ECoT decomposes problems into a Structured Task Graph, leverages efficient GraphRAG for precise knowledge retrieval from mathematical libraries, and generates verifiable code to ensure computational accuracy. Evaluations on multiple mathematical reasoning benchmarks demonstrate that KGA-ECoT significantly outperforms existing prompting methods, achieving absolute accuracy improvements ranging from several to over ten percentage points. Further analysis confirms the critical roles of GraphRAG in enhancing code quality and external code execution in ensuring precision. These findings collectively establish KGA-ECoT as a robust and highly generalizable framework for complex mathematical reasoning tasks.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。