---
title: Harmonic Oscillator Recurrent Network
url: https://www.emergentmind.com/topics/harmonic-oscillator-recurrent-network-horn
type: topic
---

# Harmonic Oscillator Recurrent Network

Searching arXiv for relevant HORN and related continuous-time attention papers.
First, I’ll look up the core HORN and oscillator-attention papers by title/id, then related context like ContiFormer.
A Harmonic Oscillator Recurrent Network (HORN) is a recurrent neural architecture in which each unit is modeled as a damped harmonic oscillator rather than as a first-order hidden state updated by a conventional nonlinear recurrence. In its canonical form, the hidden dynamics are continuous-time, second-order, and explicitly parameterized by natural frequencies, damping factors, recurrent couplings, and input couplings. Recent work has developed two closely related lines of research: a direct HORN formulation and analog-electronic implementation for sequential classification, and an oscillator-based continuous-time attention mechanism for irregular time series that the authors explicitly identify as “exactly the kind of building block you’d want in a Harmonic Oscillator Recurrent Network (HORN)” [2509.04064], [2602.12139].

## 1. Formal dynamical structure

In the full HORN model, the \(i\)-th node has scalar state \(x_i(t)\) and obeys the damped, driven oscillator equation
\[
\ddot{x}_{i}(t) + 2 \gamma_{i} \dot{x}_{i}(t) + \omega_{i}^2 x_{i}(t) = F(\mathbf{x},\dot{\mathbf{x}}, t),
\]
where \(x_i(t)\in\mathbb{R}\) is an oscillator amplitude, \(\dot{x}_i(t)\) is a velocity-like state, \(\omega_i>0\) is the natural angular frequency, \(\gamma_i>0\) is the damping factor, and \(F(\mathbf{x},\dot{\mathbf{x}},t)\) is a forcing term that includes recurrent coupling and external input. The unconstrained forcing term is
\[
F(\mathbf{x},\dot{\mathbf{x}}, t) = \alpha\, \tanh\bigl( \mathbf{V}\mathbf{x} + \mathbf{W}\dot{\mathbf{x}} + \mathbf{I}\, s(t)\bigr),
\]
with \(\mathbf{V},\mathbf{W}\in\mathbb{R}^{n\times n}\), \(\mathbf{I}\in\mathbb{R}^{1\times n}\), scalar input \(s(t)\), and global gain \(\alpha>0\) [2509.04064].

This formulation makes the HORN state intrinsically second-order. A node is characterized jointly by its amplitude \(x_i\) and its velocity \(y_i=\dot{x}_i\), so the effective hidden state is \((x_i,y_i)\). In the absence of forcing,
\[
\ddot{x}_i + 2\gamma_i \dot{x}_i + \omega_i^2 x_i = 0,
\]
whose solutions are exponentially decaying sinusoids with frequency \(\sqrt{\omega_i^2-\gamma_i^2}\). The resulting recurrence is therefore not merely a discretized first-order state transition; it is the discretization of a mechanical-looking ODE with explicit oscillatory and dissipative structure.

The analog-electronic study uses a simplified HORN imposed by hardware constraints: only \(n=4\) nodes, no self-feedback, no \(\tanh\) nonlinearity, and amplitude coupling only in the main text, with \(\mathbf{W}=0\). Under these constraints and writing \(\dot{x}_i=y_i\), the discretized “digital twin” becomes
\[
\begin{split}
x_{i,t+1} &= x_{i,t} + h\, y_{i,t+1},\\
y_{i,t+1} &= y_{i,t} + h\left[ \sum_{j\neq i}^{n} V_{ji}\, x_{i,t} + I_i\, s(t) - 2\gamma_i\, y_{i,t} - \omega_i^2\, x_{i,t} \right].
\end{split}
\]
The paper notes a small typographical oddity in this equation—the sum is written with \(x_{i,t}\) instead of \(x_{j,t}\) in the coupling term—while interpreting it conceptually as standard linear recurrent coupling from other units’ amplitudes. The discretization uses a symplectic Euler scheme for stability of the stiff oscillator dynamics [2509.04064].

## 2. Oscillatory computation, memory, and recurrence

