Supervised learning pays attention
Preprint
Abstract
In-context learning with attention enables large neural networks to make context-specific predictions by selectively focusing on relevant examples. Here, we adapt this idea to supervised learning procedures such as lasso regression and gradient boosting, for tabular data. Our goals are to (1) flexibly fit personalized models for each prediction point and (2) retain model simplicity and interpretability. Our method fits a local model for each test observation by weighting the training data according to attention, a supervised similarity measure that emphasizes features and interactions that are predictive of the outcome. Attention weighting allows the method to adapt to heterogeneous data in a data-driven way, without requiring cluster or similarity pre-specification. Further, our approach is uniquely interpretable: for each test observation, we identify which features are most predictive and which training observations are most relevant. We then show how to use attention weighting for time series and spatial data, and we present a method for adapting pretrained tree-based models to distributional shift using attention-weighted residual corrections. Across real and simulated datasets, attention weighting improves predictive performance while preserving interpretability, and theory shows that attention-weighting linear models attain lower mean squared error than the standard linear model under mixture-of-models data-generating processes with known subgroup structure.Keywords
All Related Versions
This publication has 11 references indexed in Scilit:
- Accurate predictions on small data with a tabular foundation modelNature, 2025
- A Survey on In-context Learning2024
- Quasi-oracle estimation of heterogeneous treatment effectsBiometrika, 2020
- fpp3: Data for "Forecasting: Principles and Practice" (3rd Edition)2019
- ranger: A Fast Implementation of Random Forests for High Dimensional Data in C++ and R2017
- Customized training with an application to mass spectrometric imaging of cancer tissueThe Annals of Applied Statistics, 2015
- xgboost: Extreme Gradient Boosting2014
- Hierarchical Clustering With Prototypes via Minimax LinkageJournal of the American Statistical Association, 2011
- FNN: Fast Nearest Neighbor Search Algorithms and Applications2010
- Regularization Paths for Generalized Linear Models via Coordinate Descent2010