Memory Networks

A neural architecture that separates inference from a readable and writable long-term memory.

Metadata

FieldValue
PaperMemory Networks
AuthorsJason Weston, Sumit Chopra, Antoine Bordes
Year2014
VenuearXiv preprint
arXiv1410.3916
Statusverified

Question

Standard neural networks often compress the information needed for a prediction into a fixed hidden state. That is a poor fit for tasks where the relevant facts are stored in a changing collection of sentences or records and an answer requires chaining several facts together.

Memory Networks propose a system-level decomposition:

  • an input module that converts observations into internal representations;
  • a generalization module that updates the current state;
  • an output module that produces a query for memory access;
  • a response module that maps the final state to an answer;
  • a long-term memory that can be read and written.

The key design decision is to make memory a named component rather than treating it as an undocumented part of the hidden state.

Main Claim

The paper introduces a class of models that combine inference components with a long-term memory component. It evaluates the design on question answering where memory acts as a dynamic knowledge base.

The bounded claim is:

The paper provides a framework for learning how to use memory jointly with inference. It does not establish that a memory read is automatically a proof, that the selected facts are the only sufficient evidence, or that the same access policy transfers to arbitrary documents.

Architecture Contract

ComponentSymbolRole
input feature mapmaps raw input to an internal representation
generalizationupdates the current internal state
output feature mapproduces a memory query or output representation
responsemaps the final state to an answer
memorystores facts or records accessible by the model

For a query , the system can be summarized as:

where the memory index is selected by an output or addressing operation. The original formulation allows the components to be implemented in different ways; the architecture is a contract, not one fixed neural block.

Memory as a Knowledge Base

Let the memory contain records:

Each record may be a sentence, fact, entity description, or other representation. The memory can be dynamic: new observations may be added, old records may be modified, and the system can learn how to use the collection for a prediction.

This gives the model a different capacity axis from the inference network:

CapacityControlled by
representation and computationparameters of , , , and
number of factsmemory size
fact representationencoding and storage policy
reasoning depthnumber of memory access or update steps
knowledge freshnesswrite, replacement, and provenance policy

The last row is a system property. A neural memory can be writable without being trustworthy or auditable.

Addressing and Inference

An output module produces an internal query:

An addressing function scores memory records:

For a differentiable implementation, normalized access weights are:

and a soft memory read is:

where is the value representation associated with record . A discrete memory network may instead select or rank records using a non-differentiable or supervised access mechanism.

The distinction between key and value is important:

RepresentationPurpose
keydecide which record matches the current query
valueprovide information to the inference state
provenanceidentify source, version, or evidence context
write metadatadecide whether and how the record may change

The original architecture primarily establishes the first two. Practical public LLM systems need the latter two as explicit contracts.

Multiple Supporting Facts

Suppose the answer requires facts and . A multi-step system can first read , update its state, and then use the updated state to access :

The updated query can make a second fact accessible. This is the architectural precursor to multi-hop retrieval; the number of hops is a computational depth choice, not automatically the number of human reasoning steps.

Supervision and Stronger Memory Interfaces

The paper distinguishes the final prediction from the internal access process. A system may be trained with:

SignalWhat it constrains
final answerwhether the entire system predicts correctly
supporting factswhether useful records are selected
access orderwhether the intended inference route is followed
memory writeswhich knowledge may persist or change
provenancewhether the answer can be traced to a source

End-to-end answer training can be cheaper in annotation but may leave access behavior underconstrained. A model can arrive at the right answer through a shortcut, spurious correlation, or incomplete evidence.

Relation to End-To-End Memory Networks

The original Memory Networks formulation makes the inference-memory decomposition explicit. End-To-End Memory Networks turns the access process into a recurrent attention mechanism that can be trained with the final task loss.

Design choiceMemory NetworksEnd-To-End Memory Networks
memory accessexplicit memory component and inference operationsdifferentiable attention over memory slots
intermediate supervisioncan be used for access/inference componentsreduced by end-to-end training
multiple hopssupported as repeated inferencecentral computational mechanism
outputtask-dependent response moduleanswer distribution from final state
interpretationmodular system contractlearned soft retrieval trajectory

Relation to DNC and NTM

