Autoencoding variational autoencoder (VAE)Autoencoding Variational Autoencoder
The authors claim that the standard VAE encoder cannot consistently encode samples generated by the decoder, and propose the AVAE objective, which improves the adversarial robustness of representations on colorMNIST without adversarial training.
Evaluation threat model: the attacker performs a PGD adversarial attack on the linear classifier on top of the frozen encoder, with perturbation δ satisfying an infinity-norm bound of at most the attack radius ε, with the goal of changing the classification result; on the training side, AVAE does not rely on any knowledge of the attack, whereas the comparison method SE uses PGD to generate auxiliary samples during training.
- A VAE provides both a decoder and an encoder, but the authors state that a conventionally trained VAE cannot consistently encode typical samples generated by the decoder itself back to the corresponding latent variables; there is an inconsistency between the encoder and the decoder, which affects representation quality.
- The authors construct a Markov chain extended model alternating between encoder and decoder, derive a new variational lower bound AVAE, and use samples self-generated by the decoder as auxiliary observations to constrain the encoder; there is also a self-supervised post-training variant AVAE-SS.
- On colorMNIST and CelebA, AVAE representations achieve higher downstream classification adversarial accuracy under PGD attacks than VAE, and in most settings approach or exceed SE, which requires adversarial training; the authors claim robust representations can be obtained without adversarial training, but FID and MSE get worse.
- The authors note that the robustness improvement comes with a decline in decoder quality (FID, MSE), and whether there is a fundamental reason remains to be studied; the connection to contrastive learning is left for future work. Experiments cover only colorMNIST and CelebA, and attack evaluation uses only PGD.
- Evaluated models
- AVAEAVAE-SSSE-AVAE
- Benchmarks
- colorMNISTCelebA
- Metrics
- adversarial accuracyMSEFID
A conventionally trained variational autoencoder (VAE) does not necessarily give consistent encodings for typical samples generated by its own decoder. The authors propose the concept of self-consistency, construct a variational approximation using a Markov chain that alternates between encoder and decoder, and can train a VAE from scratch or perform self-supervised post-processing on an already trained model without the original training data. On ColorMNIST and CelebA, the representations learned by this method are insensitive to adversarial attack perturbations.
Paper analysis
What problem does this paper attempt to solve?
The authors state that a conventionally trained VAE cannot consistently encode samples generated by the decoder, and propose a self-consistency constraint to fix this.
Core question: can a VAE consistently encode typical samples generated by its own decoder? The authors' answer is no.
- Problem setting: A VAE estimates the data density through the decoder, while providing amortized inference through the encoder to obtain latent representations; this paper focuses on the encoder's representation capability, hoping the representations have properties such as adversarial robustness (Introduction).
- Shortcomings of existing methods: The authors state that even if the VAE objective is globally optimized to a KL divergence of 0, because the support of the empirical distribution is discrete, the encoder is unconstrained outside the support, and the desired representation properties cannot be guaranteed (Section 2.1).
- Core observation: The authors attribute the root of the problem to the inconsistency between the encoder and the decoder, i.e., the lack of autoencoding; Figure 1 shows that on colorMNIST, iterative encoding and decoding causes the image to drift, and the authors state that this drift is a sign of encoding–decoding inconsistency.
- Proposed approach: Propose Autoencoding VAE (AVAE), which constructs a new variational lower bound based on an extended model, forcing the model to remain consistent on both the training data and the decoder's self-generated samples; it can be trained from scratch or used as a self-supervised post-training step (AVAE-SS), without requiring the original training data (Abstract, Section 3).
- Evaluation threat model (used to verify representation robustness, Section 4):
- Attacker's goal: change the classification decision of a normally trained linear classifier on top of a frozen encoder.
- Attacker's means: use PGD to compute a perturbation δ satisfying an infinity norm no greater than the attack radius ε.
- Victim system: the encoder mean mapping as representation plus a linear classifier.
- Success criterion: the proportion of samples for which the attack fails to find an adversarial example, i.e., adversarial accuracy.
What related research exists?
Related work covers VAEs and representation learning, adversarially robust representations (SE), cycle consistency, and contrastive learning.
VAEs and representation learning
- Kingma and Welling (2014), Rezende et al. (2014)—propose the VAE and stochastic backpropagation, the base models of this paper.
- Tschannen et al. (2018)—survey autoencoder-based representation learning; the paper notes that such models are usually not evaluated on robustness properties.
- Zhao et al. (2019)—InfoVAE, gives another interpretation of the ELBO, on which this paper's batch-wise KL interpretation is built.
Adversarially robust representations
- Szegedy et al. (2013)—discover the adversarial example phenomenon; the authors consider this attributable to non-smoothness of representations (e.g., a large Lipschitz constant).
- Cemgil et al. (2020)—Smooth Encoder (SE), which uses the same target model as this paper but generates auxiliary observations with adversarial attacks; this paper states that SE is a special case of its framework, and that SE training is computationally expensive.
Cycle consistency and relational models
- Zhu et al. (2017)—cross-modal cycle consistency; the authors state that this paper's autoencoding formulation is loosely related to it.
- Jha et al. (2018), Tang et al. (2019), Louizos et al. (2019)—supervised VAEs using paired data or relational information; the paper notes that this paper only modifies the encoder and does not require additional relational information.
Contrastive learning
- van den Oord et al. (2018), Chen et al. (2020)—contrastive predictive coding and SimCLR; the authors state that their connection to this paper and whether they can learn robust representations are left for future work.
Baselines and benchmarks: The compared methods are the standard VAE, SE (including SE5, SE20, and variants with different training radii), the hybrid model SE-AVAE, and the self-supervised variant AVAE-SS; the benchmarks are colorMNIST (two tasks: digit and color) and CelebA (17 binary attribute tasks). The authors position this paper as: obtaining robust representations through a self-consistency constraint without modifying the decoder likelihood and without adversarial training.
How does the paper address this problem?
AVAE constructs a new variational lower bound on the extended model, using decoder self-generated samples to constrain the encoder to remain consistent.
Overall idea: extend the VAE into a Markov chain model alternating between encoder and decoder, derive a new variational objective AVAE, so that the encoder stays consistent with the decoder both on training data and on samples self-generated by the decoder.
Extended model and problem formulation
- Standard VAE: the latent variable prior is a standard Gaussian, the decoder is a conditional Gaussian whose mean is given by a neural network g(Z; θ), and the observation noise variance is v (Eq. (1)).
- From a batch perspective, maximizing the ELBO is equivalent to minimizing KL(Q‖P), where Q = π(X)q(Z|X, η) and P = p(X|Z, θ)p(Z) (Eq. (3)).
- The extended model introduces a pair of observations X, X′, with the latent pair (Z, Z′) following a coupled prior whose coupling strength ρ (|ρ| ≤ 1) controls their correlation; ρ = 1 corresponds to Z′ = Z, and ρ = 0 corresponds to independence (Eqs. (4)–(6)).
- Proposition 2.1: approximating the extended model with a specific form of approximate distribution recovers the original VAE objective; the authors use this to argue that ρ ≈ 1 is the behavior needed for representation learning, but the standard VAE objective is completely insensitive to the choice of ρ.
Consistency condition
- Proposition 2.3: if the encoder equals the exact posterior, i.e., the consistency condition q(Z|X, η)p(X; θ) = p(X|Z; θ)p(Z) holds, then the transition kernel Q̄(X′|X) is exact for any ρ (p(X; θ)-invariant).
- The authors note that even if the VAE objective is globally optimal, because the support of the empirical distribution is discrete, the encoder is uncontrolled outside the support, and the above invariance cannot be guaranteed; Appendix B gives an analytically tractable example with probabilistic PCA: when consistent, iterative encoding-decoding converges to an invariant subspace, and when inconsistent, the chain drifts.
AVAE objective
- Target distribution Pρ = p(X|Z; θ)p(Z)pρ(Z′|Z)u(X̃), where X̃ is an auxiliary observation generated by the decoder (the paper calls it delusion), u(X̃) = 1 is a flat distribution, and ρ is a fixed hyperparameter (Eq. (9)).
- Approximate distribution QAVAE = q(Z′|X̃; η)pθ(X̃|Z)q(Z|X; η)π(X); when the decoder is used as a factor, its parameters are treated as constants (stop-gradient), so as not to change the original likelihood.
- Objective BAVAE = −KL(QAVAE | Pρ); after expansion, the first term is the same as the standard VAE ELBO, the second term measures the distance between the representation z used for generation and the encoding z′ of the auxiliary sample (smoothing term), and the third term is an additional entropy term on the auxiliary observation (Eq. (10)).
- Proposition 3.1: when the consistency condition holds and v → 0 and the decoder mean mapping is one-to-one, QAVAE(Z′|Z) equals the coupled transition with ρ = 1; the authors claim this verifies that the choice of approximate distribution is natural.
Algorithm and variants
- AVAE (Algorithm 1): encode x to get z, decode to generate x̃ (stop-gradient), then encode x̃, and maximize the objective via Monte Carlo estimation; Appendix C.1 gives pseudocode with stop-gradient.
- AVAE-SS (Algorithm 4): a post-training variant where both X and X̃ are generated by a pretrained decoder, without using the original training data.
- SE-AVAE (Algorithm 3): a hybrid objective using both PGD adversarial examples and self-generated samples.
- All models have latent space dimension 64; in the Table 1 experiments, AVAE uses ρ = 0.975 and SE uses ρSE = 0.95.
Evaluation protocol
- Three-step protocol: first train the encoder-decoder without a task; then freeze the encoder and train a linear classifier on the representation given by the mean mapping f µ (normal training, no adversarial); finally attack with PGD within radius ε, and report the fraction of samples where the attack fails as adversarial accuracy.
What experiments did the paper conduct?
Evaluating PGD adversarial accuracy of representations on colorMNIST and CelebA, AVAE outperforms VAE and approaches or exceeds SE.
Experimental setup
- Compared methods: standard VAE, SE (Smooth Encoder, including variants with different training radii and PGD iteration budgets), AVAE, AVAE-SS (self-supervised post-training), SE-AVAE (hybrid); latent space dimension is 64 for all.
- Datasets and tasks: colorMNIST (two classification tasks, digit and color, with MLP and ConvNet architectures); CelebA (17 binary attribute tasks, ConvNet only; the authors state that subjective sensitive attributes were excluded).
- Metrics: adversarial accuracy (percentage of samples where the PGD attack failed to change the classification), test MSE, FID; training time reported as a multiple relative to VAE.
- Attack settings: training uses PGD without random restarts; evaluation uses PGD with 10 random restarts, with an evaluation iteration budget of 40 for colorMNIST and 20 for CelebA; perturbations are constrained by the infinity norm (Appendix F).
- Hyperparameters: in the colorMNIST main table (Table 1), AVAE uses ρ = 0.975 and SE uses ρSE = 0.95; optimizer Adam, learning rate 1e-4, NVIDIA Tesla P100 (Appendix F).
- Review method: no LLM or human review; classification accuracy is determined automatically by whether the attack succeeds; the paper does not report the number of repetitions.
Main results
colorMNIST (ConvNet) adversarial accuracy (%), according to Table 1:
Swipe horizontally to read the table
Method digit ε=0.0 digit ε=0.1 digit ε=0.2 color ε=0.1 color ε=0.2 Time VAE 93.8 5.8 0.0 19.9 2.0 ×1 SE0.1 94.3 89.6 1.8 100.0 21.8 ×4 SE0.2 95.7 92.6 87.3 99.9 99.9 ×4 AVAE 97.3 88.1 54.8 99.8 87.7 ×1.5 SE0.1-AVAE 97.4 93.6 24.5 100.0 60.0 ×4.7 SE0.2-AVAE 97.6 94.2 79.8 100.0 83.2 ×4.7 AVAE-SS 94.1 72.8 20.8 99.6 56.8 ×1.5 - The authors claim AVAE improves nominal accuracy and remains robust at larger attack radii, and that training is completely unaware of the attack type and radius; the computation time of single-step SE is about 2.7× that of AVAE.
- The authors claim that at small radii combining the two objectives (SE-AVAE) can further improve (digit, ε = 0.1), but the advantage disappears at ε = 0.2.
- The authors claim AVAE-SS can improve the robustness of a pretrained VAE in a fully self-supervised manner, but the final adversarial accuracy is not competitive.
CelebA results
- According to Table 2 (subset of tasks, ε = 0.1): AVAE achieves 85.2 on Bald, 91.5 on Mustache, 78.4 on Necklace, and 68.9 on Eyeglasses, higher than SE5 (72.0, 69.5, 56.7, 20.3); SE20 (reported in [5]) is still higher than AVAE on Bald (86.5) and Necklace (78.9).
- Exceptions: on the Smiling and Lipstick tasks, adversarial accuracy is close to 0 for all methods (AVAE is 3.6 and 7.3, respectively, Table 2); full 17-task results are in Appendix Table 3.
- The authors claim AVAE-SS exceeds SE5 on some tasks, and SE-AVAE outperforms SE and AVAE on most tasks.
Cost and parameter analysis
- Decoder quality: in Table 1, AVAE's FID is 15.46 (VAE is 12.44), and MSE is 1371.9 (VAE 1369.2); in Table 2, SE-AVAE's FID is 109.4. The authors speculate that this trade-off may stem from the encoder being more strongly constrained.
- Coupling strength ρ: the left column of Figure 5 shows higher adversarial accuracy when ρ is close to 1 (the authors claim this is consistent with the analysis).
- Architecture and training dynamics: the middle column of Figure 5 shows that adversarial accuracy rises slowly on MLP and very quickly on ConvNet.
- Radius generalization: the right column of Figure 5 shows that SE's robustness does not extend beyond its training radius, while AVAE's accuracy decreases gently as the radius increases (the authors claim it degrades gracefully).
- Different ρ combinations: Appendix G (Figure 9) compares three combinations of ρ and ρSE, and the authors claim SE-AVAE outperforms SE and AVAE at smaller ε.
What are some points that can be further explored?
The authors note that the trade-off of degraded decoder quality remains to be resolved, and list future directions such as the connection to contrastive learning.
Limitations and future directions noted by the authors
- Robustness–quality trade-off: The authors observe that when the encoder is more robust, decoder quality (FID, MSE) becomes worse, "whether there is a fundamental reason remains to be studied," and they believe a more carefully designed training method could potentially improve both (Conclusions).
- Connection to contrastive learning: The authors state that the connection between contrastive learning methods and this paper, and whether contrastive models can learn robust representations, are left for future work (Conclusions).
- No formal guarantee: The authors state that the method in this paper does not provide a formal guarantee (end of Section 3).
- AVAE-SS competitiveness: The authors state that the final adversarial accuracy of AVAE-SS is not competitive, despite its self-supervised nature being attractive (Section 4 Results).
Scope of experiments
- The datasets are colorMNIST (MLP and ConvNet) and CelebA (ConvNet only, 17 attribute tasks), two in total (Section 4).
- Attack evaluation uses only PGD with an infinity-norm constraint, with evaluation radius ε up to 0.2 (colorMNIST) and 0.1 (CelebA) (Table 1, Table 2).
- The compared methods are VAE, SE, SE-AVAE, AVAE-SS; the SE20 numbers on CelebA are reported by [5], with MSE/FID marked as N/A (Table 2, Table 3).
- The downstream evaluation protocol is a frozen encoder plus a normally trained linear classifier; the paper does not report the number of experimental repetitions or variance.
- The paper does not report evaluation against adaptive attacks (attacks specifically designed against the AVAE mechanism).
Summarize the main content of the paper
The authors claim that a VAE does not autoencode, and propose the AVAE self-consistency objective, obtaining robust representations without adversarial training.
A theoretical and methodological paper on VAE representation learning. The authors pose and answer a question: can a VAE consistently encode typical samples generated by its own decoder? The authors state that the answer is no—a conventionally trained VAE does not constrain the encoder outside the support of the empirical data, and iterative encoding and decoding produces drift (Figure 1).
- Method: Construct an extended model with alternating encoder–decoder, derive a new variational lower bound, AVAE, and use decoder self-generated samples as auxiliary observations to constrain the encoder; the likelihood function is the same as in a standard VAE, with additionally a self-supervised post-training variant AVAE-SS and a hybrid variant SE-AVAE.
- Main results (colorMNIST ConvNet, Table 1): On the digit task at ε = 0.2, AVAE adversarial accuracy is 54.8%, VAE is 0.0%, and SE0.2 is 87.3%; AVAE takes only ×1.5 the time of VAE, while SE takes ×4.
- CelebA (Table 2): AVAE has higher adversarial accuracy at ε = 0.1 than SE5 on tasks such as Bald and Mustache, but on the Smiling and Lipstick tasks all methods are close to 0.
- Cost: AVAE's FID and MSE are worse than VAE's (e.g., FID 15.46 vs. 12.44), which the authors conjecture is related to the encoder being more strongly constrained.
- Authors' conclusion: AVAE obtains robust representations without adversarial training, and provides a principled justification for data augmentation in density estimation; the trade-off between robustness and decoder quality, and the connection to contrastive learning, are left for future work.