Rethinking Positional Encoding

Jianqiao Zheng, Sameera Ramasinghe, Simon Lucey
7/6/2021
cs.LGcs.CV

Official code: osiriszjq/Rethinking-positional-encoding (88 stars, Jupyter Notebook, last commit 2024-01-14).

Abstract

It is well noted that coordinate based MLPs benefit -- in terms of preserving high-frequency information -- through the encoding of coordinate positions as an array of Fourier features. Hitherto, the rationale for the effectiveness of these positional encodings has been solely studied through a Fourier lens.

Show full abstract

In this paper, we strive to broaden this understanding by showing that alternative non-Fourier embedding functions can indeed be used for positional encoding. Moreover, we show that their performance is entirely determined by a trade-off between the stable rank of the embedded matrix and the distance preservation between embedded coordinates. We further establish that the now ubiquitous Fourier feature mapping of position is a special case that fulfills these conditions. Consequently, we present a more general theory to analyze positional encoding in terms of shifted basis functions. To this end, we develop the necessary theoretical formulae and empirically verify that our theoretical claims hold in practice. Codes available at https://github.com/osiriszjq/Rethinking-positional-encoding.

View on arXivView PDF

Code Implementations(1)

882Jupyter NotebookJul 1, 20212 years ago

Similar Papers

Cite this paper

@article{zheng2021rethinking,
  title  = {Rethinking Positional Encoding},
  author = {Jianqiao Zheng and Sameera Ramasinghe and Simon Lucey},
  year   = {2021},
  eprint = {2107.02561},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2107.02561}
}

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

Discussion