All models

Entroformer

An image compression model whose entropy model is a transformer with top-k attention and bidirectional context.

1,096 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 (24 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
45M
Operations
1,096
Framework
PyTorch
Recurrent
No
Published
ICLR 2022
Cited by
96 (as of 28 October 2026)
Authors
Yichen Qian, Ming Lin, Xiuyu Sun and others
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
m16449
Graph hash
1b6ddcae60995abbc4298786be7dd5eed8448afb7273d05dd474eec1af2627c8
Skeleton hash
cee2efbb9b400df317d544fa9e4bd0aa86d942b4fecab115c20565541a93df22
Architecture hash
31f617a80e375516f1e0e195d6e4aba8d6b542d08af55805f775f3fcde5800b6
Diagram SHA-256
e6a538adc9ce4bb743d5b475c277f9953d29545821d799a2af46a6a10cff14f7
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

Entroformer is a transformer-based entropy model for learned image compression, designed to capture long-range dependencies in probability distribution estimation. The paper notes that previous works build entropy models upon convolutional neural networks, which are inefficient in capturing global dependencies.

The compression model has two main components: a CNN-based autoencoder that learns a latent representation and the transformer-based entropy model that predicts the latents. A transformer encoder learns the hyperprior, while a transformer decoder learns the context using masked self-attention. Two designs adapt the transformer to compression: a top-k scheme that selects the most similar keys for each query, and a relative position encoding with a diamond-shape boundary.

This model is the parallel Entroformer with a bidirectional context, in which the latents are split into two slices along the spatial dimension. The first slice is decoded from the hyperprior alone, and the second is conditioned on both the hyperprior and the decoded first slice. It uses 6 transformer encoder blocks for the hyperprior and 6 transformer decoder blocks for the context, a latent embedding dimension of 384 and 6 attention heads. It takes a 384 × 384 image, the patch size the paper trains on. On the Kodak dataset, the paper reports that Entroformer with the hyperprior and context modules outperforms CNN methods by 5.2% and BPG by 20.5% at low bit rates.

Key idea. Entroformer replaces the convolutional entropy model of learned image compression with a transformer that uses top-k self-attention, a diamond relative position encoding and a parallel bidirectional context model.

  • entroformer
  • learned image compression
  • transformer entropy model
  • lossy image compression
  • top-k attention
  • diamond rpe
  • parallel bidirectional context
  • hyperprior
  • kodak

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

Cite the paper

@misc{qian2022entroformertransformerbasedentropymodel,
      title={Entroformer: A Transformer-based Entropy Model for Learned Image Compression}, 
      author={Yichen Qian and Ming Lin and Xiuyu Sun and Zhiyu Tan and Rong Jin},
      year={2022},
      eprint={2202.05492},
      archivePrefix={arXiv},
      primaryClass={eess.IV},
      url={https://arxiv.org/abs/2202.05492}, 
}