paper

Dynamic Time Warping in the Low-Distance Regime

arXiv:2609.40249

Abstract

Dynamic Time Warping (DTW) is a classical similarity measure for strings and time series that allows local stretching. Given non-empty strings over an alphabet and a cost function , is the minimum total cost of equal-length expansions of and obtained by duplicating characters. For strings of length at most , DTW is computable in time, and this is conditionally optimal under the Orthogonal Vectors Hypothesis (OVH). We study the low-distance regime, where an integer upper-bounds , assuming and for . For several classical similarity measures, this regime admits algorithms, whereas for DTW with metric costs the best known bound is . We show that this dependence is essentially optimal: assuming OVH, computing DTW requires time even for the discrete mismatch-cost function, which assigns cost to every mismatch. The lower bound applies to the whole spectrum of thresholds between constant and linear in . Our reduction from Orthogonal Vectors encodes vector coordinates in the lengths of equal-character runs. The resulting instances are very structured: collapsing runs to single characters reveals long substrings with short periods. We complement the lower bound with a -time algorithm whenever, after collapsing runs in the inputs, every substring with period has length . Finally, we extend this lower bound to DTW pattern matching, which asks whether any non-empty substring of a length- text has DTW distance at most from a length- pattern. We prove that the classic -time dynamic-programming algorithm is near-optimal under OVH, even when .

arXiv commentAccepted to FOCS 2026. Abstract shortened to fit arXiv requirements