ParallelFlow: Parallelizing Linear Transformers via Flow Discretization

Nicola Muca Cirone, Cristopher SalviarXiv 2025 · DOI

Abstract

Modern sequence modeling faces a significant bottleneck due to the quadratic complexity of the attention mechanism. While Linear Transformers and State Space Models (SSMs) offer linear inference, parallelizing their training—especially for expressive high-rank updates—remains a challenge. We present ParallelFlow, a framework that interprets these models as discretized flows of controlled differential equations (CDEs). By applying rough path theory, we derive sigDelta, a signature-inspired algorithm that achieves a theoretical order-of-magnitude speedup in parallel complexity relative to sequence length.

Introduction

The attention mechanism is the cornerstone of modern AI, yet its $O(L^2)$ scaling with sequence length $L$ limits its application to extremely long contexts. Linear Transformers and SSMs (e.g., Mamba, DeltaNet) mitigate this by reformulating attention as linear Recurrent Neural Networks (RNNs). However, a "hardware-efficiency vs. expressivity" trade-off persists. Simple, easily parallelizable models often lack the capacity of more complex variants, such as those employing "Delta rules" or high-rank updates.

This paper introduces ParallelFlow, a principled mathematical framework designed to bridge this gap. By treating sequence modeling as a continuous-time process governed by differential equations, we can derive novel parallelization strategies that do not compromise model expressivity.

Methodology: Sequence Modeling as Flow

The ParallelFlow framework reinterprets the discrete updates of linear attention and SSMs through the lens of Controlled Differential Equations (CDEs).

Flow Discretization and Chunking

A common technique for GPU acceleration is "chunking," where a sequence is divided into smaller blocks processed in parallel. ParallelFlow demonstrates that these chunking procedures are mathematically equivalent to computing the "flows" of an underlying dynamical system. This connection allows us to utilize Rough Path Theory, a branch of stochastic analysis, to optimize these computations.

Generalizing the Delta Rule

We extend the DeltaNet architecture by generalizing its update mechanism. While standard implementations often rely on rank-1 updates for efficiency, ParallelFlow supports rank $R \ge 1$ updates. This allows the model to capture more intricate dependencies within the data while maintaining a structure amenable to parallelization.

Algorithmic Innovations

We propose two primary algorithms for implementing parallel flows:

  1. tensorInv: A hardware-efficient baseline that utilizes triangular tensor inversion to solve state updates.
  2. sigDelta: A novel algorithm inspired by signature kernels. Instead of standard matrix operations, sigDelta exploits the grid structure of the signature kernel by reordering computations along "antidiagonals."

Complexity Analysis and Results

The theoretical strength of ParallelFlow is most evident in its complexity bounds. The sigDelta algorithm effectively breaks the quadratic bottleneck inherent in many intra-chunk parallelization schemes.

Comparison of computational complexity between tensorInv and sigDelta.

As illustrated in the complexity analysis, sigDelta achieves a parallel complexity of $O(LR + d)$, providing a theoretical speedup of one order of magnitude in sequence length $L$ compared to the $O(L^2R + d)$ complexity of the tensorInv approach. This suggests that the signature-inspired method becomes exponentially more efficient as sequence lengths increase.

Discussion and Future Work

ParallelFlow provides a robust mathematical foundation for decoupling the "physics" of model dynamics from the "engineering" of hardware implementation. However, several practical hurdles remain. Current GPU kernels, such as those written in OpenAI’s Triton, do not yet fully support the specialized tensor-slicing operations required by sigDelta to achieve peak performance.

Future research will focus on:

  • Hardware Optimization: Developing custom CUDA/Triton kernels to realize the theoretical gains of sigDelta on current hardware.
  • Higher-Order Interpolation: Investigating whether polynomial or spline-based drivers for the CDEs can improve modeling accuracy.
  • Large-Scale Evaluation: Integrating these algorithms into state-of-the-art language models to evaluate performance on long-context benchmarks like document understanding.

Summary updated

BibTeX
@misc{cirone2025parallelflow,
  author = {Nicola Muca Cirone and Cristopher Salvi},
  title = {{ParallelFlow: Parallelizing Linear Transformers via Flow Discretization}},
  year = {2025},
  eprint = {2504.00492},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2504.00492},
}
Figure