O N THE DIFFERENCE BETWEEN BUILDING AND EXTRACTING PATTERNS : A CAUSAL ANALYSIS OF DEEP GENERATIVE MODELS .
Anonymous authors
Paper under double-blind review
A BSTRACT
Generative models are important tools to capture and investigate the properties of complex empirical data.
Recent developments such as Generative Adversarial
Networks (GANs) and Variational Auto-Encoders (VAEs) use two very similar, but reverse , deep convolutional architectures, one to generate and one to extract information from data.
Does learning the parameters of both architectures obey the same rules?
We exploit the causality principle of independence of mechanisms to quantify how the weights of successive layers adapt to each other.
Using the recently introduced Spectral Independence Criterion we quantify the dependencies between the kernels of successive convolutional layers and show that those are more independent for the generative process than for information extraction, in line with results from the ﬁeld of causal inference.
In addition, our experiments on generation of human faces suggest that enforcing more independence between successive layers of generators may lead to better performance and modularity of these architectures.
I NTRODUCTION
Deep generative models have proven powerful in learning to design realistic images in a variety of complex domains (handwritten digits, human faces, interior scenes).
In particular, two approaches have recently emerged: Generative Adversarial Networks (GANs) (Goodfellow et al., 2014), which train an image generator by having it fool a discriminator that should tell apart real from artiﬁcially generated images; and Variational Autoencoders (VAEs) (Kingma & Welling, 2013; Rezende et al., 2014) which learn both a mapping from latent variables to the data (the decoder) and the converse mapping of the data to latent variables (the encoder), such that correspondences between latent variables and data features can be easily investigated.
Although these architecture have been lately the subject of extensive investigations, understanding why and how they work, and how they can be improved, remains elusive.
An interesting feature of GANs and VAEs is that they both involve the learning of two deep subnetworks.
These sub-networks have a ”mirrored” architecture, as they both consist in a hierarchy of convolutional layers, but information ﬂows in opposite ways: generators and decoders map latent variables to the data space, while discriminators and encoders extract information from the same space.
Interestingly, this difference could be framed in a causal perspective, with information ﬂowing in the causal direction from the putative causes of variations in the observed data, while extracting high level properties from observations would operate in the anti-causal direction.
Generative models in machine learning are usually not required to be causal, as modeling the data distribution is considered to be the goal to achieve.
However, the idea that a generative model able to capture the causal structure of the data by disentangling the contribution of independent factors should perform better has been suggested in the literature (Bengio et al., 2013a; Mathieu et al., 2016) and evidence supports that this can help the learning procedure (Bengio et al., 2013b).
Although many approaches have been implemented on speciﬁc examples, principles and automated ways of learning disentangled representations from data remains largely an open problem both for learning representations (targeting supervised learning applications) and for ﬁtting good generative models.
GANs have for example recently been a subject of intensive work in this direction, leading to algorithms disentangling high level properties of the data such as InfoGans (Chen et al., 2016) or conditional GANs (Mirza & Osindero, 2014).
However such models require supervision (e.g. feeding digit labels as additional inputs) to disentangle factors of interest.
Another interesting approach is β -VAE (Higgins et al., 2017) which enforces a statistical independence constraint in its objective function to learn independent factors in an unsupervised way.
While the above approaches envision the disentangling of representations as ﬁnding subsets of latent variables that relate to different properties of the generated data, parameters of the network can be also considered as factors affecting the generated data.
Ideally, to ensure modularity of deep generative models, different layers should encode different aspects of the data in their parameters.
Intuitively for deep convolutional networks, different layers should encode image features at different scales.
The idea that successive layers can be used as modules encoding different levels of details as for example been exploited to build high-resolution generative model by training iteratively a GAN with an increasing number of layers (Karras et al., 2017). Enforcing modularity of trained neural architecture may not only allow to adapt them to the task at hand with minimum additional training, but also to better understand their structure and function of these highly complex black-box systems. However, to the best of our knowledge, quantifying how independent (or disentangled) are the properties encoded by the weights distributed across the structure of deep networks has not been addressed quantitatively in the literature. We propose that the coupling between high dimensional parameters can be quantiﬁed and exploited in a causal framework to infer whether the layered architecture disentangles different aspects of the data.
This hypothesis relies on recent work exploiting the postulate of Independence of Cause and Mechanism stating that Nature chooses independently the properties of a cause and those of the mechanism that generate effects from the cause (Janzing & Sch ¨ olkopf, 2010; Lemeire & Janzing, 2012).
Several methods relying on this principle have been proposed in the literature in association to different model classes (Janzing et al., 2010; Zscheischler et al., 2011;
Daniusis et al., 2010; Janzing et al., 2012; Shajarisales et al., 2015; Sgouritsa et al., 2015; Sch ¨ olkopf et al., 2012).
Among these methods, the Spectral Independence Criterion (SIC) (Shajarisales et al., 2015) can be used in the context of linear dynamical systems, which involve a convolution mechanism.
In this paper, we show how SIC can be adapted to investigate the coupling between the parameters of successive convolutional layers.
Empirical investigation shows that SIC is approximately valid between successive layers of generative models, and suggest SIC violations indicate deﬁciencies in the learning algorithm or the architecture of the network.
Interestingly, and in line with theoretical predictions (Shajarisales et al., 2015), SIC tends to be more satisﬁed for generative sub-networks (mapping latent variables to data), than for the part of the system that map the anti-causal direction (data to latent variables).
Overall, our study suggests that enforcing Independence of Mechanisms can help design better generative models.
B ACKGROUND 2. W HY A CAUSAL PERSPECTIVE ?
An insightful description of causal models is based on Structural Equations (SEs) of the form
[Equation]
The right hand side variable in this equation may or may not be random, and the additional independent noise term (cid:15) , representing exogenous effects (originating from outside the system under consideration), may be absent.
The “ := ” symbol indicates the asymmetry of this expression and signiﬁes that the left-hand-side variable is computed from the right-hand-side expression.
This expression thus stays valid if something selectively changes on the right hand side variables, for example if the value of X 1 is externally forced to stay constant (hard intervention) or if the shape of f or of an input distribution changes (soft intervention).
These properties account for the robustness or invariance that is expected from causal models with respect to purely probalistic ones.
Assume now X 1 itself is determined by other variables according to
[Equation]
then the resulting structural causal model summarized by this system of equations also implies a modularity assumption: one can intervene on the second equation while the ﬁrst one stays valid, baring the changes in the distribution of X 1 entailed by the intervention.
This structural equation framework describes well what would be expected from a robust generative model.
Assume the model generates faces, one would like to be able to intervene on e.g. the pose without changing the rest of the top-level parameters (hair color,...), and still be able to observe a realistic output.
One could also expect intervening on speciﬁc operations performed at intermediate levels by keeping the output ”qualitatively” of the same nature.
For example, we can imagine that by slightly modifying the mapping that positions the eyes with respect to the nose on a face, one generates different heads that do not match exactly human standards, but are human-like.
What we would not want is instead to see artifacts emerging all over the generated image, or edges being blurred.
2. T HE PRINCIPLE OF INDEPENDENCE OF MECHANISMS
Assume we have two variables X and Y , possibly multidimensional and neither necessarily from a vector space, nor necessary random.
Assume the data generating mechanism obeys the following structural equation:
[Equation]
with m the mechanism, X the cause and Y the effect.
We rely on the postulate that properties of
X and m are “independent” in a sense that can be formalized in various ways (Peters et al., 2017).
The present analysis will be based on a formalization explained below.
Classical Independence of Cause and Mechanism(ICM)-based methods address the problem of cause-effect pair inference, where both directions of causation are plausible.
They then take advantage of speciﬁc settings for which it is possible to prove that if the assumption is valid for the true generative model, the converse independence assumption is very likely violated (with high probability) for the anticausal or backward model
[Equation]
(independence is then computed between m − 1 and Y ).
As a consequence, the true causal direction can be identiﬁed by evaluating the independence assumptions of both models and pick the direction for which independence is the most likely.
2. S PECTRAL I NDEPENDENCE
We introduce a speciﬁc formalization of independence of mechanisms that is well suited to study convolutional layers of neural network.
This relies on representing signals or images in the Fourier domain.
2.3. B ACKGROUND ON DISCRETE SIGNALS AND IMAGES
The Discrete-time Fourier Transform (DTFT) of a sequence a = { a [ k ] , k ∈ Z } is deﬁned as
[Equation]
Note that the DTFT of such sequence is a continuous 1-periodic function of the normalized frequency ν .
By Parseval’s theorem, the energy can be expressed in the Fourier domain by (cid:107) a (cid:107) 22 = (cid:82) 1 / 2 − 1 / 2 | (cid:98) a ( ν ) | 2 dν .
To simplify notations, we will denote by (cid:104) .
(cid:105) the integral (which is also the average) of a function over the unit interval I , that is, (cid:107) {+a (cid:107) 
+}
= (cid:104)| (cid:98) a | 2 (cid:105) .
The Fourier transform can be easily generalized to 2D signals, leading to a 2D function 1-periodic with respect to both arguments
[Equation]
2.3. SIC POSTULATE
Assume now that our cause-effect pair ( X, Y ) is a weakly stationary time series.
This means that the power of these signals can be decomposed in the frequency domain using their Power Spectral
Densities (PSD) S
x ( ν ) and S y ( ν ) .
We assume that Y is the output of a Linear Time (translation)
Invariant Filter with convolution kernel
h receiving input X such that
[Equation]
In that case input and output PSDs are related by the formula S y ( ν ) =
| (cid:98)
h
( ν ) |
2 S x ( ν ) for all frequencies ν .
The Spectral Independence Postulate consists then in assuming that the power ampliﬁcation of the ﬁlter at each frequency does not adapt to the input power spectrum, i.e. the ﬁlter will not tend to selectively amplify or attenuate the frequencies with particularly large or low power.
This can be mathematically expressed by the fact that output power factorizes in the product of input power times the energy of the ﬁlter, leading to the criterion (Shajarisales et al., 2015):
Postulate 1 (Spectral Independence Criterion (SIC)) .
Let S x be the Power Spectral Density (PSD) of a cause X and h the system impulse response of the causal system of (1), then
[Equation]
holds approximately.
It can be shown that (2) is violated in the backward direction under mild assumptions when the ﬁlter is invertible.
We can deﬁne a scale invariant quantity ρ SIC measuring the departure from the SIC assumption, i.e. the dependence between input power spectrum and frequency response of the ﬁlter: the Spectral Dependency Ratio (SDR) from X to Y is deﬁned as
[Equation]
where (cid:104) .
(cid:105) denotes the integral over the unit frequency interval.
The values of this ratio can be interpreted as follows:
ρ SIC ≈ 1 reﬂects spectral independence, while ρ SIC > 1 reﬂects a correlation between the input power and frequency response of the ﬁlter (the ﬁlter selectively ampliﬁes input frequency peaks of large power, leading to anomalously large output power), conversely ρ SIC <reﬂects anticorrelation between these quantities.
We will use these terms to analyze our experimental results.
In addition (Shajarisales et al., 2015) also derived theoretical results suggesting that if ρ SIC ≈ 1 for an invertible causal system, then ρ SIC < 1 in the anticausal direction.
These interpretations of SDR values are summarized in Fig.
3b and can be used to interpret experimental results.
I NDEPENDENCE OF MECHANISMS IN DEEP NETWORKS
We now introduce our causal reasoning in the context of deep convolutional networks, where the output of successive layers are often interpreted as different levels of representation of an image, from detailed low level features to abstract concepts.
We thus investigate whether a form of modularity between successive layer can be identiﬁed using the above framework.
3. S TRIDED CONVOLUTIONAL UNITS AND INDEPENDENCE BETWEEN SCALES
DCGANs have successfully exploited the idea of convolutional networks to generate realistic images (Radford et al., 2015).
While strided convolutional units are used as pattern detectors in deep convolutional classiﬁers, they obviously play a different role in generative models: they are pattern producers.
We provide in Fig.
1 (left) a toy example to explain their potential ability to generate independent features at multiple scales.
On the picture the activation of one channel at the top layer (top left) may encode the (coarse) position of the pair of eyes in the image.
After convolution by a ﬁrst kernel, activations in a second layer indicate the location of each eye.
Finally, a kernel encoding the shape of the eye convolves this input to generate an image that combines the three types of information, distributed over three different spatial scales.
What we mean by assuming independence of the features encoded at different scales can be phrased as follows: there should be typically no strong relationship between the shape of patterns encoding a given object at successive scales.
Although counter examples may be found, we postulate that a form of independence may hold approximately, for naturalistic images that possess a large number of features at multiple scales.
A case for which this assumption is violated for a deep network is given in Fig.
1, where a long edge in the image cannot be captured by a single convolution kernel (because of the kernel size limitation to 3 by 3 in this case).
Hence, an identical kernel needs to be learned at an upper layer in order to control the precise alignment of activations in the bottom layer.
Any misalignment between the orientation of the kernels would lead to a very different pattern, and witness that information in the two successive layers is entangled. [Figure]
3. SIC BETWEEN SUCCESSIVE ( DE ) CONVOLUTIONAL UNITS
The SIC framework is well suited to the analysis of convolutional layers, since it assumes deterministic convolution mechanisms. However two differences appear with respect to the original assumptions: 1/ the striding adds spacing between input pixels in order to progressively increase the dimension and resolution of the image from one layer to the next, and 2/ there is a non-linearity between successive layers.
Striding can be easily modeled as it amounts to upsampling the input image before convolution (see illustration Fig. 1).
We denote .
↑ s the upsampling operation with integer factor 1 s that turns the 2D tensor x into
[Equation]
Interestingly, the deﬁnition implies that striding amounts to a compression of the normalized frequency axis in the Fourier domain with (cid:99) x ↑ s ( u, v ) =
ˆ x ( su, sv ) .
Next, the non-linear activation between successive layers is more challenging to take into account.
We will thus make the simplifying assumption that rectiﬁed linear Units are used (ReLU), such that a pixel is either linearly dependent on small variations of its synaptic inputs, or not active at all.
We then follow the idea that ReLU activations may be used as a switch that controls the ﬂow of relevant information in the network (Tsai et al., 2016; Choi & Kim, 2017).
Hence, for convolution kernels in successive layers that encode different aspects of the same object, we make the assumption that their corresponding outputs will be frequently coactivated, such that the linearity assumption may hold.
If pairs of kernels are not frequently coactivated, we postulate that they do not encode the same object and it is thus unlikely that their weights are related.
We thus write down the mathematical expression for the application of two successive deconvolutional units to a given input tensor using linearity assumptions leading to y =
g ∗ x ↑ s = g ∗ ( h ∗ z ) ↑ s .
In the Fourier domain, this implies
[Equation]
In order to have a criterion independent from the incoming data, we assume the input z has no spatial structure (e.g. z is sampled from a white noise), such that its power is uniformly distributed across spatial frequencies (the PSD is approximately ﬂat).
The spatial properties of x are thus entirely determined by h and the SIC criterion of equation 2 writes
[Equation]
where angular brackets denote the double integral across spatial frequencies.
We can then write down an updated version of the SDR of equation 3 corresponding to testing SIC between a cascade of two ﬁlters in successive layers as
[Equation]
which we will evaluate in the experiments.
E XPERIMENTS
We used a version of DCGANs pretrained on the CelebFaces Attributes Dataset (CelebA) 2 .
The structures of the generator and discriminator are summarized in Fig.
2 and both include four successive convolutional layers.
We also experimented with a plain VAEs 3 with a similar convolutional architecture.
Each layer uses 4 pixels wide convolution kernels for the GAN, and 5 pixels wide for the VAE.
In all cases, layers are enumerated following the direction of information ﬂow.
We will talk about coarse scales for layers that are towards the latent variables, and ﬁne scales for the ones that are closer to the image.
4. SIC BETWEEN SUCCESSIVE DECONVOLUTIONAL UNITS
We ﬁrst illustrate the previously introduced framework by showing in Fig. 3a an example of two convolution kernels between successive layers (1 and 2) of the GAN generator.
It shows a slight anti-correlation between the absolute values of the Fourier transforms of both kernels, resulting I a SDR of .88.
One can notice the effect of kernels h (upper layer) and g (lower layer) on the resulting convolved kernel in the Fourier domain: the kernel from the upper layer tends to modulate the fast variations of g ∗ h in the Fourier domain, while g affects the ‘slow’ variations.
This is a consequence of the design of the strided fractional convolution.
We use this approach to characterize the amount of dependency between successive layers by plotting the histogram of the SDR that we get for all possible combination of kernels belonging to each layer, i.e. all possible pathways between all input and output channels, as described in Fig.
3c.
The result is shown in Fig.
4, witnessing a rather good concentration of the SDR around 1, which suggests independence of the convolution kernels between successive layers.
It is interesting to compare these histograms to the values computed for the discriminator of the GAN, which implements convolutional layers of the same dimensions in reverse order.
The result also shown in Fig.
4 exhibits a broader distribution of the SDR, especially for layers encoding lower level image features.
This is in line with the ICM principle, as the discriminator is operating in the anticausal direction.
However, the difference between the generator and discriminator is not strong, which may be due to the fact that the discriminator does not implement an inversion of the putative causal model, but only extract relevant latent information for discrimination.
In order to check our method on a generative model including a network mapping back the input to their cause latent variables, we applied it to a trained VAE.
The results presented in Fig.
5 show much sharper differences between generator (decoder) and encoder.
The shape of the histograms are matching predictions from (Shajarisales et al., 2015) shown in Fig.
3b: with a mode around one for the distribution in the causal direction, while it remains below one in the anti-causal direction.
The difference with GANs can be explained by the fact that VAEs are indeed performing an inversion of the generative model, leading to very small SDR values in the anticausal direction.
We also note overall a much broader distribution of VAE SDRs in the causal direction (decoder) with respect to their GAN counterpart.
Interestingly, the training of the VAE did not lead to values as satisfactory as what we obtained with the GAN.
Examples generated from the VAE are shown in appendix (Fig. 10).
This suggests that dependence between cause and mechanism may reﬂect a suboptimal performance of the generator. [Figure] [Equation] [Figure]
g h layer n layer n +
[Figure]
[Figure] [Figure] [Figure] 4. R EMOVING CORRELATED UNITS
We saw in the above histograms that while many successive convolutional unit had a SDR close to one, there are tails composed of units exhibiting either a ratio inferior to one (reﬂecting negative correlation between the Fourier transform of the corresponding kernels) or a ratio larger than one (reﬂecting positive correlation).
Interestingly, if we superimpose the histograms (see Fig. 4) of the lower level layer of the generator and discriminator networks, we see that these tails are quite different between networks, showing more negative correlations for the discriminative networks, while the positive correlation tail of the generative networks remains rather strong.
This suggests that negative and positive correlation are qualitatively different phenomena.
In order to investigate the nature of ﬁlters exhibiting different signs of correlation, we selectively removed ﬁlters of the third layer of the generator (the last but one), based on the magnitude (above or below one) of the average SDR that each ﬁlter achieved when combined with any of the ﬁlters in the last layer.
In order to check that our results were not inﬂuenced by ﬁlters with very small weights (that still can exhibit correlations), we zeroed the kernels contributing to the output layer with the smallest energy (averaged across output channels), while maintaining an acceptable quality of the output of the network (see Fig.
6 second column).
This removed around half of the ﬁlters of the third layer.
Then we removed additional ﬁlters exhibiting either large or small (anti-correlated) generic ratio, such that the same proportion of ﬁlters is removed (see Fig.
6 third and fourth column).
It appears clearly from this result that ﬁlters exhibiting large positive or negative correlation do not play the same role in the network.
From the quality of the generated images, ﬁlters from the third layer that are negatively correlated to ﬁlters from the fourth seem to allow correction of checkerboard artifacts, potentially generated as side effect of the fractional strided convolution mechanisms 4 .
Despite a decrease in texture quality, the removal of such kernels does not distinctively affect an meaningful aspect of the generated images.
Conversely, removing positively correlated ﬁlters lead to a disappearance of the color information in a majority of the regions of the image.
This suggests that such ﬁlters do encode the color structure of images, and the introduced positive correlation between the ﬁlters from the third and fourth layer may result from the fact that uniform color patches corresponding to speciﬁc parts of the image (hair, skin) need a tight coordination of the ﬁlters at several scales of the image in order to produce large uniform areas with sharp border.
As we observed more dependency betwen
GAN layers at ﬁne scales, we considered using dropout (Srivastava et al., 2014) in order to reduce this dependency.
Indeed, dropout has been introduced with the idea that it can prevent neurons from over-adapting to each other and thus regularize the network.
The results shown in Fig.
11 witness on the contrary an increase of the dependencies (especially positive correlation) between these layers and exhibit a strongly deteriorated performance as shown in examples Fig.
We suggest that dropout limits the expressivity of the network by enforcing more redundancy in the convolutional ﬁlters, leading also to more dependency between them.
4. R ELATIONSHIP BETWEEN PERFORMANCE AND SDR STATISTICS .
In order to further assess how much our SIC analysis relates to the performance of the generative model, we trained different versions of VAEs by acting on two parameters: we changed the number of channels in the last hidden layer, and we weighted differently the error term with respect to the
KL divergence term in the VAE objective using a factor β , in the same way as for β -VAEs.
Example results on Fig.
7 show that while the number of channels has little effect on performance, β does affect the variety of faces that can be generated by the network. Interestingly, this improvement is reﬂected in the SDR statistics plotted in Fig. 8, showing more concentrated SDR values for better performing networks at the coarser level, which is likely related broad variations in the type of generated faces. This suggests that SDR statistics can be used as a diagnostic tool, to guide the choice of parameters of the architecture.  D ISCUSSION
In this work, we derived a measure of independence between the weights learned by convolutional layers of deep networks.
The results suggest that generative models that map latent variables to data tend to have more independence between successive layers than discriminative or encoding networks.
This is in line with theoretical predictions about independence of mechanisms for causal and anticausal systems.
In addition, our results suggest the dependency between successive layers relates to the bad performance of the trained generative models.
Enforcing independence during training may thus help build better generative models.
Moreover, the SDR analysis also indicates which layers should be modiﬁed to improve the performance.
Finally, we speculate that independence between successive layers, by favoring modularity of the network, may help build architecture that can be easily adapted to new purposed.
In particular, separation of spatial scales in such models may help build architectures where one can intervene on one scale without affecting others, with applications such as style transfer Gatys et al.
One speciﬁc feature of our approach is that this quantitative measure of the networks in not statistical and as such does not require test samples to be computed.
Only the parameters of the model are used, which makes the approach easy to apply to any neural network equipped with convolutional layers.