TensorX
返回文献探索

Paper · arXiv 2502.07316

CodeI/O: Condensing Reasoning Patterns via Code Input-Output Prediction

Junlong Li, Daya Guo, Dejian Yang, Runxin Xu, Yu Wu, Junxian He

50 upvotesFebruary 11, 2025arXiv 预印本
AI 摘要

CodeI/O transforms code into a code input-output prediction format to train models on universal reasoning primitives and improve performance across various reasoning tasks through CoT rationales and multi-turn revision.

CodeI/OChain-of-Thoughtlogic flow planningstate-space searchingdecision tree traversalmodular decompositionCoT rationalesmulti-turn revisionCodeI/O++

Abstract

Reasoning is a fundamental capability of Large Language Models. While prior research predominantly focuses on enhancing narrow skills like math or code generation, improving performance on many other reasoning tasks remains challenging due to sparse and fragmented training data. To address this issue, we propose CodeI/O, a novel approach that systematically condenses diverse reasoning patterns inherently embedded in contextually-grounded codes, through transforming the original code into a code input-output prediction format. By training models to predict inputs/outputs given code and test cases entirely in natural language as Chain-of-Thought (CoT) rationales, we expose them to universal reasoning primitives -- like logic flow planning, state-space searching, decision tree traversal, and modular decomposition -- while decoupling structured reasoning from code-specific syntax and preserving procedural rigor. Experimental results demonstrate CodeI/O leads to consistent improvements across symbolic, scientific, logic, math & numerical, and commonsense reasoning tasks. By matching the existing ground-truth outputs or re-executing the code with predicted inputs, we can verify each prediction and further enhance the CoTs through multi-turn revision, resulting in CodeI/O++ and achieving higher performance. Our data and models are available at https://github.com/hkust-nlp/CodeIO.

北京市昌平区探索星信息技术及软件开发工作室

京ICP备2026059466号
CodeI/O: Condensing Reasoning Patterns via Code Input-Output Prediction | TensorX