Retentive or Forgetful? Diving into the Knowledge Memorizing Mechanism of Language Models
Boxi Cao, Qiaoyu Tang, Hongyu Lin, Shanshan Jiang, Bin Dong, Xianpei Han, Jiawei Chen, Tianshu Wang, Le Sun
TL;DR
This work probes the memory behavior of language models by contrasting vanilla (unpretrained) models with pre-trained models using a factual knowledge acquisition setup derived from LAMA. It introduces a testbed that tracks forgetting curves across knowledge types, learning cycles, and time scales, revealing a clear transition from short-term to long-term memory driven by pre-training. The findings show vanilla models suffer catastrophic forgetting with limited memory, while pre-trained models develop durable memorization that strengthens with longer pre-training. Crucially, memory formation is modulated by knowledge relevance and diversification, with interference from related facts and low diversity causing memory instability, offering practical guidance for designing learning regimens and evaluation protocols.
Abstract
Memory is one of the most essential cognitive functions serving as a repository of world knowledge and episodes of activities. In recent years, large-scale pre-trained language models have shown remarkable memorizing ability. On the contrary, vanilla neural networks without pre-training have been long observed suffering from the catastrophic forgetting problem. To investigate such a retentive-forgetful contradiction and understand the memory mechanism of language models, we conduct thorough experiments by controlling the target knowledge types, the learning strategies and the learning schedules. We find that: 1) Vanilla language models are forgetful; 2) Pre-training leads to retentive language models; 3) Knowledge relevance and diversification significantly influence the memory formation. These conclusions are useful for understanding the abilities of pre-trained language models and shed light on designing and evaluating new learning and inference algorithms of language models.
