Abstract
Large Language Models (LLMs) are pivotal in advancing natural language processing but often struggle with complex reasoning tasks due to inefficient attention distributions. In this paper, we explore the effect of increased computed tokens on LLM performance and introduce a novel method for extending computed tokens in the Chain-of-Thought (CoT) process, utilizing attention mechanism optimization. By fine-tuning an LLM on a domain-specific, highly structured dataset, we analyze attention patterns across layers, identifying inefficiencies caused by non-semantic tokens with outlier high attention scores. To address this, we propose an algorithm that emulates early layer attention patterns across downstream layers to re-balance skewed attention distributions and enhance knowledge abstraction. Our findings demonstrate that our approach not only facilitates a deeper understanding of the internal dynamics of LLMs but also significantly improves their reasoning capabilities, particularly in non-STEM domains. Our study lays the groundwork for further innovations in LLM design, aiming to create more powerful, versatile, and responsible models capable of tackling a broad range of real-world applications.
Introduction
While Chain-of-Thought (CoT) prompting has significantly enhanced the reasoning capabilities of Large Language Models (LLMs), the underlying mechanics of why these intermediate steps improve performance remain partially understood. A critical bottleneck identified in current transformer architectures is inefficient attention distribution. As information processes through deeper layers, the model's attention often becomes "distracted" by high-frequency, non-semantic tokens—such as "the," "is," or newline characters—which act as "attention sinks." These anchor tokens absorb the computational budget that should ideally be allocated to semantically rich tokens from previous reasoning steps, leading to truncated logic or incoherent conclusions.
Methodology
To address the attention skew, we introduce a training-free Attention Optimization Algorithm. This method is designed to preserve the fine-grained semantic focus found in early layers and propagate it through the deeper layers of the network.
The approach involves several key components:
- Diagnostic Fine-tuning: A LLaMA 7B model was fine-tuned on a structured multi-turn conversation dataset to facilitate a cleaner analysis of internal attention maps.
- Attention Amplification: The algorithm amplifies attention scores in downstream layers based on patterns observed in early layers, where attention is naturally more semantic and less concentrated on anchor tokens.
-
Layer-wise Weight Decay: To maintain model stability, a moderating weight decay factor is applied: $$A_l(i, j) = A_l(i, j) + A_l(i, j) \cdot (1 - \frac{l}{h}) \cdot M_t(i, j)$$ where $l$ is the current layer and $h$ is the maximum layer. This ensures the intervention is most prominent in the middle layers and tapers off toward the output.
-
Regularization: Dropout (0.1) was applied to the attention output projection layer during fine-tuning to discourage over-reliance on outlier tokens.
Key Insights: The "Anchor Token" Trap
Our analysis reveals that high-frequency tokens act as outliers that skew the attention mechanism in deeper layers. This suggests that LLMs tend to "forget" nuanced semantic relationships established in early layers as they move toward the final output.
Interestingly, middle layers (layers 4–8) showed significant resilience; non-anchor tokens could be zeroed out or attention steps skipped without a total collapse in performance. This implies these layers primarily serve to carry information rather than generate novel insights. Conversely, modifications to the first two layers led to immediate performance failure, confirming their role as essential information integrators.
Experimental Results
The proposed method was evaluated across several benchmarks, including MMLU, PIQA (Physical Interaction QA), and SIQA (Social Interaction QA).
- Performance Gains: The LLaMA-13B model demonstrated notable improvements, with PIQA accuracy increasing by approximately 5% and SIQA by 2% compared to standard zero-shot CoT. In specific configurations, the method outperformed baselines by nearly 15 percentage points in physical commonsense tasks.
- Extended Reasoning: By mitigating the attention skew, the model naturally generated longer response chains. These additional "computed tokens" correlated directly with improved logical coherence and accuracy, particularly in non-STEM fields like medicine and the humanities.
- Domain Specificity: The algorithm was particularly effective at correcting flawed knowledge representations in social and physical reasoning tasks.
Discussion and Limitations
Despite the successes in commonsense reasoning, the method faced challenges in STEM categories. Longer reasoning chains in mathematics and science can amplify error propagation if the base model's underlying logic is insufficient. Additionally, a slight drop (~3%) in pure memory recall was observed, as the model occasionally "over-thinks" simple factual questions.
Future work will explore "ghost attention" mechanisms to improve computational efficiency and hybrid training approaches to balance reasoning gains with factual recall. This study provides a foundational step toward more robust and logically sound LLM architectures.
Summary updated