Sequential Density Estimation via NCWFAs Sequential Density Estimation via Nonlinear Continuous Weighted Finite Automata

Tianyu Li, Bogdan Mazoure, Guillaume RabusseauarXiv 2022

Abstract

Weighted finite automata (WFAs) have been widely applied in many fields. One of the classic problems for WFAs is probability distribution estimation over sequences of discrete symbols. Although WFAs have been extended to deal with continuous input data, namely continuous WFAs (CWFAs), it is still unclear how to approximate density functions over sequences of continuous random variables using WFA-based models, due to the limitation on the expressiveness of the model as well as the tractability of approximating density functions via CWFAs. In this paper, we propose a nonlinear extension to the CWFA model to first improve its expressiveness, we refer to it as the nonlinear continuous WFAs (NCWFAs). Then we leverage the so-called RNADE method, which is a well-known density estimator based on neural networks, and propose the RNADE-NCWFA model. The RNADE-NCWFA model computes a density function by design. We show that this model is strictly more expressive than the Gaussian HMM model, which CWFA cannot approximate. Empirically, we conduct a synthetic experiment using Gaussian HMM generated data. We focus on evaluating the model's ability to estimate densities for sequences of varying lengths (longer length than the training data). We observe that our model performs the best among the compared baseline methods.

Introduction

Estimating the probability density of sequential data—such as audio signals, financial time series, or biological sequences—is a fundamental challenge in machine learning. Traditionally, Weighted Finite Automata (WFAs) have been the primary tool for discrete sequences, offering strong theoretical guarantees and efficient spectral learning algorithms. However, extending these models to continuous real-valued vectors is difficult.

Previous attempts, such as Continuous WFAs (CWFAs), suffered from limited expressiveness and an inability to naturally produce valid probability distributions. CWFAs are essentially linear models, making them unable to represent complex distributions like Gaussian Hidden Markov Models (HMMs). This paper introduces Nonlinear Continuous Weighted Finite Automata (NCWFAs) to bridge the gap between formal language theory and neural density estimation, creating a model that retains the elegant structure of automata while gaining the power to handle complex, continuous sequences.

Methods

The researchers developed the RNADE-NCWFA model, which combines three main components:

  1. Nonlinear Extensions: By adding a nonlinear feature map to the input and a nonlinear termination function to the output, the model breaks the linearity constraints of previous continuous automata.
  2. RNADE Integration: Leveraging the Real-valued Neural Autoregressive Density Estimator (RNADE) framework, the model predicts the parameters of a Gaussian Mixture Model (GMM) for each step in the sequence, ensuring the output is a valid probability density.
  3. Hybrid Spectral Learning: To address the vanishing gradient problem in long sequences, the authors use a hybrid approach. Gradient descent learns the nonlinear mappings, while spectral learning (based on tensor-train decomposition) recovers the core transition logic of the automaton.

Results and Performance

The RNADE-NCWFA model was tested against standard HMMs and LSTMs using synthetic data generated from a 10-state Gaussian HMM.

Log likelihood ratio comparison across varying training sizes, noise levels, and test sequence lengths.

Generalization and Robustness

As illustrated in Figure 1, the NCWFA model (labeled as RNADE-CWFA in the plots) consistently achieved the highest log-likelihood across different training sizes and noise levels. A key finding is the model's ability to generalize: when trained on short sequences but tested on sequences of length 400, the NCWFA maintained high performance while baseline models degraded significantly.

In high-noise scenarios (Noise STD = 1.0), the spectral learning variant outperformed the version trained solely with stochastic gradient descent (SGD). This suggests that the algebraic structure of spectral learning acts as a powerful regularizer, providing stability and lower variance in performance, particularly when training data is scarce.

Expressive Power

Mathematically, the authors demonstrate that RNADE-NCWFAs are strictly more expressive than Gaussian HMMs. Specifically, NCWFAs can model "shifting" HMMs where the emission distribution changes over time—a dynamic that standard HMMs are too rigid to capture.

Conclusion and Future Work

The NCWFA framework successfully combines the structural benefits of automata with the flexibility of neural networks. While the current study focuses on synthetic data, it establishes a strong theoretical and empirical foundation for applying these models to real-world continuous streams. Future research will explore making the hidden state transitions nonlinear and testing the model on practical applications like climate modeling or financial forecasting.

Summary updated

BibTeX
@misc{li2022sequential,
  author = {Tianyu Li and Bogdan Mazoure and Guillaume Rabusseau},
  title = {{Sequential Density Estimation via NCWFAs Sequential Density Estimation via Nonlinear Continuous Weighted Finite Automata}},
  year = {2022},
  eprint = {2206.03923},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2206.03923},
}
Figure