Adaptive Memory Networks

Daniel Li, Asim KadavWorkshops @ ICLR 2018

In the world of deep learning, "more" is often equated with "better." More layers, more parameters, and more memory usually lead to higher accuracy. However, in real-world applications like voice assistants or medical diagnosis, "more" also means "slower." When a smart assistant has a hard eight-second timeout to process, transliterate, and answer a question, every millisecond counts.

A 2018 ICLR workshop paper by Daniel Li and Asim Kadav introduces Adaptive Memory Networks (AMN), a clever approach to Question Answering (QA) that doesn't just store information—it learns how to organize and prune it on the fly to achieve lightning-fast inference.

TL;DR

Adaptive Memory Networks (AMN) dynamically restructure their own architecture based on the input story and question, concentrating relevant information into small "memory banks." By learning to ignore irrelevant data during the final reasoning step, AMN achieves state-of-the-art accuracy on bAbI tasks while examining 48% fewer entities, leading to significantly faster inference times.

What Problem Does This Paper Address?

Most modern QA systems use Memory Networks, which store an entire input story in an addressable memory. While powerful, these models typically have a "scan everything" problem: to answer a simple question, they must perform a "soft attention" scan over every single word or entity in the story.

As stories get longer, this becomes computationally expensive. Previous attempts to fix this used unsupervised clustering (like nearest-neighbor searches), but these often performed poorly because the "importance" of a memory wasn't actually learned by the model. The challenge is creating a system that can discretely decide what to keep and what to ignore while remaining "differentiable" (so it can be trained using standard gradient descent).

Methods

The core innovation of AMN is the Adaptive Memory Module, which treats memory not as a single flat list, but as a series of dynamic Memory Banks.

Full Architecture of Adaptive Memory Networks

The architecture is divided into three main phases: an Encoder, the Semantic Memory Module, and a Decoder. The Semantic Memory Module operates through several key mechanisms:

  1. Dynamic Bank Creation ($\Pi_{new}$): The model monitors the "entropy" (information density) of its current memory. If a bank becomes too crowded or saturated, the model automatically creates a new one.
  2. Entity Movement ($\Pi_{move}$): Based on the specific question asked, a "Bank Controller" decides which entities (hidden states representing words/sentences) are relevant. It gradually moves these "important" entities into the primary memory banks.
Bank Controller and Memory Banks
  1. The Bank Controller: To make the discrete "keep or toss" decision differentiable, the authors used a reparameterization trick (similar to those used in Variational Autoencoders). This allows the model to learn binary decisions (0 or 1) through backpropagation.
  2. Transitive Logic ($\Pi_{prop}$): To handle complex reasoning (e.g., "Where is the ball?" if the story says "John picked up the ball" and "John went to the kitchen"), AMN uses a directed graph to propagate information between related entities.
  3. Efficient Decoding: During the final "answer" phase, the decoder only looks at the most relevant banks. If the model did its job well, the answer is in Bank 1, and it can ignore the rest of the "filing cabinet."

Datasets

The researchers evaluated AMN on the bAbI dataset, a suite of 20 synthetic reasoning tasks (e.g., deduction, induction, pathfinding).

They also introduced Extended bAbI tasks to test scalability:

  • Scaled Task 1: Increased the number of entities to 100 and story length to 90 sentences to see if the model could still find the "needle in the haystack."
  • Multiple Questions: Modified the tasks to require answering several questions about the same story simultaneously.

Key Insights and Ideas

  • Learned Organization: Unlike previous models that use fixed memory slots, AMN learns an organizational strategy. It acts like a student highlighting a textbook—it moves the "highlighted" parts to the front of its mind.
  • The Power of Dynamics: By using a dynamic framework (PyTorch), the model can actually change its size and shape for every individual input. This "on-the-fly" architecture is much more efficient than a one-size-fits-all static network.
  • Transitive Closure: The use of an adjacency matrix ($A$) to model sentence structure allows the model to perform "sentence walks," effectively following a chain of events to find an answer that isn't explicitly stated in a single sentence.

Key Results

  • Accuracy: AMN solved all 20 bAbI tasks with an error rate below 5%, matching or beating state-of-the-art models like EntNet and DMN+.
  • Efficiency: On average, the model required 48% fewer entities to be examined during inference. On tasks with high amounts of "noise" or unrelated information, this reduction was even more dramatic.
  • Speedup: In wall-clock time tests, AMN was significantly faster. For "Single Supporting Fact" tasks, the baseline took 2.15s while AMN took only 0.6s—a nearly 4x speedup.
  • Scalability: In the 100-entity scaled task, AMN reduced the ratio of examined entities to just 0.13, proving it becomes more efficient as the data gets noisier.

Limitations and Future Work

While the results on the bAbI dataset are impressive, bAbI is a synthetic, controlled environment. The authors acknowledge that the next step is testing AMN on larger, real-world datasets (like SQuAD or WikiQA) where language is more complex and less structured.

Additionally, while the model is generic, it currently focuses on text. Future work could involve extending this "adaptive bank" concept to other domains, such as video processing or long-term robot navigation, where the "memory" of past frames or locations needs constant, intelligent pruning.

Summary updated

BibTeX
@inproceedings{li2018adaptive,
  author = {Daniel Li and Asim Kadav},
  title = {{Adaptive Memory Networks}},
  booktitle = {Workshops @ ICLR},
  year = {2018},
}
Figure