cs.LGSep 29, 2026
SaveLearned Queries and Keys Are All You Need: Replacing the Value Projection with Structured Transforms
Organizations: University of Illinois Chicago, Chicago, IL 60607
Abstract
To reduce the number of parameters and cache memory requirements of transformers we introduce dual-headed transformers instead of three heads. We studied Walsh-Hadamard Transform (WHT), Discrete Cosine Transform (DCT), Discrete Fourier Transform, filterbank based Shearlet Transform, and Multiplication-Avoiding (MA) operators to construct dual heads. We combine spatial patches and their orthogonal transforms (or Shearlet and MA operators) in a structure similar to the attention block. We obtained better results than triple headed transformers in ImageNet. Extensive simulation examples are presented.
Figures & tables
| Unit | Complexity |
|---|---|
| QKV | |
| QKK | |
| QK-DCTK | |
| QK-WHTK | |
| QK-ShearK | |
| QK-MFQK |
Table 1: Computational complexity of the attention units.
| Configuration | Parameters | Test Accuracy (%) |
|---|---|---|
| Regular Attention: | 546,186 | |
| 480,138 | ||
| 480,138 | ||
| 480,138 | ||
| 480,634 | ||
| 480,634 |
Table 2: Test accuracy and parameter count of the evaluated attention configurations.
| Dataset | Attention | Top-1 (%) | Top-5 (%) | Params (M) | Mult. (M) |
|---|---|---|---|---|---|
| C10 | Softmax ViT | 81.92 | 98.82 | 2.694 | 182.85 |
| Normalized MF–tanh | 77.80 | 98.70 | 2.471 | 168.47 | |
| Tiny-IN | Softmax ViT | 40.39 | 65.35 | 2.758 | 184.66 |
| Normalized MF–tanh | 35.40 | 60.32 | 2.536 | 170.28 |
Table 3: Comparison of conventional ViT and normalized MF–tanh attention. Top-1 accuracy is the best accuracy on the fixed internal validation split from one training run (seed 0). “Mult.” counts general multiplications and excludes sign, absolute-value, addition, tanh, reduction, and division operations. C10 represent the CIFAR10 dataset and Tiny-IN represent Tiny ImageNet dataset.