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)。