Papers
Topics
Authors
Recent
Search
2000 character limit reached

Stochastic Clock Attention

Updated 22 December 2025
  • Stochastic Clock Attention is a cross-attention mechanism that uses learned clock processes to generate continuous, monotonic alignments between source and target sequences.
  • It replaces standard scaled dot-product attention with a Gaussian kernel based on normalized or unnormalized clock integrals, enforcing near-diagonal and causal mappings.
  • SCA supports both parallel and autoregressive decoding regimes, showing robust performance in text-to-speech and other time-synchronous tasks.

Stochastic Clock Attention (SCA) is a cross-attention mechanism designed for sequence-to-sequence modeling where alignment between continuous, ordered sequences is central. Unlike standard scaled dot-product attention (SDPA) that relies on external positional encodings and lacks guarantees for monotonicity or continuity, SCA formulates attention as the meeting probability of two learned, nonnegative "clock" processes, each parameterizing normalized "time" for the source and target. This approach yields an explicit, probabilistic alignment model with inherent inductive biases for causal, smooth, and near-diagonal mappings—key for frame-synchronous tasks such as text-to-speech (TTS). SCA supports both normalized (parallel) and unnormalized (autoregressive) decoding regimes and acts as a nearly parameter-free drop-in replacement for conventional cross-attention modules (Soh et al., 18 Sep 2025).

1. Mathematical Formulation and Path-Integral Derivation

SCA designates the input sequences XsX_s (s∈[0,S]s\in[0,S]) and YtY_t (t∈[0,T]t\in[0,T]) as source and target, respectively. Both undergo learned feature projections: ηsX=F(Xs)∈Rd,ηtY=G(Yt)∈Rd\eta^X_s = \mathcal{F}(X_s) \in \mathbb{R}^d, \qquad \eta^Y_t = \mathcal{G}(Y_t) \in \mathbb{R}^d A nonnegative rate function ϕ:Rd→R>0\phi: \mathbb{R}^d \to \mathbb{R}_{>0} (e.g., Softplus, exe^x) transforms the projections. In the parallel regime (normalized clocks), cumulative integrals define the normalized clocks: λsX=∫0sϕ(ηuX) du∫0Sϕ(ηuX) du,λtY=∫0tϕ(ηvY) dv∫0Tϕ(ηvY) dv\lambda^X_s = \frac{\int_0^s \phi(\eta^X_u)\, du}{\int_0^S \phi(\eta^X_u)\, du}, \quad \lambda^Y_t = \frac{\int_0^t \phi(\eta^Y_v)\, dv}{\int_0^T \phi(\eta^Y_v)\, dv} with λsX,λtY∈[0,1]\lambda^X_s, \lambda^Y_t \in [0,1] providing strictly monotonic time reparameterizations. In the autoregressive regime, unnormalized clocks

λ~sX=∫0sϕ(ηuX)du,λ~tY=∫0tϕ(ηvY)dv\tilde{\lambda}^X_s = \int_0^s \phi(\eta^X_u) du, \quad \tilde{\lambda}^Y_t = \int_0^t \phi(\eta^Y_v) dv

are used.

Alignment between source and target is modeled by the meeting probability kernel: s∈[0,S]s\in[0,S]0 Assuming the projections are perturbed by zero-mean Gaussian fields, a perturbative expansion yields a Gaussian kernel in clock space: s∈[0,S]s\in[0,S]1 where s∈[0,S]s\in[0,S]2 and s∈[0,S]s\in[0,S]3 aggregates covariances from both clocks. Under stationarity and the delta-method, the variance profile approximates Brownian-bridge behavior: s∈[0,S]s\in[0,S]4 For unnormalized clocks, the variance grows linearly (diffusively) with s∈[0,S]s\in[0,S]5 and s∈[0,S]s\in[0,S]6.

The attention score simplifies (with s∈[0,S]s\in[0,S]7 absorbed by the row-wise softmax): s∈[0,S]s\in[0,S]8

2. Probabilistic Inductive Biases: Continuity, Monotonicity, and Alignment

