Memory and attention in deep learning

Hung LearXiv 2021

TL;DR

This thesis explores memory and attention mechanisms in deep learning, proposing novel Memory-Augmented Neural Networks (MANNs) that enhance sequence modeling capabilities. The work introduces new architectures for multi-process learning, generative models, optimal memory operations, and even simulates Universal Turing Machines, pushing the boundaries of what AI can learn and remember.

What Problem Does This Paper Address?

The core challenge this thesis tackles is the inherent limitation of current deep learning models in handling complex, long-term dependencies and variability, especially in sequential data. While Recurrent Neural Networks (RNNs) have some memory, their capacity is limited, leading to issues like vanishing gradients and difficulty in remembering distant information. Existing Memory-Augmented Neural Networks (MANNs) have shown promise by incorporating external memory, but there's a need for more sophisticated architectures that can handle multiple processes, model generative variability, optimize memory usage, and achieve greater computational power akin to human memory and even Universal Turing Machines. The thesis aims to bridge this gap by advancing the understanding and application of memory and attention in deep learning.

Methods

The thesis proposes several novel approaches:

  • Taxonomy of Memory: A comprehensive classification of memory types in RNNs, drawing parallels to human memory and exploring various external memory constructions.
  • Memory-Augmented Neural Networks (MANNs):
    • Dual Controller MANNs (DCw-MANN): Architectures with multiple controllers and write-protected mechanisms for sequence-to-sequence tasks.
  • Dual Memory Neural Computer (DMNC): A model designed for asynchronous multi-view sequential learning, utilizing two external memories and novel cache components for early-fusion interactions.
  • Variational Memory Encoder-Decoder (VMED): A generative framework that uses external memory to model latent variability in sequential data, particularly for conversational AI.
  • Optimal Writing Schemes (Uniform Writing & Cached Uniform Writing): Theoretical analysis and practical methods to optimize memory writing operations for better memorization capacity and computational efficiency.
  • Neural Stored-Program Memory (NSM): A novel external memory that stores controller weights, enabling MANNs to simulate Universal Turing Machines and dynamically adapt their programs.
  • Attention Mechanisms: Leveraged extensively for memory access, particularly in the context of SDM and Transformer-like architectures.

Datasets

The paper utilizes a variety of datasets for evaluation:

  • Healthcare Data: MIMIC-III dataset for treatment recommendation, drug prescription, and disease progression tasks.
  • Conversational Data: Open-domain movie transcript datasets (Cornell Movies, OpenSubtitle), and closed-domain datasets (LiveJournal, Reddit comments) for conversational response generation.
  • Synthetic Tasks: Odd-Even Sequence Prediction, Sum of Two Sequences, Synthetic Memorization (Copy, Reverse), Synthetic Reasoning (Add, Max), and Sinusoidal Regression.
  • Image Classification: MNIST and pMNIST datasets for Flatten Image Recognition.
  • Document Classification: Several large datasets including IMDb, Yelp, AG's News, DBPedia, and Yahoo! Answers.
  • Question Answering: bAbI dataset for text question answering.
  • Few-Shot Learning: Omniglot dataset.

Key Insights and Ideas

  • Memory is Crucial for Intelligence: The thesis strongly emphasizes that memory is not just for remembering but is fundamental for higher cognitive functions like reasoning, attention, and imagination, making it indispensable for advanced AI.
  • External Memory is Key to Overcoming RNN Limitations: By moving beyond implicit memory within RNNs, external memory modules (like those in MANNs) can effectively address vanishing gradients and long-term dependency issues.
  • Multi-View and Multi-Process Learning Requires Sophisticated Memory: Handling complex data with multiple interacting views or processes necessitates architectures like DMNC that can manage separate and shared memories, and model asynchronous interactions.
  • Generative Models Benefit from Variational Memory: Injecting variability into generative models, especially for sequential data like conversations, can lead to more natural and diverse outputs by modeling latent modes of expression.
  • Optimal Memory Operations Matter: Simply having memory isn't enough; how information is written and accessed (e.g., Uniform Writing, Cached Uniform Writing) significantly impacts memorization capacity, computational efficiency, and overall performance.
  • Simulating Universal Turing Machines is Achievable: The concept of Neural Stored-Program Memory (NSM) demonstrates that MANNs can be extended to simulate Universal Turing Machines, opening doors to more general-purpose AI.
  • Explainability Through Memory Access: Analyzing memory access patterns (e.g., write gate values) can provide insights into how models learn and make decisions, which is particularly important in domains like healthcare.