The central computational premise of HORN is that transient oscillatory dynamics, rather than fixed-point convergence, constitute the substrate of computation. In the formulation summarized by the analog-electronic study, amplitude \(x_i\) is analogous to a membrane-potential-like or rate-like variable, velocity \(y_i\) is a momentum-like variable, and the combination of intrinsic oscillation, damping, and recurrent forcing yields transient responses that evolve in both amplitude and phase [2509.04064].

Several functional consequences are emphasized. First, HORNs can encode information in both phase and amplitude. Second, they can exploit resonance and interference patterns: an oscillator responds more strongly to inputs matching its intrinsic frequency \(\omega_i\). Third, damped oscillators provide fading memory with multiple timescales, because memory traces decay naturally through damping while remaining spectrally structured. The analog-electronic paper attributes prior digital HORN advantages in learning speed and robustness relative to classical RNNs to phase-based encoding and synchronization, frequency-selective resonance, and fading memory with multiple timescales [2509.04064].

This dynamical organization distinguishes HORN from standard recurrent architectures in several precise ways. Classical RNNs are typically discrete-time and first-order, with updates of the form
\[
h_{t+1} = \phi(W_{hh} h_t + W_{xh} x_t + b),
\]
whereas HORN begins with continuous-time, second-order oscillator dynamics and only then discretizes them. Standard RNNs often operate near fixed points or chaotic attractors; HORN enforces oscillatory local dynamics in each node. Standard recurrent models encode time by hidden-state accumulation, whereas HORN introduces explicit phase and resonance structure through \(\omega_i\) and \(\gamma_i\). The model parameters also admit direct physical interpretation—frequencies, damping, couplings, and input gains—which is significant for hardware mapping and for continuous-time analysis.

A common misconception is that oscillatory recurrence is merely a stylistic reparameterization of a conventional RNN. The cited formulations suggest otherwise: the hidden state is explicitly second-order, the local dynamics are mechanically constrained, and the computational use of resonance and transient interference is built into the architecture rather than added post hoc. A plausible implication is that HORN imposes a strong inductive bias toward temporally structured signals, especially where periodicity, smoothness, or decaying correlations are natural.

## 3. Closed-form oscillator banks and the HORN-like attention viewpoint

The 2026 oscillator-attention work does not present itself as a HORN paper in name, but it makes the connection explicit by replacing ContiFormer’s Neural ODE dynamics with linear damped, driven harmonic oscillators and stating that this is “exactly the kind of building block you’d want in a Harmonic Oscillator Recurrent Network (HORN).” In that formulation, each scalar key or value coordinate satisfies
\[
\ddot{x}(t) + 2\gamma\,\dot{x}(t) + \omega^2 x(t) = F(t),
\]
with learnable damping \(\gamma\), natural frequency \(\omega\), and forcing term \(F(t)\). In first-order state-space form, with \(z(t)=\begin{bmatrix}x(t) & p(t)\end{bmatrix}^\top\) and \(p(t)=\dot{x}(t)\),
\[
\frac{d}{dt}z(t)=Az(t)+B(t), \qquad
A=\begin{bmatrix}0 & 1\\ -\omega^2 & -2\gamma\end{bmatrix},
\]
and the exact solution is
\[
z(t)=e^{A(t-t_0)}z_0+\int_{t_0}^t e^{A(t-s)}B(s)\,ds.
\]
Because the matrix exponential is available in closed form in the underdamped, critically damped, and overdamped regimes, the continuous-time trajectories are analytic rather than solver-dependent [2602.12139].

