TY - GEN
T1 - Do Nonlinear Transformers Implement Kernel Regression In-Context? An Empirical Investigation
AU - Wang, Jiahui
AU - Zhang, Di
N1 - Publisher Copyright:
© The Author(s), under exclusive license to Springer Nature Singapore Pte Ltd. 2027.
PY - 2027
Y1 - 2027
N2 - Recent work has shown that linear transformers can perform in-context learning (ICL) by implicitly implementing ridge-regression-like algorithms. However, practical transformers use softmax attention and nonlinear MLPs, and it remains unclear to what extent their ICL behavior can still be interpreted through a kernel-regression lens. We study this question through a kernel surrogate hypothesis, which compares a trained nonlinear ICL predictor with kernel ridge regression (KRR) using a combined attention- and MLP-inspired kernel. Rather than claiming an exact equivalence, we evaluate this hypothesis through controlled synthetic experiments on polynomial regression, Gaussian process (GP) regression, and sparse linear regression. Across these tasks, we compare trained single-layer transformers with closed-form KRR reference predictors in terms of predictive error, context-length scaling, attention-weight alignment, and model-width sensitivity. The results show that the KRR surrogate closely follows the Bayes reference on GP tasks, whereas trained transformers achieve high correlation with KRR outputs on polynomial tasks (r > 0.90) but retain a persistent MSE gap. Attention analysis further shows that transformer attention becomes more aligned with KRR contribution weights during training, although the alignment remains moderate. Overall, these findings suggest that kernel regression provides a useful reference-level description of nonlinear ICL in controlled settings, but not a complete account of finite-width trained transformer behavior.
AB - Recent work has shown that linear transformers can perform in-context learning (ICL) by implicitly implementing ridge-regression-like algorithms. However, practical transformers use softmax attention and nonlinear MLPs, and it remains unclear to what extent their ICL behavior can still be interpreted through a kernel-regression lens. We study this question through a kernel surrogate hypothesis, which compares a trained nonlinear ICL predictor with kernel ridge regression (KRR) using a combined attention- and MLP-inspired kernel. Rather than claiming an exact equivalence, we evaluate this hypothesis through controlled synthetic experiments on polynomial regression, Gaussian process (GP) regression, and sparse linear regression. Across these tasks, we compare trained single-layer transformers with closed-form KRR reference predictors in terms of predictive error, context-length scaling, attention-weight alignment, and model-width sensitivity. The results show that the KRR surrogate closely follows the Bayes reference on GP tasks, whereas trained transformers achieve high correlation with KRR outputs on polynomial tasks (r > 0.90) but retain a persistent MSE gap. Attention analysis further shows that transformer attention becomes more aligned with KRR contribution weights during training, although the alignment remains moderate. Overall, these findings suggest that kernel regression provides a useful reference-level description of nonlinear ICL in controlled settings, but not a complete account of finite-width trained transformer behavior.
KW - empirical study
KW - In-context learning
KW - kernel methods
KW - nonlinear activation
KW - transformers
UR - https://www.scopus.com/pages/publications/105046972689
U2 - 10.1007/978-981-92-3417-2_48
DO - 10.1007/978-981-92-3417-2_48
M3 - Conference Proceeding
AN - SCOPUS:105046972689
SN - 9789819234165
T3 - Lecture Notes in Computer Science
SP - 564
EP - 574
BT - Advanced Intelligent Computing Technology and Applications - 22nd International Conference on Intelligent Computing, ICIC 2026, Proceedings
A2 - Huang, De-Shuang
A2 - Zhang, Chuanlei
A2 - Chen, Wei
A2 - Pan, Yijie
A2 - Premaratne, Prashan
PB - Springer Science and Business Media Deutschland GmbH
T2 - 22nd International Conference on Intelligent Computing, ICIC 2026
Y2 - 22 July 2026 through 26 July 2026
ER -