WithinVAE: Compact Visual Autoencoding with Self-Distilled Semantics

Yuzhou Ji, Jiepeng Wang, Tianyu Jin, Lizhuang Ma, Haibin Huang, Chi Zhang, Xuelong LiarXiv 2026

TL;DR

WithinVAE is a compact visual autoencoder that learns semantic structure entirely from its own internal representations via self-distillation, eliminating the need for external pretrained encoders like CLIP or DINO. It achieves superior reconstruction quality and semantic organization at half the latent capacity of previous state-of-the-art methods, while enabling variable-rate "prefix decoding" from a single model.

What Problem Does This Paper Address?

Visual autoencoders face a difficult "trilemma": they must simultaneously be high-fidelity (reconstruct pixels accurately), compact (low dimensionality for efficient downstream tasks), and semantically structured (latents should represent meaningful concepts).

Most current "semantic tokenizers" solve the semantic part by "borrowing" representations from pretrained models like DINO or CLIP. However, these models are optimized for recognition and often discard the fine-grained appearance details—like texture and exact edges—required for perfect image reconstruction. This creates a coupling between the autoencoder and an external model that might not share the same goals. WithinVAE addresses the question: Can a compact autoencoder organize its own semantic structure without borrowing a recognition representation?

Methods

The authors introduce WithinVAE, which integrates three key mechanisms:

  1. Self-Distilled Semantics: Instead of an external teacher, WithinVAE uses an Exponential Moving Average (EMA) copy of itself. It employs two complementary distillation losses:
  2. Global DINO-style loss: Matches mean-pooled compact tokens between student and teacher across different augmented views of the same image.
  3. Local iBOT-style loss: Performs masked patch prediction to ensure the shared encoder retains spatially grounded details.
  4. Sequential Bottleneck & Position-Dependent Masking: The model maps images to a 1D sequence of tokens. During training, tokens later in the sequence have a higher probability of being masked. This "ordered corruption" forces the model to pack the most critical information into the early tokens (the "prefix").
  5. Variational Bottleneck: It uses a token-wise VAE to maintain a continuous, modelable latent space suitable for downstream generative tasks like diffusion.
Figure 2: WithinVAE training. The reconstruction path maps an image xs through a query encoder (ViT-L patches and 256 latent queries) and a token-wise VAE to a 256 × 32 ordered token sequence; position-dependent masking keeps a reliable prefix z1:k and corrupts the masked tail before the ViT-L pixel decoder produces ˆxs, supervised by a reconstruction loss Lrec + Lperc + Ladv. The semantic branches below match mean-pooled compact tokens via global DINO (Lglobal) and student masked patches via local iBOT (Llocal) against targets produced by an EMA copy of the encoder and VAE that observes a clean view xt.

Datasets

  • ImageNet-1K: The primary dataset used for training and evaluation at $256 \times 256$ resolution.
  • The model is evaluated on standard reconstruction metrics (PSNR, rFID, LPIPS, SSIM) and semantic probes (frozen linear probing and nearest-neighbor accuracy).

Key Insights and Ideas

  • Semantics can be "homegrown": The paper demonstrates that internal pressures—view consistency and masked prediction—are sufficient to organize semantics. You don't need a billion-parameter external model to teach an autoencoder what an object is.
  • Synergy over Trade-off: Surprisingly, adding semantic self-distillation actually improves reconstruction fidelity. The local iBOT-style loss is crucial here, as it prevents the encoder from becoming too invariant (losing detail) while chasing global semantic consistency.
  • Ordered Reliability: The position-dependent masking creates a natural hierarchy. A single model can perform "prefix decoding," where using just the first 128 tokens (25% of the sequence) yields a reconstruction that is already better than previous full-sequence baselines.
Diagnostics showing that WithinVAE attends to object extents more cleanly than baselines and maintains high PSNR even with significant prefix compression.

Key Results

  • State-of-the-Art Reconstruction: On ImageNet-1K, WithinVAE improves all four reported reconstruction metrics over the RPiAE baseline. It achieves a +1.36 dB PSNR gain while using only half the latent scalar capacity (8,192 vs 16,384 scalars).
  • Superior Semantic Quality: In frozen linear probing, WithinVAE's latents outperform RPiAE by 6.5 points and its own reconstruction-only baseline by 5.1 points, proving that the semantic gains come from the self-distillation objective itself.
  • Clean Attention: Qualitative attention maps show that WithinVAE naturally focuses on foreground objects without any explicit supervision, whereas baselines that borrow semantics often produce diffuse or fragmented attention in their actual bottlenecks.
Figure 3: Qualitative results. Up: Matched validation examples showing WithinVAE reconstruction, WithinVAE head-averaged attention, and RPiAE variational-bridge attention averaged over heads and bridge queries. The displays share the input crop, per-map normalization, and color map, but the attention operators are architecture-specific. Down: Class-conditional generation samples from the 80-epoch LightningDiT. Table 3 provides the distribution-level comparison.

Limitations and Future Work

  • Generation Performance: While WithinVAE excels at reconstruction and semantics, its downstream generation quality (when paired with a Diffusion Transformer) currently trails behind some baselines (gFID of 9.12 vs 2.25 for RPiAE). The authors attribute this to a "compatibility" issue between the latent distribution geometry and the generator, rather than a failure of the representation.
  • Quantization: The current model uses continuous scalars. Future work could involve discrete quantization to create a true variable-rate bitstream codec.
  • Dense Task Evaluation: While global semantics are strong, testing on dense tasks like semantic segmentation would further confirm the quality of the local patch-level representations.

Summary updated

Abstract

Visual autoencoders must balance reconstruction fidelity, compactness, and semantic structure. Existing semantic tokenizers typically inherit semantics from pretrained recognition encoders, whose invariances can discard the appearance detail required for inversion. We show that this inheritance is unnecessary: semantic structure can be learned inside an autoencoder's own reconstructive representation. We introduce WithinVAE, a compact variational visual autoencoder with a sequential bottleneck, DINO/iBOT-style self-distillation from an exponential-moving-average copy of the autoencoder itself, and position-dependent token masking to achieve a 4-fold compression ratio, which is free of pretrained representation encoder or external semantic target. On ImageNet-1K at $256\times256$, WithinVAE improves all four reported reconstruction metrics over RPiAE including PSNR by 1.36 dB, while using half its latent scalar capacity. Under frozen evaluation, the same latents improve linear probing by 6.5 points over RPiAE and 5.1 points over our reconstruction-only baseline, attributing the semantic gains to self-distillation rather than architecture or external supervision. An auxiliary latent-to-latent model reproduces the ordered-compression trend, and a pixel-to-latent model transfers the objective to a pretrained generative space. These results separate the origin of semantic supervision from its use: a compact visual autoencoder can organize semantic structure without borrowing a recognition representation.
BibTeX
@misc{ji2026withinvae,
  author = {Yuzhou Ji and Jiepeng Wang and Tianyu Jin and Lizhuang Ma and Haibin Huang and Chi Zhang and Xuelong Li},
  title = {{WithinVAE: Compact Visual Autoencoding with Self-Distilled Semantics}},
  year = {2026},
  eprint = {2610.36593},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2610.36593},
}
Figure