Sampled Transformer for Point Sets

Shidi Li, Christian Walder, Alexander Soen, Lexing Xie, miaomiao Liu

TL;DR

Standard transformers handle point sets naturally via permutation-invariant dense attention, but their $O(n^2)$ cost makes them prohibitive for large point clouds. This paper proposes the Sampled Transformer, an $O(n)$ attention mechanism that pairs random element subsetting with sparse Hamiltonian cycle self-attention. By viewing point permutation as a Monte Carlo approximation of dense attention, it eliminates the need for expensive spatial heuristics while provably retaining universal approximation capabilities for set-to-set functions.

What Problem Does This Paper Address?

Dense self-attention treats inputs as sets by default—swapping two elements does not change which tokens interact. However, scaling to dense 3D point clouds is bottlenecked by quadratic $O(n^2)$ memory and compute costs.

In sequential domains (like text), researchers cut complexity to $O(n)$ using sparse attention patterns (e.g., local sliding windows). Unfortunately, fixed sparse patterns break permutation invariance: changing the arbitrary order of points changes which elements attend to each other. Previous set transformers solved this either by introducing spatial heuristics (like $k$-nearest neighbors) or by compressing tokens into a small set of "inducing points." The authors ask: Can an $O(n)$ sparse attention mechanism operate directly on unordered sets without adding heavy domain-specific inductive biases?

Methods

The authors introduce Sampled Attention, which maps point permutations directly to random edge sampling in the complete attention graph:

  1. Random Element Sampling: The full input of $n$ points is split into $l$ overlapping subsets $X^i$, each containing $n_s$ points (with stride $n_s - 1$ and cyclic wrapping, such that $(n_s - 1) \cdot l = n$).
  2. Hamiltonian Self-Attention: Within each subset, each token attends only to itself and its immediate neighbor ($k$ and $k+1$). This forms a Hamiltonian path requiring only $O(n_s)$ operations.
  3. Cycle Attention: Because adjacent subsets share an overlapping point, concatenating the sub-matrices forms a closed Hamiltonian cycle across the entire point cloud.
  4. Monte Carlo Approximation of Dense Attention: Because points are randomly ordered, each forward pass samples a random Hamiltonian cycle from the complete attention graph. Over repeated stochastic draws across training batches and epochs (conceptually similar to Dropout), the expected connectivity converges toward dense $O(n^2)$ attention.
  5. Theoretical Guarantee: The authors mathematically prove (extending the framework of Yun et al.) that this sampled sparse architecture is a universal approximator for continuous set-to-set functions using selective-shift and all-max-shift operators.
Full Point Set  ──►  Randomly Partition into Overlapping Subsets
                             │
                             ▼
               Sparse Hamiltonian Path Attention (O(n_s))
                             │
                             ▼
             Coupled Cycle Attention (Hamiltonian Cycle)
                             │
                             ▼
      Stochastic Resampling per Step  ===>  Monte Carlo Dense Attention

Datasets

The authors evaluated the method across multiple 3D and 2D benchmarks:

  • ShapeNet: Used for self-supervised pre-training via masked point autoencoding (MAE).
  • ModelNet40: Used for downstream 3D shape classification, few-shot classification (5-way/10-way, 10-shot/20-shot), and isolated attention comparisons across varying point resolutions (256 to 8,192 points).
  • ScanObjectNN: Real-world scanned 3D objects across 15 categories (tested on OBJ-BG, OBJ-ONLY, and PB-T50-RS splits) to assess transfer learning.
  • Synthetic 2D Gaussian Mixtures: A toy clustering benchmark testing amortized parameter inference for set inputs.

No new datasets were introduced; standard benchmark splits and evaluation protocols were strictly followed.

Key Insights and Ideas

  • Randomness restores invariance: While a single fixed sparse attention graph is permutation-variant, randomizing the graph per batch/epoch yields an unbiased estimator of dense attention in expectation.
  • Dropout-like regularization: Beyond reducing memory, sampling sparse Hamiltonian cycles acts as an implicit regularizer. On several tasks, Sampled Attention actually outperforms full dense attention.
  • Elimination of geometric heuristics: Unlike $k$-NN transformers, Sampled Attention requires no Euclidean distance lookups or spatial clustering, maintaining a broad, global receptive field across all subsets.

Key Results

  • Self-Supervised Learning (MAE): On ModelNet40, pre-training with Sampled Attention (MAE-sampled) achieved 93.7% accuracy, edging out dense attention (MAE-dense, 93.6%) despite running at linear complexity.
  • Few-Shot Learning: In few-shot classification on ModelNet40, MAE-sampled beat state-of-the-art models on 3 out of 4 settings—e.g., reaching 97.0% in 5-way 10-shot (vs. 95.9% for MAE-dense) and 98.3% in 5-way 20-shot (vs. 97.2% for MAE-dense).
  • Memory & Scalability: In single-layer scaling tests on an RTX 3090 (24 GB):
  • Dense Attention ran out of memory (OOM) at $n \ge 3072$ points.
  • Sampled Attention scaled seamlessly up to 8,192 points, consuming only 4.2 GB of VRAM while maintaining 87.73% accuracy (compared to $k$-NN attention, which degraded to 82.26% at 4,096 points due to receptive field shrinkage).
  • Transfer Learning: On ScanObjectNN, the sampled model achieved competitive results across all three perturbation benchmarks (e.g., 88.81% on OBJ-ONLY vs. 88.50% for dense).

Limitations and Future Work

  • Single-pass variance: Because dense connectivity is approximated in expectation over training, individual test-time inferences only see a single sparse realization. Multiple inference draws or hybrid evaluation schemes were not explored.
  • Asymmetric cross-attention limits: Hamiltonian cycles assume equal numbers of queries and keys ($n \times n$). For asymmetric architectures (such as Set Transformer’s $m \times n$ inducing point blocks), the authors had to revert to a heuristic per-row uniform sampling pattern rather than a structured Hamiltonian cycle.
  • Dynamic subset tuning: The paper assumes uniform subset sizing ($(n_s - 1) \cdot l = n$); dynamically adapting subset counts or sparsity rates for irregular point cloud distributions remains open for future research.

Summary updated

BibTeX
@inproceedings{li2023sampled,
  author = {Shidi Li and Christian Walder and Alexander Soen and Lexing Xie and miaomiao Liu},
  title = {{Sampled Transformer for Point Sets}},
  booktitle = {International Conference on Learning Representations},
  year = {2023},
  url = {https://openreview.net/forum?id=F7f4BYnDAIc},
}
Figure