Oscillators Are All You Need: Irregular Time Series Modelling via Damped Harmonic Oscillators with Closed-form Solutions
Keywords: transformers, closed-form solution, novel architecture, irregular time-series
TL;DR: Closed-form solution for Contiformer Using Damped Harmonic Oscillators
Abstract: Transformers excel at time series modeling through attention mechanisms that capture long-term temporal patterns. However, they assume uniform time intervals and therefore struggle with irregular time series. Neural ODEs effectively handle irregular time series by modeling hidden states as continuously evolving trajectories. ContiFormers (Chen at al., 2024) combine Neural ODEs with Transformers, but inherit the computational bottleneck of the former by using heavy numerical solvers. This bottleneck can be removed by using a closed-form solution for the given dynamical system - but this is known to be intractable in general! We obviate this by replacing Neural ODEs with a novel linear damped harmonic oscillator analogy - which has a known closed-form solution. We model keys and values as damped, driven oscillators and expand the query in a sinusoidal basis up to a suitable number of modes. This analogy naturally captures the query-key coupling that is fundamental to any transformer architecture by modelling attention as a resonance phenomenon. Our closed-form solution eliminates the computational overhead of numerical ODE solvers while preserving expressivity. We prove that this oscillator-based parameterization maintains the universal approximation property of continuous-time attention; specifically, any discrete attention matrix realizable by ContiFormer's continuous keys can be approximated arbitrarily well by our fixed oscillator modes. Our approach delivers both theoretical guarantees and scalability, achieving state-of-the-art performance on irregular time series benchmarks while being orders of magnitude faster.
All our code is available here: LINK
Primary Area: learning on time series and dynamical systems
Submission Number: 17016
Loading