Guiding Physical Intuition with Neural Stethoscopes

1 INTRODUCTION . Intuitive physics in the deep learning community describes physical understanding acquired by neural networks in a data-driven as opposed to a rule-based manner : With an increasing amount of training examples , we expect an algorithm to develop a better understanding of its ( physical ) environment , especially when the task it is trained on is inherently linked to the physical rules governing the scene . However , what type of understanding the network develops highly depends on the types of scenarios it is confronted with and the task it is trying to solve . Furthermore , it depends on the network architecture , on regularisation techniques , on the training procedure , etc . As a result , in contrast to a rule-based approach , it is often hard to assess what form of physical understanding a neural network has developed . We are specifically interested in whether the network uses visual cues as shortcuts which reflect correlations in the dataset but are incommensurate with the underlying laws of physics the network was intended to learn . In this paper , we specifically focus on stability prediction of block towers , a task which has gained interest in both the deep learning ( Lerer et al. , 2016 ; Wu et al. , 2017 ; Groth et al. , 2018 ) and the robotics community in recent years ( Li et al. , 2017a ; b ) . Images of towers of blocks stacked on top of each other are shown to a neural network . Its task is to predict whether the tower will fall over or not resulting in a binary classification problem . End-to-end learning approaches as well as simulation-based approaches achieve super-human performance on a real dataset ( Lerer et al. , 2016 ; Wu et al. , 2017 ; Groth et al. , 2018 ) . However , with investigation of trained deep learning models limited to occlusion-based attention analyses ( Lerer et al. , 2016 ; Groth et al. , 2018 ) , it is not clear to what extent neural networks trained on this task take into account physical principles such as centre-of-mass or whether they follow visual cues instead . To this end , we introduce a variation of the ShapeStacks dataset presented by Groth et al . ( 2018 ) which facilitates the analysis of the effects of visual cues on the learning process . Motivated by the need for an effective tool to understand and guide the physical reasoning of the neural network and inspired by prior research in interpretability , multi-task learning and adversarial training , we present neural stethoscopes as a unified framework for the interrogation and perturbation of task-specific information at any layer . A stethoscope can be deployed in a purely analytic fashion whereby a question is posed via a stethoscope loss which is not propagated back into the main network . It can also be used to promote or suppress specific information by deploying either an auxiliary or an adversarial training mechanism . The concept is illustrated in Figure 1 . We demonstrate that deploying an auxiliary stethoscope can be used to promote information conducive to the main task improving overall network performance . Conversely , we show that an adversarial stethoscope can mitigate a specific bias by effectively suppressing information . Moreover , the main network does not need to be changed in order to apply a neural stethoscope . In this work , we present two contributions : ( 1 ) An in-depth analysis of the state-of-the-art approach for intuitive stability prediction . To that end , we also introduce an extension to the existing ShapeStacks dataset which will be made publicly available . ( 2 ) A framework for interpreting , suppressing or promoting extraction of features specific to a secondary task unifying existing approaches from interpretability , auxiliary and adversarial learning . While we frame this work in the context of intuitive physics , questions regarding model interpretability and , consequently , systematic , targeted model adaptation find applicability in all domains of deep learning . For a study of two MNIST toy problems with neural stethoscopes , please see Appendix C . 2 RELATED WORK . This work touches on two fields within deep learning : intuitive physics , specifically stability prediction , and targeted model adaptation/interpretation . Stability Prediction Vision-based stability prediction of block towers has become a popular task for teaching and showcasing physical understanding of algorithms . Approaches include end-to-end deep learning algorithms ( Lerer et al. , 2016 ; Groth et al. , 2018 ) as well as pipelines using computer vision to create an abstract state representation which can then be used by a physics simulator ( Furrer et al. , 2017 ; Wu et al. , 2017 ) . Furrer et al . ( 2017 ) achieve impressive results with a pipeline approach to robotic stone stacking . Interestingly , on a publicly available real-world dataset of block tower images ( Lerer et al. , 2016 ) , the state-of-the-art is shared between an end-to-end learning approach ( Groth et al. , 2018 ) and a pipeline method using a physics simulator ( Wu et al. , 2017 ) . While being much easier to implement , end-to-end approaches have the downside of being significantly harder to interpret . Interpretability brings at least two advantages : ( 1 ) Trust by understanding the model ’ s reasoning and therefore also its potential failure cases . ( 2 ) Identification of potentials to improve the model . Both Lerer et al . ( 2016 ) and Groth et al . ( 2018 ) conduct occlusion-based attention analyses . Groth et al . ( 2018 ) find that the focus of the algorithm ’ s attention lies within a bounding box around the stability violation in 80 % of the cases . While encouraging , conclusions which can be drawn regarding the network ’ s understanding of physical principles are limited . Moreover , Selvaraju et al . ( 2017 ) shows that attention analyses can be misleading : The Grad-CAM visualisation does not change even for artificially crafted adversarial examples which maximally confuse the classifier . Neural Stethoscopes The notion of passively interrogating and actively influencing feature representations in hidden layers of neural networks connects disparate fields including interpretability , auxiliary losses and multitask learning as well as adversarial training . We note that much of the required machinery for neural stethoscopes already exists in a number of sub-domains of deep learning . Work on auxiliary objectives ( Jaderberg et al. , 2016 ) as well as multi-task learning ( e.g . Caruana ( 1995 ; 1998 ) ) commonly utilises dedicated modules with losses targeted towards a variety of tasks in order to optimise a representation shared across tasks . Based on this notion both deep supervision ( Wang et al. , 2015 ) and linear classifier probes ( Alain & Bengio , 2016 ) reinforce the original loss signal at various levels throughout a network stack . Although their work is restricted to reinforcing the learning signal via the same loss applied to the global network ( Alain & Bengio , 2016 ) in particular demonstrate that the accessibility of information at a given layer can be determined - and promoted - by formulating a loss applied locally to that layer . Conversely , in order to encourage representations invariant to components of the input signal , regularisation techniques are commonly utilised ( e.g . Srivastava et al . ( 2014 ) ) . To obtain invariance with respect to known systematic changes between training and deployment data , Ganin et al . ( 2016 ) ; Wulfmeier et al . ( 2017 ) propose methods for domain adaptation . In order to prevent a model fitting to a specific nuisance factor , Louizos et al . ( 2015 ) minimise the Maximum Mean Discrepancy between conditional distributions with different values of a binary nuisance variable in the conditioning set . This method is limited to discrete nuisance variables and its computational cost scales exponentially with the number of states . Xie et al . ( 2017 ) address both issues via adversarial training , optimising an encoding to confuse an additional discriminator , which aims to determine the values of nuisance parameters . This approach assumes that the nuisance variable is known and is an input to the main model during training and deployment . Louppe et al . ( 2017 ) follow a similar approach , applying the discriminator to the output of the main model instead of its intermediate representations . 3 NEURAL STETHOSCOPES . We use stethoscopes to analyse and influence the learning process on the task of stability prediction , but present it in the following as a general framework which can be applied to any set of tasks . In supervised deep learning , we typically look for a function fθ : X Ñ Y with parameters θ that maps an input x P X to its target y P Y . Often the function internally computes one or more intermediate representations z P Z of the data . In this case , we rewrite fθ as the composition of the encoder hencθ : X Ñ Z , which maps the input to the corresponding features z P Z , and the decoder hdecθ : Z Ñ Y , which maps features to the output . In this work , we consider only classification tasks so that Y is a finite set of labels ( or a simplex in the case of a probabilistic output ) , but our approach generalises directly also to regression tasks . The information present in the input x might support multiple different tasks . By introducing a supplementary task into our training framework we hope to improve the performance of our network at the primary task . However , the impact of the supplementary task on the primary task is often difficult to determine , and in some cases can even detriment performance on the primary task . To this end , we propose neural stethoscopes , which allow us to interrogate the relationships between primary and supplementary tasks . In addition , the framework provides a tool to improve the network ’ s performance at the primary task in light of both beneficial and detrimental supplementary tasks through the introduction of auxiliary and adversarial losses respectively promoting or suppressing extraction of features related to the supplemental task by the encoder hencθ . Let the stethoscope be defined as an arbitrary function hsψ : Z Ñ S with parameters ψ. Crucially , hsψ is trained on a supplemental task with targets s P S and not for the main objective . We define two loss functions : Lypθq , which measures the discrepancy between predictions fθ and the true task y and Lspθ , ψq , which measures the performance on the supplemental task . The weights of the stethoscope are updated as ´∆ψ9∇ψLspθ , ψq to minimise Lspθ , ψq and the weights of the main network as ´∆θ9∇θLy , spθ , ψq to minimise the energy Ly , spθ , ψq “ Lypθq ` λ ¨ Lspθ , ψq . ( 1 ) By choosing different values for the constant λ we obtain three very different use cases : Analytic Stethoscope ( λ “ 0 ) Here , the gradients of the stethoscope , which acts as a passive observer , are not used to alter the main model . This setup can be used to interrogate learned feature representations : if the stethoscope predictions are accurate , the features can be used to solve the task . Auxiliary Stethoscope ( λ ą 0 ) The encoder is trained with respect to the stethoscope objective , hence enforcing correlation between main network and supplemental task . This setup is related to learning with auxiliary tasks , and helpful if we expect the two tasks to be beneficially related . Adversarial Stethoscope ( λ ă 0 ) By setting λ ă 0 , we train the encoder to maximise the stethoscope loss ( which the stethoscope still tries to minimise ) , thus encouraging independence between main network and supplemental tasks . This is effectively an adversarial training framework and is useful if features required to solve the stethoscope task are a detrimental nuisance factor . For the analytic stethoscope , to fairly compare the accessibility of information with respect to a certain task in different feature representations , we set two criteria : ( 1 ) The capacity of the stethoscope architecture has to be constant regardless of the dimensions of its input . ( 2 ) The stethoscope has to be able to access each neuron of the input separately . We guarantee this by fully connecting the input with the first layer of the stethoscope using a sparse matrix . This matrix has a constant number of non-zero entries ( criterion 1 ) and connects every input unit as well as every output unit at least once ( criterion 2 ) . For a more detailed description , see Appendix A . In auxiliary and adversarial mode , we attach the stethoscope to the main network ’ s last layer before the logits in a fully connected manner . This setup proved to have the highest impact on the learning process of the main network . The stethoscope itself is implemented as a two-layer perceptron with ReLU activation and trained with sigmoid or softmax cross-entropy loss on its task S. For numerical stability , the loss of the encoder in the adversarial setting is rewritten as L̃y , spθ , ψq “ Lypθq ` |λ| ¨ Ls̄pθ , ψq ( 2 ) where Ls̄pθ , ψq is the stethoscope loss with flipped labels . The objective is similar to the confusion loss formulation utilised in GANs to avoid vanishing gradients when the discriminator ’ s performance is high ( Goodfellow , 2016 ) .

Summary: This paper is about using "neural stethoscopes", small complementary neural networks that are added to a main network which with their auxilary loss functions can measure suitability of features or guide the learning process. The idea is incremental to multi-task learning and enable, in a single framework, to validate intermediate features for additional related tasks. Moreover it can promote or suppress the correlation of such features to the tasks related to the main one. The framework is applied to the task of visual stability prediction of block towers. The paper builds upon Groth et al. 2018, adding the concept of local stability as correlated secondary task, used with the proposed neural stethoscopes. Experiments with an extension of ShapeStacks (Groth et al. 2018) dataset where the local stability is added to the global stability class, show that it is possibile increase the performance using the additional task. Moreover, it is shown that neural stethoscopes can suppress nuisance information when using a biased training dataset where the local and global stability are purposely inversely correlated.