
SetTransformer
228 ops423.2K params
Attention for sets: induced self-attention plus learned-seed pooling, order-invariant and linear in set size.
228 operations Checked
Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.
The file opened in a new tab. Use your browser's Save command there to keep it.
The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.
The Set Transformer is an attention-based network for inputs that are sets, built to model how the elements of a set interact. Such models should be permutation invariant, because the right answer does not depend on the order in which the set's elements are listed. Earlier set-pooling networks embed each element on its own and then pool, discarding information about interactions; the Set Transformer instead uses self-attention to encode the whole set at once.
Its building block, the Multihead Attention Block, is the Transformer encoder block with positional encoding and dropout removed. A Set Attention Block is that block attending from the set to itself, returning a set of the same size, so several can be stacked to capture higher-order interactions. Because self-attention over n elements costs quadratic time, the Induced Set Attention Block routes attention through m inducing points, bringing the cost down to order n times m. The inducing points belong to the block itself and are trained with the rest of the network. The idea is borrowed from inducing point methods in the sparse Gaussian process literature. Instead of mean or max pooling, the decoder aggregates with Pooling by Multihead Attention, attending from k learnable seed vectors onto the encoded set.
On amortized clustering of 2D Gaussian mixtures the Set Transformer recovered accurate parameters and even beat the oracle after a single EM update. A version with only 16 inducing points did best of all, outperforming the full Set Transformer. Across experiments the attention-based decoder mattered more than attention in the encoder: the gain from PMA exceeded that from SAB. The official repository the captured member comes from implements the maximum value regression, amortized clustering and point cloud classification experiments. The captured member is configured for that clustering experiment, with four seed vectors so that each one generates the parameters of one cluster.
Key idea. The Set Transformer uses attention for both encoding and aggregating a set, and the paper shows both halves are needed to model complicated interactions among elements. An inducing point scheme makes the self-attention scale linearly rather than quadratically in the number of elements.
AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.
@misc{lee2019settransformerframeworkattentionbased,
title={Set Transformer: A Framework for Attention-based Permutation-Invariant Neural Networks},
author={Juho Lee and Yoonho Lee and Jungtaek Kim and Adam R. Kosiorek and Seungjin Choi and Yee Whye Teh},
year={2019},
eprint={1810.00825},
archivePrefix={arXiv},
primaryClass={cs.LG},
url={https://arxiv.org/abs/1810.00825},
}