Linear Transformer Topological Masking with Graph Random Features

Isaac Reid, Kumar Avinava Dubey, Deepali Jain, Will Whitney, Amr Ahmed +10 more
10/4/2024
cs.LGstat.ML

No confident code implementation found for this paper.

Abstract

When training transformers on graph-structured data, incorporating information about the underlying topology is crucial for good performance. Topological masking, a type of relative position encoding, achieves this by upweighting or downweighting attention depending on the relationship between the query and keys in a graph. In this paper, we propose to parameterise topological masks as a learnable function of a weighted adjacency matrix -- a novel, flexible approach which incorporates a strong structural inductive bias. By approximating this mask with graph random features (for which we prove the first known concentration bounds), we show how this can be made fully compatible with linear attention, preserving $\mathcal{O}(N)$ time and space complexity with respect to the number of input tokens. The fastest previous alternative was $\mathcal{O}(N \log N)$ and only suitable for specific graphs. Our efficient masking algorithms provide strong performance gains for tasks on image and point cloud data, including with $>30$k nodes.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{reid2024linear,
  title  = {Linear Transformer Topological Masking with Graph Random Features},
  author = {Isaac Reid and Kumar Avinava Dubey and Deepali Jain and Will Whitney and Amr Ahmed and Joshua Ainslie and Alex Bewley and Mithun Jacob and Aranyak Mehta and David Rendleman and Connor Schenck and Richard E. Turner and René Wagner and Adrian Weller and Krzysztof Choromanski},
  year   = {2024},
  eprint = {2410.03462},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2410.03462v2},
  journal = {ICLR 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/2410.03462.svg)](https://codeofpaper.com/paper/2410.03462)

Discussion