Initialization is Critical to Whether Transformers Fit Composite Functions by Reasoning or Memorizing

Zhongwang Zhang, Pengxiao Lin, Zhiwei Wang, Yaoyu Zhang, Z. Xu
2/3/2026

No official code found. Best implementation: sjtuzzw/complexity_control (1 star, last commit 2025-01-05).

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 $\gamma$ to be a convenient tunable hyper-parameter in common deep learning frameworks, where $1/d_{\mathrm{in}}^\gamma$ is the standard deviation of parameters of the layer with $d_{\mathrm{in}}$ input neurons.

View on arXivView PDF

Code Implementations(1)

10Shell, PythonJan 5, 20251 years ago

Similar Papers

Cite this paper

@article{zhang2026initialization,
  title  = {Initialization is Critical to Whether Transformers Fit Composite Functions by Reasoning or Memorizing},
  author = {Zhongwang Zhang and Pengxiao Lin and Zhiwei Wang and Yaoyu Zhang and Z. Xu},
  year   = {2026},
  eprint = {2405.05409},
  archivePrefix = {arXiv},
  doi    = {10.52202/079017-0451},
  url    = {https://arxiv.org/abs/2405.05409},
  journal = {NEURIPS 2024 2024}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2405.05409.svg)](https://codeofpaper.com/paper/2405.05409)

Discussion