Retrieval-Centric Deep Learning in Growing Nonparametric Neural Networks
Organizations: Google, Paradigms of Intelligence Team, Zurich, Switzerland · MIT CSAIL, Cambridge, MA, USA · Department of Computer Science and Wu Tsai Institute, Yale University, New Haven, CT, USA
Abstract
We investigate a general-purpose layer for deep learning that, instead of compressing arbitrary-size training data into fixed-size weight matrices, stores a new pair of key-value representations for every data point during training, and retrieves and recombines these representations through an attention mechanism at inference time - resulting in a growing neural net (NN). While Irie et al. (arXiv:2202.05798) have put forward this perspective from the classic duality expressing any linear layer in a deep NN trained by gradient descent as linear attention (LA) over the training data points, replacing LA by more powerful attention functions, as they suggest, turns out to be non-trivial: we show that naively applying learning rules from the LA case to advanced kernels does not lead to principled optimization. Here we fill this gap and develop functional gradient-based learning rules for kernelized attention layers, based on radial basis function (RBF) and softmax-like kernels - establishing the principled "retrieval-centric deep learning" (RCDL) paradigm. Empirically, we demonstrate the promising performance and learning-efficiency of RCDL on image classification and synthetic teacher-student learning tasks. Moreover, we show that replacing LA in the dual form of NNs by advanced LA variants, namely MesaNet/DeltaNet, yields a formal connection to recently proposed optimizers for conventional fixed-size NNs, offering a novel perspective on deep learning optimization.
Figures & tables
| Model | Parametric neural networks | Growing nonparametric networks |
|---|---|---|
| Building block | Linear layer | Attention layer |
| Learnable state | Fixed-size weight matrix | Growing database of keys & values |
| (for train examples) | ||
| Inference | ||
| ( , ) | ||
| Illustration |
Appendix figures & tables19 assets
Supplementary material from the paper’s appendix.
Appendix
| Hyperparameter | Value |
|---|---|
| Model | Single Weighted Softmax layer |
| Data normalization | RMSNorm (on input) |
| Value learning rate | |
| Weight learning rate | |
| Softmax temperature | |
| Momentum |
| Hyperparameter | Value |
|---|---|
| Dataset | CIFAR-10, CIFAR-100 |
| Input | images flattened to |
| Model | Residual MLP |
| Residual stream size ( ) | |
| # residual blocks ( ) | |
| Normalization in blocks | RMSNorm (pre-norm, per block) |
| Hyperparameter | Value |
|---|---|
| Model | residual blocks + readout layer, no nonlinearity |
| Embedding dimension | (flattened image, no input embedding) |
| Normalization | RMSNorm (no learned scale) before each layer and the readout |
| Maximal width per layer | |
| Growth threshold | |
| Value learning rate |
| Hyperparameter | Value |
|---|---|
| Dataset | CIFAR-10 |
| Input | images flattened to |
| Model | MLP |
| Normalization in blocks | RMSNorm (pre-norm, per block) |
| shape | (2560000, 3072) |
| shape | (2560000, 10) |
| Hyperparameter | Value |
|---|---|
| Model | Single Parametric Softmax layer |
| Hidden size | |
| Data normalization | RMSNorm (on input) |
| Learning rate | |
| Temperature | |
| Optimizer | Adam |
| Hyperparameter | Value |
|---|---|
| Dataset | CIFAR-10, CIFAR-100 |
| Input | images flattened to |
| Model | Residual MLP |
| Residual stream size ( ) | |
| # residual blocks ( ) | |
| Normalization in blocks | RMSNorm (pre-norm, per block) |
| Mesa newton-approximation steps | |||
|---|---|---|---|
| Dataset | 5 | 10 | Inf. |
| CIFAR-10 | 0.6914 | 0.7130 | 0.7124 |
| CIFAR-100 | 0.4149 | 0.4323 | 0.4319 |
| Hyperparameter | Value |
|---|---|
| Dataset | CIFAR-10, CIFAR-100 |
| Input | images flattened to |
| Model | Residual MLP |
| Residual stream size ( ) | |
| # residual blocks ( ) | |
| Normalization in blocks | RMSNorm (pre-norm, per block) |
| Hyperparameter | Value |
|---|---|
| Dataset | CIFAR-10, CIFAR-100 |
| Input | images flattened to |
| Model | Residual MLP |
| Residual stream size ( ) | |
| # residual ( ) | |
| Normalization in blocks | RMSNorm (pre-norm, per block) |
| Hyperparameter | Value |
|---|---|
| Dataset | CIFAR-10 |
| Input | images flattened to |
| Model | Residual MLP |
| Input projection | Linear |
| Residual stream size ( ) | |
| # residual blocks |
| Hyperparameter | Value |
|---|---|
| Dataset | CIFAR-10, CIFAR-100 |
| Input | images flattened to |
| Model | Residual MLP |
| Residual stream size ( ) | |
| # residual ( ) | |
| Normalization in blocks | RMSNorm (pre-norm, per block) |
| Hyperparameter | Value |
|---|---|
| Model | Residual MLP |
| Residual stream size ( ) | |
| # residual ( ) | |
| Normalization | None |
| MLP activation | ReLU |
| Optimizer | SGD |
| Hyperparameter | Value |
|---|---|
| Dataset | CIFAR-10 |
| Input | images flattened to |
| Model | RBF kernel |
| Classification | on predicted output |
| Optimizer | Exact solver |
| Bandwidth |
| Hyperparameter | Value |
|---|---|
| Dataset | CIFAR-10 |
| Input | images, patches ( patch tokens + CLS token) |
| Model | ViT, transformer blocks |
| Embedding dimension | |
| Attention heads | |
| Positional embedding | learned |
| Hyperparameter | Value |
|---|---|
| Dataset | CIFAR-10 |
| Input | images, patches ( patch tokens + CLS token) |
| Model | ViT, transformer blocks, FFN replaced by growing GWS |
| Embedding dimension | |
| Attention heads | |
| Positional embedding | learned |
Deep Learning Optimization
Deep learning optimization develops algorithms and training strategies that help neural networks converge, generalize, and use compute efficiently.
See all 206 papers