DynaPipe: Dynamic Layer Redistribution for Efficient Serving of LLMs with Pipeline Parallelism

HongXin Xu, Tianyu Guo, Xianwei ZhangNeurIPS 2025

TL;DR

DynaPipe is a new framework that eliminates "pipeline bubbles" in LLM serving by dynamically redistributing model layers across GPUs in real-time. By accounting for the often-ignored computational overhead of token sampling at the final stage, DynaPipe reduces end-to-end latency by 8% to 49% compared to state-of-the-art systems.

What Problem Does This Paper Address?

When serving Large Language Models (LLMs) across multiple GPUs, engineers often use Pipeline Parallelism (PP). This involves splitting the model's layers into sequential "stages" and assigning each stage to a different device. Traditionally, these layers are distributed evenly (e.g., a 60-layer model on 4 GPUs gets 15 layers per GPU).

However, this "even" split creates a hidden bottleneck. While the first few GPUs only perform forward-pass computations, the final GPU in the chain has an extra job: sampling. It must calculate logits and select the next token, a process that adds significant latency. Because each step in autoregressive generation depends on the previous token, the upstream GPUs end up idling while waiting for the final stage to finish sampling. This idle time—known as a pipeline bubble—wastes expensive hardware resources and slows down response times.

Comparison of even vs. uneven layer assignment showing how uneven distribution reduces pipeline bubbles.

Methods

To address this pipeline misalignment, the authors introduce DynaPipe. DynaPipe moves away from static layer assignments in favor of a three-part dynamic system designed to balance computational load on the fly:

Overview of the DynaPipe architecture featuring the Execution Time Predictor, Bubble-Aware Scheduler, and Migration Coordinator.
  1. Execution Time Predictor: A lightweight model that predicts the latency of a single layer's forward pass and the sampling operation in real-time. It uses variables like the number of tokens in a batch and the current sequence length to provide accurate estimates.
  2. Bubble-Aware Scheduler: This component monitors the predicted workload. If it detects that the final stage is becoming a bottleneck due to high sampling demand, it triggers a redistribution. It might move 2 or 3 layers from the final GPU to earlier, less-burdened GPUs to balance the "time-per-stage." To prevent constant "flickering" between configurations, it uses a stability window—only changing the layout if the imbalance persists.
  3. Migration Coordinator: This is the technical "heavy lifter." Moving layers during active inference is usually slow because you have to move the KV cache (the memory of previous tokens). DynaPipe uses an asynchronous migration mechanism via NCCL that transfers the cache in the background while the GPUs continue processing other layers, ensuring the pipeline never actually stalls during a transition.

Datasets

The system was evaluated using two primary real-world datasets:

  • ShareGPT: A dataset of real user conversations with ChatGPT, representing typical chatbot workloads.
  • Azure-Conv: A production dataset from Microsoft Azure featuring dialogue services, characterized by longer input sequences relative to outputs.
  • Synthetic Data: Used to test specific "Output-to-Input" (O:I) ratios to see how the system handles varying lengths of generated text.

Key Insights and Ideas

  • Sampling is not "free": The authors found that, on average, the sampling operation at the end of a pipeline takes as much time as 3.09x the forward pass of a single transformer layer. Ignoring this in a 4-GPU setup is like forcing one person to do 20% more work than everyone else in an assembly line.
  • The "Perfect" Split is a Moving Target: Because the ratio of "prefill" (processing the prompt) to "decoding" (generating new tokens) changes with every request, a static layer distribution is mathematically guaranteed to be suboptimal most of the time.
  • Asynchronous Migration is Viable: The most surprising insight is that the overhead of moving layers (specifically the KV cache) can be almost entirely hidden by overlapping communication with the computation of unaffected layers.

Key Results

DynaPipe was tested against heavyweights like vLLM, SGLang, and gLLM using Qwen2.5 models (14B and 32B parameters):

  • Latency Reduction: DynaPipe reduced average end-to-end request latency by 8% to 49% across various workloads.
  • Throughput & SLOs: It significantly improved Service Level Objective (SLO) attainment. For a 90% SLO target, DynaPipe could handle up to 19% higher request rates than gLLM.
  • Scalability: The system maintained its performance gains even in multi-node settings where network latency is higher, proving the robustness of the migration coordinator.

Limitations and Future Work

While DynaPipe is a major step forward, the authors note a few trade-offs:

  • Memory Overhead: To allow for rapid redistribution, each GPU must "pre-load" the weights of layers it might eventually take over. This consumes roughly 7.5% extra GPU memory, which could be tight on memory-constrained hardware.
  • Migration Fluctuations: While mostly hidden, KV cache migration can cause minor, local performance jitters during the actual transfer.
  • Future Directions: The authors suggest exploring weight offloading (moving weights to CPU RAM when not in use) to solve the memory overhead and integrating vocabulary parallelism to further optimize the sampling bottleneck.

Summary updated

BibTeX
@inproceedings{xu2025dynapipe,
  author = {HongXin Xu and Tianyu Guo and Xianwei Zhang},
  title = {{DynaPipe: Dynamic Layer Redistribution for Efficient Serving of LLMs with Pipeline Parallelism}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=D6w7wIN360},
}
Figure