Abstract
Traditional autoencoders utilize fixed-size latent bottlenecks, which inefficiently allocate representational capacity regardless of input complexity. We present Variable Length Embeddings (VLEs), a novel architecture that encodes images into a sequence of tokens using an autoregressive loop. By iteratively focusing on reconstruction residuals, VLEs achieve state-of-the-art performance with significantly fewer parameters than standard Variational Autoencoders (VAEs). Furthermore, the introduction of a masking mechanism enables unsupervised object discovery and enhanced interpretability.
Introduction
In deep representation learning, the standard paradigm involves mapping high-dimensional inputs to a fixed-length vector. This approach contradicts information-theoretic principles, as the entropy of natural signals varies significantly—a simple image of a clear blue sky requires fewer bits than a complex urban scene. Fixed-length embeddings lead to over-allocation for simple samples and under-representation for complex ones.
To address this, we introduce Variable Length Embeddings (VLEs). VLEs break the fixed-bottleneck constraint by employing an iterative encoding process. This allows the model to adapt its "storage" to the specific needs of the input, resulting in higher efficiency and a more interpretable latent space where individual tokens correspond to specific image features or objects.
Methods
The VLE architecture centers on an autoregressive loop that decomposes an image into a sequence of tokens. The process begins with an empty reconstruction. In each step, the encoder receives the "residual"—the difference between the original image and the current reconstruction—and produces a single token. The decoder then transforms this token into an image patch, which is added to the cumulative reconstruction.
We explore two variants:
- Vanilla VLE: Optimized solely for Mean Squared Error (MSE), this version typically performs a frequency-based decomposition, capturing coarse structures first and fine details later.
- Masked VLE: Incorporates a masking mechanism and a Convolutional LSTM memory state. This forces the model to attend to spatially localized regions, leading to a semantic decomposition where tokens represent distinct objects.
Results
The models were trained on the LAION dataset and evaluated on iNaturalist and ImageNet benchmarks.
Efficiency and Scaling
The Vanilla VLE demonstrates remarkable parameter efficiency. With only 7M parameters, a single-token VLE achieves an MSE of 0.0119, nearly matching the 0.0113 MSE of an 80M parameter VAE. As shown in Figure 1, the VLE's performance scales gracefully with the number of tokens, reaching an MSE of 0.0036 with 7 tokens, far surpassing fixed-length baselines.
Unsupervised Semantic Discovery
The Masked VLE successfully learns to isolate objects without explicit supervision. Qualitative analysis reveals that the model naturally separates foreground elements from backgrounds, assigning specific tokens to semantically meaningful parts of the scene, such as a bird's head versus its body.
Discussion and Conclusion
VLEs offer a flexible and efficient alternative to fixed-length latent spaces. By allowing the embedding length to vary, we achieve high-fidelity reconstructions with a fraction of the parameters required by traditional models. The spatial grounding of tokens in the Masked VLE provides a path toward improved control in generative tasks, such as precise object placement. Future work will focus on overcoming computational limits to train longer sequences and integrating multi-modal data to further refine the semantic grounding of the learned tokens.
Summary updated