English

In-Context Learning for Attention Scheme: from Single Softmax Regression to Multiple Softmax Regression via a Tensor Trick

Machine Learning 2023-07-06 v1

Abstract

Large language models (LLMs) have brought significant and transformative changes in human society. These models have demonstrated remarkable capabilities in natural language understanding and generation, leading to various advancements and impacts across several domains. We consider the in-context learning under two formulation for attention related regression in this work. Given matrices A1Rn×dA_1 \in \mathbb{R}^{n \times d}, and A2Rn×dA_2 \in \mathbb{R}^{n \times d} and BRn×nB \in \mathbb{R}^{n \times n}, the purpose is to solve some certain optimization problems: Normalized version minXD(X)1exp(A1XA2)BF2\min_{X} \| D(X)^{-1} \exp(A_1 X A_2^\top) - B \|_F^2 and Rescaled version exp(A1XA2)D(X)BF2\| \exp(A_1 X A_2^\top) - D(X) \cdot B \|_F^2. Here D(X):=diag(exp(A1XA2)1n)D(X) := \mathrm{diag}( \exp(A_1 X A_2^\top) {\bf 1}_n ). Our regression problem shares similarities with previous studies on softmax-related regression. Prior research has extensively investigated regression techniques related to softmax regression: Normalized version exp(Ax),1n1exp(Ax)b22\| \langle \exp(Ax) , {\bf 1}_n \rangle^{-1} \exp(Ax) - b \|_2^2 and Resscaled version exp(Ax)exp(Ax),1nb22\| \exp(Ax) - \langle \exp(Ax), {\bf 1}_n \rangle b \|_2^2 In contrast to previous approaches, we adopt a vectorization technique to address the regression problem in matrix formulation. This approach expands the dimension from dd to d2d^2, resembling the formulation of the regression problem mentioned earlier. Upon completing the lipschitz analysis of our regression function, we have derived our main result concerning in-context learning.

Keywords

Cite

@article{arxiv.2307.02419,
  title  = {In-Context Learning for Attention Scheme: from Single Softmax Regression to Multiple Softmax Regression via a Tensor Trick},
  author = {Yeqi Gao and Zhao Song and Shenghao Xie},
  journal= {arXiv preprint arXiv:2307.02419},
  year   = {2023}
}
R2 v1 2026-06-28T11:22:52.707Z