The same paper represents queries by a truncated sinusoidal expansion,
\[
q(t)=\sum_{k=1}^J \Big(A_k\cos(\omega_k t)+B_k\sin(\omega_k t)\Big),
\]
and defines continuous-time attention logits by the time-averaged inner product
\[
\alpha_i(t)=
\begin{cases}
\displaystyle\frac{1}{t-t_i}\int_{t_i}^t \langle q(\tau),k_i(\tau)\rangle\,d\tau, & t>t_i,\\[4pt]
\langle q(t_i),k_i(t_i)\rangle, & t=t_i.
\end{cases}
\]
The softmax weights then follow the standard Transformer scaling. Because both queries and keys are expressed in sinusoids and exponentially damped sinusoids, the attention integrals can be evaluated analytically. This yields a physical interpretation in which attention is a resonance phenomenon: the key oscillator acts as a linear filter with transfer function
\[
H(\omega)=\frac{\beta}{\omega_0^2-\omega^2+2i\gamma\omega},
\]
and query–key interaction measures spectral overlap. When query energy is concentrated near \(\omega\approx\omega_{0,i}\), the inner product and therefore the logit are large; when frequencies are misaligned, the oscillatory terms average out and the attention is small [2602.12139].

Relative to ContiFormer [2402.10635], the oscillator formulation replaces numerical ODE solves with closed-form propagation and closed-form attention kernels. The paper gives numerical complexity
\[
T_{\text{num}}=\Theta(N^2 S d^2),\quad M_{\text{num}}=\Theta(N^2 S d),\quad D_{\text{num}}=\Theta(S)
\]
for the numerical continuous-attention formulation, and
\[
T_{\text{cf}}=\Theta(N^2 J d)+O(Nd^2),\quad M_{\text{cf}}=\Theta(N^2 d),\quad D_{\text{cf}}=\Theta(1)
\]
for the closed-form oscillator layer. With \(S=80\), \(d=64\), and \(J=8\), the dominant \(N^2\) cost ratio is approximately \(1/640\), described as a “three orders of magnitude” reduction in the \(N^2\) term. The same work also states a Harmonic Approximation Theorem showing that a shared undamped oscillator bank on a fixed frequency grid can approximate continuous key trajectories arbitrarily well on compact intervals, and therefore can approximate the induced attention logits and weights arbitrarily well [2602.12139].

From a recurrent perspective, this oscillator-attention layer is continuous-time and state-space structured:
\[
\frac{d}{dt} z(t)=Az(t)+Bu(t),
\]
with token-specific initial conditions and forcing. The paper therefore proposes an explicit HORN-style abstraction: a global oscillator bank parameterized by \((\omega_n,\gamma_n)\), a state \(z(t)\in\mathbb{R}^{2(M+1)d}\), and irregularly timed inputs that update initial conditions or driving terms. This suggests that HORN can be interpreted broadly as a family of continuous-time recurrent models built from superpositions of damped harmonic modes, with either attention-based or recurrent readout.

## 4. Architecture, readout, and analog-electronic realization

In the proof-of-concept analog implementation, the network architecture is deliberately small. The recurrent core contains \(n=4\) damped harmonic oscillator units, with all-to-all amplitude coupling except self-couplings, scalar input \(s(t)\), and a 10-class output readout. In the digital simulation for sequential MNIST, one pixel is presented per integration step, so \(h=1\), and the continuous-time frequency \(\omega_i\) is interpreted as radians per pixel. The input sequence is a row-wise serialization of the \(28\times 28\) grayscale image, yielding 784 steps; the hardware experiment prepends a registration pulse and zero-pads the sequence to length \(L=1000\) [2509.04064].

Classification uses an affine terminal-time readout
\[
\mathbf{o}=\mathbf{M}\mathbf{x}_T+\mathbf{b},
\]
with \(\mathbf{M}\in\mathbb{R}^{10\times n}\), \(\mathbf{b}\in\mathbb{R}^{10}\), and softmax on the logits. The supervised loss is the standard cross-entropy
\[
\mathcal{L}=-\sum_{k=1}^{10} y_k\log \hat{y}_k,
\]
with \(\hat{y}=\text{softmax}(\mathbf{o})\). The digital model is trained by backpropagation through time in PyTorch. The paper explicitly states 66 trainable parameters in total: 16 in the recurrent core implemented in analog hardware and 50 in the readout [2509.04064].

