arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2504.09663cs.LGecon.EMmath.STstat.MLstat.TH
收藏

普通最小二乘法作为注意力机制

Ordinary Least Squares as an Attention Mechanism

Université du Québec à Montréal(魁北克大学蒙特利尔分校)

Philippe Goulet Coulombe

AI总结:

将普通最小二乘法解释为一种注意力机制,通过变换回归空间中的相似性方法,重新定义OLS的优化目标,连接注意力机制与时间序列计量经济学。

摘要:

我证明普通最小二乘法(OLS)的预测可以重写为受限注意力模块的输出,类似于构成大型语言模型核心的模块。这种联系提供了另一种看待注意力机制的视角,超越传统的信息检索框架,使具有传统统计背景的研究人员和分析人员更容易理解。当OLS被框架为变换回归空间中的相似性方法时,这种观点与基于偏相关性的标准观点不同。事实上,OLS解可以重新表述为另一种问题的解决方案:通过内积比较训练和测试向量来最小化预测误差的平方,通过优化嵌入空间。与其直接估计系数,我们等效地学习了最优的编码和解码操作。从这个角度看,OLS自然地映射到注意力机制的查询-键-值结构上。基于这一基础,我讨论了Transformer风格注意力的关键元素,并将其与经典的时间序列计量经济学思想联系起来。

英文摘要:

I show that ordinary least squares (OLS) predictions can be rewritten as the output of a restricted attention module, akin to those forming the backbone of large language models. The connection comes from viewing OLS as a similarity-based prediction rule in a learned embedding space. In this representation, least squares does not estimate coefficients per se. Instead, it selects an embedding that minimizes squared prediction error by matching training and test vectors through inner products. This maps directly onto the query-key-value structure of attention mechanisms. I then discuss extensions to dimensionality reduction, nonlinearity, and time series econometrics. Monte Carlo simulations and real-data experiments on UCI/OpenML benchmarks show that nonlinear Attention Regression performs competitively against standard machine learning baselines. In the reverse direction, I replace the attention sublayer of a transformer for tabular data with an explicit regression on polynomial features. The resulting model performs comparably to the standard transformer at a fraction of its parameter count.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