All models

set_transformer_encoder

Attention for sets: induced self-attention plus learned-seed pooling, order-invariant and linear in set size.

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 18 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
m9164
Graph hash
52239fef502eae915af625a3d42cdc00838a94b521354a1427c85b0f338eba40
Skeleton hash
c847366e1978c617703aafec3aaccdee1c616587a5901db9e19aa4929d0dad9a
Architecture hash
3adcfdd0e8319e9f432441bf2af104b52b068975d979519b219c2ad08bcbe3dd
Diagram SHA-256
27f962bf5e21342f9d2b7f40f1f495855dd4a03f81d07b563a6ad8608a0721f4
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 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.

  • Set Transformer
  • ISAB
  • induced set attention block
  • PMA
  • pooling by multihead attention
  • permutation invariant
  • set-input network
  • amortized clustering
  • Deep 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}, 
}