Table of Contents
Fetching ...

Neural Hidden Markov Model with Adaptive Granularity Attention for High-Frequency Order Flow Modeling

Tianzuo Hu

Abstract

We propose a Neural Hidden Markov Model (HMM) with Adaptive Granularity Attention (AGA) for high-frequency order flow modeling. The model addresses the challenge of capturing multi-scale temporal dynamics in financial markets, where fine-grained microstructure signals and coarse-grained liquidity trends coexist. The proposed framework integrates parallel multi-resolution encoders, including a dilated convolutional network for tick-level patterns and a wavelet-LSTM module for low-frequency dynamics. A gating mechanism conditioned on local volatility and transaction intensity adaptively fuses multi-scale representations, while a multi-head attention layer further enhances temporal dependency modeling. Within this architecture, a Neural HMM with conditional normalizing flow emissions is employed to jointly model latent market regimes and complex observation distributions. Empirical results on high-frequency limit order book data demonstrate that the proposed model outperforms fixed-resolution baselines in predicting short-term price movements and liquidity shocks. The adaptive granularity mechanism enables the model to dynamically adjust its focus across time scales, providing improved performance particularly during volatile market conditions.

Neural Hidden Markov Model with Adaptive Granularity Attention for High-Frequency Order Flow Modeling

Abstract

We propose a Neural Hidden Markov Model (HMM) with Adaptive Granularity Attention (AGA) for high-frequency order flow modeling. The model addresses the challenge of capturing multi-scale temporal dynamics in financial markets, where fine-grained microstructure signals and coarse-grained liquidity trends coexist. The proposed framework integrates parallel multi-resolution encoders, including a dilated convolutional network for tick-level patterns and a wavelet-LSTM module for low-frequency dynamics. A gating mechanism conditioned on local volatility and transaction intensity adaptively fuses multi-scale representations, while a multi-head attention layer further enhances temporal dependency modeling. Within this architecture, a Neural HMM with conditional normalizing flow emissions is employed to jointly model latent market regimes and complex observation distributions. Empirical results on high-frequency limit order book data demonstrate that the proposed model outperforms fixed-resolution baselines in predicting short-term price movements and liquidity shocks. The adaptive granularity mechanism enables the model to dynamically adjust its focus across time scales, providing improved performance particularly during volatile market conditions.
Paper Structure (32 sections, 20 equations, 3 figures, 3 tables)

This paper contains 32 sections, 20 equations, 3 figures, 3 tables.

Figures (3)

  • Figure 1: Architecture of the Neural HMM with Adaptive Granularity Attention.
  • Figure 2: Attention weights assigned by the multi-head attention layer over time and features. High-volatility periods (shaded) correspond to elevated fine-grained attention weights (Spearman $\rho = 0.72$).
  • Figure 3: Relationship between local signal variance and gating vector values. Low, medium, and high volatility regimes are shown in green, orange, and red respectively. The black curve represents the fitted sigmoid trend.