Dynamic Programming in Rank Space: Scaling Structured Inference with Low-Rank HMMs and PCFGs

Songlin Yang, Wei Liu, Kewei Tu

Introduction

Structured models such as Hidden Markov Models (HMMs) and Probabilistic Context-Free Grammars (PCFGs) are essential for capturing hierarchical and sequential dependencies in natural language. However, their practical utility is often limited by the computational cost of inference, which scales poorly with the number of hidden states. For instance, the Inside algorithm for PCFGs has a complexity of $O(n^3m^3)$, where $n$ is the sentence length and $m$ is the number of states. This cubic dependency on $m$ prevents the use of large state spaces that could otherwise capture fine-grained linguistic nuances.

While low-rank approximations have been proposed to mitigate this, previous algorithms often retained a dependency on the original state size $m$ during the dynamic programming (DP) steps. This paper presents "Dynamic Programming in Rank Space," a novel approach that uses tensor decomposition to move the computational burden of inference from the large state space to a significantly smaller "rank space."

Methodology

The authors utilize the framework of Factor Graph Grammars (FGGs) to represent structured models. Their method involves a two-step transformation to decouple the state space size from the inference complexity.

Tensor Rank Decomposition

First, the large probability tensors defining the grammar (e.g., the $m \times m \times m$ transition tensor in a PCFG) are approximated using Canonical Polyadic Decomposition (CPD). This process introduces a new "rank" dimension $r$ and decomposes high-order hyperedges into a set of lower-order edges connected by a central rank node $R$.

Decomposition of a hyperedge into a rank-space representation using a rank node R.

Marginalization in Rank Space

The key innovation lies in marginalizing out the original state nodes entirely before performing inference. By doing so, the authors construct a new FGG that operates purely in Rank Space.

Marginalization of state nodes to create a pure rank-space rule, eliminating the dependency on state size m during DP.

This transformation results in a "Rank-space Inside Algorithm" with a complexity of $O(n^3r + n^2r^2)$. Critically, this eliminates the $O(n^2mr)$ term that acted as a bottleneck in prior low-rank implementations. Since the rank $r$ is typically much smaller than the state size $m$, this allows for the use of tens of thousands of hidden states with minimal computational overhead.

Experimental Results

The proposed method was evaluated on the Penn Treebank (PTB) for unsupervised parsing and language modeling.

Unsupervised Parsing

The rank-space PCFG, utilizing 9,000 preterminals and 4,500 nonterminals, achieved an F1 score of 64.1 on the PTB. This significantly outperforms the previous state-of-the-art of 60.4. The approach allowed for a 20-fold increase in the number of hidden states compared to previous low-rank methods while maintaining superior performance and lower inference complexity.

HMM Language Modeling

The authors successfully scaled HMMs to $2^{15}$ (32,768) states. The resulting model achieved a perplexity of 126.4, which is lower than the 131.8 achieved by previous low-rank HMM implementations, while also demonstrating improved execution speed.

Discussion and Limitations

The findings highlight the benefits of over-parameterization in structured latent variable models when paired with efficient inference algorithms. However, certain limitations persist. The rank-space approach is designed for "sum-product" inference and does not natively support "max-product" (Viterbi) decoding. To obtain parse trees, the authors employed Minimum Bayes-Risk (MBR) decoding. Furthermore, while the DP is exact within the rank-space FGG, the initial CPD decomposition remains an approximation of the full-rank model. Future research will explore extending this framework to more complex grammars and investigating the impact of approximation errors in various downstream tasks.

Summary updated

BibTeX
@inproceedings{yang2022dynamic,
  author = {Songlin Yang and Wei Liu and Kewei Tu},
  title = {{Dynamic Programming in Rank Space: Scaling Structured Inference with Low-Rank HMMs and PCFGs}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2022},
  doi = {10.18653/v1/2022.naacl-main.353},
}
Figure