cs.LGNov 4, 2026

Understanding the Out-of-Distribution Generalization of Chain-of-Thought Reasoning in LLMs

Authors: Nuo-Jing Liang, Xiao-Tong Yuan, Pan Zhou

Organizations: School of Intelligence Science and Technology, Nanjing University · Singapore Management University

Abstract

Chain-of-Thought (CoT) reasoning substantially improves Large Language Models (LLMs), yet its out-of-distribution (OOD) generalization mechanism remains theoretically underexplored. We study CoT as compositional OOD generalization: the target task lacks complete reasoning trajectories or direct input-output pairs, while training provides only in-distribution (ID) atomic step data. We show that CoT generalizes by repeatedly applying a shared single-step predictor to compose reusable ID transitions. Theoretically, let TT denote the number of reasoning steps in the target task, nn the number of training samples per sub-task, and kk the number of output tokens per step; then the OOD task risk is controlled by the sum of the ID sub-task risks, scaled by a coefficient of order O(k)\mathcal{O}(k) that is independent of TT, although the summed risk itself may still grow with TT. A Rademacher-complexity analysis further shows that the estimation term is of order O(T/n)\mathcal{O}(\sqrt{T/n}), rather than linear in TT, due to predictor sharing under a uniform capacity control on the shared class. For autoregressive Next-Token Prediction, the final-task risk is bounded by the best-in-class step-level risk scaled by the same coefficient of order O(k)\mathcal{O}(k), plus an estimation term of order O~(kT/n)\widetilde{\mathcal{O}}\big(k\sqrt{T/n}\big). A parity-coupled construction further shows that, for the sub-task empirical risk minimizer, the expected final-task risk is at least the best in-class risk plus Ω(T/n)Ω(\sqrt{T/n}) when T≤nT\le n. Experiments on Atom-Task and GSM8K support the theory: CoT enables short-to-long and compositional generalization, while explicit state tracking is crucial. Our code is available at https://github.com/maxliang114514/CoT-OOD.

Figures & tables

Appendix figures & tables2 assets

Supplementary material from the paper’s appendix.

Appendix

Explore similar work

CardsList
  1. Learning Composable Chains-of-Thought

    May 28, 2025Fangcong Yin, Zeyu Leo Liu, Liu Leqi +2LLM Fine-TuningCoT Reasoning

  2. On the Out-of-Distribution Generalization of Reasoning in Multimodal LLMs for Simple Visual Planning Tasks

    Feb 17, 2026Yannic Neuhaus, Nicolas Flammarion, Matthias Hein +1OOD GeneralizationMultimodal Reasoning

  3. Tool Use Reduces Depth-Induced Collapse in OOD Reasoning

    Feb 24, 2026David Koplow, Tomer Galanti, Tomaso PoggioOOD GeneralizationLLM Tool Use