Hybrid Random Features

Krzysztof Choromanski, Haoxian Chen, Han Lin, Yuanzhe Ma, Arijit Sehanobish +8 more
10/8/2021
cs.LGstat.ML
transformer-attention

Official code: arijitthegame/hybrid-sampling (3 stars, Python, Apache-2.0, PyTorch, last commit 2022-07-02).

Abstract

We propose a new class of random feature methods for linearizing softmax and Gaussian kernels called hybrid random features (HRFs) that automatically adapt the quality of kernel estimation to provide most accurate approximation in the defined regions of interest. Special instantiations of HRFs lead to well-known methods such as trigonometric (Rahimi and Recht, 2007) or (recently introduced in the context of linear-attention Transformers) positive random features (Choromanski et al., 2021).

Show full abstract

By generalizing Bochner's Theorem for softmax/Gaussian kernels and leveraging random features for compositional kernels, the HRF-mechanism provides strong theoretical guarantees - unbiased approximation and strictly smaller worst-case relative errors than its counterparts. We conduct exhaustive empirical evaluation of HRF ranging from pointwise kernel estimation experiments, through tests on data admitting clustering structure to benchmarking implicit-attention Transformers (also for downstream Robotics applications), demonstrating its quality in a wide spectrum of machine learning problems.

View on arXivView PDF

Code Implementations(1)

PyTorchApache-2.0

Adaptation of Hybrid methods to softmax sampling. Code for some results and the general hybrid mechanisms for our work in https://openreview.net/pdf?id=EMigfE6ZeS

30Python, Jupyter NotebookMay 19, 20214 years agoApache-2.0
pytorchsoftmax-samplingtransformer

Similar Papers

Cite this paper

@article{choromanski2021hybrid,
  title  = {Hybrid Random Features},
  author = {Krzysztof Choromanski and Haoxian Chen and Han Lin and Yuanzhe Ma and Arijit Sehanobish and Deepali Jain and Michael S Ryoo and Jake Varley and Andy Zeng and Valerii Likhosherstov and Dmitry Kalashnikov and Vikas Sindhwani and Adrian Weller},
  year   = {2021},
  eprint = {2110.04367},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2110.04367}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2110.04367.svg)](https://codeofpaper.com/paper/2110.04367)

Discussion