TL;DR
While modern Large Language Models (LLMs) boast massive context windows, they frequently fail at precision-critical tasks involving long numerical sequences due to "attention dispersion." To solve this, SepSeq introduces a training-free, plug-and-play input formatting technique that strategically inserts separator tokens (like newlines) to act as attention sinks. This simple adjustment yields an average relative accuracy improvement of 35.6% across nine major LLMs while simultaneously reducing inference token consumption by 16.4%.
What Problem Does This Paper Address?
Despite supporting context windows spanning hundreds of thousands of tokens, LLMs remain notoriously unreliable when processing long sequences of numbers (e.g., financial tickers, sensor logs, or binary strings). Unlike natural language, numerical data lacks semantic redundancy—missing or misattending to a single digit can completely invalidate the final answer.
The authors identify the root cause as attention dispersion inherent in the standard Softmax attention mechanism. As an input sequence grows longer, the Softmax normalization denominator accumulates contributions from a vast number of locally similar, semantically lightweight tokens. This dilutes the model's attention mass, making it incredibly difficult to maintain focused access to specific values or local spans. Even advanced strategies like tool-use or Program-of-Thought (PoT) prompting fall short because the model fails at the very first step: faithfully preserving and transcribing the raw numerical sequence.
Methods
The authors propose Separate Sequence (SepSeq), a training-free, inference-time input formatting framework.
Instead of using standard delimiters like spaces or commas ($\tau_{sp}$) to separate numbers, SepSeq replaces them with a specific separator token ($\tau_{sep}$), such as a newline character (\n), at regular intervals (every $k$ tokens). This partitions an intractable long sequence into shorter, cleanly bounded segments without adding any overhead to the total token length.
Mechanistically, these inserted separators leverage an architectural quirk of LLMs: certain special tokens naturally act as attention sinks. Because the newline token strongly attracts attention from subsequent context, it inflates the Softmax denominator for cross-segment tokens. This mathematically suppresses distant, irrelevant context and forces the model's attention heads to focus on localized segments while still preserving global context.
Datasets
The framework was rigorously evaluated across two primary datasets containing 200 samples per task:
- Synthetic Dataset ($\mathcal{D}_{syn}$): Comprises 1,200 samples across six precision-critical tasks:
max-int,min-int,max-float,min-float,indexing(finding the position of the last '1' in a binary sequence), andcounting(counting total '1's). Sequences are divided into short (2–32), medium (33–128), large (129–256), and extra-large (256–512) lengths. - Real Dataset ($\mathcal{D}_{real}$): Comprises 800 samples across four practical domains:
number-string(counting numerals in alphanumeric strings),number-list(logical reasoning over lists),stock(analyzing financial time-series data), andweather(analyzing meteorological data).
Key Insights and Ideas
- Separators as Attention Anchors: Both theoretical derivation and empirical visualization confirm that newline tokens act as prominent attention sinks across model layers and heads. By absorbing excess attention mass, they mitigate cross-segment interference.
- Formatting Beats More Reasoning: Surprisingly, popular prompting techniques like Chain-of-Thought (CoT) and In-Context Learning (ICL) actually degraded performance on vanilla numerical sequences. This proves the bottleneck isn't the model's downstream reasoning capability, but rather its upstream perceptual capacity to parse long sequences.
- The "Repetition Loop" Cure: Typically, accuracy-boosting prompts increase token overhead. SepSeq bucked this trend by reducing token consumption by 16.4%. When LLMs lose track of long numerical sequences, they frequently fall into hallucination or infinite repetition loops. By keeping attention localized, SepSeq ensures concise, precise answers.
Key Results
- Substantial Accuracy Boosts: Across 9 diverse LLMs (including Qwen3, DeepSeek-V3/R1, GPT-4o, and Claude 3.7 Sonnet), SepSeq achieved an average relative accuracy gain of 35.6%.
- Real-World Impact: The performance leap was most pronounced in complex real-world tasks, showing a +100.0% relative accuracy surge on
stockdata and +60.9% onweatherdata. - Complementary to Tool Use: When combined with Program-of-Thought (PoT) prompting, SepSeq boosted average accuracy from 78.90% to 84.45%, proving that it successfully resolves the fragile transcription bottleneck that often breaks code-generation pipelines.
- Hyperparameter Robustness: The framework is highly stable; performance gains saturate rapidly once a minimal segmentation frequency is met ($k \ge 8$), meaning engineers don't need to meticulously tune the segment length.
Limitations and Future Work
- Scale Dependence: SepSeq's effectiveness is closely tied to model capacity. For very small models (e.g., Qwen3-0.6B), the framework actually caused performance degradation. The benefits only become robust beyond the 4B parameter threshold, suggesting that a model requires a baseline level of emergent cognitive capability to interpret the implicit structural guidance of the separators.
- Separator Sensitivity: The optimal separator token shifts based on task complexity. While novel or unconventional separators like backslashes (
\\) worked well for simple synthetic tasks, standard Line Feeds (\n) were superior for complex real-world datasets due to their prevalence in the models' original training data.
Summary updated