A Framework for Inference Inspired by Human Memory Mechanisms

Xiangyu Zeng, Jie Lin, Piao Hu, Ruizheng Huang, Zhicheng Zhang

TL;DR

The authors introduce the PMI (Perception, Memory, Inference) framework, a novel neural architecture inspired by human cognitive theories. By splitting memory into a capacity-limited Working Memory (WM) and a relational Long-Term Memory (LTM), PMI significantly boosts the reasoning and long-context capabilities of standard Transformers and Convolutional Neural Networks (CNNs).

What Problem Does This Paper Address?

Standard deep learning models, such as vanilla Transformers or CNNs, excel at pattern recognition but often struggle with complex, multi-step relational reasoning. A major reason for this limitation is their lack of a dedicated, structured memory. They typically rely on hidden states as "implicit memory," which constantly overwrites past information as new data flows in.

While Memory-Augmented Neural Networks (MANNs) exist, they usually feature a single, flat memory structure. This clashes with how human cognition works. The human brain separates transient task data (Working Memory) from accumulated relational knowledge (Long-Term Memory). The authors tackle this gap by designing a biologically inspired, dual-layer memory module that can be plugged into existing architectures to help them "remember" and reason more like humans.

Methods

The authors propose the PMI framework, which processes information in three distinct stages: Perception, Memory, and Inference.

The PMI framework architecture, detailing the high-level flow and the internal mechanisms of the memory update and inference modules.
  1. Perception (P): Converts raw input (text, images) into internal feature representations using standard embeddings or convolutional layers.
  2. Memory (M): The core novelty of the framework. It is a globally shared, dual-layer system:
  3. Working Memory (WM): Temporarily buffers data. It uses a "competitive write" mechanism—a sparse cross-attention mechanism that only selects the top-$k$ most important features. This mimics human attention bottlenecks, preventing memory overflow and filtering out noise.
  4. Long-Term Memory (LTM): A 3D tensor designed to store complex relational knowledge. It is updated by merging the newly updated WM into the LTM using an outer product operation. Unlike standard addition or dot products, outer products explicitly capture the relationships and interactions between different pieces of information.
  5. Inference (I): The model retrieves relevant information from both WM and LTM using content-based addressing, blending this historical context with the current input to make a final prediction.

To test this framework, the authors replaced the standard pairwise self-attention layers in Transformers with their PMI module (creating PMI-TR) and also augmented standard CNNs (CNN_PMI).

Datasets

The framework was evaluated across a diverse set of benchmarks requiring different types of reasoning:

  • Sort-of-CLEVR: A visual dataset specifically designed to test relational reasoning (e.g., "What is the shape of the object furthest from the green object?").
  • bAbI-20k: A classic text-based question-answering dataset testing logical deduction, counting, and pathfinding.
  • Detecting Equilateral Triangles: A synthetic visual task requiring the model to understand spatial relationships between distant point clusters.
  • Language Modeling: Enwik8 (character-level), WikiText-103, and PG-19 (word-level) to test long-context retention.
  • CIFAR-10: A standard image classification benchmark.

Key Insights and Ideas

  • Biological Plausibility Works: Mimicking the "Multiple Memory Systems" theory from cognitive science translates to tangible performance gains in AI. Separating "what I am doing right now" (WM) from "what I know about the world" (LTM) prevents catastrophic forgetting during complex tasks.
  • Information Bottlenecks are Good: The competitive write access to WM acts like Miller's Law (the psychological rule that humans can only hold ~7 items in working memory). Forcing the model to discard less relevant data actually improves reasoning.
  • Outer Products for Relations: Using outer products to update LTM is a game-changer. It explicitly encodes how different vectors interact, building a rich, evolving web of relational knowledge rather than just a list of isolated facts.
  • Global Sharing is Efficient and Effective: Sharing the exact same memory module across all layers of a Transformer—rather than giving each layer its own isolated memory—not only saves massive amounts of parameters but actually improves convergence and accuracy.

Key Results

The PMI framework demonstrated significant improvements across multiple domains, particularly in tasks requiring complex relational reasoning.

Accuracy curves on the Sort-of-CLEVR dataset showing PMI-TR outperforming baselines on Unary, Binary, and Ternary relational questions.
  • Visual Relational Reasoning (Sort-of-CLEVR): PMI-TR converged faster and achieved higher accuracy than baselines, particularly excelling on complex binary and ternary relational questions.
  • Text QA (bAbI-20k): PMI-TR achieved a state-of-the-art mean error rate of 2.55%, significantly outperforming the closest baseline (TR+HSW at 3.6%) and older memory networks like DNCs.
  • Spatial Reasoning: On the Equilateral Triangles task, PMI-TR jumped to 97.9% accuracy, crushing the standard Transformer's 89.8%.
  • Language Modeling: Pushed the envelope on long-context tasks, achieving highly competitive scores: 0.96 Bits-Per-Character on Enwik8 and 16.5 perplexity on WikiText-103.
  • Vision: Adding PMI to a standard CNN improved CIFAR-10 accuracy, proving the memory module is architecture-agnostic.

Limitations and Future Work

  • Limitations: While not heavily emphasized as a dedicated section, the ablation studies reveal that tuning the top-$k$ sparsity requires some care (e.g., ternary relations require a slightly larger $k$ than simpler tasks). Additionally, if the memory is not globally shared across layers, the parameter count explodes by roughly 8x.
  • Future Work: The authors view this as a preliminary exploration. They plan to integrate the PMI module into a broader variety of foundational architectures and extend its application to more complex, multi-modal tasks where long-term relational reasoning is critical.

Summary updated

BibTeX
@inproceedings{zeng2024framework,
  author = {Xiangyu Zeng and Jie Lin and Piao Hu and Ruizheng Huang and Zhicheng Zhang},
  title = {{A Framework for Inference Inspired by Human Memory Mechanisms}},
  booktitle = {International Conference on Learning Representations},
  year = {2024},
  url = {https://openreview.net/forum?id=vBo7544jZx},
}
Figure