cs.LGFeb 19, 2026

SoftDTW-CUDA-Torch: Memory-Efficient GPU-Accelerated Soft Dynamic Time Warping for PyTorch

Authors: Ron Shapira Weber, Oren Freifeld

Organizations: The Faculty of Computer and Information Science Ben-Gurion University of the Negev

Abstract

We present softdtw-cuda-torch, an open-source PyTorch library for computing Soft Dynamic Time Warping (SoftDTW) on GPUs. Our implementation addresses three key limitations of existing GPU implementations of SoftDTW: a hard sequence-length cap of 1024, numerical instability in the backward pass for small smoothing parameters, and excessive GPU memory consumption from materializing pairwise distance tensors. We introduce (1) tiled anti-diagonal kernel execution that removes the sequence-length constraint, (2) a log-space back-ward pass that prevents floating-point overflow, and (3) a fused distance-computation mode that eliminates the O(BN M ) intermediate distance tensor, achieving up to 98% memory reduction compared to prior work. The library supports arbitrary sequence lengths, full PyTorch autograd integration, and Soft-DTW Barycenter computation. Code is available at https://github.com/BGU-CS-VIL/sdtw-cuda-torch.

Figures & tables

Explore similar work

CardsList
  1. Fast Gradient-Based Approximation of Continuous Dynamic Time Warping

    Oct 9, 2026Pierre Houedry, Romain Tavenard, Nicolas Courty +1Dynamic Time Warping

  2. Soft-MSM: Differentiable Context-Aware Elastic Alignment for Time Series

    Apr 30, 2026Christopher Holder, Anthony BagnallDynamic Time WarpingTime Series Classification

  3. LCT: Losslessly Compressed Tensors with GPU friendly execution for Training

    Oct 15, 2026Max Zhu, Bohang Sun, Pietro Lio +1Memory CompressionMemory-Efficient Training