Key Results

  • Outperformance on Healthcare Tasks: Proposed models (DCw-MANN, DMNC) achieved state-of-the-art or competitive results on treatment recommendation, drug prescription, and disease progression tasks, outperforming baselines by 1-2%.
  • Improved Conversational AI: VMED demonstrated significant quantitative and qualitative improvements in conversational response generation, producing more contextually relevant and diverse outputs.
  • Efficient Long-Term Learning: UW and CUW significantly reduced computation time (up to 60% for DNC) and improved accuracy on ultra-long sequential learning tasks with limited memory.
  • Enhanced Reasoning and Memorization: NUTM, equipped with NSM, showed superior performance on algorithmic tasks, continual learning, and few-shot learning, outperforming NTM and other MANNs.
  • State-of-the-Art in Question Answering: NUTM with DNC core achieved state-of-the-art results on the bAbI dataset for question answering.

Limitations and Future Work

  • Generative Models: The current work is limited to generating simple and deterministic output sequences. Future work could involve implementing a dynamic number of modes in VMED to enable learning of the optimal K for each timestep, and exploring multi-person dialog settings.
  • Healthcare Applications: While DCw-MANN and DMNC show promise, extensions could include handling multiple healthcare tasks like medical question answering. DMNC could also be generalized to multi-input multi-output settings and applied to broader problems like multi-media and multi-agent systems.
  • Theoretical Analysis: Future investigations for Chapter 6 will focus on tightening the measurement bound for memory capacity.
  • Generalizability of NSM: While NSM shows benefits for MANNs, further research could explore integrating NSM into other neural network architectures to enhance their flexibility and modularity.
  • Computational Universality: The work on NSM and NUTM demonstrates the potential for MANNs to simulate Universal Turing Machines, but further exploration into their full computational capabilities is warranted.

Summary updated

Abstract

Intelligence necessitates memory. Without memory, humans fail to perform various nontrivial tasks such as reading novels, playing games or solving maths. As the ultimate goal of machine learning is to derive intelligent systems that learn and act automatically just like human, memory construction for machine is inevitable. Artificial neural networks model neurons and synapses in the brain by interconnecting computational units via weights, which is a typical class of machine learning algorithms that resembles memory structure. Their descendants with more complicated modeling techniques (a.k.a deep learning) have been successfully applied to many practical problems and demonstrated the importance of memory in the learning process of machinery systems. Recent progresses on modeling memory in deep learning have revolved around external memory constructions, which are highly inspired by computational Turing models and biological neuronal systems. Attention mechanisms are derived to support acquisition and retention operations on the external memory. Despite the lack of theoretical foundations, these approaches have shown promises to help machinery systems reach a higher level of intelligence. The aim of this thesis is to advance the understanding on memory and attention in deep learning. Its contributions include: (i) presenting a collection of taxonomies for memory, (ii) constructing new memory-augmented neural networks (MANNs) that support multiple control and memory units, (iii) introducing variability via memory in sequential generative models, (iv) searching for optimal writing operations to maximise the memorisation capacity in slot-based memory networks, and (v) simulating the Universal Turing Machine via Neural Stored-program Memory-a new kind of external memory for neural networks.

Empirical ResultsBrowse all benchmarks →

BenchmarkMethodMetricScoreProtocol / Evidence
Copy · Synthetic memorisation — Copy · L=50DNC+UWTest accuracy97.7%+29.7 vs baselinesplit: test · memory-slots=4 · sequence-length=50
Source quote
L4687: DNC+UW │ 100 │ 98,840 │ 97.7 │ 69.3 │ 100 │ 79.5\tabularnewline
Reported baseline / comparator measurements (2)
BenchmarkMethodMetricScoreProtocol / Evidence
Copy · Synthetic memorisation — Copy · L=50DNC baselineTest accuracy68.0%split: test · memory-slots=4 · sequence-length=50
Source quote
L4684: DNC │ 100 │ 98,840 │ 68.0 │ 44.2 │ 65.0 │ 54.1\tabularnewline
OmniglotMANN (LRUA) baselineClassification accuracy63.3%split: test · few-shot · classes=10 · presentation=fifth · memory-condition=persistent · training-episodes=100000
Source quote
L5397: MANN (LRUA) │ Yes │ 66.2 │ 73.4 │ 81.0 │ 51.3 │ 59.2 │ 63.3\tabularnewline
BibTeX
@misc{le2021memory,
  author = {Hung Le},
  title = {{Memory and attention in deep learning}},
  year = {2021},
  eprint = {2107.01390},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2107.01390},
}
Figure