Exploring the Latent Space of Autoencoders with Interventional Assays
Abstract
Autoencoders exhibit impressive abilities to embed the data manifold into a lowdimensional latent space, making them a staple of representation learning methods.
However, without explicit supervision, which is often unavailable, the representation is usually uninterpretable, making analysis and principled progress challenging.
We propose a framework, called latent responses , which exploits the locally contractive behavior exhibited by variational autoencoders to explore the learned manifold.
More specifically, we develop tools to probe the representation using interventions in the latent space to quantify the relationships between latent variables.
We extend the notion of disentanglement to take the learned generative process into account and consequently avoid the limitations of existing metrics that may rely on spurious correlations.
Our analyses underscore the importance of studying the causal structure of the representation to improve performance on downstream tasks such as generation, interpolation, and inference of the factors of variation.
Introduction
Autoencoders (AEs)
[1, 2] and its modern variants like the widely used variational autoencoders (VAEs) [3], are a powerful paradigm for self-supervised representation learning for generative modeling [4], compression [5], anomaly detection [6] or natural language processing [7].
Since autoencoders can learn low dimensional representations without requiring labeled data, they are particularly useful for computer vision tasks where samples can be very high dimensional making processing, transmitting, and search prohibitively expensive.
Here VAEs have shown impressive results, often achieving state-of-the-art results compared to other paradigms [8, 9, 10, 11].
The striking performance coupled with the relatively flexible approach has prompted an explosion of variants to learn a representation with some structure that is particularly conducive to a given task [12, 13, 14].
In addition to a meaningful lower-dimensional representations of our world [15], the focus may be to improve generalization [16, 17, 18], increase interpretability by disentangling the underlying mechanisms [19, 20, 21, 22], or even to enable causal reasoning [23, 24].
In designing ever more intricate training objectives to learn more specialized structures as part of complicated model pipelines, it becomes increasingly important to gain a better understanding of what the representation actually looks like to more quickly identify and resolve any weaknesses of a proposed method.
Here the manifold learning community provides a principled formulation to analyze and control the geometry of the data manifold learned by the representation [25, 26, 27, 28, 29, 30, 31, 32, 33].
Developing tools to better understand the structure of the representation is not only useful as a diagnostic to identify avenues for improving modelling and sampling [34, 35], but it also has crucial importance for fairness [36, 37] and safety [18, 38, 39].
Our focus here is on taking advantage of common properties of autoencoders to gain a deeper understanding of the structure of the representation.
We summarize our contributions as follows:
• We propose a framework, called latent responses , which exploits the locally contractive behavior of autoencoders to distinguish the informative components from the noise in the latent space and to identify the relationships between latent variables. • We develop tools to analyze how the data manifold is embedded in the latent space by estimating the extrinsic curvature which also enables semantically meaningful interpolations. • Where true labels are available, we use conditioned latent responses to assess how each true factor of variation is encoded in the representation and introduce the Causal Disentanglement Score to quantify how disentangled the learned generative process is. We release our code
at
https://github com/felixludos/latent-responses .
Background
Representation learning begins with a set of N observation samples x ∈ X ⊆ R D which originate from some unknown stochastic generative process with distribution x ∼ p ( X ) and support X .
This data manifold X is embedded into a low-dimensional ( d << D ) latent space R d , and is modelled by the support Z of an encoder f : X (cid:55)→ Z with the decoder learning the inverse mapping g : Z (cid:55)→ ˆ X where after training ˆ X ≈ X .
Variational Autoencoders (VAEs) [3, 40] are a framework for optimizing a latent variable model p ( X )
≈ (cid:82) Z p ( X | Z ; θ ) p ( Z )
d Z with parameters θ , typically with a fixed prior p ( Z ) =
N ( Z ; 0 , I ) , using amortized stochastic variational inference.
A variational distribution q ( Z | X ; ϕ ) with parameters ϕ approximates the intractable posterior p ( Z | X ) .
The encoder and decoder are parameterized such that q ( Z | X = x ; ϕ ) =
N ( Z ; f ϕ ( x ) , σ ϕ ( x )) , and E [ p ( X | Z
= z ; θ )]
= g θ ( z ) where f ϕ ( x ) and σ ϕ ( x ) , and g θ ( z ) are neural networks which are jointly optimized using the reparameterization trick [3] to maximize the ELBO (Evidence Lower BOund) which is a lower bound to the log likelihood:
[Equation]
Note that in practice, p ( X ) is unknown, and we only have access samples { x ( i ) } Ni , so p ( X ) is approximated by π ( X = x ) = 1 N (cid:80) Ni =1 δ ( x − x ( i ) ) .
The first term in the objective corresponds to a reconstruction loss, while the second can be interpreted as a regularization term to encourage the posterior to match the prior.
2.1 Related Work
Representation geometry A closely related approach is manifold learning which aims to exploit the geometry of the data manifold, usually by regularizing the geometry of the representation by estimating the intrinsic curvature of the data manifold [26, 27, 28, 29, 30], or by improving sampling and interpolation using the the Riemmanian metric [31, 32, 25, 33].
In comparison, our response maps estimate the extrinsic curvature, which focuses on the specific embedding, rather than being an intrinsic property of the dataset (see appendix A.4).
Interpretability and Disentanglement
Another general approach is to gain a better understanding of the representation by making it more interpretable, by, for example, disentangling the true factors of variation [19, 22, 41, 42, 43, 44].
While our analysis is more similar to approaches that improve the representation by focusing on the structure of the representation, for example by learning extra post-hoc models in the latent space [45, 46, 47], we develop a metric to evaluate how disentangled the learned generator is, rather than just the encoder.
Autoencoder Consistency VAEs have been investigated from an information theoretic viewpoint [48, 49] and with respect to training problems like posterior collapse [50] or the holes problem [51] to better understand common failure modes.
Similarly, mismatches between the encoder and decoder [52, 53], have spurred research into increasing the self-consistency of autoencoders [54, 55, 56, 57, 58].
Our latent response framework relies on a very similar approach and formulation, but crucially, thus far these methods focus on regularizing the training of the representation to impose certain desired structure, while we focus on analyzing the structure that is learned rather than modifying the training objective, making our tools directly applicable to virtually all VAEs.
Latent Responses
On a high level, to explore the structure of how the data manifold is embedded in the latent space, it is necessary to separate the semantic information from the noise in the latent space.
So our goal is to decompose the latent variables Z into an endogenous S and exogenous U component, which, for simplicity, we choose to relate to one another as shown in equation 2.
[Equation]
Conceptually, S should capture the semantic information necessary to to reconstruct the sample X , while U is a local noise model in the latent space for a given observation X which does not meaningfully affect the semantics.
In the context of VAEs with a Gaussian prior, we propose equationsand 4 which recovers the familiar posterior for VAEs q ( Z | X = x ; ϕ ) =
q ( S | X ; ϕ ) q
( U | X ; ϕ ) =
N ( f ϕ ( x ) , σ ϕ ( x )) .
[Equation]
One implication of separating the deterministic and stochastic part of the encoder is a new perspective on the training signal for the decoder from the VAE objective.
Substituting our definitions for S and
U into the reconstruction loss term (shown in equation 5) reveals the decoder is trained to map all samples from the posterior to match the same observation sample
x
( i ) .
As a result, the decoder learns to filter out any exogenous component u from z around s , making the latent space locally contractive around S to the extent of U .
Although we observe this as a byproduct of the VAE objective, this contractive behavior is even observed in unregularized autoencoders to some extent [59] suggesting this may be a more fundamental feature of the inductive biases in deep autoencoders.
[Equation]
where s ( i ) =
f ϕ ( x ( i ) ) is the (deterministic) latent code corresponding to the observation x ( i ) .
Starting from some latent sample z ∼ p
( Z ) , we would like to separate the constituent exogenous u and endogenous s components.
If we had the matching x such that z ∼ q ( Z | X = x ; ϕ ) , then the separation would be trivial since, by definition s = f ϕ ( x ) and u = z − s .
However, since the
VAE is optimized to reconstruct observations from the latent space, we approximate the missing x with ˆ x = g θ
( z ) .
Subsequently, we encode the generated sample ˆ x to infer an approximation of s , ˆ s = f ϕ
(ˆ x ) .
Now by expanding g θ around z and f ϕ around x to the first order, we are left with three terms shown in equation 6 (neglecting higher order terms, full derivation in appendix A.2).
[Equation]
where ϵ
= ˆ x − x is the reconstruction error, J f ϕ ( x ) is the jacobian of f ϕ evaluated at x and J g θ ( s ) is the jacobian of g
θ evaluated at s .
Term 1 aligns with our conceptual interpretation of s as the semantic information should remain invariant to any noise information also contained in z .
Meanwhile the second and third terms correspond to two different sources of error to this interpretation we must potentially take into account.
The term 2 derives from the encoder struggling to encode samples that were not seen during training, since π ( X ) ̸
= p ( ˆ X | Z ; θ ) p ( Z ) .
However, provided the reconstructions sufficiently faithful across latent space (i.e. g θ ( s ) − x is small), this term may be ignored.
This error can be further mitigated by training the encoder to be more robust with respect to the input (diminishing J f ϕ ( x ) ) with mild additive noise on the input observations or additional regularization terms [54, 52, 58].
Finally, term 3 in equation 6 originates from the decoder having to filter out the stochastic exogenous information from z when decoding.
As discussed above in equation 5, the VAE objective already directly minimizes this term by training the decoder output to be invariant to noise samples u , thus diminishing J g θ ( s ) .
The bottom line is, as long as the decoder can filter out the exogenous information u from latent samples z and the encoder can recognize the resulting generated samples ˆ x , the endogenous information s is preserved.
We call this process of decoding and reencoding latent samples, h ϕθ = f
ϕ ◦ g θ the latent response function.
Crucially, the latent response function allows us to extract the semantic information from the latent space without knowing how the information is encoded, so although we can identify the structure of the representation, the representation is not necessarily interpretable without ground truth label information.
A statistical treatment of this phenomenon is discussed in the appendix, however provided the error terms are sufficiently small the corresponding response distribution r ( ˆ Z | Z ; θ, ϕ ) is shown in equation 7.
[Equation]
One subtlety of our interpretation remains to be addressed: how ambiguities due to overlapping posterior distributions are resolved by latent responses.
To match the prior, there will be overlap between posterior distributions which correspond to semantically different samples.
Statistically speaking, these ambiguities are captured by the higher moments of r ( ˆ Z | Z ; θ, ϕ ) .
Despite E r ( ˆ Z | Z ; θ,ϕ ) [ ˆ S ] ≈ S , the variance can be interpreted to relate to the uncertainty of the encoder in the inference of the endogenous variable from the generated sample, suggesting a potential signal for anomaly detection [55].
From another perspective, a strong deviation between ˆ S and S implies there is some inconsistency between the encoder and decoder, which identifies the "holes" in the latent space [51], where the encoder has trouble recognizing the samples generated by the decoder.
3.1 Interventions
[Figure]
along the horizontal latent dimension with that of the sample with a yellow border. In this case, the intervention results in the latent sample leaving the latent manifold. Now the latent response function approximately filters out the exogenous noise to effective project the sample back onto the manifold.
Note that this projection (green arrow) changes both the horizontal and vertical dimensions, from which we infer there is a non-trivial relationship between the horizontal and vertical.
To control the learned generative process, we need to know how to manipulate specific semantic information in the representation.
We conceptualize these manipulations as interventions where a chosen latent variable is modified while all others remain unchanged.
For example, given latent sample z , ∆ ( z j ← ˜
z
j ) ( z ) refers to the interventional sample where the j th latent variable is resampled from the marginal of the aggregate posterior ˜
z
j ∼ q ( Z j ; ϕ ) .
When intervening on latent variables Z , there are two possible outcomes: either the resulting generated sample is affected significantly, that is to say, the semantic information S is affected by the intervention, or there is no significant change in which case only the noise was affected.
In the first case, we identify a specific kind of intervention to manipulate the learned generative process.
Latent Response Matrix This brings us to the first practical tool we introduce based on latent responses, which aims to describe to what extent the latent variables causally affect one another with respect to the learned generative process.
Each element in the matrix M ∈ R d ∗ d quantifies the degree to which an intervention in latent variable j causes a response in latent variable k as seen in equation 8, where h θϕk refers to the k th variable of the latent response (see figure 1).
[Equation]
Along the diagonal, M jj can be interpreted as quantifying the extent to which an intervention along the j th latent variable is detectable at all.
As the value approaches 0, changes in the latent variable do not affect the generated sample in any way detectable by the encoder.
For VAEs, this is frequently due to posterior collapse [60, 61, 50, 62].
On the other hand, if the latent variable is maximally informative and the intervention ˜
z j is fully recoverable it implies negligible exogenous noise, so then h ϕθj (˜ z ) ≈ ˜
z
j and h ϕθj ( z ) ≈
z j , and M jj approaches 1, since both ˜ z j and z j are sampled independently from a standard normal, and the elements are normalized with a factor of 12 .
Perhaps even more interesting, the off-diagonal elements of M jk show to what extent an intervention on variable j affects variable k .
Consequently, the latent response matrix can be interpreted as a weighted adjacency matrix of a directed graph of the learned structural causal graph.
Note that there may be cycles in this graph if there is some non-trivial relationship between latent variables.
For example, the model could embed a periodic variable into two latent dimensions, such as jand j 2 , to keep the representation continuous.
In that case, we would expect an intervention along dimension j 1 to elicit a similar response in j 2 as the response of j 1 from an intervention on j 2 .
Consequently, M j 1 j 2 ≈ M j 2 j 1 > 0 suggests j 1 and j 2 should be treated jointly as a single latent variable.
Consequently, the latent response matrix not only describes the causal structure of the learned generative process, but it can also identify more complex relationships between latent variables for further analysis.
Conditioned Response Matrix While the latent response matrix M jk lets us quantitatively compare how much each latent dimension affects another, without manual inspection or label information, the correspondence between the learned causal variables the true causal factors is, in general, unknown [19].
However, when we have access to the true generative process, or at least the ground truth labels y
( i ) ∈ Y ⊆
R d ∗ corresponding to the observation samples x
( i ) , then there is variant of the latent response matrix, termed the conditioned response matrix , to quantify how well the learned variables match with the true ones, which is closely related to the disentanglement of the representation.
The key is to carefully select our interventions such that they only affect one true factor at a time, and then evaluate to what extent these interventions for each of the latent variables are still detectable.
Intuitively, if a latent variable Z j only captures information pertaining to factor Y c , then if we select interventions that only change factor Y c ′ where c ′ ̸ = c , then interventions on Z j do not produce a response, so M jj ≈ 0 .
To condition the set of interventions on a specific factor Y c , we choose a subset of observations which are all semantically identical except for a single factor Y c , x ∼ p ( X | Y c , Y − c ) p ( Y c ) p ( Y − c ) where p ( X | Y ) refers to the true generative process given label Y and Y − c refers to all true causal variables except Y c .
Then the latent response matrix is computed with interventions exclusively sampled from the resulting aggregate posterior of this subset q ( Z | Y − c ; ϕ )
= (cid:82) q [Equation]
p [Equation]
[Equation]
In the context of controllable generation, the conditioned response matrix quantifies how much an intervention on each latent variable can affect each of the true factors of variation.
Ideally, each true causal factor would only be manipulable by disjoint subsets of the latent variables, which is commonly referred to as "disentangling" the factors of variation.
From the conditioned response matrix, we can identify not only which latent variables contain information pertaining to each of the true factors of variation, but also which factors are affected by an intervention in each of the latent variables.
Causal Disentanglement Score To more easily compare representations, we can aggregate the information in the conditioned response matrix into a single value to measure the degree to which the representation is able to disentangle the true factors of variation.
The causal disentanglement score (CDS) in equation 10 which allows each latent variable to causally affect a single factor, but penalizes any additional responses.
As written, the score is between 1 d ∗ and 1, but we re-scale it to [0 , 1] .
[Equation]
(To our knowledge) none of the existing disentanglement metrics take the learned generative process into account at all.
If the task is only to infer the true labels from the observations (as is common), then the decoder is admittedly superfluous, which is why disentanglement methods generally focus on the encoder.
However, in tasks such as controllable generation, where disentanglement is obviously valuable, the behavior of the decoder is critical.
Here, the main risk in evaluating disentanglement from the encoder alone is that some latent variables may be correlated with true factors of variation without them having any causal effect on those factors when generating new samples.
These spurious correlations also potentially decrease the resulting disentanglement score, which may falsely penalize larger representations.
The conditioned response matrix and associated CDS mirrors the responsibility matrix and disentanglement score introduced by [42].
However, crucially, the responsibility matrix identifies how well each latent variable correlates with each true factor of variation.
Response Maps The last type of analysis we propose focuses on gaining a qualitative understanding of how the data manifold is embedded in the latent space.
Specifically, we exploit the ability to probe the latent manifold using the response function to map out the manifolds extent, including estimating its extrinsic curvature.
From the definition of s = f ϕ ( x ) where s ∈ Z , x ∈ X and f ϕ is a smooth deterministic function, we may interpret s as a projection of the data manifold X into the latent space.
Usually, our analysis of Z is limited to the observation samples of x we have access, from which manifold learning methods often estimate the intrinsic curvature of the data manifold X .
However, using latent responses, we can use any latent sample
z ∼ p
( Z ) to probe Z as long as ˆ s ≈ s .
Rearranging the terms gives us u ( z ) in equation 11, whose magnitude can be interpretted as the unsigned distance function to the latent manifold, which is evocative of the neural implicit functions [63, 63, 64] suggesting a variety of further tools we leave for future work.
[Equation]
Treating | u ( z ) | as an approximate distance function to the manifold, we compute the mean curvature
H of the latent manifold (see appendix for further discussion).
In practice, we estimate the necessary gradients by finite differencing across a 2D grid in the latent space, we call the resulting map the response map , visualized similarly as in [65].
Qualitatively, with our sign convention, high curvature corresponds to regions where u ( z ) is small and locally convergent, and consequently where we find the data manifold.
Empirically, we also find the divergence of u ( z ) , which is closely related to the mean curvature, and is useful for identifying the regions of the latent space where u diverges, which may be interpreted as possible "holes" in the latent space.
When interpolating between latent samples z , ideally we would follow the geodesic of the data manifold.
This is can done by estimating the Riemannian metric from the data samples and integrating an expensive ODE to find the geodesic connecting samples [25].
The Riemmanian metric relates to the intrinsic curvature of the data manifold, which is independent of the embedding, consequently guaranteeing we find the geodesic independent of the representation.
However, in our case, we use the latent responses to estimate the extrinsic curvature which does depend on the embedding, so the resulting path may not be optimal with respect to the underlying data manifold.
Nevertheless, we optimize the path along the response map to stay in high curvature regions, thereby effectively are finding a path in the latent space which stays near the data manifold.
Toy Example: The Double Helix
To illustrate how the latent response framework can be used to study the representation learned by a VAE, we show the process when learning a 2D representation for samples from a double helix embedded in R 3 .
Disregarding the additive noise, the data manifold has two degrees of freedom (data manifold formally defined in the appendix).This analysis is largely independent of the precise neural network architecture, provided the model has sufficient capacity to learn a satisfactory representation (hyperparameters in the appendix).
Figure 2 provides an example for how the response maps can be used to trace the latent representation through the mean curvature and divergence.
Note that the magnitude of the response | u ( z ) | is not sufficient to identify the latent manifold since both the regions with maximal and minimal curvature have a minimal response.
The divergence shows most of the latent space has a slightly negative divergence, implying most of the latent space converges, rather than diverges, which is consistent with expectations.
The mean curvature shows what regions of the latent space the map converges to
Magnitude of
Divergence
Mean Curvature
Posterior 0.
in yellow, from which we can recognize the structure of the learned latent manifold. Finally, the right most plot shows the aggregate posterior q ( S | X ; ϕ ) of the 1024 training samples. This toy example also motivates the value of meaningful interpolations as seen in figure 3. The path in red shows the shortest euclidean path between the two samples in orange, but note that the resulting path in the observation space jumps from one strand to another twice.
Meanwhile, the path the maximizes the estimated mean curvature is shown in green and produces a much more reasonable path.
[Figure]
Experiments & Results
Experimental Setup We apply our new tools on a small selection of common benchmark datasets, including 3D-Shapes [66], MNIST [67], and Fashion-MNIST [68] 4 .
Our methods are directly applicable to any VAE-based model, and can readily be extended to any autoencoders.
Nevertheless, we focus our empirical evaluation on vanilla VAEs and some β -VAEs (denoted by substituting the β , so 4-VAE refers to a β -VAE where β = 4 ).
Specifically, here we mostly analyze a 4-VAE model with a d = 24 latent space trained on 3D-Shapes (except for table 1) referred to as Model A, and include results on a range of other models in the appendix.
All our models use four convolution and two fully-connected layers in the encoder and decoder.
The models are trained using Adam [69] with a learning rate of 0.001 for 100k steps (see appendix for details).
Qualitative Understanding The most direct way to get a better understanding the manifold structure is the visualization of the response maps, in particular with the mean curvature (see figure 4).
Unfortunately, since the curvature is estimated numerically using a grid of samples, the maps do not scale well to the whole latent space.
Here the latent response matrices help identify pairs of related latent dimensions which can then be analyzed more closely with a response map. Furthermore, [Figure]
Pos- terior 1. [Figure]
[Figure] 1.5 Dimension 13 1.
D i m e n s i o n
[Figure]
currently, all these response maps are aligned to the axes of the latent space.
Although VAEs do align information along the axes somewhat [70], any off-axis structure is missed since the off-axes responses are completely ignored.
Since, an implicit requirement of disentangled representations is that the information is axis-aligned [19], the response maps present the most striking results for disentangled representations (see appendix for more examples).
From the mean curvature response map in figure 5a, we see that the manifold is particularly nonlinear along these two latent dimensions (13 and 14).
Consequently, there can be a dramatic difference between the geodesic (here approximated using the mean curvature), compared to the shortest path in euclidean space as seen in figure 5.
Causal Disentanglement Table 1, unsurprisingly, shows the disentanglement increasing with increasing β .
Our proposed CDS score correlates strongly with the other disentanglement metrics.
Perhaps noteworthy is that even though the CDS and DCI-D scores are computed in similar ways (the vital difference being whether responsibility rests on a causal link or a statistical correlation), the
DCI-D scores are consistently lower than the CDS scores. This may be explained by the DCI-D metric taking additional spurious correlations between latent variables into account (as seen in figure 6), while the CDS metric focuses on the causal links, so the DCI-D has an undeservedly low score.
[Table]
[Table] [Figure] [Figure]
[Figure]
[Figure] [Figure] Causal Structure Closer comparison between the conditioned response matrices and the responsibility matrices reveal more how the DCI-D metric and CDS differ.
Figure 6 shows the responsibility matrix matches the conditioned response matrix for the most part.
The only exception being latent variables 4 and 20.
Since the DCI framework identifies which latent variables are most predictive for the true factors, it cannot distinguish between a correlation and a causal link.
In this case, the DCI metric recognized a correlation between dimension 4 and the "scale" factor.
However, from the latent response matrix (and the graph 6d) we see interventions on dim 20 have a significant effect on dim 4, but not vice versa.
Consequently, we identify dim 20 is a parent of dim 4 in the learned causal graph.
Since dim 20 is closely related with the "scale" factor the causal link to dim 4 results in dim 4 being correlated with "scale".
The conditioned response matrix correctly identifies that it is dimensionwhich primarily affects the scale, but indirectly also affects the shape through dimension 4.
This is a prime example of how causal reasoning can avoid misattributing responsibility due to spurious correlations.
Conclusion
In this work, we have introduced and motivated the latent response framework including a variety of tools to better visualize and understand the representations learned by variational autoencoders.
Notably, the current analysis relies on a certain degree of axis-aligned structure in the latent space, which makes these tools especially useful for understanding the structure of disentangled representation.
Another limitation is that computing the latent response maps to, for example, improve interpolations, does not scale well for the large representations of high fidelity generative models [8].
Consequently, our experiments thus far have focused on synthetic datasets designed for evaluating disentanglement methods.
However, latent responses do not require any ground truth label information, which is particularly promising for better understanding representations of real datasets and consequently speed up development of not just better performing representation learning techniques, but also more interpretable and trustworthy [71] models Acknowledgements This work was supported by the German Federal Ministry of Education and Research (BMBF):
Tübingen AI Center, FKZ: 01IS18039B and by the Machine Learning Cluster of Excellence, EXC number 2064/1 – Project number 390727645.
The authors thank the International Max Planck
Research School for Intelligent Systems (IMPRS-IS) for supporting Felix Leeb.
Checklist
The checklist follows the references.
Please read the checklist guidelines carefully for information on how to answer these questions.
For each question, change the default [TODO] to [Yes] , [No] , or [N/A] .
You are strongly encouraged to include a justification to your answer , either by referencing the appropriate section of your paper or providing a brief inline description.
For example:
• Did you include the license to the code and datasets?
[Yes] See Section ?? .
• Did you include the license to the code and datasets?
[No] The code and the data are proprietary.
• Did you include the license to the code and datasets?
[N/A]
Please do not modify the questions and only use the provided macros for your answers.
Note that the
Checklist section does not count towards the page limit.
In your paper, please delete this instructions block and only keep the Checklist section heading above along with the questions/answers below.
For all authors... (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope?
[Yes] (b) Did you describe the limitations of your work?
[Yes] (c) Did you discuss any potential negative societal impacts of your work?
[Yes] (d) Have you read the ethics review guidelines and ensured that your paper conforms to them?
[Yes] 2.
If you are including theoretical results... (a) Did you state the full set of assumptions of all theoretical results?
[N/A] (b) Did you include complete proofs of all theoretical results?
[N/A] 3.
If you ran experiments... (a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)?
[Yes] (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)?
[Yes] (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)?
[No] The disentanglement metrics don’t have error bars, as we focus on the trends between samples rather than specific quantitative comparisons.
(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] 4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... (a) If your work uses existing assets, did you cite the creators? [Yes] (b) Did you mention the license of the assets?
[Yes] (c) Did you include any new assets either in the supplemental material or as a URL? [Yes] (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A] All datasets we use are standard benchmarks. (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content?
[N/A] 5. If you used crowdsourcing or conducted research with human subjects... (a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation?
[N/A] A Appendix A.1 Latent Responses In a similar setup as [54], we can extend the joint distribution p ( X, Z ) to include the reconstruction and response as p ( X, Z, ˆ X, ˆ Z ) , where crucial question is how the posterior q ( Z | X ; ϕ ) relates to the response q ( ˆ Z | ˆ X ; ϕ ) where Z and ˆ Z are related by (also shown in equation 7):
[Equation] Note, that r ( ˆ Z | Z ; θ, ϕ ) is equivalent to the transition kernel Q AVAE in [54]. However, crucially, we do not make two assumptions used to derive the AVAE objective. Firstly, we do not assume that the decoder is a one-to-one mapping between latent samples and a corresponding generated sample.
The contractive behavior observed in the latent space of autoencoders [59], suggests a many-to-one mapping is more realistic, which may be interpretted as the decoder filtering out useless exogenous information from the latent code. Consequently, we also do not treat p ( ˆ Z ; θ, ϕ ) = E p ( Z ) [ r ( ˆ Z | Z ; θ, ϕ )] as a normal distribution, which would imply the encoder perfectly inverts the decoder.
Consider the reconstructions ˆ X of the maximally overfit encoder q ( z
= Z | x i = X ; ˜ ϕ ) = δ ( s i − z ) (recall s i =
f ϕ ( x i ) ) and decoder p ( ˆ X | Z ; ˜ θ ) .
Since the autoencoder is trained on the empirical generative process π ( X ) rather than the true generative process p ( X ) , the overfit decoder generates samples from p ( ˆ X ; ˜ θ )
= (cid:82) p ( ˆ X | Z ; ˜ θ ) p ( Z )
d Z = π ( X ) , which does not have continuous support.
For such a decoder, all exogenous noise is completely removed and the decoder mapping is obviously many-to-one, and it follows that r ( ˆ Z =
ˆ z | Z = z ; ˜ θ, ˜ ϕ ) =
δ (ˆ z − s ) (recall z
= s + u ).
Now consider the more desirable (and perhaps slightly more realistic) setting where the autoencoder extrapolates somewhat beyond π ( X ) to resemble p ( X ) , in which case decoding the latent sample z ∼ q ( Z | X = x ; ϕ ) to generate ˆ x ∼ p (ˆ x = ˆ X | z
= Z ; θ ) will not necessarily match the observation x , which, by our definition of endogenous information, implies a change in the endogenous information contained in z .
When re-encoding to get q ( ˆ Z | ˆ X
= ˆ x ; ϕ ) , the changes in the endogenous information result in some width to the distribution over ˆ Z .
A.2 Derivation of Equation
Starting from our definition of ˆ s = f ϕ
(ˆ x )
where ˆ x = g θ ( z ) , z = f ϕ ( x ) , z = s + u , and ϵ
= ˆ x − x .
The high-level goal is expand f ϕ around x and then g θ around s to first order.
[Equation]
A
Comparing
the Conditioned Response Matrix and the DCI Responsibility Matrix
In [42], the responsibility matrix is used to evaluate the disentanglement of a learned representation.
In the matrix, element R ij corresponds to the relative importance of latent variable j in predicting the true factor of variation i for a simple classifier trained with full supervision to recover the true factors from the latent vector.
Although the scalar scores (DCI-d and CDS) are computed identically from the respective matrices, there are important practical and theoretical distinctions in the DCI and latent response frameworks.
First and most importantly, since the DCI framework only uses the encoder, the learned generative process is not taken into account at all.
Consequently, the DCI framework (and other existing disentanglement metrics) fail to evaluate how disentangled the causal drivers of the learned generative process are, and instead evaluate which latent variables are correlated with true factors.
Furthermore, practically speaking, the DCI framework is sensitive to a variety of hyperparameters such as the exact design and training of the model [72], while the conditioned response matrix has far fewer (and more intuitive) hyperparameters relating to the Monte carlo integration.
Interestingly, the DCI responsibility matrices do often resemble the conditioned response matrices, suggesting that relying on correlations instead of a full causal analysis, can yield similar results.
Obviously as the data becomes more challenging and realistic, and the true generative process involves a more complicated causal structure, then we may expect the DCI responsibility matrix to become less reliable for analyzing the generative model structure.
In fact, then the learned causal structure estimated using the latent response matrix may be used in tandem to develop a structure-aware disentanglement metric.
A.4 Mean Curvature for Manifold Learning
The geometry of learned representations with a focus on the generalization ability of neural networks has been discussed in [73].
One key problem is that the standard Gaussian prior used in variational autoencoders relies on the usual Lebesgue measure which in turn, assumes a Euclidean structure over the latent space.
This has been demonstrated to lead to difficulties in particular when interpolating in the latent space [25, 74, 75] due to a manifold mismatch [76, 77].
Given the complexity of the underlying data manifold, a viable alternative is based on riemanian geometry [78] which has previously been investigated for alternative probabilistic models like Gaussian Process regression [79].
These methods focus on the intrinsic curvature of the data manifold, which does not depend on the specific embedding of the manifold in the latent space.
However, our focus is precisely on how the data manifold is embedded in the latent space, to (among other things) quantify the relationships between latent variables and how well the representation disentangles the true factors of variation.
Consequently, we focus on the extrinsic curvature, and more specifically the mean curvature which can readily be estimated using the response maps.
As discussed in the main paper, | u ( z ) | = | z − s | is interpreted as a distance where | u ( z ) | = 0 implies z is on the latent manifold and there is no exogenous noise.
The gradient of this function ∇ z | u ( z ) | , effectively projects any point in the latent space onto the endogenous manifold.
Similarly, the mean curvature (equation 13) can be computed, which can be interpreted as identifying the regions in the latent space where the | u ( z ) | converges and diverges.
These gradients are estimated numerically by finite differencing.
[Equation]
A.5 Double Helix Example Details
To illustrate how the latent response framework can be used to study the representation learned by a VAE, we show the process when learning a 2D representation for samples from a double helix embedded in R 3 , defined as:
[Equation]
where t i ∼ Uniform( − 1 , 1) , n i ∼ Bernoulli(0 .
, ϵ i ∼ N ( 0 , σ I ) .
For this experiment, we set
A 1 =
A 2 =
A 3 = ω =
and σ = 0 .
Disregarding the additive noise ϵ i , the data manifold has two degrees of freedom, which are the strand location t i and the strand number n i .
To provide the model sufficient capacity, we use four hidden layers with 32 units each for the encoder and decoder.
We train until convergence (at most 5k steps) with β = 0.05 using an Adam optimizer on a total of N = 1024 training samples (see the supplementary code for the full training and evaluation details).
[Figure]
A.6 Architecture and Training Details
All our models are based on the same convolutional neural network architecture detailed in table 10 so that in total models have approximately 500k trainable parameters.
For the smaller datasets MNIST and Fashion-MNIST, samples are upsampled to 32x32 pixels from their original 28x28 and the one convolutional block is removed from both the encoder and decoder.
The datasets are split into a 70-10-20 train-val-test split, and are optimized using Adam [69] with a learning rate of 0.0001, weight decay 0, and β 1 , β 2 of 0.9 and 0.999 respectively.
The models are trained for 100k iterations with a batch size of 64 (128 for MNIST and Fashion
Input 64x64x3 image
Conv Layer (64 filters, k=5x5, s=1x1, p=2x2)
Max pooling (filter 2x2, s=2x2)
Group Normalization (8 groups, affine)
ELU activation
Conv Layer (64 filters, k=3x3, s=1x1, p=1x1)
Max pooling (filter 2x2, s=2x2)
Group Normalization (8 groups, affine)
ELU activation
Conv Layer (64 filters, k=3x3, s=1x1, p=1x1)
Max pooling (filter 2x2, s=2x2)
Group Normalization (8 groups, affine)
ELU activation
Conv Layer (64 filters, k=3x3, s=1x1, p=1x1)
Max pooling (filter 2x2, s=2x2) Group Normalization (8 groups, affine) ELU activation Conv Layer (64 filters, k=3x3, s=1x1, p=1x1)
Max pooling (filter 2x2, s=2x2) Group Normalization (8 groups, affine) ELU activation Fully-connected Layer (256 units)
ELU activation Fully-connected Layer (128 units) ELU activation Fully-connected Layer ( 2 d units)
Output posterior µ and log σ Input d latent vector Fully-connected Layer (128 units) ELU activation
Fully-connected Layer (256 units) ELU activation Fully-connected Layer (256 units) ELU activation
Bilinear upsampling (scale 2x2)
Conv Layer (64 filters, k=3x3, s=1x1, p=1x1) Group Normalization (8 groups, affine) ELU activation Bilinear upsampling (scale 2x2)
Conv Layer (64 filters, k=3x3, s=1x1, p=1x1)
Group Normalization (8 groups, affine)
ELU activation
Bilinear upsampling (scale 2x2)
Conv Layer (64 filters, k=3x3, s=1x1, p=1x1) Group Normalization (8 groups, affine) ELU activation Bilinear upsampling (scale 2x2)
Conv Layer (64 filters, k=3x3, s=1x1, p=1x1)
Group Normalization (8 groups, affine)
ELU activation
Conv Layer (3 filters, k=3x3, s=1x1, p=1x1)
[Figure]
[Table] [Figure] [Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table]
[Table]
[Figure]
[Table]
[Figure]
Latent Dimension floor_hue wall_hue object_hue scale shape orientation
[Figure]
scale shape orientation
[Figure] [Figure] i o n [Figure]
[Figure] [Figure] i [Figure]
n [Figure] i o n [Figure]
2 Dimension 21 2.
D i m e n s i o n -0. [Figure] and Pos- terior    2 Dimension 21 2.
D i m e n s i o n 0. [Figure] 2 Dimension 13 2. D i m e n s i o n -0.
- terior    2 Dimension 13 2. D i m e n s i o n 0. [Figure] [Table]
[Figure] [Table] VAE [Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table] [Figure] [Table] n
[Table] 2-VAE Response I n t e r v e n t
i o n 4-VAE
Response I n t e r v e n t i o
n [Table] [Figure] [Table]
[Figure] [Table] [Figure] [Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
[Figure]
[Figure]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table]
8-VAE
[Figure]
[Table]
[Figure]
[Figure]
D i m e n s i o n -0.
[Figure]
2 Dimension 0 2.
D i m e n s i o n 0.
[Figure]
[Figure] [Figure] D i m e n s i o n -1. [Figure]
Divergence Map
[Figure]
Aggregate Pos- terior    2 Dimension 8 2.
D i m e n s i o n 1.
[Figure]
[Figure] 2 Dimension 11 2. D i m e n s i o n -0. [Figure]
2 Dimension 11 2.
D i m e n s i o n
[Figure]
[Figure] i
[Figure] n s i [Figure] n
[Figure]
[Figure]
D i m e n s i o n
[Figure]
[Figure] [Figure] [Figure]
i
[Figure]
n
[Figure]
n
[Figure]
Due to the computational cost of evaluating the response function over a dense grid, we focus our visualizations to 2D projections of the latent space.
However, for MNIST and Fashion-MNIST, we train several VAE models to embed the whole representation into two dimensions d = 2 , so that we can visualize the full representation.
While the resulting divergence and curvature maps do not demonstrate as intuitive structure as in the disentangled representations for 3D-Shapes or MPI-3D, we can nevertheless appreciate the learned manifold beyond qualitatively observing reconstructions.
[Figure]
[Figure] [Figure] [Figure] [Figure]
[Figure] [Figure] [Figure] [Figure]
[Figure] [Figure]
[Figure]