Papers
Topics
Authors
Recent
Gemini 2.5 Flash
Gemini 2.5 Flash 100 tok/s
Gemini 2.5 Pro 58 tok/s Pro
GPT-5 Medium 29 tok/s
GPT-5 High 29 tok/s Pro
GPT-4o 103 tok/s
GPT OSS 120B 480 tok/s Pro
Kimi K2 215 tok/s Pro
2000 character limit reached

Dynamic Sequence Parallelism (DSP)

Updated 3 September 2025
  • Dynamic Sequence Parallelism (DSP) is a parallelization methodology that dynamically adapts to workload and hardware heterogeneity in both HPC and large-scale machine learning.
  • DSP employs techniques like dynamic partitioning, multi-dimensional switching, and runtime auto-tuning to optimize resource use and minimize communication overhead.
  • DSP significantly improves throughput and scalability in distributed training by addressing irregular and long-tail sequence workloads.

Dynamic Sequence Parallelism (DSP) is a class of parallelization methodologies and system abstractions that extend traditional sequence parallelism to dynamically adapt to workload and hardware heterogeneity across both classic high-performance computing and modern large-scale machine learning. The DSP paradigm encompasses a rich variety of techniques that address the challenges posed by irregular, multi-dimensional, and long-tail sequence workloads, enabling high throughput, lower communication overhead, and improved scalability for distributed training and computation.

1. Fundamental Principles and Definitions

Dynamic Sequence Parallelism generalizes static sequence parallelism by leveraging runtime information—such as workload characteristics, sequence length variability, or computational patterns—to make fine-grained, data-driven decisions about how to partition and distribute sequence data or tasks across computational resources.

Key principles of DSP include:

  • Dynamic partitioning of sequences: Rather than partitioning sequences statically along a single dimension, DSP dynamically determines how to split and assign sequence chunks or tasks based on current execution context or workload heterogeneity (Zhao et al., 15 Mar 2024, Wang et al., 2 Dec 2024).
  • Flexible switching of parallel dimensions: In multi-dimensional transformer architectures or other tensorized computations, DSP selects the most communication- and computation-efficient dimension(s) for parallelization at each stage, enabling efficient scaling (Zhao et al., 15 Mar 2024, Gu et al., 26 Jun 2024).
  • Auto-tuning at runtime: DSP integrates decision functions or optimization routines—ranging from heuristics to MILP solvers—to adapt partitioning, grouping, and resource allocation on-the-fly (Jackson et al., 2012, Wang et al., 2 Dec 2024).
  • Minimized global communication: By choosing optimal data layouts and communication patterns, DSP reduces total data movement across devices, often by resharding minimal times with AlltoAll or similar collectives (Zhao et al., 15 Mar 2024, Fang et al., 13 May 2024, Zou et al., 28 May 2025).

DSP subsumes and extends prior approaches by integrating dynamic adaptation, multi-dimensional flexibility, and heterogeneous workload and resource consideration.

2. Algorithms and System Designs

The DSP paradigm is instantiated through diverse algorithms and system architectures, including:

a) Dynamic Decision Functions and Profiling

  • DSP in traditional nested loop and task codes (e.g., in shared-memory programming) utilizes source-to-source compilation to generate serial and parallel variants, with a runtime library making execution choices using workload-dependent heuristics or online profiling of execution time (Jackson et al., 2012). Profiling enables selection of the fastest path dynamically, significantly outperforming static OpenMP "if" clauses.

b) Adaptive Scattering and Group Assignment

  • In large-scale training of LLMs, DSP employs MILP-based optimization to partition sequences into groups, adapting the sequence-parallel degree based on individual sequence lengths and memory constraints. The assignment minimizes both computation and communication time across heterogeneous microbatches (Wang et al., 2 Dec 2024).
  • Sequence bucketing and microbatch chunking minimize the variance of workload within each group (Wang et al., 2 Dec 2024).

c) Efficient Resharding and Multi-Dimensional Switching

  • In multidimensional transformers and spatial-temporal models, DSP introduces "dynamic dimension switching," allocating parallelism along (e.g.) spatial, temporal, or head dimensions as best fits the current computation stage (Zhao et al., 15 Mar 2024, Gu et al., 26 Jun 2024).
  • This yields efficient "2D-Attention" or double-ring communication topologies, as in EpicSeq/LoongTrain, overcoming scalability bottlenecks inherent to head- or context-parallelism alone (Gu et al., 26 Jun 2024).