The analog system is implemented on an anabrid Model-1 hybrid analog-digital computer. Each node is realized as a two-integrator cascade implementing
\[
\ddot{x}_i(t) = -2\gamma_i\dot{x}_i(t)-\omega_i^2x_i(t)+u_i(t),
\qquad
u_i(t)=\sum_{j\neq i}V_{ji,E}x_j(t)+I_{i,E}s_E(t),
\]
so that, equivalently,
\[
\ddot{x}_i + 2\gamma_i \dot{x}_i + \omega_i^2 x_i = \sum_{j\neq i} V_{ji,E} x_j + I_{i,E} s_E(t).
\]
The experimental setup includes a digital control computer, an ADALM2000 signal generator for producing analog waveforms, the Model-1 analog computer implementing the oscillator network, and a TeensyLogger recording inputs and outputs [2509.04064].

Parameter transfer from the digital twin to the analog twin is governed by a scaling factor \(c=\Delta S\,k_0\), where the experiment duration is \(T=6\,\text{s}\), the sample length is \(L=1000\), the sample duration is \(\Delta S=T/L=6\,\text{ms/pixel}\), and the machine integration factor is \(k_0=10\). The mapping is
\[
I_E=\frac{1}{c}\frac{I_M}{\omega_M},\qquad
\gamma_E=\gamma_M c,\qquad
\omega_E=\omega_M c,\qquad
V_{(i,j),E}=\frac{1}{c}\frac{V_{(i,j),M}}{\omega_{j,M}}.
\]
The implemented digital model uses homogeneous oscillator parameters
\[
\omega_{i,M}=0.22,\qquad \gamma_{i,M}=0.01,\qquad i=1,\dots,4.
\]
Hardware operation is constrained by effective precision \(\Delta=\pm 0.03\) in machine units and a state range \([-1,1]\). To avoid clipping, the input weights \(I_i\) are rescaled per sample so that the maximum nodal amplitude stays just within this interval [2509.04064].

## 5. Empirical behavior and benchmark results

On sequential MNIST, the simplified 4-node digital HORN achieves **59.24%** test accuracy. The analog system is evaluated on 10,000 test samples by comparing the recorded analog state trajectories against the digital twin with four custom metrics: mismatch at decision time, area difference over the sequence, average phase difference, and temporal correlation. The paper reports that, for the majority of samples, these error metrics are small, indicating high fidelity of the analog dynamics relative to the digital twin. Nevertheless, direct reuse of the digital readout on analog-generated trajectories yields only **28.39%** agreement with the predictions of the digital model [2509.04064].

The same study analyzes this discrepancy geometrically. At readout time, the trained digital affine readout partitions the 4D HORN state space into decision regions for the ten digit classes. The paper reports that some classes—specifically 0, 3, 7, and 9—occupy very small volumes in this state space and lie near decision boundaries. Because the analog hardware has effective precision of approximately \(0.03\) in machine units, while the floating-point digital twin has much higher precision, small state perturbations can cross decision boundaries even when the underlying analog dynamics closely match the digital ones. The authors therefore attribute the low agreement primarily to precision mismatch rather than to failure of the analog oscillator dynamics [2509.04064].

When the analog HORN is instead used as a reservoir and a new linear readout is trained on the analog states, the lost task performance is recovered. With a linear SVM trained on digital HORN states, performance reaches about **74%** accuracy. With a linear SVM trained on analog HORN states, the reported performance is **~75.50% vs 73.75%** for analog versus digital, respectively. The paper interprets this as evidence that the analog transient dynamics preserve the task-relevant information, even when the original digital readout is too brittle to transfer directly [2509.04064].

The oscillator-attention line of work reports a different empirical profile, focused on irregular time series. On event prediction benchmarks including Synthetic, Neonate, Traffic, MIMIC, StackOverflow, and BookOrder, the oscillator model matches or slightly trails ContiFormer in log-likelihood and accuracy while being much faster. One example given is Traffic log-likelihood: ContiFormer \(0.635\pm 0.019\), OsciFormer \(0.612\pm 0.022\), with accuracy almost equal. On synthetic event sequences, log-likelihood is reported as around \(-0.558\) versus \(-0.535\), with equal accuracy of approximately \(0.84\). On long-context UCR/UEA multivariate classification, OsciFormer reaches average accuracy **64.5%**, equal to the best baseline reported, and on MI reaches **91.8% ± 0.2**. On the HR benchmark for irregular heart-rate prediction, the reported RMSE is **\(2.56\pm 0.18\)** for OsciFormer, compared with Transformer **\(8.24\pm 2.24\)**, RFormer **\(2.66\pm 0.21\)**, and ContiFormer out of memory. On an irregular synthetic binary classification task, OsciFormer achieves equidistant encoding **100%**, event-based encoding **99.83% (±0.32)**, and **per-epoch time 0.56 min**, whereas ContiFormer reaches event-based **99.93%** with **per-epoch time 3.83 min** [2602.12139].

