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

Junlong Li, Daya Guo, Dejian Yang, Runxin Xu, Yu Wu +1 more
2/14/2026

No official code found. Best implementation: hkust-nlp/CodeIO (572 stars, last commit 2025-05-06).

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.

View on arXivView PDF

Code Implementations(1)

hkust-nlp/CodeIOCommunity76%

[ICML 2025 Oral] CodeI/O: Condensing Reasoning Patterns via Code Input-Output Prediction

57234Shell, PythonFeb 8, 20251 years ago

Similar Papers

Cite this paper

@article{li2026codeio,
  title  = {CodeI/O: Condensing Reasoning Patterns via Code Input-Output Prediction},
  author = {Junlong Li and Daya Guo and Dejian Yang and Runxin Xu and Yu Wu and Junxian He},
  year   = {2026},
  eprint = {2502.07316},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2502.07316},
  journal = {ICML 2025 2025}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2502.07316.svg)](https://codeofpaper.com/paper/2502.07316)

Discussion