Initialization is Critical to Whether Transformers Fit Composite Functions by Reasoning or Memorizing
Zhongwang Zhang, Pengxiao Lin, Zhiwei Wang, Yaoyu Zhang, Zhi-Qin John Xu
TL;DR
This work asks why transformers sometimes learn compositional reasoning rather than merely memorizing mappings. By adopting an anchor-function setup with two-anchor compositions, it demonstrates a phase diagram controlled by the initialization rate $\gamma$ (with parameter std dev ~ $1/d_{\text{in}}^{\gamma}$) and model depth: small initializations promote inferential, low-complexity solutions that compose single-anchor mappings, while larger initializations push towards symmetric memorization. The authors illuminate distinct information-flow and vector-representation mechanisms for each phase and show that inferential solutions exhibit low complexity with structured embeddings and condensed directions in $W^{Q(1)}$, whereas symmetric solutions do not. Validation on synthetic data and broader architectures (e.g., GPT-2) across multiple tasks indicates that initializing transformers with appropriate $\gamma$ can bias models toward reasoning over memorization, with practical implications for tuning models toward compositional generalization. They further propose using $\gamma$ as a tunable hyper-parameter to balance reasoning and memorization in real-world settings, and discuss limitations and future work including more diverse datasets and mixture-of-experts approaches.
Abstract
Transformers have shown impressive capabilities across various tasks, but their performance on compositional problems remains a topic of debate. In this work, we investigate the mechanisms of how transformers behave on unseen compositional tasks. We discover that the parameter initialization scale plays a critical role in determining whether the model learns inferential (reasoning-based) solutions, which capture the underlying compositional primitives, or symmetric (memory-based) solutions, which simply memorize mappings without understanding the compositional structure. By analyzing the information flow and vector representations within the model, we reveal the distinct mechanisms underlying these solution types. We further find that inferential (reasoning-based) solutions exhibit low complexity bias, which we hypothesize is a key factor enabling them to learn individual mappings for single anchors. We validate our conclusions on various real-world datasets. Our findings provide valuable insights into the role of initialization scale in tuning the reasoning and memorizing ability and we propose the initialization rate $γ$ to be a convenient tunable hyper-parameter in common deep learning frameworks, where $1/d_{\mathrm{in}}^γ$ is the standard deviation of parameters of the layer with $d_{\mathrm{in}}$ input neurons.