d) Task-Level Dynamic Parallelism in Hardware

  • In FPGA and HLS contexts, DSP refers to dynamic sharing of arithmetic blocks using techniques such as task-level multi-pumping, enabling sequences of operations to share common resources adaptively, with clock and pipeline interval auto-tuning to preserve throughput (Brignone et al., 2023, Li et al., 5 Sep 2024).

3. Implementation Methodologies

DSP frameworks vary with hardware and application context but share several core methodological features:

  • Directive-based/source-to-source compilers automatically rewrite user code, inserting duplicated code paths with runtime switchover logic for dynamic task/loop partitioning (Jackson et al., 2012, Wu et al., 2016, Olabi et al., 2022).
  • Optimization engines for runtime group assignment (solving MILP or dynamic programming subproblems) adapt the scatter/gather configuration per batch and per group based on sequence statistics (Wang et al., 2 Dec 2024).
  • Minimal code monkey-patching strategies, as exemplified in 360-LLaMA-Factory, enable drop-in replacement of attention routines and efficient grouping strategies, including tricks such as "Dummy-Head Ulysses" for head-count mismatches (Zou et al., 28 May 2025).
  • Efficient distributed collectives: Employ AlltoAll, zigzag ring P2P, and hybrid communication to minimize overhead when exchanging Q/K/V slices, with careful placement strategies to maximize intra-node bandwidth (Zhao et al., 15 Mar 2024, Gu et al., 26 Jun 2024, Zou et al., 28 May 2025).
  • Profiling-based auto-tuning: Short-lived profiling phases inform which variant (e.g., serial vs parallel, or parallelization dimension) to prefer for the current workload (Jackson et al., 2012).

A summary table contrasting major DSP implementation axes:

Context Partitioning Adaptivity Communication Optimization
1D Loop/Task DSP Runtime heuristics Avoid redundant parallelism
Multi-Dim LLM DSP Dynamic dimension Minimize AlltoAll/resharding
HLS/FPGA DSP Task-level multi-pump In-DSP path sharing

4. Performance and Scalability

DSP implementations repeatedly demonstrate substantial improvements in throughput, scalability, and/or hardware utilization:

  • On high-performance computing workloads, runtime-dynamized loop parallelism reduces OpenMP overhead and yields superior thread utilization, particularly for codes with variable loop bounds or nested irregularity (Jackson et al., 2012).
  • In distributed sequence-parallel LLM training, approaches such as USP, FlexSP, and LoongTrain demonstrate up to 1.98× overall speedups, 2.88× Model FLOPs Utilization (MFU) improvement, and robust scaling to sequence lengths of 208K tokens and beyond, with communication often reduced by 75% or more compared to static approaches (Wang et al., 2 Dec 2024, Fang et al., 13 May 2024, Gu et al., 26 Jun 2024).
  • Workload-aware group assignment and bucketing can decrease the critical communication path (e.g., AlltoAll time) from 40% to 10% of iteration time (Wang et al., 2 Dec 2024).
  • Dynamic adaptation ensures that hardware occupancy remains high even as sequence heterogeneity and cluster topology vary (Fang et al., 13 May 2024, Gu et al., 26 Jun 2024).

A key insight is that DSP's adaptivity not only reduces communication overhead but also counters process or device "straggler" effects, mitigating load imbalance typical in long-tail input distributions (Xu et al., 2019, Wang et al., 2 Dec 2024).

5. Challenges and Limitations

While DSP offers marked efficiency improvements, it also introduces notable challenges:

  • Profiling and runtime overhead: For short-lived task sequences, dynamic profiling may outweigh benefits, requiring tradeoff analysis (Jackson et al., 2012).
  • Synchronization and dependency management: DSP for general sequences (with dependencies or non-uniform work) requires careful design to avoid race conditions or deadlocks, particularly when dynamically switching execution modes (Jackson et al., 2012, Wu et al., 2016).
  • Complexity of optimization: Solving the optimal group assignment in heterogeneous sequence workloads can necessitate solving large-scale MILP or dynamic programming formulations at runtime, with associated computational and implementation complexity (Wang et al., 2 Dec 2024).
  • Compatibility constraints: Adapter routines such as "Dummy-Head Ulysses" are needed for DSP approaches to work with models when parallel group sizes do not evenly divide sequence or head counts (Zou et al., 28 May 2025). Position encodings, sequence bucketing, and gradient reduction may also require nontrivial reimplementation.

6. Broader Applicability and Future Directions

DSP is rapidly expanding from traditional HPC workloads to modern deep learning, including:

Emerging directions include:

DSP's adaptability, data-centric optimization, and system integration make it a foundational technique for efficient computation and training in increasingly complex, variable, and large-scale AI and HPC pipelines.