Learning deep representations by mutual information estimation and maximization
R Devon Hjelm, Alex Fedorov, Samuel Lavoie-Marchildon, Karan Grewal, Phil Bachman, Adam Trischler, Yoshua Bengio
Introduction
One core objective of deep learning is to discover useful representations, and the simple idea explored here is to train a representation-learning function, i.e. an encoder, to maximize the mutual information (MI) between its inputs and outputs. MI is notoriously difficult to compute, particularly in continuous and high-dimensional settings. Fortunately, recent advances enable effective computation of MI between high dimensional input/output pairs of deep neural networks (Belghazi et al., 2018). We leverage MI estimation for representation learning and show that, depending on the downstream task, maximizing MI between the complete input and the encoder output (i.e., global MI) is often insufficient for learning useful representations. Rather, structure matters: maximizing the average MI between the representation and local regions of the input (e.g. patches rather than the complete image) can greatly improve the representation’s quality for, e.g., classification tasks, while global MI plays a stronger role in the ability to reconstruct the full input given the representation.
Usefulness of a representation is not just a matter of information content: representational characteristics like independence also play an important role (Gretton et al., 2012; Hyvärinen & Oja, 2000; Hinton, 2002; Schmidhuber, 1992; Bengio et al., 2013; Thomas et al., 2017). We combine MI maximization with prior matching in a manner similar to adversarial autoencoders (AAE, Makhzani et al., 2015) to constrain representations according to desired statistical properties. This approach is closely related to the infomax optimization principle (Linsker, 1988; Bell & Sejnowski, 1995), so we call our method Deep InfoMax (DIM). Our main contributions are the following:
We formalize Deep InfoMax (DIM), which simultaneously estimates and maximizes the mutual information between input data and learned high-level representations.
Our mutual information maximization procedure can prioritize global or local information, which we show can be used to tune the suitability of learned representations for classification or reconstruction-style tasks.
We use adversarial learning (à la Makhzani et al., 2015) to constrain the representation to have desired statistical characteristics specific to a prior.
We introduce two new measures of representation quality, one based on Mutual Information Neural Estimation (MINE, Belghazi et al., 2018) and a neural dependency measure (NDM) based on the work by Brakel & Bengio (2017), and we use these to bolster our comparison of DIM to different unsupervised methods.
Related Work
There are many popular methods for learning representations. Classic methods, such as independent component analysis (ICA, Bell & Sejnowski, 1995) and self-organizing maps (Kohonen, 1998), generally lack the representational capacity of deep neural networks. More recent approaches include deep volume-preserving maps (Dinh et al., 2014; 2016), deep clustering (Xie et al., 2016; Chang et al., 2017), noise as targets (NAT, Bojanowski & Joulin, 2017), and self-supervised or co-learning (Doersch & Zisserman, 2017; Dosovitskiy et al., 2016; Sajjadi et al., 2016).
Generative models are also commonly used for building representations (Vincent et al., 2010; Kingma et al., 2014; Salimans et al., 2016; Rezende et al., 2016; Donahue et al., 2016), and mutual information (MI) plays an important role in the quality of the representations they learn. In generative models that rely on reconstruction (e.g., denoising, variational, and adversarial autoencoders, Vincent et al., 2008; Rifai et al., 2012; Kingma & Welling, 2013; Makhzani et al., 2015), the reconstruction error can be related to the MI as follows:
where and denote the input and output of an encoder which is applied to inputs sampled from some source distribution. denotes the expected reconstruction error of given the codes . and denote the marginal and conditional entropy of in the distribution formed by applying the encoder to inputs sampled from the source distribution. Thus, in typical settings, models with reconstruction-type objectives provide some guarantees on the amount of information encoded in their intermediate representations. Similar guarantees exist for bi-directional adversarial models (Dumoulin et al., 2016; Donahue et al., 2016), which adversarially train an encoder / decoder to match their respective joint distributions or to minimize the reconstruction error (Chen et al., 2016).
Methods based on mutual information have a long history in unsupervised feature learning. The infomax principle (Linsker, 1988; Bell & Sejnowski, 1995), as prescribed for neural networks, advocates maximizing MI between the input and output. This is the basis of numerous ICA algorithms, which can be nonlinear (Hyvärinen & Pajunen, 1999; Almeida, 2003) but are often hard to adapt for use with deep networks. Mutual Information Neural Estimation (MINE, Belghazi et al., 2018) learns an estimate of the MI of continuous variables, is strongly consistent, and can be used to learn better implicit bi-directional generative models. Deep InfoMax (DIM) follows MINE in this regard, though we find that the generator is unnecessary. We also find it unnecessary to use the exact KL-based formulation of MI. For example, a simple alternative based on the Jensen-Shannon divergence (JSD) is more stable and provides better results. We will show that DIM can work with various MI estimators. Most significantly, DIM can leverage local structure in the input to improve the suitability of representations for classification.
Leveraging known structure in the input when designing objectives based on MI maximization is nothing new (Becker, 1992; 1996; Wiskott & Sejnowski, 2002), and some very recent works also follow this intuition. It has been shown in the case of discrete MI that data augmentations and other transformations can be used to avoid degenerate solutions (Hu et al., 2017). Unsupervised clustering and segmentation is attainable by maximizing the MI between images associated by transforms or spatial proximity (Ji et al., 2018). Our work investigates the suitability of representations learned across two different MI objectives that focus on local or global structure, a flexibility we believe is necessary for training representations intended for different applications.
Proposed independently of DIM, Contrastive Predictive Coding (CPC, Oord et al., 2018) is a MI-based approach that, like DIM, maximizes MI between global and local representation pairs. CPC shares some motivations and computations with DIM, but there are important ways in which CPC and DIM differ. CPC processes local features sequentially to build partial “summary features”, which are used to make predictions about specific local features in the “future” of each summary feature. This equates to ordered autoregression over the local features, and requires training separate estimators for each temporal offset at which one would like to predict the future. In contrast, the basic version of DIM uses a single summary feature that is a function of all local features, and this “global” feature predicts all local features simultaneously in a single step using a single estimator. Note that, when using occlusions during training (see Section 4.3 for details), DIM performs both “self” predictions and orderless autoregression.
Deep InfoMax
An example encoder for image data is given in Figure 2, which will be used in the following sections, but this approach can easily be adapted for temporal data. Similar to the infomax optimization principle (Linsker, 1988), we assert our encoder should be trained according to the following criteria:
Mutual information maximization: Find the set of parameters, , such that the mutual information, , is maximized. Depending on the end-goal, this maximization can be done over the complete input, , or some structured or “local” subset.
The formulation of these two objectives covered below we call Deep InfoMax (DIM).
At a high level, we optimize by simultaneously estimating and maximizing ,
Second, as we are primarily interested in maximizing MI, and not concerned with its precise value, we can rely on non-KL divergences which may offer favourable trade-offs. For example, one could define a Jensen-Shannon MI estimator (following the formulation of Nowozin et al., 2016),
Noise-Contrastive Estimation (NCE, Gutmann & Hyvärinen, 2010; 2012) was first used as a bound on MI in Oord et al. (and called “infoNCE”, 2018), and this loss can also be used with DIM by maximizing:
2 Local mutual information maximization
The objective in Eq. 3 can be used to maximize MI between input and output, but ultimately this may be undesirable depending on the task. For example, trivial pixel-level noise is useless for image classification, so a representation may not benefit from encoding this information (e.g., in zero-shot learning, transfer learning, etc.). In order to obtain a representation more suitable for classification, we can instead maximize the average MI between the high-level representation and local patches of the image. Because the same representation is encouraged to have high MI with all the patches, this favours encoding aspects of the data that are shared across patches.
Suppose the feature vector is of limited capacity (number of units and range) and assume the encoder does not support infinite output configurations. For maximizing the MI between the whole input and the representation, the encoder can pick and choose what type of information in the input is passed through the encoder, such as noise specific to local patches or pixels. However, if the encoder passes information specific to only some parts of the input, this does not increase the MI with any of the other patches that do not contain said noise. This encourages the encoder to prefer information that is shared across the input, and this hypothesis is supported in our experiments below.
Our local DIM framework is presented in Figure 3. First we encode the input to a feature map, that reflects useful structure in the data (e.g., spatial locality), indexed in this case by . Next, we summarize this local feature map into a global feature, . We then define our MI estimator on global/local pairs, maximizing the average estimated MI:
We found success optimizing this “local” objective with multiple easy-to-implement architectures, and further implementation details are provided in the App. (A.2).
3 Matching representations to a prior distribution
This approach is similar to what is done in adversarial autoencoders (AAE, Makhzani et al., 2015), but without a generator. It is also similar to noise as targets (Bojanowski & Joulin, 2017), but trains the encoder to match the noise implicitly rather than using a priori noise samples as targets.
All three objectives – global and local MI maximization and prior matching – can be used together, and doing so we arrive at our complete objective for Deep InfoMax (DIM):
where and are the discriminator parameters for the global and local objectives, respectively, and , , and are hyperparameters. We will show below that choices in these hyperparameters affect the learned representations in meaningful ways. As an interesting aside, we also show in the App. (A.8) that this prior matching can be used alone to train a generator of image data.
Experiments
We test Deep InfoMax (DIM) on four imaging datasets to evaluate its representational properties:
CIFAR10 and CIFAR100 (Krizhevsky & Hinton, 2009): two small-scale labeled datasets composed of images with and classes respectively.
Tiny ImageNet: A reduced version of ImageNet (Krizhevsky & Hinton, 2009) images scaled down to with a total of classes.
STL-10 (Coates et al., 2011): a dataset derived from ImageNet composed of images with a mixture of unlabeled training examples and labeled examples per class. We use data augmentation with this dataset, taking random crops and flipping horizontally during unsupervised learning.
CelebA (Yang et al., 2015, Appendix A.5 only): An image dataset composed of faces labeled with binary attributes. This dataset evaluates DIM’s ability to capture information that is more fine-grained than the class label and coarser than individual pixels.
For our experiments, we compare DIM against various unsupervised methods: Variational AutoEncoders (VAE, Kingma & Welling, 2013), -VAE (Higgins et al., 2016; Alemi et al., 2016), Adversarial AutoEncoders (AAE, Makhzani et al., 2015), BiGAN (a.k.a. adversarially learned inference with a deterministic encoder: Donahue et al., 2016; Dumoulin et al., 2016), Noise As Targets (NAT, Bojanowski & Joulin, 2017), and Contrastive Predictive Coding (CPC, Oord et al., 2018). Note that we take CPC to mean ordered autoregression using summary features to predict “future” local features, independent of the constrastive loss used to evaluate the predictions (JSD, infoNCE, or DV). See the App. (A.2) for details of the neural net architectures used in the experiments.
Evaluation of representations is case-driven and relies on various proxies. Linear separability is commonly used as a proxy for disentanglement and mutual information (MI) between representations and class labels. Unfortunately, this will not show whether the representation has high MI with the class labels when the representation is not disentangled. Other works (Bojanowski & Joulin, 2017) have looked at transfer learning classification tasks by freezing the weights of the encoder and training a small fully-connected neural network classifier using the representation as input. Others still have more directly measured the MI between the labels and the representation (Rifai et al., 2012; Chen et al., 2018), which can also reveal the representation’s degree of entanglement.
Class labels have limited use in evaluating representations, as we are often interested in information encoded in the representation that is unknown to us. However, we can use mutual information neural estimation (MINE, Belghazi et al., 2018) to more directly measure the MI between the input and output of the encoder.
Next, we can directly measure the independence of the representation using a discriminator. Given a batch of representations, we generate a factor-wise independent distribution with the same per-factor marginals by randomly shuffling each factor along the batch dimension. A similar trick has been used for learning maximally independent representations for sequential data (Brakel & Bengio, 2017). We can train a discriminator to estimate the KL-divergence between the original representations (joint distribution of the factors) and the shuffled representations (product of the marginals, see Figure 12). The higher the KL divergence, the more dependent the factors. We call this evaluation method Neural Dependency Measure (NDM) and show that it is sensible and empirically consistent in the App. (A.6).
To summarize, we use the following metrics for evaluating representations. For each of these, the encoder is held fixed unless noted otherwise:
Linear classification using a support vector machine (SVM). This is simultaneously a proxy for MI of the representation with linear separability.
Non-linear classification using a single hidden layer neural network ( units) with dropout. This is a proxy on MI of the representation with the labels separate from linear separability as measured with the SVM above.
Semi-supervised learning (STL-10 here), that is, fine-tuning the complete encoder by adding a small neural network on top of the last convolutional layer (matching architectures with a standard fully-supervised classifier).
MS-SSIM (Wang et al., 2003), using a decoder trained on the reconstruction loss. This is a proxy for the total MI between the input and the representation and can indicate the amount of encoded pixel-level information.
Mutual information neural estimate (MINE), , between the input, , and the output representation, , by training a discriminator with parameters to maximize the DV estimator of the KL-divergence.
Neural dependency measure (NDM) using a second discriminator that measures the KL between and a batch-wise shuffled version of .
For the neural network classification evaluation above, we performed experiments on all datasets except CelebA, while for other measures we only looked at CIFAR10. For all classification tasks, we built separate classifiers on the high-level vector representation (), the output of the previous fully-connected layer (fc) and the last convolutional layer (conv). Model selection for the classifiers was done by averaging the last 100 epochs of optimization, and the dropout rate and decaying learning rate schedule was set uniformly to alleviate over-fitting on the test set across all models.
2 Representation learning comparison across models
In the following experiments, DIM(G) refers to DIM with a global-only objective () and DIM(L) refers to DIM with a local-only objective (), the latter chosen from the results of an ablation study presented in the App. (A.5). For the prior, we chose a compact uniform distribution on , which worked better in practice than other priors, such as Gaussian, unit ball, or unit sphere.
Our classification results can be found in Tables 1, 2, and 3. In general, DIM with the local objective, DIM(L), outperformed all models presented here by a significant margin on all datasets, regardless of which layer the representation was drawn from, with exception to CPC. For the specific settings presented (architectures, no data augmentation for datasets except for STL-10), DIM(L) performs as well as or outperforms a fully-supervised classifier without fine-tuning, which indicates that the representations are nearly as good as or better than the raw pixels given the model constraints in this setting. Note, however, that a fully supervised classifier can perform much better on all of these benchmarks, especially when specialized architectures and carefully-chosen data augmentations are used. Competitive or better results on CIFAR10 also exist (albeit in different settings, e.g., Coates et al., 2011; Dosovitskiy et al., 2016), but to our knowledge our STL-10 results are state-of-the-art for unsupervised learning. The results in this setting support the hypothesis that our local DIM objective is suitable for extracting class information.
Our results show that infoNCE tends to perform best, but differences between infoNCE and JSD diminish with larger datasets. DV can compete with JSD with smaller datasets, but DV performs much worse with larger datasets.
For CPC, we were only able to achieve marginally better performance than BiGAN with the settings above. However, when we adopted the strided crop architecture found in Oord et al. (2018), both CPC and DIM performance improved considerably. We chose a crop size of of the image size in width and depth with a stride of the image size (e.g., crops with strides for CIFAR10, crops with strides for STL-10), so that there were a total of local features. For both DIM(L) and CPC, we used infoNCE as well as the same “encode-and-dot-product” architecture (tantamount to a deep bilinear model), rather than the shallow bilinear model used in Oord et al. (2018). For CPC, we used a total of such networks, where each network for CPC is used for a separate prediction task of local feature maps in the next rows of a summary predictor feature within each column.Note that this is slightly different from the setup used in Oord et al. (2018), which used a total of such predictors, though we found other configurations performed similarly. For simplicity, we omitted the prior term, , from DIM. Without data augmentation on CIFAR10, CPC performs worse than DIM(L) with a ResNet-50 (He et al., 2016) type architecture. For experiments we ran on STL-10 with data augmentation (using the same encoder architecture as Table 2), CPC and DIM were competitive, with CPC performing slightly better.
CPC makes predictions based on multiple summary features, each of which contains different amounts of information about the full input. We can add similar behavior to DIM by computing less global features which condition on blocks of local features sampled at random from the full sets of local features. We then maximize mutual information between these less global features and the full sets of local features. We share a single MI estimator across all possible blocks of local features when using this version of DIM. This represents a particular instance of the occlusion technique described in Section 4.3. The resulting model gave a significant performance boost to DIM for STL-10. Surprisingly, this same architecture performed worse than using the fully global representation with CIFAR10. Overall DIM only slightly outperforms CPC in this setting, which suggests that the strictly ordered autoregression of CPC may be unnecessary for some tasks.
Extended comparisons
Tables 4 shows results on linear separability, reconstruction (MS-SSIM), mutual information, and dependence (NDM) with the CIFAR10 dataset. We did not compare to CPC due to the divergence of architectures. For linear classifier results (SVC), we trained five support vector machines with a simple hinge loss for each model, averaging the test accuracy. For MINE, we used a decaying learning rate schedule, which helped reduce variance in estimates and provided faster convergence.
MS-SSIM correlated well with the MI estimate provided by MINE, indicating that these models encoded pixel-wise information well. Overall, all models showed much lower dependence than BiGAN, indicating the marginal of the encoder output is not matching to the generator’s spherical Gaussian input prior, though the mixed local/global version of DIM is close. For MI, reconstruction-based models like VAE and AAE have high scores, and we found that combining local and global DIM objectives had very high scores (, is presented here as DIM(L+G)). For more in-depth analyses, please see the ablation studies and the nearest-neighbor analysis in the App. (A.4, A.5).
3 Adding coordinate information and occlusions
Maximizing MI between global and local features is not the only way to leverage image structure. We consider augmenting DIM by adding input occlusion when computing global features and by adding auxiliary tasks which maximize MI between local features and absolute or relative spatial coordinates given a global feature. These additions improve classification results (see Table 5).
Additional implementation details can be found in the App. (A.7). Roughly speaking, our input occlusions and coordinate prediction tasks can be interpreted as generalizations of inpainting (Pathak et al., 2016) and context prediction (Doersch et al., 2015) tasks which have previously been proposed for self-supervised feature learning. Augmenting DIM with these tasks helps move our method further towards learning representations which encode images (or other types of inputs) not just in terms of compressing their low-level (e.g. pixel) content, but in terms of distributions over relations among higher-level features extracted from their lower-level content.
Conclusion
In this work, we introduced Deep InfoMax (DIM), a new method for learning unsupervised representations by maximizing mutual information, allowing for representations that contain locally-consistent information across structural “locations” (e.g., patches in an image). This provides a straightforward and flexible way to learn representations that perform well on a variety of tasks. We believe that this is an important direction in learning higher-level representations.
Acknowledgements
RDH received partial support from IVADO, NIH grants 2R01EB005846, P20GM103472, P30GM122734, and R01EB020407, and NSF grant 1539067. AF received partial support from NIH grants R01EB020407, R01EB006841, P20GM103472, P30GM122734. We would also like to thank Geoff Gordon (MSR), Ishmael Belghazi (MILA), Marc Bellemare (Google Brain), Mikołaj Bińkowski (Imperial College London), Simon Sebbagh, and Aaron Courville (MILA) for their useful input at various points through the course of this research.
References
Appendix A Appendix
Here we show the relationship between the Jensen-Shannon divergence (JSD) between the joint and the product of marginals and the pointwise mutual information (PMI). Let and be two marginal densities, and define and as the conditional and joint distribution, respectively. Construct a probability mixture density, . It follows that , , and .
The quantity inside the expectation of Eqn. 10 is a concave, monotonically increasing function of the ratio , which is exactly . Note this relationship does not hold for the JSD of arbitrary distributions, as the the joint and product of marginals are intimately coupled.
We can verify our theoretical observation by plotting the JSD and KL divergences between the joint and the product of marginals, the latter of which is the formal definition of mutual information (MI). As computing the continuous MI is difficult, we assume a discrete input with uniform probability, (e.g., these could be one-hot variables indicating one of i.i.d. random samples), and a randomly initialized joint distribution, , such that . For this joint distribution, we sample from a uniform distribution, then apply dropout to encourage sparsity to simulate the situation when there is no bijective function between and , then apply a softmax. As the distributions are discrete, we can compute the KL and JSD between and .
We ran these experiments with matched input / output dimensions of , , , , and , randomly drawing joint distributions, and computed the KL and JSD divergences directly. Our results (Figure 4) indicate that the KL (traditional definition of mutual information) and the JSD have an approximately monotonic relationship. Overall, the distributions with the highest mutual information also have the highest JSD.
A.2 Experiment and architecture details
Here we provide architectural details for our experiments. Example code for running Deep Infomax (DIM) can be found at https://github.com/rdevon/DIM.
We used an encoder similar to a deep convolutional GAN (DCGAN, Radford et al., 2015) discriminator for CIFAR10 and CIFAR100, and for all other datasets we used an Alexnet (Krizhevsky et al., 2012) architecture similar to that found in Donahue et al. (2016). ReLU activations and batch norm (Ioffe & Szegedy, 2015) were used on every hidden layer. For the DCGAN architecture, a single hidden layer with units was used after the final convolutional layer, and for the Alexnet architecture it was two hidden layers with . For all experiments, the output of all encoders was a dimensional vector.
Mutual information discriminators
For the global mutual information objective, we first encode the input into a feature map, , which in this case is the output of the last convolutional layer. We then encode this representation further using linear layers as detailed above to get . is then flattened, then concatenated with . We then pass this to a fully-connected network with two -unit hidden layers (see Table 6).
We tested two different architectures for the local objective. The first (Figure 7) concatenated the global feature vector with the feature map at every location, i.e., . A convolutional discriminator is then used to score the (feature map, feature vector) pair,
Fake samples are generated by combining global feature vectors with local feature maps coming from different images, :
This architecture is featured in the results of Table 4, as well as the ablation and nearest-neighbor studies below. We used a convnet with two -unit hidden layers as discriminator (Table 7).
The other architecture we tested (Figure 7) is based on non-linearly embedding the global and local features in a (much) higher-dimensional space, and then computing pair-wise scores using dot products between their high-dimensional embeddings. This enables efficient evaluation of a large number of pair-wise scores, thus allowing us to use large numbers of positive/negative samples. Given a sufficiently high-dimensional embedding space, this approach can represent (almost) arbitrary classes of pair-wise functions that are non-linear in the original, lower-dimensional features. For more information, refer to Reproducing Kernel Hilbert Spaces. We pass the global feature through a fully connected neural network to get the encoded global feature, . In our experiments, we used a single hidden layer network with a linear shortcut (See Table 8).
We embed each local feature in the local feature map using an architecture which matches the one for global feature embedding. We apply it via convolutions. Details are in Table 9.
Finally, the outputs of these two networks are combined by matrix multiplication, summing over the feature dimension ( in the example above). As this is computed over a batch, this allows us to efficiently compute both positive and negative examples simultaneously. This architecture is featured in our main classification results in Tables 1, 2, and 5.
For the local objective, the feature map, , can be taken from any level of the encoder, . For the global objective, this is the last convolutional layer, and this objective was insensitive to which layer we used. For the local objectives, we found that using the next-to-last layer worked best for CIFAR10 and CIFAR100, while for the other larger datasets it was the previous layer. This sensitivity is likely due to the relative size of the of the receptive fields, and further analysis is necessary to better understand this effect. Note that all feature maps used for DIM included the final batch normalization and ReLU activation.
Prior matching
Figure 7 shows a high-level overview of the prior matching architecture. The discriminator used to match the prior in DIM was a fully-connected network with two hidden layers of and units (Table 10).
Generative models
For generative models, we used a similar setup as that found in Donahue et al. (2016) for the generators / decoders, where we used a generator from DCGAN in all experiments.
All models were trained using Adam with a learning rate of for epochs for CIFAR10 and CIFAR100 and for epochs for all other datasets.
Contrastive Predictive Coding
For Contrastive Predictive Coding (CPC, Oord et al., 2018), we used a simple a GRU-based PixelRNN (Oord et al., 2016) with the same number of hidden units as the feature map depth. All experiments with CPC had the global state dimension matched with the size of these recurrent hidden units.
A.3 Sampling strategies
We found both infoNCE and the DV-based estimators were sensitive to negative sampling strategies, while the JSD-based estimator was insensitive. JSD worked better ( accuracy improvement) by excluding positive samples from the product of marginals, so we exclude them in our implementation. It is quite likely that this is because our batchwise sampling strategy overestimate the frequency of positive examples as measured across the complete dataset. infoNCE was highly sensitive to the number of negative samples for estimating the log-expectation term (see Figure 9). With high sample size, infoNCE outperformed JSD on many tasks, but performance drops quickly as we reduce the number of images used for this estimation. This may become more problematic for larger datasets and networks where available memory is an issue. DV was outperformed by JSD even with the maximum number of negative samples used in these experiments, and even worse was highly unstable as the number of negative samples dropped.
A.4 Nearest-neighbor analysis
In order to better understand the metric structure of DIM’s representations, we did a nearest-neighbor analysis, randomly choosing a sample from each class in the test set, ordering the test set in terms of distance in the representation space (to reflect the uniform prior), then selecting the four with the lowest distance. Our results in Figure 8 show that DIM with a local-only objective, DIM(L), learns a representation with a much more interpretable structure across the image. However, our result potentially highlights an issue with using only consistent information across patches, as many of the nearest neighbors share patterns (colors, shapes, texture) but not class.
A.5 Ablation studies
To better understand the effects of hyperparameters , , and on the representational characteristics of the encoder, we performed several ablation studies. These illuminate the relative importance of global verses local mutual information objectives as well as the role of the prior.
The results of our ablation study for DIM on CIFAR10 are presented in Figure 10. In general, good classification performance is highly dependent on the local term, , while good reconstruction is highly dependent on the global term, . However, a small amount of helps in classification accuracy and a small about of improves reconstruction. For mutual information, we found that having a combination of and yielded higher MINE estimates. Finally, for CelebA (Figure 11), where the classification task is more fine-grained (is composed of potentially locally-specified labels, such as “lipstick” or “smiling”), the global objective plays a stronger role than with classification on other datasets (e.g., CIFAR10).
The effect of the prior
We found including the prior term, , was absolutely necessary for ensuring low dependence between components of the high-level representation, , as measured by NDM. In addition, a small amount of the prior term helps improve classification results when used with the local term, . This may be because the additional constraints imposed on the representation help to encourage the local term to focus on consistent, rather than trivial, information.
A.6 Empirical consistency of Neural Dependency Measure (NDM)
Here we evaluate the Neural Dependency Measure (NDM) over a range of -VAE (Alemi et al., 2016; Higgins et al., 2016) models. -VAE encourages disentangled representations by increasing the role of the KL-divergence term in the ELBO objective. We hypthesized that NDM would consistenly measure lower dependence (lower NDM) as the values increase, and our results in Figure 13 confirm this. As we increase , there is a strong downward trend in the NDM, though and give similar numbers. In addition, the variance over estimates and models is relatively low, meaning the estimator is empirically consistent in this setting.
A.7 Additional details on occlusion and coordinate prediction experiments
Here we present experimental details on the occlusion and coordinate prediction tasks.
For the occlusion experiments, the sampling distribution for patches to occlude was ad-hoc. Roughly, we randomly occlude the input image under the constraint that at least one block of pixels remains visible and at least one block of pixels is fully occluded. We chose based on the receptive fields of local features in our encoder, since it guarantees that occlusion leaves at least one local feature fully observed and at least one local feature fully unobserved. Figure 14 shows the distribution of occlusions used in our tests.
Absolute coordinate prediction
For absolute coordinate prediction, the global features and local features are sampled by 1) feeding an image from the data distribution through the feature encoder, and 2) sampling a random spatial location from which to take the local features . Given and , we treat the coordinates and as independent categorical variables and measure the required log probability using a sum of categorical cross-entropies. In practice, we implement the prediction function as an MLP with two hidden layers, each with units, ReLU activations, and batchnorm. We marginalize this objective over all local features associated with a given global feature when computing gradients.
Relative coordinate prediction
For relative coordinate prediction, the global features and local features are sampled by 1) feeding an image from the data distribution through the feature encoder, 2) sampling a random spatial location from which to take source local features , and 3) sampling another random location from which to take target local features . In practice, our predictive model for this task uses the same architecture as for the task described previously. For each global feature we select one source feature and marginalize over all possible target features when computing gradients.
A.8 Training a generator by matching to a prior implicitly
A.9 Generation experiments and results
For the generator and encoder, we use a ResNet architecture (He et al., 2016) identical to the one found in Gulrajani et al. (2017). We used the contractive penalty (found in Mescheder et al. (2018) but first introduced in contractive autoencoders (Rifai et al., 2011)) on the encoder, gradient clipping on the discriminators, and no regularization on the generator. Batch norm (Ioffe & Szegedy, 2015) was used on the generator, but not on the discriminator. We trained on dimensional LSUN (Yu et al., 2015), CelebA (Liu et al., 2015), and Tiny Imagenet dataset.
A.10 Images Generation
Here, we train a generator mapping to two Gaussian implicitly as described in Section A.8. Our results (Figure 16) show highly realistic images qualitatively competitive to other methods (Gulrajani et al., 2017; Hjelm et al., 2018). In order to quantitatively compare our method to GANs, we trained a non-saturating GAN with contractive penalty (NS-GAN-CP) and WGAN-GP (Gulrajani et al., 2017) with identical architectures and training procedures. Our results (Table 11) show that, while our mehtod did not surpass NS-GAN-CP or WGAN-GP in our experiments, they came reasonably close.