Command Palette
Search for a command to run...
文処理における記憶効率とリソース合理的なエンコーディング
文処理における記憶効率とリソース合理的なエンコーディング
Weijie Xu Brian Dillon Richard Futrell
概要
人間の言語処理のモデルとして機能するためには、言語モデル(LM)は文脈に対する記憶の利用に制限を設ける必要があるという見解が広がる中、この文脈記憶は人間の作業記憶(WM)に対応する。本研究では、記憶を限られたリソースとして戦略的に配分するとみなす認知モデルを反映する形で、言語モデルにおけるWMに制限を設ける、新規かつシンプルなアプローチを提案する。記憶エンコーディングに対するこの制約を捉えるため、TransformerベースのLMの隠れ表現に対して調整可能な割合でノイズを注入する。続いて、全体のエンコーディング精度に対する明示的な制約のもとで次語予測性能を最大化するように学習させる混合目的関数を用いてモデルを訓練する。その結果、明示的なWM制約がモデルと人間の読書時間との整合性を改善することが明らかになった。より重要なのは、エンコーディング精度の管理が必要とされることで、モデルの文脈表現の性質が再構成され、より圧縮かつカテゴリカルになることが示された点である。本研究の結果は、作業記憶の配分に関するリソース合理的なモデルをニューラルモデルに単純かつ成功裏に実装できることを示すとともに、人間の文処理モデルにおけるWM検索メカニズムと基盤となる記憶表現との間の分離を示唆している。
One-sentence Summary
Researchers from University of California, Irvine and University of Massachusetts Amherst inject tunable noise into the hidden representations of Transformer-based language models and train them with a hybrid objective that constrains total encoding precision, simulating resource-rational working memory allocation and yielding improved alignment with human reading times as well as more compressed and categorical context representations.
Key Contributions
- Working-memory constraints are added to Transformer-based language models by injecting tunable noise into hidden representations and training with a hybrid objective that balances next-word prediction against an explicit limit on encoding precision.
- These constraints improve alignment with human reading times and reshape context representations to be more compressed and categorical, supporting a resource-rational account of memory allocation.
- Moderate constraints increase locality bias in attention weights, while stricter constraints weaken it, revealing a dissociation between retrieval mechanisms and encoded representations and linking working-memory constraints to quantization.
Introduction
Human sentence processing relies on working memory because earlier words must influence later interpretation after they are no longer directly available. Since human working memory is highly limited, understanding how these constraints shape language representations is important for both psycholinguistics and for building language models that behave more like humans. Prior computational work has mainly simulated working memory limits through ad hoc choices, such as smaller models, shorter context windows, biased local attention, or binary erasure of past words, but these approaches do not directly explain how limited resources affect the quality of information stored in memory. The authors instead treat working memory constraints as limits on representational precision and show that noisier, less precise memory encodings can emerge as a resource rational response to linguistic prediction demands.
Method
The authors model working memory constraints in Transformer-based language models by making the internal memory representation deliberately noisy. The core idea is that linguistic inputs are not encoded perfectly in working memory, and the fidelity of that encoding depends on the amount of working memory resources available to the model. In the proposed framework, working memory capacity is operationalized through encoding precision, and precision is manipulated by injecting Gaussian noise into the value vectors used by self-attention.
The method builds on the standard self-attention mechanism. Normally, a query vector interacts with key vectors to determine attention weights, and those weights are used to aggregate value vectors from earlier positions. To model imperfect memory, the authors corrupt each historical value vector before aggregation. Given a value vector vqk corresponding to a previous key position k relative to the current query position q, the noisy value v~qk is sampled from a Gaussian distribution:
v~qk∼N(vqk,τ−1I).Here, τ denotes the encoding precision, defined as the inverse of the variance. A higher precision corresponds to lower noise and therefore a more faithful memory representation. This connects the computational model to an information-theoretic interpretation: the noisy attention pathway behaves like a communication channel with limited signal-to-noise ratio. Models with greater working memory resources can maintain higher precision, while models with tighter constraints transmit information under stronger noise.
Precision is not fixed across all past tokens. Instead, it decays exponentially as a token becomes more distant from the current query position. The precision for a key token at position k relative to query position q is given by:
τqk=τ0e−θ(q−k).The parameter θ controls the rate of decay, and τ0 is the highest achievable precision, corresponding to the current token at query position where q−k=0. Even this base precision is finite, reflecting the assumption that encoding is never perfectly noiseless. This design allows the model to represent a graded memory effect: recent information is encoded with higher precision, while more remote information becomes progressively noisier.
The output of an attention head is then formed by aggregating the noisy value vectors using the standard softmax attention weights:
zq=k∑aqkv~qk,with attention weights
aq=softmax(dK⊤q).To optimize this stochastic attention mechanism efficiently, the authors apply a reparameterization trick. The attention output is decomposed into a deterministic component and a noise component:
zq=zqdet+z~q.The deterministic part zqdet is computed as in standard self-attention, as if no noise were present. The noisy part is expressed as a scaled unit Gaussian:
z~q=σqϵ,ϵ∼N(0,I).Assuming independence of the noise contributions from different previous tokens, the effective variance after attention aggregation is
σq2=k∑(aqkσqk)2=k∑aqk2τqk−1.This formulation preserves parallelized attention computation while introducing position-dependent memory noise. The authors inject noise specifically into self-attention rather than at the output embeddings because self-attention most closely mirrors the working memory process of retrieving and combining representations from different points in context. It also makes it natural to control noise as a function of the relative distance between the stored token and the current query position.
Working memory constraints are then manipulated during training through a hybrid loss function. The model is not optimized solely for language modeling accuracy. Instead, it must balance predictive performance against the cost of maintaining precise memory representations. The training objective is
L=cross-entropy loss−y∈S∑t=1∑Tlogp(yt∣y<t)+λmemory capacityh,l,t,k∑τh,l,t,kz−1,where
z=LHT2T−1.The first term is the standard next-word prediction loss over training examples. The second term penalizes the average encoding precision of past tokens across attention heads and layers. This term represents the amount of working memory resources used by the model. The scalar λ controls the strength of the working memory constraint. A larger λ imposes a stronger penalty on high precision, encouraging the model to operate with fewer working memory resources. As a result, the model learns a trade-off between linguistic prediction performance and the cost of encoding information in memory.
This design yields a unified method for studying working memory limitations in Transformers. Gaussian noise injection creates a continuous, distributional representation of memory imperfection, while the precision decay function introduces distance-dependent degradation. The hybrid training objective then explicitly shapes how much precise memory the model is allowed to allocate, making working memory capacity a controllable property of the language model architecture.
Experiment
The experiments evaluate GPT-2-style language models trained with varying working-memory constraints, examining learned precision decay, alignment with human reading times, and the geometry of next-word prediction spaces. As the memory constraint increases, models show asymmetric precision decay across layers and generate predictions that align better with human reading behavior at moderate constraint levels, despite higher perplexity and reduced extreme surprisal estimates. Stronger constraints also compress the prediction space and promote more categorical encoding, indicating a shift from fine-grained distinctions toward broader semantic generalization.