stat.MLOct 9, 2026

Fast Gradient-Based Approximation of Continuous Dynamic Time Warping

Authors: Pierre Houedry, Romain Tavenard, Nicolas Courty, Romaric Gaudel

Organizations: INRIA Rennes · IRISA, UMR 6074, CNRS, Université de Rennes · IRISA, UMR 6074, CNRS, Université de Bretagne Sud

Abstract

Dynamic Time Warping (DTW) is a common choice for measuring the discrepancy between time series. It proceeds by finding an optimal warping between timestamps through dynamic programming, which can be slow and is not differentiable. Consequently, several variants have been proposed. Among them, Soft-DTW proposes a smooth formulation of DTW, amenable to gradient computation, while Continuous-DTW (CDTW) introduces a continuous formulation through parametrizable warping functions. Yet, computational costs remain high for both methods and impractical for large datasets in modern machine learning pipelines. This paper revisits CDTW in several ways. After establishing its differentiability under mild conditions, we introduce FastCDTW, which is an efficient approximate solver with two different computational strategies: an exact closed-form scheme for piecewise-linear warping functions, and an unbiased Monte Carlo estimator for smooth ones, such as implicit neural networks. Both strategies provide gradients with respect to the warping function and the input time series, and the resulting algorithm is GPU-friendly. We demonstrate its benefits through its integration into more complex learning problems, including time series averaging, classification and deep domain adaptation.

Figures & tables

Appendix figures & tables9 assets

Supplementary material from the paper’s appendix.

Appendix

Explore similar work

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

    Feb 19, 2026Ron Shapira Weber, Oren FreifeldDynamic Time WarpingGPU Acceleration

  2. Time Series Classification through Diffeomorphic Time Warping (DiffTW)

    Jun 22, 2026Vicky Geneva Haney, Kamel Lahouel, Victor Rielly +1Dynamic Time WarpingTime Series Classification

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

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