# neuralsymbolic_integration_a_compositional_perspective__da525de3.pdf Neural-Symbolic Integration: A Compositional Perspective Efthymia Tsamoura1, Timothy Hospedales1, Loizos Michael2,3 1 Samsung AI Research 2 Open University of Cyprus 3 CYENS Center of Excellence efi.tsamoura@samsung.com, t.hospedales@samsung.com, loizos@ouc.ac.cy Despite significant progress in the development of neuralsymbolic frameworks, the question of how to integrate a neural and a symbolic system in a compositional manner remains open. Our work seeks to fill this gap by treating these two systems as black boxes to be integrated as modules into a single architecture, without making assumptions on their internal structure and semantics. Instead, we expect only that each module exposes certain methods for accessing the functions that the module implements: the symbolic module exposes a deduction method for computing the function s output on a given input, and an abduction method for computing the function s inputs for a given output; the neural module exposes a deduction method for computing the function s output on a given input, and an induction method for updating the function given input-output training instances. We are, then, able to show that a symbolic module with any choice for syntax and semantics, as long as the deduction and abduction methods are exposed can be cleanly integrated with a neural module, and facilitate the latter s efficient training, achieving empirical performance that exceeds that of previous work1. Introduction Neural-symbolic frameworks (d Avila Garcez, Broda, and Gabbay 2002; Rockt aschel and Riedel 2017; Wang et al. 2019) vow to bring a new computational paradigm in which symbolic systems can tolerate noisy or unstructured data, and neural systems can learn with fewer data and offer interpretable outcomes. The potential of integrating a symbolic, typically logic-based, module on top of a neural one has been well-demonstrated in semi-supervised learning (Donadello, Serafini, and d Avila Garcez 2017; Marra et al. 2019; Serafini and d Avila Garcez 2016; van Krieken, Acar, and van Harmelen 2019), program induction (Kalyan et al. 2018; Parisotto et al. 2017), and open question answering (Sun et al. 2018) settings. In these cases, the training of the neural module is regulated by the logic theory (and its integrity Copyright 2021, Association for the Advancement of Artificial Intelligence (www.aaai.org). All rights reserved. 1Efthymia Tsamoura and Loizos Michael contributed to the conception and design of the framework, to the implementation of the architecture, to the analysis and interpretation of the results, and to the writing of the paper. Timothy Hospedales contributed to early discussions in the general area of neural-symbolic integration, and proposed some existing benchmarks for the empirical evaluation. constraints or other constructs), which is far from straightforward since logical inference cannot be, in general, captured via a differentiable function. To accommodate the integration of neural modules with logical theories, the majority of neural-symbolic frameworks restrict the type of the theories (e.g., to non-recursive or acyclic propositional ones), and they either translate them into neural networks (d Avila Garcez, Broda, and Gabbay 2002; H olldobler, St orr, and Kalinke 1999; Towell and Shavlik 1994), or they replace logical computations by differentiable functions (Boˇsnjak et al. 2017; Gaunt et al. 2017). A second line of work abandons the use of classical logic altogether and adopts theories whose interpretations take continuous values, such as fuzzy logic (Donadello, Serafini, and d Avila Garcez 2017; Marra et al. 2019; Serafini and d Avila Garcez 2016; Sourek et al. 2015; van Krieken, Acar, and van Harmelen 2019), or probabilistic logic (Manhaeve et al. 2018), which can support the uniform application of backpropagation on both the symbolic and the neural module. We consider the problem of integrating a symbolic module that computes a function s( ) on top of a neural module that computes a function n( ), so that together the two modules implement the composition s n. We argue that this integration can be done fully compositionally, without the need to revamp the syntax or semantics of either module. We borrow two well-known notions from mathematical logic to establish the interface that should be provided by the symbolic module to reach a transparent and non-intrusive integration: deduction, or forward inference, and abduction, through which one computes (i.e., abduces) the inputs to the symbolic module that would deduce a given output. While abduction has been used in the past as the means to train a neural module feeding into a symbolic module (Dai et al. 2019), there are two key differences between our framework and prior art, over and above our high-level contribution in setting the basis for compositionality. The first difference is on the abduced inputs that are used to train the neural module. Our basic framework makes use of all such abduced inputs, while prior art restricts its attention on one of them. As also supported by the empirical evidence that we offer in this work, this restriction causes the learning process to suffer: learning is led to fall into local minima since the single abduced input offers lopsided feedback to the learning process, training faces weaker supervision signals due to The Thirty-Fifth AAAI Conference on Artificial Intelligence (AAAI-21) the loss of the semantic constraints among the different abduced inputs, and the learning process becomes vulnerable to random supervision signals on those parts of the single abuced input that are forced to take values when they should have semantically been treated as irrelevant. The second difference is on the training process itself. Prior art uses an ad-hoc training procedure which requires training of the neural module multiple times for the same training sample. That training approach is not only computationally expensive, but it is also difficult to customize on different scenarios. Instead, our framework provides the means to control the training process in a customized manner by delegating to the symbolic module the encoding of any domain-specific training choices. In particular, there exist cases where one would wish to have the neural predictions guide the choice of abduced inputs presumably the problem that also motivates prior art. We show that such neural-guided abduction can be done easily as an extension of our basic framework, by encoding in the symbolic module the knowledge of which abduced inputs are to be used for training, using declarative or procedural techniques to resolve any inconsistencies and to rank the abduced inputs in terms of compatibility with the current neural predictions. Beyond the plugging in of theories with any semantics and syntax, and beyond the already-mentioned support for neural-guided abduction, the clean take of our proposed compositional architecture easily extends to support other features found in past works, including program induction and domain-wide constraints. To our knowledge, a uniform handling of all these features is not present in past works. We empirically evaluate in what we believe to be a more comprehensive manner than typically found in the relevant literature the performance of our framework against three frameworks that share the same goals with ours: DEEPPROBLOG (Manhaeve et al. 2018), NEURASP (Yang, Ishay, and Lee 2020), and ABL (Dai et al. 2019). We demonstrate the superior performance of our framework both in terms of training efficiency and accuracy over a wide range of scenarios showing the features described above. Preliminaries For concreteness of exposition, and without excluding other syntax and semantics, we assume that the symbolic component encodes a logic theory using the standard syntax found in the abductive logic programming literature (Kakas 2017). As typical in logic programming, the language comprises a set of relational predicates that hold over variables or constants. An atom is a predicate with its arguments. A formula is defined as a logical expression over atoms, using the logical connectors of Prolog, e.g., conjunction, disjunction, negation. A theory is a collection of such formulas. Figure 1 shows a theory for determining the status of the game of a certain variant of chess played on a 3 3 board with three pieces: a black king, and two white pieces of different types. As far as our proposed architecture is concerned, the precise syntax and semantics of the theory are inconsequential. We will, therefore, not delve into a detailed analysis of the aforementioned theory T, except as needed to highlight certain features. What is of only importance is that T is accom- safe abduction symbolic-module theory 𝑇 loss function differentiation neural-module predictions safe :- placed(Z1), movable(Z1). draw :- placed(Z1), \+attacked(Z1), \+movable(Z1). mate :- placed(Z1), attacked(Z1), \+movable(Z1). placed(Z1) :- pos(Z1), at(b(k),Z1), pos(Z2), pos(Z3), Z2\=Z3, piece(w(P2)), at(w(P2),Z2), piece(w(P3)), at(w(P3),Z3). movable(Z1) :- pos(Z2), reached(Z2,k,Z1), \+attacked(Z2). attacked(Z2) :- pos(Z3), piece(w(P)), at(w(P),Z3), reached(Z2,P,Z3). reached((X,Y),k,(PX,PY)) :- abs(X,PX,DX), 1>=DX, abs(Y,PY,DY), 1>=DY, sum(DX,DY,S), 0