🤖 AI Summary
This work investigates the internal mechanisms underlying arithmetic reasoning in large language models (LLMs) under single-step chain-of-thought (CoT) prompting.
Method: We propose and validate the hypothesis that LLMs generalize via implicit learning of algebraic structures—such as commutativity and identity properties—without requiring explicitly annotated multi-step reasoning data. We establish the first theoretical framework grounded in algebraic invariance, formally proving that Transformer embeddings remain invariant under input permutation and identity-element augmentation. Using a custom arithmetic dataset and empirical analysis under weight-bias constraints, we verify this invariance.
Contribution/Results: Our analysis demonstrates that LLMs implicitly acquire algebraic structure and generalize to unseen arithmetic problems. Parameter configurations guided by our theory significantly improve single-step arithmetic accuracy. This work provides the first provably grounded, algebraic-invariance-based explanation for LLMs’ arithmetic capabilities.
📝 Abstract
The reasoning abilities of large language models (LLMs) have improved with chain-of-thought (CoT) prompting, allowing models to solve complex tasks stepwise. However, training CoT capabilities requires detailed reasoning data, which is often scarce. The self-taught reasoner (STaR) framework addresses this by using reinforcement learning to automatically generate reasoning steps, reducing reliance on human-labeled data. Although STaR and its variants have demonstrated empirical success, a theoretical foundation explaining these improvements is lacking. Large language models (LLMs) have demonstrated remarkable mathematical capabilities, largely driven by chain-of-thought (CoT) prompting, which decomposes complex reasoning into step-by-step solutions. However, the mechanisms underlying LLMs' ability to perform arithmetic in a single step of CoT remain poorly understood. In this work, we propose that LLMs learn arithmetic by capturing algebraic structures, such as commutativity and identity properties. Since these structures are observable through input-output relationships, they can generalize to unseen data. We empirically demonstrate that LLMs can learn algebraic structures using a custom dataset of arithmetic problems, as well as providing theoretical evidence showing that, under specific configurations of weights and biases, the transformer-based LLMs can generate embeddings that remain invariant to both permutations of input tokens and the presence of identity elements. Our findings indicate that leveraging algebraic structures can enhance the LLMs' arithmetic capabilities, offering insights into improving their arithmetic performance.