Self-Attention through Kernel-Eigen Pair Sparse Variational Gaussian Processes

Yingyi Chen, Qinghua Tao, Francesco Tonin, Johan A. K. Suykens
2/2/2024
7 citations
cs.LGcs.AIcs.CV
transformer-attentionbayesian

Official code: yingyichen-cyy/KEP-SVGP (16 stars, Python, last commit 2024-10-15).

Abstract

While the great capability of Transformers significantly boosts prediction accuracy, it could also yield overconfident predictions and require calibrated uncertainty estimation, which can be commonly tackled by Gaussian processes (GPs). Existing works apply GPs with symmetric kernels under variational inference to the attention kernel; however, omitting the fact that attention kernels are in essence asymmetric.

Show full abstract

Moreover, the complexity of deriving the GP posteriors remains high for large-scale data. In this work, we propose Kernel-Eigen Pair Sparse Variational Gaussian Processes (KEP-SVGP) for building uncertainty-aware self-attention where the asymmetry of attention kernels is tackled by Kernel SVD (KSVD) and a reduced complexity is acquired. Through KEP-SVGP, i) the SVGP pair induced by the two sets of singular vectors from KSVD w.r.t. the attention kernel fully characterizes the asymmetry; ii) using only a small set of adjoint eigenfunctions from KSVD, the derivation of SVGP posteriors can be based on the inversion of a diagonal matrix containing singular values, contributing to a reduction in time complexity; iii) an evidence lower bound is derived so that variational parameters and network weights can be optimized with it. Experiments verify our excellent performances and efficiency on in-distribution, distribution-shift and out-of-distribution benchmarks.

View on arXivView PDF

Code Implementations(1)

(ICML 2024) PyTorch implementation of "Self-Attention through Kernel-Eigen Pair Sparse Variational Gaussian Processes"

162Python, ShellMay 5, 20242 years ago

Similar Papers

Cite this paper

@article{chen2024selfattention,
  title  = {Self-Attention through Kernel-Eigen Pair Sparse Variational Gaussian Processes},
  author = {Yingyi Chen and Qinghua Tao and Francesco Tonin and Johan A. K. Suykens},
  year   = {2024},
  eprint = {2402.01476},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2402.01476v2},
  journal = {ICML 2024 2024}
}

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/2402.01476.svg)](https://codeofpaper.com/paper/2402.01476)

Discussion