These two empirical programs address different questions. The analog HORN study evaluates whether oscillatory recurrent dynamics can survive transfer into physical analog hardware. The oscillator-attention study evaluates whether damped harmonic oscillator parameterizations can replace Neural ODE dynamics in continuous-time attention for irregular sequences. Taken together, they support the view that oscillator-based recurrence is not limited to a single architecture family, but can serve as a reusable continuous-time computational core.

## 6. Limitations, assumptions, and open directions

The principal modeling limitation is linearity in the continuous-time core. In the oscillator-attention formulation, key and value dynamics are linear damped oscillators, even though the overall network remains nonlinear through projections and feed-forward layers. The paper states that highly nonlinear or chaotic dynamics, such as logistic-map long-horizon forecasting, are hard to capture; adding more modes reduces but does not eliminate this mismatch. The same study also notes that the universal approximation theorem assumes a fixed frequency grid, whereas practical grids are learned or log-uniform but still global; very localized or time-varying frequencies may therefore require many modes. Finally, the method remains quadratic in sequence length because it retains Transformer-style \(O(N^2)\) attention, so the speedups are specifically against NODE-based continuous models rather than against linear-time state-space models or approximate attention schemes [2602.12139].

The analog HORN implementation exposes a different set of constraints. The proof-of-concept uses only four nodes, homogeneous frequencies and damping, no self-feedback, and no \(\tanh\) nonlinearity. The anabrid Model-1 provides limited integrators, adders, and programmable coefficients, which constrains network size and topology. Effective precision is limited to \(\pm 0.03\) in machine units and the dynamic range to \([-1,1]\), making readout transfer brittle. Parameter transfer from software to hardware requires careful scaling and per-sample rescaling of input weights, and all training is performed in simulation rather than in situ on the analog substrate [2509.04064].

Several practical design points recur across the literature summarized here. For HORN-like oscillator banks on irregular time series, the oscillator-attention paper reports that a log-uniform frequency initialization over \([10^{-2},10^1]\) in normalized time works well, that optimal initial damping lies in \([0.05,0.4]\), and that \(J=8\) oscillator modes yields essentially identical predictive performance to larger settings, with accuracy saturating around \(J\in[6,8]\). It also states that most learned coordinates end up underdamped, where the resonance interpretation is strongest [2602.12139]. In the analog HORN context, the results suggest that precision-aware or noise-aware training, low-precision-compatible readouts, or in situ learning could be important for future hardware realizations [2509.04064].

A second common misconception is that successful analog transfer requires exact prediction agreement with a digital twin. The analog HORN results argue against that interpretation: dynamical agreement can be high while classification agreement is low if the readout is geometrically brittle. Conversely, the reservoir-computing experiment indicates that analog trajectories can preserve sufficient information even when direct reuse of floating-point readout parameters fails. This suggests that future HORN research may need to treat the oscillator core and the decoder as a coupled system whose precision assumptions should be co-designed rather than transferred independently.

In the broader sense implied by both papers, HORN denotes more than a specific four-node recurrent classifier. It denotes a class of continuous-time recurrent systems whose hidden state is a superposition of damped harmonic oscillators, with inputs modulating forcing or initial conditions, and with outputs read either by a terminal linear classifier, by a reservoir readout, or by a continuous-time attention mechanism that aggregates oscillator states through resonance. Under that view, the defining features of HORN are the oscillator state-space backbone, the use of damping and frequency as learnable inductive biases, and the exploitation of transient oscillatory dynamics as the primary computational resource.

Source: https://www.emergentmind.com/topics/harmonic-oscillator-recurrent-network-horn