SCA's rate function s∈[0,S]s\in[0,S]9 ensures the clocks YtY_t0 and YtY_t1 are strictly monotonic, providing aligned trajectories. The quadratic penalty on YtY_t2 intrinsically biases attention toward the diagonal, enforcing smooth, continuous alignments. The Brownian-bridge variance YtY_t3 profile is lowest at endpoints and maximal at the center, leading SCA to favor sharper (more certain) alignments at boundaries and softer, continuous transitions in the mid-sequence. Causal structure is imposed in the AR regime by masking keys with YtY_t4, ensuring causal attention propagation.

3. Scoring Rule and Contrast with Scaled Dot-Product Attention

Conventional SDPA computes scores as

YtY_t5

SCA, in contrast, defines the score by a Gaussian kernel in clock space: YtY_t6 This construction entirely replaces the need for positional encodings: temporal alignment is achieved via the learned clock integrals, not through hand-crafted features or sinusoids. SCA introduces few additional parameters, integrating naturally as a plug-and-play module in Transformer-style cross-attention layers.

4. Decoding Regimes and Algorithmic Implementation

SCA supports two decoding paradigms:

Regime Clock Normalization Use Case Notes
Parallel Normalized Global length known Clocks in YtY_t7; full matrix support
Autoregressive Unnormalized Left-to-right decoding Causal mask; increment clocks with history

In parallel mode, the system requires a global length estimate for the target. The attention matrix is computed using normalized clocks and the closed-form score, with softmax applied row-wise.

In the AR regime, SCA operates with unnormalized clocks, incrementally accumulating YtY_t8 up to the current frame, ensuring past-only (causal) dependencies. Future tokens are masked.

Pseudocode for SCA primitives (Scala-like) is:

ϕ:Rd→R>0\phi: \mathbb{R}^d \to \mathbb{R}_{>0}3

5. Practical Implementation: Architecture, Hyperparameters, and Training

SCA was implemented within a 6-layer Transformer encoder and a 4-layer Transformer decoder, both operating at YtY_t9 with 4 heads and standard feedforward blocks. Projection matrices t∈[0,T]t\in[0,T]0 in t∈[0,T]t\in[0,T]1 and t∈[0,T]t\in[0,T]2 in t∈[0,T]t\in[0,T]3 are used. "MaskedTimeNorm" applies per-timestep normalization for stability, adding t∈[0,T]t\in[0,T]4. The rate function is t∈[0,T]t\in[0,T]5, t∈[0,T]t\in[0,T]6.

The squared difference in clock space is divided by t∈[0,T]t\in[0,T]7, and a learnable logit scale (initialized to 1.0) modulates the scoring. Training uses AdamW (t∈[0,T]t\in[0,T]8, t∈[0,T]t\in[0,T]9, batch size 48) for ηsX=F(Xs)∈Rd,ηtY=G(Yt)∈Rd\eta^X_s = \mathcal{F}(X_s) \in \mathbb{R}^d, \qquad \eta^Y_t = \mathcal{G}(Y_t) \in \mathbb{R}^d0 epochs, optimizing ηsX=F(Xs)∈Rd,ηtY=G(Yt)∈Rd\eta^X_s = \mathcal{F}(X_s) \in \mathbb{R}^d, \qquad \eta^Y_t = \mathcal{G}(Y_t) \in \mathbb{R}^d1 loss on mel-spectrograms. In the parallel regime, the mel-to-phoneme ratio (MPR) is swept from ηsX=F(Xs)∈Rd,ηtY=G(Yt)∈Rd\eta^X_s = \mathcal{F}(X_s) \in \mathbb{R}^d, \qquad \eta^Y_t = \mathcal{G}(Y_t) \in \mathbb{R}^d2 to ηsX=F(Xs)∈Rd,ηtY=G(Yt)∈Rd\eta^X_s = \mathcal{F}(X_s) \in \mathbb{R}^d, \qquad \eta^Y_t = \mathcal{G}(Y_t) \in \mathbb{R}^d3; in AR, ηsX=F(Xs)∈Rd,ηtY=G(Yt)∈Rd\eta^X_s = \mathcal{F}(X_s) \in \mathbb{R}^d, \qquad \eta^Y_t = \mathcal{G}(Y_t) \in \mathbb{R}^d4 MPR is set to ηsX=F(Xs)∈Rd,ηtY=G(Yt)∈Rd\eta^X_s = \mathcal{F}(X_s) \in \mathbb{R}^d, \qquad \eta^Y_t = \mathcal{G}(Y_t) \in \mathbb{R}^d5.