ArchitectureMemory behavior
NTMdifferentiable read/write over a matrix with content and location addressing
DNCadds allocation and temporal links for structured memory manipulation
Memory Networkstreats memory as a knowledge base for inference and response
End-To-End Memory Networksperforms multiple differentiable reads before prediction
Modern Hopfield networkfocuses on content-addressed associative retrieval and fixed-point dynamics

These models share a memory vocabulary but differ in what can be written, how addressing is trained, and whether the memory is a transient tensor or a persistent knowledge store.

Evidence

Evidence typeWhat it supportsWhat it does not prove
question answering with a dynamic knowledge basememory can participate in predictionfactual reliability on open-world data
chained supporting sentencesmulti-step access can be usefulfaithful reasoning trace
comparison with fixed-state modelsexplicit memory can add capacityuniversal superiority
memory read/write behaviormodular access is learnablesafe persistence or provenance

Read the paper as an architecture proposal and a set of QA experiments. Do not convert the existence of a memory module into a claim that the model has human-like long-term memory.

Ablation and Reading Questions

QuestionWhy it matters
Is the memory read-only or writable?separates retrieval from continual storage
Is memory size fixed during training and evaluation?tests capacity and extrapolation
Are facts independently encoded?reveals whether addressing depends on context leakage
Are supporting facts supervised?determines how much access behavior is constrained
Can the model answer with contradictory records?tests source conflict handling
Does the response module copy or synthesize?separates lookup from generation

For a modern implementation, also record chunking, deduplication, indexing, source version, retrieval top-k, reranking, and whether the final answer is allowed to use information not returned by memory.

Complexity and Systems Trade-offs

Dense memory scoring for records of dimension costs approximately:

per access step. With hops:

before accounting for encoding, indexing, reranking, and response generation.

Scaling axisBenefitRisk
more recordsbroader knowledge coveragemore distractors and higher lookup cost
more hopsmore compositional accesslatency and error accumulation
larger embeddingsricher key/value representationsmemory bandwidth and overfitting
writable memoryfreshness and adaptationstale, conflicting, or unsafe writes
external indexfaster candidate retrievalapproximate recall and index drift

The original paper does not provide a complete production retrieval system. Modern systems need an index, document lifecycle, provenance, and verification layer around the neural access operation.

Limitations

  • A memory module does not guarantee that the selected facts are sufficient or correct.
  • Soft or learned addressing can be diffuse and sensitive to distractors.
  • Final-answer supervision may leave the memory access path underdetermined.
  • A dynamic knowledge base requires write policy, versioning, conflict resolution, and access control.
  • Synthetic or closed-world QA does not measure open-world retrieval, stale sources, or citation correctness.
  • Increasing memory size can increase latency and introduce more false matches.
  • A modular architecture does not automatically make each module independently interpretable.

Relation to LLM and Agent Systems

The paper’s decomposition maps cleanly onto modern systems, but the mapping must remain explicit:

Memory Network conceptModern analogue
long-term memorydocument store, vector index, database, or durable file
output modulequery encoder, retriever, or planner
generalization modulereranker, reader, or language-model state update
response moduleanswer generator or structured-output head
read/write policyretrieval pipeline, tool contract, or memory lifecycle

In an agent, the memory is not just another prompt string. It has provenance, permissions, freshness, and verification requirements. The neural architecture describes how information can be used; the surrounding workflow decides whether it may be trusted or persisted.

Implementation Checklist

  • Define the memory record schema and provenance fields.
  • Separate retrieval keys, returned values, and source metadata.
  • Log top-k candidates and scores for every access step.
  • Evaluate with distractors, duplicates, contradictions, and stale records.
  • Distinguish final-answer accuracy from evidence-selection accuracy.
  • Specify whether writes are enabled, who authorizes them, and how versions are retained.
  • Compare one-hop and multi-hop variants under matched compute.
  • Keep the external memory boundary visible in the system diagram.

Why It Matters

Memory Networks provide the cleanest early statement of a design principle that remains central to LLM and agent systems:

Knowledge can live in a memory store and be accessed by a learned inference process. The important engineering questions then become what is stored, how it is addressed, how many access steps are allowed, and what evidence accompanies the answer.

Read it before End-To-End Memory Networks, then compare the result with DNC and modern retrieval-augmented generation.

Connections