EconBase
← All papers

Ordinary Least Squares as an Attention Mechanism

Philippe Goulet Coulombe

arXiv 13 Apr 2025 · Machine Learning · 1 citations (OpenAlex)

arXiv:2504.09663 · PDF · DOI · OpenAlex · Extracted main text

Abstract

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. This connection offers an alternative perspective on attention beyond the conventional information retrieval framework, making it more accessible to researchers and analysts with a background in traditional statistics. It falls into place when OLS is framed as a similarity-based method in a transformed regressor space, distinct from the standard view based on partial correlations. In fact, the OLS solution can be recast as the outcome of an alternative problem: minimizing squared prediction errors by optimizing the embedding space in which training and test vectors are compared via inner products. Rather than estimating coefficients directly, we equivalently learn optimal encoding and decoding operations for predictors. From this vantage point, OLS maps naturally onto the query-key-value structure of attention mechanisms. Building on this foundation, I discuss key elements of Transformer-style attention and draw connections to classic ideas from time series econometrics.

Citation extraction

38
references
53
in-text mentions
39
distinct cited
0
self-citations
14,289
main-text words

appendix boundary found by appendix_command · 96% of the source is main text. Read the extracted text to check this.

Most heavily cited references

The works this paper leans on most, across its whole bibliography — not restricted to papers in our corpus. Ranked by composite intensity, which combines how often a work is mentioned, how many sections mention it, and how much of that falls in the main text rather than the appendix.

ReferenceIntensityMentionsSectionsMain text
1Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gome… (2017) Attention is all you need1.00053100%
2Goulet Coulombe, P., Göbel, M., and Klieber, K (2024) Dual interpretation of machine learning forecasts0.84333100%
3Choromanski, K., Likhosherstov, V., Dohan, D., Song, X., Gane, A., S… (2020) Rethinking attention with performers0.64422100%
4Fein-Ashley, J., Kannan, R., and Prasanna, V (2025) The fft strikes again: An efficient alternative to self-attention0.64422100%
5Garnelo, M. and Czarnecki, W. M (2023) Exploring the space of key-value-query models with intention0.64422100%
6Gu, A. and Dao, T (2023) Mamba: Linear-time sequence modeling with selective state spaces0.64422100%
7Hastie, T., Tibshirani, R., and Friedman, J (2009) The Elements of Statistical Learning: Data Mining, Inference, and Prediction0.64422100%
8Kelly, B. T., Kuznetsov, B., Malamud, S., and Xu, T. A (2025) Artificial intelligence asset pricing models0.64422100%
9Peng, H., Pappas, N., Yogatama, D., Schwartz, R., Smith, N. A., and… (2021) Random feature attention0.64422100%
10Tsai, Y.-H. H., Bai, S., Yamada, M., Morency, L.-P., and Salakhutdin… (2019) Transformer dissection: a unified understanding of transformer's attention via the lens of kernel0.64422100%

Showing the top 10 of 39 scored citations.

Cited by, within the corpus

arXiv econ.EM papers that cite this one, ranked by how heavily they lean on it.

Citing paperIntensityMentionsSections
1Nonlinear Dynamic Factor Analysis With a Transformer Network0.40511
2A Nonlinear Target-Factor Model with Attention Mechanism for Mixed-Frequency Data0.40511