Neural Production Systems

1 Introduction . Despite never having taken a physics course , every child beyond a young age appreciates that pushing a plate off the dining table will cause the plate to break . The laws of physics accurately characterize the dynamics of our natural world , and although explicit knowledge of these laws is not necessary to reason , we can reason explicitly about objects interacting through these laws . Humans can verbalize knowledge in propositional expressions such as “ If a plate drops from table height , it will break , ” and “ If a video-game opponent approaches from behind and they are carrying a weapon , they are likely to attack you. ” Expressing propositional knowledge is not a strength of current deep learning methods for several reasons . First , propositions are discrete and independent from one another . Second , propositions must be quantified in the manner of first-order logic ; for example , the video-game proposition applies to any X for which X is an opponent and has a weapon . Incorporating the ability to express and reason about propositions should improve generalization in deep learning methods because this knowledge is modular— propositions can be formulated independently of each other— and can therefore be acquired incrementally . Propositions can also be composed with each other and applied consistently to all entities that match , yielding a powerful form of systematic generalization . The classical AI literature from the 1980s can offer deep learning researchers a valuable perspective . In this era , reasoning , planning , and prediction were handled by architectures that performed propositional inference on symbolic knowledge representations . A simple example of such an architecture is * Equal Contribution , * * Equal Advising 1 Mila , University of Montreal , 2 Google Deepmind , 3 Waverly , 4 Google Research , Brain Team . Corresponding authors : anirudhgoyal9119 @ gmail.com , adidolkar123 @ gmail.com 35th Conference on Neural Information Processing Systems ( NeurIPS 2021 ) . the production system ( Laird et al. , 1986 ; Anderson , 1987 ) , which expresses knowledge by conditionaction rules . The rules operate on a working memory : rule conditions are matched to entities in working memory inspired by cognitive science , and such a match can trigger computational actions that update working memory or external actions that operate on the outside world . Production systems were typically used to model high-level cognition , e.g. , mathematical problem solving or procedure following ; perception was not the focus of these models . It was assumed that the results of perception were placed into working memory in a symbolic form that could be operated on with the rules . In this article , we revisit production systems but from a deep learning perspective which naturally integrates perceptual processing and subsequent inference for visual reasoning problems . We describe an end-to-end deep learning model that constructs object-centric representations of entities in videos , and then operates on these entities with differentiable—and thus learnable—production rules . The essence of these rules , carried over from traditional symbolic system , is that they operate on variables that are bound , or linked , to the entities in the world . In the deep learning implementation , each production rule is represented by a distinct MLP with query-key attention mechanisms to specify the rule-entity binding and to determine when the rule should be triggered for a given entity . We are not the first to propose a neural instantiation of a production system architecture . Touretzky & Hinton ( 1988 ) gave a proof of principle that neural net hardware could be hardwired to implement a production system for symbolic reasoning ; our work fundamentally differs from theirs in that ( 1 ) we focus on perceptual inference problems and ( 2 ) we use the architecture as an inductive bias for learning . 1.1 Variables and entities . What makes a rule general-purpose is that it incorporates placeholder variables that can be bound to arbitrary values or—the term we prefer in this article—entities . This notion of binding is familiar in functional programming languages , where these variables are called arguments . Analogously , the use of variables in the production rules we describe enable a model to reason about any set of entities that satisfy the selection criteria of the rule . Consider a simple function in C like int add ( int a , int b ) . This function binds its two integer operands to variables a and b . The function does not apply if the operands are , say , character strings . The use of variables enables a programmer to reuse the same function to add any two integer values In order for rules to operate on entities , these entities must be represented explicitly . That is , the visual world needs to be parsed in a task-relevant manner , e.g. , distinguishing the sprites in a video game or the vehicles and pedestrians approaching an autonomous vehicle . Only in the past few years have deep learning vision researchers developed methods for object-centric representation ( Le Roux et al. , 2011 ; Eslami et al. , 2016 ; Greff et al. , 2016 ; Raposo et al. , 2017 ; Van Steenkiste et al. , 2018 ; Kosiorek et al. , 2018 ; Engelcke et al. , 2019 ; Burgess et al. , 2019 ; Greff et al. , 2019 ; Locatello et al. , 2020a ; Ahmed et al. , 2020 ; Goyal et al. , 2019 ; Zablotskaia et al. , 2020 ; Rahaman et al. , 2020 ; Du et al. , 2020 ; Ding et al. , 2020 ; Goyal et al. , 2020 ; Ke et al. , 2021 ) . These methods differ in details but share the notion of a fixed number of slots ( see Figure 1 for example ) , also known as object files , each encapsulating information about a single object . Importantly , the slots are interchangeable , meaning that it doesn ’ t matter if a scene with an apple and an orange encodes the apple in slot 1 and orange in slot 2 or vice-versa . A model of visual reasoning must not only be able to represent entities but must also express knowledge about entity dynamics and interactions . To ensure systematic predictions , a model must be capable of applying knowledge to an entity regardless of the slot it is in and must be capable of applying the same knowledge to multiple instances of an entity . Several distinct approaches exist in the literature . The predominant approach uses graph neural networks to model slot-to-slot interactions ( Scarselli et al. , 2008 ; Bronstein et al. , 2017 ; Watters et al. , 2017 ; Van Steenkiste et al. , 2018 ; Kipf et al. , 2018 ; Battaglia et al. , 2018 ; Tacchetti et al. , 2018 ) . To ensure systematicity , the GNN must share parameters among the edges . In a recent article , Goyal et al . ( 2020 ) developed a more general framework in which parameters are shared but slots can dynamically select which parameters to use in a state-dependent manner . Each set of parameters is referred to as a schema , and slots use a query-key attention mechanism to select which schema to apply at each time step . Multiple slots can select the same schema . In both GNNs and SCOFF , modeling dynamics involves each slot interacting with each other slot . In the work we describe in this article , we replace the direct slot-to-slot interactions with rules , which mediate sparse interactions among slots ( See arrows in Figure 1 ) . Thus our main contribution is that we introduce NPS , which offers a way to model dynamic and sparse interactions among the variables in a graph and also allows dynamic sharing of multiple sets of parameters among these interactions . Most architectures used for modelling interactions in the current literature use statically instantiated graph which model all possible interactions for a given variable at each step i.e . dense interactions . Also such dense architectures share a single set of parameters across all interactions which maybe quite restrictive in terms of representational capacity . A visual comparison between these two kinds of architectures is shown in Figure 1 . Through our experiments we show the advantage of modeling interactions in the proposed manner using NPS in visually rich physical environments . We also show that our method results in an intuitive factorization of rules and entities . 2 Production System . Formally , our notion of a production system consists of a set of entities and a set of rules , along with a mechanism for selecting rules to apply on subsets of the entities . Implicit in a rule is a specification of the properties of relevant entities , e.g. , a rule might apply to one type of sprite in a video game but not another . The control flow of a production system dynamically selects rules as well as bindings between rules and entities , allowing different rules to be chosen and different entities to be manipulated at each point in time . The neural production system we describe shares essential properties with traditional production system , particularly with regard to the compositionality and generality of the knowledge they embody . Lovett & Anderson ( 2005 ) describe four desirable properties commonly attributed to symbolic systems that apply to our work as well . Production rules are modular . Each production rule represents a unit of knowledge and are atomic such that any production rule can be intervened ( added , modified or deleted ) independently of other production rules in the system . Production rules are abstract . Production rules allow for generalization because their conditions may be represented as high-level abstract knowledge that match to a wide range of patterns . These conditions specify the attributes of relationship ( s ) between entities without specifying the entities themselves . The ability to represent abstract knowledge allows for the transfer of learning across different environments as long as they fit within the conditions of the given production rule . Production rules are sparse . In order that production rules have broad applicability , they involve only a subset of entities . This assumption imposes a strong prior that dependencies among entities are sparse . In the context of visual reasoning , we conjecture that this prior is superior to what has often been assumed in the past , particularly in the disentanglement literature—independence among entities Higgins et al . ( 2016 ) ; Chen et al . ( 2018 ) . Production rules represent causal knowledge and are thus asymmetric . Each rule can be decomposed into a { condition , action } pair , where the action reflects a state change that is a causal consequence of the conditions being met . These four properties are sufficient conditions for knowledge to be expressed in production rule form . These properties specify how knowledge is represented , but not what knowledge is represented . The latter is inferred by learning mechanisms under the inductive bias provided by the form of production rules . 3 Neural Production System : Slots and Sparse Rules . The Neural Production System ( NPS ) , illustrated in Figure 2 , provides an architectural backbone that supports the detection and inference of entity ( object ) representations in an input sequence , and the underlying rules which govern the interactions between these entities in time and space . The input sequence indexed by time step t , { x1 , . . . , xt , . . . , xT } , for instance the frames in a video , are processed by a neural encoder ( Burgess et al. , 2019 ; Greff et al. , 2019 ; Goyal et al. , 2019 , 2020 ) applied to each xt , to obtain a set of M entity representations { V t1 , . . . , . . . , V tM } , one for each of the M slots . These representations describe an entity and are updated based on both the previous state , V t−1 and the current input , xt . NPS consists of N separately encoded rules , { R1 , R2 , .. , RN } . Each rule consists of two components , Ri = ( ~Ri , MLPi ) , where ~Ri is a learned rule embedding vector , which can be thought of as a template defining the condition for when a rule applies ; and MLPi , which determines the action taken by a rule . Both ~Ri and the parameters of MLPi are learned along with the other parameters of the model using back-propagation on an objective optimized end-to-end . In the general form of the model , each slot selects a rule that will be applied to it to change its state . This can potentially be performed several times , with possibly different rules applied at each step . Rule selection is done using an attention mechanism described in detail below . Each rule specifies conditions and actions on a pair of slots . Therefore , while modifying the state of a slot using a rule , it can take the state of another slot into account . The slot which is being modified is called the primary slot and other is called the contextual slot . The contextual slot is also selected using an attention mechanism described in detail below .

Summary: The authors present a new neural network system that can reason over entities. The solution should be applicable to any tasks that require visual reasoning.  Specifically, the NPS algorithm is: ``` for every step in a sequence:     update the slots (entities)     compute attention between slot queries and rule keys to select a rule     compute attention between primary slot queries and all slot keys to get contextual slot     apply the rule MLP to the primary and contextual slot values     add the result to the primary slot ``` Slots can either be updated in parallel (i.e., there is only one slot updated per step) or in sequence (i.e., multiple slots can be updated per step).  They compare sequential vs parallel rule application on 4 tasks: - given a transformation and mnist digit, predict the digit with the transformation applied - given two x,y coordinates predict the result of an arithmetic change (e.g., subtract the ys from one another) applied - for a stack of falling shapes, predict the bounding box of each object in future frames - predict the next frame of billiard balls bouncing around  They compare NPS to GNNs and related methods on four tasks. The goal of each task is to predict latent states in future frames: - physics env: blocks of unknown weight interacting with one another - Atari games (pong, space invaders, freeway, breakout, qBert) - sprites (moving objects of different shapes)