The reasoning capabilities of Large Language Models (LLMs) play a pivotal role in the realm of embodied artificial intelligence. Although there are effective methods like program-of-thought prompting for LLMs which uses programming language to tackle complex reasoning tasks, the specific impact of code data on the improvement of reasoning capabilities remains under-explored. To address this gap, we propose complexity-impacted reasoning score (CIRS), which combines structural and logical attributes, to measure the correlation between code and reasoning abilities. Specifically, we use the abstract syntax tree to encode the structural information and calculate logical complexity by considering the difficulty and the cyclomatic complexity. Through an empirical analysis, we find not all code data of complexity can be learned or understood by LLMs. Optimal level of complexity is critical to the improvement of reasoning abilities by program-aided prompting. Then we design an auto-synthesizing and stratifying algorithm, and apply it to instruction generation for mathematical reasoning and code data filtering for code generation tasks. Extensive results demonstrates the effectiveness of our proposed approach. Code will be integrated into the EasyInstruct framework at https://github.com/zjunlp/EasyInstruct.
翻译:大型语言模型(LLMs)的推理能力在具身人工智能领域发挥着关键作用。尽管存在有效的思维链编程提示等方法,通过编程语言处理复杂推理任务,但代码数据对推理能力提升的具体影响仍未被充分探索。为解决这一空白,我们提出复杂度影响推理评分(CIRS),该评分结合结构与逻辑属性,用于衡量代码与推理能力之间的相关性。具体而言,我们利用抽象语法树编码结构信息,并通过考虑难度与圈复杂度来计算逻辑复杂度。实证分析发现,并非所有复杂度等级的代码数据都能被LLMs学习或理解,最优复杂度水平对通过程序辅助提示提升推理能力至关重要。基于此,我们设计了一种自动合成与分层算法,并将其应用于数学推理的指令生成与代码生成的代码数据过滤任务。大量实验表明,所提方法具有显著有效性。代码将集成至EasyInstruct框架中,链接为https://github.com/zjunlp/EasyInstruct。