Skip to content
aiqbench takeMachine Learning

aiqbench analysis

This paper establishes a theoretical bridge between classical Ordinary Least Squares regression and the attention mechanisms central to modern large language models, demonstrating that linear prediction can be mathematically recast as a restricted attention operation. By validating this equivalence through simulations and real-data experiments, the work reveals how standard econometric techniques implicitly perform similarity-based selection akin to query-key-value structures without requiring explicit neural network training. Furthermore, the study shows that replacing transformer attention layers with explicit polynomial regression yields comparable performance on tabular data with significantly fewer parameters, offering a more efficient alternative for non-linguistic tasks.
Source coveringarXiv
What this isA model's reading of the article and related coverage, written for aiqbench. Not the publisher's words.

Ordinary Least Squares as an Attention Mechanism

arXiv2 min read

arXiv:2504.09663v3 Announce Type: replace 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. 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.

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. 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.

Accepted at NeurIPS 2026. 29 pages including appendices

Machine Learning (cs.LG); Econometrics (econ.EM); Statistics Theory (math.ST); Machine Learning (stat.ML)

arXiv:2504.09663 [cs.LG]

(or arXiv:2504.09663v3 [cs.LG] for this version)

https://doi.org/10.48550/arXiv.2504.09663 Focus to learn more arXiv-issued DOI via DataCite

arXivLabs is a framework that allows collaborators to develop and share new arXiv features directly on our website.

Both individuals and organizations that work with arXivLabs have embraced and accepted our values of openness, community, excellence, and user data privacy. arXiv is committed to these values and only works with partners that adhere to them.

Have an idea for a project that will add value for arXiv's community? Learn more about arXivLabs.

Full text under the publisher's open licence · 264 words

Related coverage