Algebraic Positional Encodings

Konstantinos Kogkalidis, Jean-Philippe Bernardy, Vikas Garg
12/1/2023
11 citations

Official code: konstantinosKokos/ape (21 stars, Python, CC-BY-SA-4.0, PyTorch, last commit 2025-08-20).

Abstract

We introduce a novel positional encoding strategy for Transformer-style models, addressing the shortcomings of existing, often ad hoc, approaches. Our framework provides a flexible mapping from the algebraic specification of a domain to an interpretation as orthogonal operators.

Show full abstract

This design preserves the algebraic characteristics of the source domain, ensuring that the model upholds its desired structural properties. Our scheme can accommodate various structures, ncluding sequences, grids and trees, as well as their compositions. We conduct a series of experiments to demonstrate the practical applicability of our approach. Results suggest performance on par with or surpassing the current state-of-the-art, without hyper-parameter optimizations or"task search"of any kind. Code is available at https://github.com/konstantinosKokos/ape.

View on arXivView PDF

Code Implementations(1)

PyTorchCC-BY-SA-4.0

🧮 Algebraic Positional Encodings.

212Python, ShellAug 17, 20221 years agoCC-BY-SA-4.0
neurips-2024neurosymbolicpositional-encodingpytorchrope+1 more

Similar Papers

Cite this paper

@article{kogkalidis2023algebraic,
  title  = {Algebraic Positional Encodings},
  author = {Konstantinos Kogkalidis and Jean-Philippe Bernardy and Vikas Garg},
  year   = {2023},
  eprint = {2312.16045},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2312.16045},
  journal = {NEURIPS 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/2312.16045.svg)](https://codeofpaper.com/paper/2312.16045)

Discussion