All models

SetTransformer

The Set Transformer is an attention-based network whose input is a set, with no dependence on element order.

228 operations Checked

100%

Showing the top corner; full diagram not loaded yetShowing a small copy; full diagram not loaded yetLarge diagram, not loaded yet

Open SVG

Loading diagram (21 KB)

Open in a new tab

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.

At a glance

Parameters
423.2K
Operations
228
Framework
PyTorch
Recurrent
No
Published
ICML 2019
Cited by
641 (as of 23 October 2026)
Authors
Juho Lee, Yoonho Lee, Jungtaek Kim and others
License
MIT
Checked
Passed: the trace was replayed operation by operation and matched the model's own output for this input.

Files

The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.

Details
Stable ID
m2789
Graph hash
52239fef502eae915af625a3d42cdc00838a94b521354a1427c85b0f338eba40
Skeleton hash
c847366e1978c617703aafec3aaccdee1c616587a5901db9e19aa4929d0dad9a
Architecture hash
3adcfdd0e8319e9f432441bf2af104b52b068975d979519b219c2ad08bcbe3dd
Diagram SHA-256
07e896c4346f8629f00da5f26c33ca885eeb4640e01dabf0d5def1efc2bb0289
TorchLens version
2.36.0
Renderer
graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
Check
Forward pass replayed in PyTorch

What it is

The Set Transformer is an attention-based neural network module designed to model interactions among the elements of an input set. It is meant for problems whose solutions do not depend on the order of the elements, so the model should be permutation invariant. Earlier set pooling methods process every element independently before pooling, and the paper argues that some information about interactions between elements is then necessarily discarded.

The model consists of an encoder and a decoder, both of which rely on attention. Plain self-attention over a set has quadratic time complexity, so the paper introduces the Induced Set Attention Block (ISAB). An ISAB holds a small number of trainable vectors called inducing points: these first attend to the input set, and the input set then attends to the result. This reduces the computation time of self-attention from quadratic to linear in the number of elements in the set. In the decoder, Pooling by Multihead Attention (PMA) aggregates features by applying multihead attention on a learnable set of k seed vectors, in place of a dimension-wise average or maximum.

One of the paper's tasks is amortized clustering with a mixture of Gaussians, where four seed vectors are used so that each generates the parameters of a cluster. On that task the paper reports that the Set Transformer with only 16 inducing points showed the best performance, even outperforming the full Set Transformer.

Key idea. The Set Transformer models interactions among set elements with attention in its encoder and decoder, using inducing points to make self-attention linear rather than quadratic in set size.

  • set transformer
  • settransformer
  • permutation invariant
  • set function
  • set-structured data
  • induced set attention block
  • isab
  • pooling by multihead attention
  • amortized clustering
  • attention on sets

AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.

Cite the paper

@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}, 
}