Hierarchical Memory Networks

Sarath Chandar, Sungjin Ahn, Hugo Larochelle, Pascal Vincent, Gerald Tesauro, Yoshua BengioarXiv 2016

Introduction

Neural networks with external memory components are powerful tools for knowledge-based reasoning, such as question answering. However, they face a severe computational bottleneck in the "reader" mechanism. Traditionally, readers use soft attention, applying a softmax function over the entire memory to decide what to read. When memory contains millions of facts, this linear-time operation becomes prohibitive. The alternative, hard attention, often requires reinforcement learning which is notoriously difficult to train. Hierarchical Memory Networks (HMNs) aim to build a scalable, end-to-end differentiable memory reader without relying on dataset-specific heuristics.

Methodology

The authors propose replacing the full-memory softmax with a $K$-MIPS (Maximum Inner Product Search) attention mechanism. Instead of scanning the entire memory, the network queries the memory to find the top-$K$ most relevant facts and performs a softmax only over that small subset.

The paper explores two implementation phases:

  1. Exact $K$-MIPS: A linear scan finds the exact top $K$ matches. While not saving time, this validates whether restricting the softmax to $K$ items maintains or improves training.
  2. Approximate $K$-MIPS: To achieve speedups, memory is organized hierarchically using methods like Clustering (Spherical K-means), PCA-Trees, or Winner-Takes-All (WTA) Hashing.

Analysis of Training Dynamics

A key insight of the paper is that "less is more" regarding gradient dispersion. When a softmax is applied over 100,000+ facts, the gradient is dispersed into tiny, unhelpful fractions across thousands of irrelevant cells. By restricting the softmax to the top $K$ candidates, the network focuses its learning signal on the facts that matter most, leading to better convergence.

Validation error over epochs for different softmax sizes. Smaller K values lead to faster convergence and lower error compared to the standard full softmax.

As shown in the figure above, models with smaller $K$ values (like 10-softmax) converge faster and reach lower validation errors compared to the standard full softmax.

Empirical Results

The proposed HMN architecture was evaluated on the SimpleQuestions dataset using Freebase. Unlike previous approaches that used keyword heuristics to filter facts, this model searches the massive memory space end-to-end, proving the architecture's general applicability.

Performance comparison of MIPS-based models against standard softmax and other approximation methods.

The results demonstrate that the 10-MIPS approach achieved 62.2% test accuracy, significantly outperforming the standard Full-softmax approach (59.5%). Notably, it achieved this while reducing the average softmax size from approximately 108,000 to just 1,290. Among approximation methods, clustering-based approaches outperformed tree-based and hashing-based methods, achieving a ~5x speedup by accessing only ~20,000 facts per query.

Limitations and Future Work

The primary limitation of this approach is the requirement for static memory. If memory representations were updated during training, the approximate MIPS index (e.g., K-means clusters) would need frequent, expensive re-indexing. Future work should focus on dynamic $K$-MIPS algorithms to allow for evolving memory states without sacrificing search efficiency.

Summary updated

BibTeX
@misc{chandar2016hierarchical,
  author = {Sarath Chandar and Sungjin Ahn and Hugo Larochelle and Pascal Vincent and Gerald Tesauro and Yoshua Bengio},
  title = {{Hierarchical Memory Networks}},
  year = {2016},
  eprint = {1605.07427},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1605.07427},
}
Figure