All models

SwapVAE

A variational autoencoder that separates neural activity into content and style latent spaces.

Neuroscience signals · 146 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 (124 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
137.9K
Operations
146
Framework
PyTorch
Recurrent
Yes
Published
NeurIPS 2021
Cited by
9 (as of 26 October 2026)
Authors
Ran Liu, Mehdi Azabou, Max Dabagia 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
m20672
Graph hash
ddcfb4dc2fbad0dcfd1702f2172887675411c2f3a6e4b928ff830319232ba845
Skeleton hash
25c7a6160668ea260805cbd0636b7f31611c7e217d9820472410ab468a45c02f
Architecture hash
60521ae4c9f177d777cff3f420255ba9ced0f17cf361200a3e9e6421bcef4ca9
Diagram SHA-256
faa5c69e71635f4243f17e487b935fb45143d2fc0ffefb15c7e180b969a06798
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

SwapVAE, written Swap-VAE in the paper, is an unsupervised approach for learning disentangled representations of neural activity. It combines a generative model with an alignment loss that tries to maximize the similarity between the representations of transformed views of the same input, a brain state. The views are created by dropping out neurons and jittering samples in time.

The encoder partitions the latent variables of the two views into a content space and a style space. The alignment loss is applied to the content representations, while a decoder reconstructs neural activity from both parts of the latent space. In a step called BlockSwap, the content variables of the two augmented views are swapped before being passed through the decoder. The reconstruction side is a regularized variational autoencoder (beta-VAE). In the paper's experiments the encoder has three fully connected layers with batch normalization and ReLU activations, and the decoder is symmetric.

The paper describes the approach as loosely inspired by computer vision methods that decompose images into their content and style. Its neural datasets come from two rhesus macaques, Chewie and Mihi, both trained to reach toward one of eight different directions after a cue. On those datasets the reconstruction loss is the Poisson loss.

Key idea. Swap-VAE combines a generative model with an alignment loss that maximizes the representational similarity between transformed views of neural activity.

  • swapvae
  • swap-vae
  • drop swap and generate
  • neural activity
  • disentangled representations
  • blockswap
  • self-supervised neural representation
  • generating neural activity
  • variational autoencoder

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

Cite the paper

@misc{liu2021dropswapgenerateselfsupervised,
      title={Drop, Swap, and Generate: A Self-Supervised Approach for Generating Neural Activity}, 
      author={Ran Liu and Mehdi Azabou and Max Dabagia and Chi-Heng Lin and Mohammad Gheshlaghi Azar and Keith B. Hengen and Michal Valko and Eva L. Dyer},
      year={2021},
      eprint={2111.02338},
      archivePrefix={arXiv},
      primaryClass={cs.LG},
      url={https://arxiv.org/abs/2111.02338}, 
}