Looped Transformers are Better at Learning Learning Algorithms
Liu Yang, Kangwook Lee, Robert Nowak, Dimitris Papailiopoulos
TL;DR
The paper tackles the gap between standard transformers and the iterative nature of classical learning algorithms by introducing a looped transformer that shares parameters across repeated passes to emulate fixed-point iterations. Through a carefully designed training strategy that injects inputs and uses a truncated loss over loop iterations, the model achieves competitive in-context learning performance with far fewer parameters than a conventional transformer. Across linear, sparse linear, decision-tree, and neural-network function classes, the looped transformer matches or surpasses the standard transformer and demonstrates favorable sample efficiency, inductive biases, and robustness under certain out-of-distribution conditions. The work highlights the practical potential of looped architectures for efficient, iteration-aware in-context learning and discusses mathematical implications, trade-offs, and future directions for adaptive looping and generalization beyond training distributions.
Abstract
Transformers have demonstrated effectiveness in in-context solving data-fitting problems from various (latent) models, as reported by Garg et al. However, the absence of an inherent iterative structure in the transformer architecture presents a challenge in emulating the iterative algorithms, which are commonly employed in traditional machine learning methods. To address this, we propose the utilization of looped transformer architecture and its associated training methodology, with the aim of incorporating iterative characteristics into the transformer architectures. Experimental results suggest that the looped transformer achieves performance comparable to the standard transformer in solving various data-fitting problems, while utilizing less than 10% of the parameter count.
