LLM as Effective Streaming Processor: Bridging Streaming-Batch Mismatches with Group Position Encoding

Junlong Tong, Jinlan Fu, Zixuan Lin, Yingqi Fan, Anhao Zhao, Hui Su, Xiaoyu Shen

Introduction

Large Language Models (LLMs) have demonstrated remarkable capabilities in batch-processing tasks, where the entire input sequence is available at once. However, real-world applications such as live translation and simultaneous speech recognition demand streaming capabilities, where data arrives incrementally. Transitioning batch-trained LLMs to streaming environments typically results in significant performance degradation due to fundamental architectural mismatches. This paper introduces Group Position Encoding (GPE), a method that bridges the gap between batch and streaming processing, enabling standard LLMs to outperform specialized streaming architectures while achieving up to an 11x increase in throughput.

The Streaming-Batch Mismatch

The transition from batch processing to streaming introduces three primary "mismatches" that hinder LLM performance:

  1. Input-Attention Mismatch: In standard batch training, source tokens are processed together and do not attend to target tokens. In naive streaming implementations, source tokens may inadvertently attend to previously generated target tokens, disrupting the model's internal representations.
  2. Output-Attention Mismatch: During streaming, tokens are generated based on a partial input stream. This differs from batch mode, where the model often has access to the full context of the source sentence.
  3. Position-ID Mismatch: As tokens arrive incrementally, the absolute position IDs (e.g., 0, 1, 2...) assigned during streaming often fail to align with the sequence structures the model encountered during training.

Historically, researchers have addressed the Position-ID mismatch through "re-encoding"—re-processing the entire KV cache every time new data arrives to ensure IDs remain sequential. This paper identifies re-encoding as a computationally expensive process that addresses a largely misunderstood problem.

Group Position Encoding (GPE)

The authors propose that the "positional confusion" often cited in streaming failures is secondary to the stability of relative distances between tokens. Since modern LLMs utilize Rotary Positional Encoding (RoPE), they are inherently more sensitive to the relative distance between tokens than to their absolute position IDs.

GPE leverages this insight by organizing tokens into two independent groups:

  • Source Group: Position IDs start at 0 and increase monotonically as input arrives.
  • Target Group: Position IDs start from a predefined offset ($\phi$) and increase monotonically as tokens are generated.

By maintaining these distinct groups, GPE ensures that the internal relative distances within the source and target remain consistent with the model's training logic. This allows the model to skip the "re-encoding" step entirely, as the KV cache remains valid even as the stream progresses.

Experimental Evaluation

The researchers evaluated GPE across two demanding streaming domains:

  • Text-to-Text Translation: Utilizing the IWSLT-17 dataset for English-French and English-German pairs.
  • Speech-to-Text (ASR): Utilizing the LibriSpeech (test-clean) dataset.

The method was applied to several prominent open-weights models, including Gemma2-2B, Phi3-Mini, and Llama3.1-8B. The models were fine-tuned using a "wait-k" policy, where the model waits for $k$ source tokens before beginning generation.

Key Insights and Results

The study yielded several critical findings that challenge prevailing assumptions in the field:

The Re-encoding Myth

One of the most significant contributions of this work is the discovery that re-encoding the KV cache provides negligible performance benefits. The computational overhead traditionally spent on "fixing" position IDs does not translate to higher accuracy. Instead, the primary cause of performance degradation is the Input-Attention Mismatch. Once the model is prevented from allowing source tokens to attend to target tokens via proper masking, performance stabilizes.

Efficiency and Throughput

By removing the requirement for re-encoding, GPE facilitates a massive leap in efficiency. The authors report a 5.9x to 11.3x increase in throughput compared to traditional re-encoding methods. This allows standard LLMs to operate in real-time environments with minimal latency.

Accuracy and Robustness

Models equipped with GPE consistently outperformed specialized decoder-only streaming baselines, such as CAAT and SimulMask, in both BLEU scores (for translation) and Word Error Rate (WER) for speech recognition. Furthermore, the models proved robust to the specific value of the target offset ($\phi$); as long as the internal ordering of the target group was preserved, the absolute starting ID had little impact on performance.

Conclusion

Group Position Encoding demonstrates that standard LLMs are far more capable of streaming tasks than previously thought. By focusing on relative token distances rather than absolute positions and addressing attention mismatches, GPE allows batch-trained models to function as highly efficient streaming processors. This approach not only improves accuracy but also drastically reduces the computational cost of real-time inference, paving the way for universal LLM processors that handle both batch and streaming workloads with equal proficiency.

Summary updated

BibTeX
@inproceedings{tong2025llm,
  author = {Junlong Tong and Jinlan Fu and Zixuan Lin and Yingqi Fan and Anhao Zhao and Hui Su and Xiaoyu Shen},
  title = {{LLM as Effective Streaming Processor: Bridging Streaming-Batch Mismatches with Group Position Encoding}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2025},
}
Figure