Sequence Modeling via Segmentations

Chong Wang, Yining Wang, Po-Sen Huang, Abdelrahman Mohamed, Dengyong Zhou, Li Deng

Introduction

Most standard sequence models, such as basic Recurrent Neural Networks (RNNs), process data token-by-token (e.g., character-by-character or word-by-word). However, many real-world sequences are naturally composed of multi-token "segments"—think of phrases like "machine learning" in text or phonotactic rules like "th-ough-t" in speech.

The primary challenge in modeling these sequences is that segment boundaries are usually unknown (latent). While models like Connectionist Temporal Classification (CTC) handle alignment, they do not explicitly model the internal structure of these segments. Other "segmental" models often rely on expensive approximations or heuristics to find the "best" alignment.

This paper introduces a probabilistic framework for modeling sequences through their underlying segmental structure. By using an efficient dynamic programming algorithm called Sleep-WAke Networks (SWAN), the model can exactly marginalize over all possible segmentations and alignments, discovering meaningful patterns while achieving state-of-the-art performance in speech recognition and text modeling.

Methods: Segmental RNNs and SWAN

The authors propose a generative model where the probability of a sequence is the product of the probabilities of its segments.

1. Sleep-WAke Networks (SWAN)

For sequence-to-sequence tasks, the authors introduce SWAN. In this setup, each input element $x_t$ can either "wake up" and emit a segment of one or more output tokens, or "sleep" and emit an empty segment (often denoted by a special end-of-segment token like $).

Sleep-WAke Network (SWAN) emitting segments of varying lengths.

2. Segmental and Connecting RNNs

Each segment is modeled using an RNN (like an LSTM or GRU). Crucially, the initial state of a segment's RNN is informed by the input and the history of previous segments. The authors found that carrying hidden state information across segment boundaries using a separate "connecting" RNN is vital. It allows the model to maintain a "language model" of sorts, where the choice of the next segment depends on what was emitted previously.

Architecture showing the connecting RNN that carries hidden state information across segment boundaries.

3. Exact Marginalization via Dynamic Programming

Because the number of possible segmentations is exponentially large, the authors develop a Dynamic Programming (DP) algorithm. This allows them to calculate the total probability $p(y|x)$ by summing over all valid segmentations in polynomial time, avoiding the need for approximations.

4. Efficiency Gains

To make training practical, they implement two strategies:

  • Limiting segment length: Capping the maximum segment length ($L$).
  • Reusing computations: The RNN hidden states for a long segment can be used to calculate the probabilities of all shorter sub-segments starting at the same point.

Key Insights and Results

The framework is general enough to be used as a standalone loss function in various deep learning architectures and offers several advantages over existing methods.

  • Beyond CTC Constraints: Unlike CTC, which requires the output sequence to be no longer than the input sequence, SWAN can handle cases where the output is longer because a single "wake" step can emit multiple tokens.
  • Automatic Structure Discovery: One of the most compelling findings is that the model discovers linguistically meaningful segments (like "support vector machines" or "hidden Markov models") entirely unsupervised during text modeling tasks.

Experimental Performance

The model was evaluated on two distinct types of tasks:

  1. Speech Recognition (TIMIT): The authors performed both phoneme-level and character-level recognition.
  2. Phoneme Error Rate (PER): Achieved 18.1%, outperforming several strong baselines including standard BiLSTMs (18.4%) and Neural Transducers (18.2%).
  3. Character Error Rate (CER): Achieved 30.5%, notably better than a CTC baseline (31.8%). Qualitatively, the "best path" segmentations often aligned with English phonotactics (e.g., grouping "th", "ou", and "ght" as units).
  4. Text Modeling (AP & CiteULike): The model achieved significantly higher predictive log-likelihood than Latent Dirichlet Allocation (LDA). As the maximum allowed segment length ($L$) increased from 1 to 3, the model's performance improved monotonically, proving that capturing segmental structure is beneficial for density estimation.

Limitations and Future Work

While powerful, the approach has limitations. The authors note that SWAN is currently about 5 times slower than CTC. While the DP algorithm is efficient, it is still computationally heavier than token-level approaches. Furthermore, experiments were conducted on relatively small datasets (like TIMIT); validating the approach on large-scale speech datasets (like Librispeech) remains a task for future work.

Finally, the authors suggest that this approach is a natural fit for phrase-based machine translation, where segmentations could represent translated phrases, potentially bridging the gap between traditional phrase-based systems and modern neural MT.

Summary updated

BibTeX
@inproceedings{wang2017sequence,
  author = {Chong Wang and Yining Wang and Po-Sen Huang and Abdelrahman Mohamed and Dengyong Zhou and Li Deng},
  title = {{Sequence Modeling via Segmentations}},
  booktitle = {International Conference on Machine Learning},
  year = {2017},
  url = {https://openreview.net/forum?id=ryZ-yjZ_Wr},
}
Figure