Saved in:
Bibliographic Details
Main Authors: Li, Junlong, Guo, Daya, Yang, Dejian, Xu, Runxin, Wu, Yu, He, Junxian
Format: Preprint
Published: 2025
Subjects:
Online Access:https://arxiv.org/abs/2502.07316
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866916748901482496
author Li, Junlong
Guo, Daya
Yang, Dejian
Xu, Runxin
Wu, Yu
He, Junxian
author_facet Li, Junlong
Guo, Daya
Yang, Dejian
Xu, Runxin
Wu, Yu
He, Junxian
contents 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.
format Preprint
id arxiv_https___arxiv_org_abs_2502_07316
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle CodeI/O: Condensing Reasoning Patterns via Code Input-Output Prediction
Li, Junlong
Guo, Daya
Yang, Dejian
Xu, Runxin
Wu, Yu
He, Junxian
Computation and Language
Artificial Intelligence
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.
title CodeI/O: Condensing Reasoning Patterns via Code Input-Output Prediction
topic Computation and Language
Artificial Intelligence
url https://arxiv.org/abs/2502.07316