CLAIMay 8, 2025

Chain-of-Thought Tokens are Computer Program Variables

Peking U
arXiv:2505.04955v15 citationsh-index: 9Has Code
Originality Incremental advance
AI Analysis

This work provides incremental insights into the inner mechanisms of chain-of-thought reasoning for researchers in natural language processing and AI interpretability.

The paper investigates the role of chain-of-thought tokens in large language models on compositional tasks like multi-digit multiplication and dynamic programming, finding that preserving only tokens storing intermediate results achieves comparable performance and that these tokens function similarly to variables in computer programs.

Chain-of-thoughts (CoT) requires large language models (LLMs) to generate intermediate steps before reaching the final answer, and has been proven effective to help LLMs solve complex reasoning tasks. However, the inner mechanism of CoT still remains largely unclear. In this paper, we empirically study the role of CoT tokens in LLMs on two compositional tasks: multi-digit multiplication and dynamic programming. While CoT is essential for solving these problems, we find that preserving only tokens that store intermediate results would achieve comparable performance. Furthermore, we observe that storing intermediate results in an alternative latent form will not affect model performance. We also randomly intervene some values in CoT, and notice that subsequent CoT tokens and the final answer would change correspondingly. These findings suggest that CoT tokens may function like variables in computer programs but with potential drawbacks like unintended shortcuts and computational complexity limits between tokens. The code and data are available at https://github.com/solitaryzero/CoTs_are_Variables.

Code Implementations1 repo
Foundations

The foundational work for this paper's niche, ranked by how specifically the neighbourhood builds on it — not by global fame.

Your Notes