Abstract
Large language models make remarkable progress in reasoning capabilities. Existing works focus mainly on deductive reasoning tasks (e.g., code and math), while another type of reasoning mode that better aligns with human learning, inductive reasoning, is not well studied. We attribute the reason to the fact that obtaining high-quality process supervision data is challenging for inductive reasoning. Towards this end, we novelly employ number sequences as the source of inductive reasoning data. We package sequences into algorithmic problems to find the general term of each sequence through a code solution. In this way, we can verify whether the code solution holds for any term in the current sequence, and inject case-based supervision signals by using code unit tests. We build a sequence synthetic data pipeline and form a training dataset CodeSeq. Experimental results show that the models tuned with CodeSeq improve on both code and comprehensive reasoning benchmarks.
Introduction: The Challenge of Inductive Reasoning
While recent advancements in Large Language Models (LLMs)—such as OpenAI’s o1 and DeepSeek-R1—have demonstrated exceptional deductive reasoning skills, inductive reasoning remains a significant hurdle. Deductive reasoning involves applying established rules to reach conclusions, whereas inductive reasoning requires observing specific patterns to generalize a universal rule.
Current models frequently fail at simple tasks like predicting the next number in a sequence because they lack "process supervision." Unlike mathematical derivations where each step can be verified, the mental process of induction is open-ended and difficult to label as correct or incorrect.
Methodology: The CodeSeq Pipeline
To address the lack of high-quality inductive reasoning data, researchers developed CodeSeq. This novel synthetic dataset frames the search for a sequence's "general term" as a coding problem. By using code as a verifier, the system can automatically check if a model's induced rule holds true for any given term in a sequence.
The authors implemented a three-stage pipeline to generate this data:
- Sequence Data Filtering: Thousands of sequences were scraped from the Online Encyclopedia of Integer Sequences (OEIS). A "Working Agent" (DeepSeek-V3) filtered these to ensure they contained sufficient mathematical information for algorithmic conversion.
- Problem Generation & Validation: The sequences were transformed into programming challenges (e.g., "Write a Python function to find the $n$-th term"). A "Guiding Agent" (OpenAI o1-preview) validated these problems against known cases to ensure solvability.
- Case-based Supervision Injection: The Working Agent attempted to solve the problems in a Python sandbox. If the code failed unit tests, the Guiding Agent provided feedback for self-correction. This process captured "Chain-of-Thought" traces of failure, learning, and eventual success.
Experimental Results
The researchers fine-tuned LLaMA3-8B and Qwen2.5-7B using the resulting CodeSeq dataset (9,242 samples, 15.3M tokens). The results demonstrated that inductive reasoning is a "meta-skill" that transfers across domains:
- General Reasoning: LLaMA3-8B achieved a significant +8.82 point increase on the MMLU benchmark.
- Coding Proficiency: Qwen2.5-7B improved by +6.71 points on HumanEval.
- Inductive Mastery: In 5-shot next-number prediction, the CodeSeq-tuned Qwen2.5-7B performed on par with the much larger Claude 3.5 Sonnet.
- Ablation Success: The feedback loop provided by sandbox unit tests was found to be critical; without it, the synthetic data's effectiveness dropped significantly.
Insights and Future Directions
The core innovation of this work is using code as a proxy for intuition. While it is hard to verify a model's "hunch" about a pattern, code execution provides an objective ground truth. Furthermore, including "failure-to-success" traces in the training data teaches models how to refine their reasoning when their initial hypotheses are incorrect.
However, the scope is currently limited to numerical sequences. Future work could expand this methodology to visual patterns, linguistic structures, or scientific datasets. Additionally, as the pipeline relies on high-end "teacher" models, exploring how to surpass the reasoning limits of these teachers remains an open research question.
Summary updated