Memorize-Generalize: An online algorithm for learning higher-order sequential structure with cloned Hidden Markov Models

Rajeev Rikhye, J. Swaroop Guntupalli, Nishad Gothoskar, Miguel Lázaro-Gredilla, Dileep George

Abstract

Sequence learning is a vital cognitive function observed in numerous brain areas, yet discovering the underlying algorithms remains a major endeavor in both neuroscience and machine learning. This paper introduces a biologically plausible learning algorithm for Cloned Hidden Markov Models (CHMMs) called "memorize-generalize." By constraining the sparsity of the emission matrix, CHMMs efficiently learn higher-order temporal dependencies and recognize contexts in noisy signals. The central basis of our model is the observation that cortical neurons sharing the same receptive field properties can learn to represent unique incidences of bottom-up information within different temporal contexts. The memorize-generalize algorithm allows for rapid memorization of sequences followed by gradual generalization as more data is accumulated. We demonstrate that CHMMs trained with this algorithm can model long-range structure in bird songs with only a slight degradation in performance compared to expectation-maximization, while still outperforming other representations like LSTMs and n-grams.

Introduction

Sequence learning—the ability to recognize and predict patterns over time—is fundamental to everything from human speech to motor control. While machine learning has made strides with Recurrent Neural Networks (RNNs) and LSTMs, these models often struggle to handle uncertainty natively and lack biological plausibility in how they learn. Traditional Hidden Markov Models (HMMs) are more robust to noise but typically use a "dense" structure that makes it difficult to represent higher-order dependencies, where the next state depends on a long history of previous states. Furthermore, the standard Expectation-Maximization (EM) algorithm for training HMMs is a slow, batch-oriented process. In contrast, biological systems, such as a young bird learning a song, often memorize patterns rapidly and generalize them online as they encounter new information.

Methods

The authors build upon the Cloned Hidden Markov Model (CHMM). Unlike a standard HMM, a CHMM uses a sparse emission matrix where multiple hidden states (called "clones") are deterministically mapped to the same observation. This mimics cortical columns in the brain, where many neurons share the same receptive field but fire in different temporal contexts.

Overview of the Cloned HMM structure (A) and the phases of the Memorize-Generalize algorithm: Memorization (B) and Randomization (C).

The core contribution is the Memorize-Generalize (M-G) algorithm, which operates in three distinct phases:

  1. Memorization: The model is first forced to memorize a training sequence verbatim, creating a rigid path of transitions between clones.
  2. Randomization: The model is endowed with a "random jump" probability using pseudocounts in the transition matrix, allowing it to transition between any clones with a very low probability.
  3. Generalization: As new data arrives, the model uses an online version of Viterbi training. It decodes the next symbol based on its current state and immediately updates its transition counts. This allows the model to "distill" its rigid memory into a generalized statistical representation.

Datasets and Evaluation

The researchers evaluated the algorithm using canary songs from Belgian Waterslager canaries. Canary songs are ideal because they consist of "syllables" arranged in complex phases with long-range temporal correlations—the choice of what to sing next depends on what was sung several seconds prior.

Key insights from the evaluation include:

  • Sparsity as a Feature: Deterministic and sparse mapping from hidden states to observations makes the CHMM easier to train and less prone to poor local minima.
  • Biological Inspiration: The M-G algorithm mirrors the "subsong" phase in juvenile birds, where they initially produce highly variable sequences before crystallizing them into structured songs.
  • Handling Uncertainty: Unlike LSTMs, which provide point estimates, CHMMs maintain a full probability distribution over states, allowing them to handle noisy or incomplete data gracefully.

Key Results

  • Performance vs. EM: While the M-G algorithm showed a slight degradation in performance compared to the "gold standard" EM algorithm, it converged much faster and functioned entirely online.
  • Superiority over Baselines: CHMMs trained with M-G outperformed LSTMs and n-gram models in capturing the higher-order structure of the bird songs.
  • Structural Discovery: Visualization of the learned transition matrices revealed that the model successfully uncovered fine-grained ordering and long-range relationships between syllables that simpler models miss.
  • Lookahead Buffers: Using a small "lookahead buffer" significantly improved the model's ability to generalize by decoding symbols based on a small window of future context.

Conclusion

The memorize-generalize algorithm provides a biologically inspired framework for online sequence learning. By leveraging the unique structural properties of CHMMs, it bridges the gap between rapid memorization and robust statistical generalization. Future work could involve applying these models to more complex domains, such as natural language processing or real-time robotic control, where online learning and uncertainty management are critical.

Summary updated

BibTeX
@inproceedings{rikhye2019memorize,
  author = {Rajeev Rikhye and J. Swaroop Guntupalli and Nishad Gothoskar and Miguel Lázaro-Gredilla and Dileep George},
  title = {{Memorize-Generalize: An online algorithm for learning higher-order sequential structure with cloned Hidden Markov Models}},
  booktitle = {2019},
  year = {2019},
  doi = {10.32470/ccn.2019.1407-0},
}
Figure