DILATE: Loss for Shape & Time in Forecasting
- The paper introduces DILATE with dual loss terms that separately optimize waveform shape fidelity and temporal precision.
- It implements a soft-DTW shape term and a soft-TDI temporal term using dynamic programming for efficient, end-to-end gradient-based training.
- Empirical results show significant MAE reductions over MSE and classic DTW, validating its effectiveness in diverse forecasting applications.
DILATE (Distortion Loss Incorporating Shape and Time) is a differentiable training objective designed for deep models in multi-step time series forecasting, with explicit sensitivity to both waveform shape and event timing. Unlike conventional losses such as Mean Squared Error (MSE) or classic Dynamic Time Warping (DTW), DILATE disentangles amplitude/shape fidelity and temporal precision via two smoothly-differentiable terms. The loss is implemented with dynamic programming, yielding computational efficiency and enabling end-to-end gradient-based training in complex neural architectures. Empirical evaluations demonstrate that DILATE substantially improves the detection and prediction of sudden or sharp changes in diverse domains such as physiological waveform modeling and traffic or electricity forecasting (Guen et al., 2021, Guen et al., 2019, Sahoo et al., 2 Jan 2026).
1. Mathematical Formulation and Key Components
The DILATE loss computes a weighted sum of two distortion terms over predicted and observed sequences of equal length, and , parameterized by a tradeoff scalar and a soft-min smoothing parameter :
- Shape term (soft-DTW): Measures morphological similarity via a log-sum-exp relaxation of classic DTW. For (or in (Sahoo et al., 2 Jan 2026)), soft-DTW is:
where denotes monotonic alignment matrices. As , soft-DTW converges to classic DTW.
- Temporal term (soft-TDI): Assesses alignment by penalizing off-diagonal associations, measuring timing errors. Using a penalty matrix (typically or ):
with , the expected soft-alignments under the Gibbs measure induced by . This yields differentiability in both model output and input sequences.
2. Computational Implementation and Differentiation
Both shape and temporal components leverage dynamic programming for efficient evaluation and gradient computation:
- Forward DP: Constructs recurrence matrices to compute soft-DTW in time and space, avoiding enumeration of all alignment paths.
- Backward DP: Derivatives with respect to are computed via reverse dynamic programming. The temporal loss multiplies with and backpropagates through the Hessian of (Guen et al., 2019).
- PyTorch integration: Custom autograd functions exploit intermediate DP tables for both forward and backward passes, yielding up to speed-up versus naïve autograd for (Guen et al., 2019, Guen et al., 2021).
3. Parameterization and Hyperparameter Selection
DILATE introduces the following tunable elements for practical deployment:
| Parameter | Purpose | Typical Values |
|---|---|---|
| Shape/timing balance in total loss | ||
| Smoothing in soft-minimum | to | |
| Temporal penalty matrix | , | |
| KD vs DILATE weighting (Sahoo et al., 2 Jan 2026) | , |
Cross-validation or ablation can identify optimal hyperparameters. For KDPhys (rPPG), best MAE was achieved for and (Sahoo et al., 2 Jan 2026). For generic forecasting and biomedical signals, similar mid-range achieves robust shape and event detection.
4. Domain-Specific Roles and Significance
The shape term in DILATE enforces morphological fidelity, preserving oscillations, amplitudes, and salient event structure (e.g., systolic ramp in rPPG). The temporal term penalizes horizontal event shifts, ensuring sharp event localization—a property vital for domains where precise timing of peaks, drops, or change-points is critical.
For rPPG extraction, DILATE ensures predicted pulse cycles align in both morphology and event timing, outperforming MSE or frequency-domain losses that cannot separate these criteria (Sahoo et al., 2 Jan 2026). In traffic or ECG forecasting, DILATE detects sudden transitions and matches ground-truth event positions better than alternatives (Guen et al., 2019, Guen et al., 2021).
5. Comparative Evaluation and Ablation Results
Empirical studies confirm DILATE's advantages. On standard benchmarks:
| Loss | MAE/DTW/TDI Improvement | Case |
|---|---|---|
| DILATE | MAE reduction by | KDPhys rPPG (Sahoo et al., 2 Jan 2026) |
| DILATE vs MSE | DTW down , TDI | ECG, traffic, electricity (Guen et al., 2021) |
| DILATE vs TD+FD | lower MAE | UBFC rPPG (Sahoo et al., 2 Jan 2026) |
In ablation, a sweep of in DILATE shows optimal MAE and RMSE centrally (); shifting towards pure shape or timing degrades performance (Sahoo et al., 2 Jan 2026). Separate shape and temporal terms outperform "tangled" DILATE or band-constrained soft-DTW (Guen et al., 2019).
6. Integration into Neural Architectures and Applications
DILATE's differentiability, DP-based efficiency, and agnostic design allow integration with MLPs, RNNs, Seq2Seq, Transformer, and convolutional architectures. No changes to output layers are required—only the loss function is modified (Guen et al., 2019, Guen et al., 2021).
In KDPhys, DILATE is combined with an Attention Feature Distillation term for end-to-end knowledge transfer from 3D CNN teachers to lightweight 2D students (Sahoo et al., 2 Jan 2026). In STRIPE++ (Guen et al., 2021), DILATE-driven kernels enable determinantal point process (DPP) diversity in probabilistic multi-future forecasting, with quality-weighting to encourage sharp and temporally varied forecasts.
DILATE is robust to noise, benefiting from annealing and gradient clipping strategies for numerically demanding signals.
7. Limitations and Variants
DILATE's performance is dependent on correct balancing of shape and time—extreme values of can render either criterion dominant to the detriment of the other. The quadratic time complexity () scales favourably for moderate-length sequences but becomes limiting in very long horizons. Tangled variants that combine shape and time in a single soft-DTW term underperform the separated approach (Guen et al., 2019).
For domain-specific applications such as noisy biomedical signals or traffic, asymmetric penalty matrices or adaptive smoothing may further improve event localization, especially when early or late shifts have different functional interpretations.
DILATE establishes a rigorous, efficiently-computable, and highly adaptable framework for deep time series learning with sensitivity to both feature morphology and timing. Its widespread empirical validation positions it as a strong alternative to conventional loss formulations in forecasting and physiological waveform analysis (Guen et al., 2021, Sahoo et al., 2 Jan 2026, Guen et al., 2019).