6. Experimental Evaluation: Speech Synthesis Performance and Alignment

On the LJSpeech-1.1 corpus (13,100 utterances, 80-dim mel-spectrograms, 22.05 kHz), inference was conducted using a fixed HiFi-GAN vocoder. Evaluations used both Whisper and wav2vec2-CTC automatic speech recognition.

Parallel Decoding at MPR = 6.0:

  • SDPA: WER = 7.39% ηsX=F(Xs)∈Rd,ηtY=G(Yt)∈Rd\eta^X_s = \mathcal{F}(X_s) \in \mathbb{R}^d, \qquad \eta^Y_t = \mathcal{G}(Y_t) \in \mathbb{R}^d6 0.22; CER = 3.94% ηsX=F(Xs)∈Rd,ηtY=G(Yt)∈Rd\eta^X_s = \mathcal{F}(X_s) \in \mathbb{R}^d, \qquad \eta^Y_t = \mathcal{G}(Y_t) \in \mathbb{R}^d7 0.14
  • SCA (normalized): WER = 7.03% ηsX=F(Xs)∈Rd,ηtY=G(Yt)∈Rd\eta^X_s = \mathcal{F}(X_s) \in \mathbb{R}^d, \qquad \eta^Y_t = \mathcal{G}(Y_t) \in \mathbb{R}^d8 0.20; CER = 3.66% ηsX=F(Xs)∈Rd,ηtY=G(Yt)∈Rd\eta^X_s = \mathcal{F}(X_s) \in \mathbb{R}^d, \qquad \eta^Y_t = \mathcal{G}(Y_t) \in \mathbb{R}^d9 0.12

SDPA's performance degrades for MPR outside ϕ:Rd→R>0\phi: \mathbb{R}^d \to \mathbb{R}_{>0}0 (alignment blur, over- or under-generation), while SCA maintains WER ϕ:Rd→R>0\phi: \mathbb{R}^d \to \mathbb{R}_{>0}1 for the full tested range, demonstrating robust speed/rate control.

Autoregressive Decoding:

  • SDPA yields no coherent alignments (WER, CER Ï•:Rd→R>0\phi: \mathbb{R}^d \to \mathbb{R}_{>0}2) under causal masks and teacher-forcing.
  • SCA (unnormalized): WER = 66.5%; CER = 48.5% on 1,852 evaluated ARCTIC+Harvard sentences.

Visual analysis of attention matrices reveals that SCA produces sharper, near-diagonal, and continuous attention, versus drifting or noisy patterns for SDPA. The mid-sequence "softening" observed matches the theoretical Brownian-bridge variance, suggesting a useful inductive bias against over-rigid alignment.

7. Extensions, Applications, and Limitations

SCA generalizes to multi-scale or hierarchical clocks that couple global and local rate modeling and could inform clock-guided diffusion or flow-matching decoders. Its potential extends to continuous sequence alignment tasks beyond audio, including video frame alignment, motion capture, and expressive music performance generation.

Limitations include:

  • The strict monotonic alignment assumption precludes non-monotonic (large reordering) alignments.
  • The normalized clock regime requires a known or accurately predicted global target length.
  • For discrete text generation, global length control may be semantically risky without explicit external modeling.

SCA thus provides an inductively structured, nearly parameter-free attention mechanism that enforces monotonicity and continuity by construction, offers a closed-form Gaussian scoring rule based on learned clock integrals, and improves robustness and stability of sequence alignment compared to conventional SDPA—especially in tasks requiring precise, time-synchronous mappings (Soh et al., 18 Sep 2025).

Definition Search Book Streamline Icon: https://streamlinehq.com
References (1)

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Stochastic Clock Attention.