<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>When to Reason in Neuro-Symbolic Inference</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Cristina Cornelio</string-name>
          <email>c.cornelio@samsung.com</email>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Jan Stuehmer</string-name>
          <email>jan.stuehmer@h-its.org.com</email>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Shell Xu Hu</string-name>
          <email>shell.hu@samsung.com</email>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Timothy Hospedales</string-name>
          <email>t.hospedales@samsung.com</email>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="editor">
          <string-name>Neuro-symbolic AI, Constraints in NNs, Reinforcement learning</string-name>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Samsung AI</institution>
          ,
          <addr-line>Cambridge</addr-line>
          ,
          <country country="UK">UK</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>Work done while at Samsung AI</institution>
          ,
          <addr-line>Cambridge</addr-line>
          ,
          <country country="UK">UK</country>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2023</year>
      </pub-date>
      <abstract>
        <p>The imposition of hard constraints on the output of neural networks is a highly desirable capability, as it instills confidence in AI by ensuring that neural network predictions adhere to domain expertise. This area has received significant attention recently, however, current methods typically enforce constraints in a ”weak” form during training, with no guarantees at inference, and do not provide a general framework for diferent tasks/constraint types. We approach this open problem from a neuro-symbolic perspective. Our method enhances a conventional neural predictor with a reasoning module that can correct predictions errors and a neural attention module that learns to focus the reasoning efort on potential prediction errors while leaving other outputs unchanged. This framework provides a balance between the eficiency of unconstrained neural inference and the high cost of exhaustive reasoning during inference.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>when
and where to reason in order to efectively achieve high prediction accuracy and constraint
satisfaction with low computation cost.</p>
      <p>The Method.</p>
      <p>We introduce a new neuro-symbolic integration method with a novel
neuralattention module (Mask-Predictor) that works with any type of constraints/rules. More formally,
we consider a set of input data points ( ∈</p>
      <p>) representing instances to solve (e.g. the picture
of a partially filled Sudoku board), and, a set of multi-dimensional output data points (  ∈ 
)
that correspond to complete interpretable (symbolic) solutions (e.g. the symbolic representation
of a completely filled Sudoku board). The collection of  of these pairs of data points will
form the task dataset  = {
 ,   }</p>
      <p>=1 . Moreover, we require that the task (e.g. completing a
partially filled Sudoku board) can be expressed (fully or partially) by a set of rules
ℛ in the
Italy
form of domain-knowledge constraints (e.g. the rules of the Sudoku game). The goal is to learn
a function  ∶  →  associating a solution to a given input instance, and which satisfies the
rules ℛ. To solve this class of problems, we propose NASR, a neuro-symbolic pipeline that works
as follows: an input instance is first processed by the Neuro-Solver that outputs an approximate
solution. The solution is then analyzed by the Mask-Predictor that has the role of identifying the
components of the Neuro-Solver predictions that do not satisfy the set of domain-knowledge
constraints/rules ℛ. The masking output of the Mask-Predictor is then combined with the
probability distribution predicted by the Neuro-Solver. This is done by deleting the wrong
elements of the predictions, leaving the corresponding components “empty” (the component is
iflled by an additional class, indicating a masked element). This masked probability distribution
is then fed to the Symbolic-Solver that fills the gaps with a feasible solution (satisfying the rules
ℛ). In brief, the role of the Symbolic-Solver is to correct the Neuro-Solver prediction errors
identified by the Mask-Predictor.</p>
      <p>
        Results. We tested NASR on two tasks: Visual-Sudoku (given an image of a incomplete Sudoku
board, the goal is to provide a complete symbolic solution) and Predicate Classification ( PredCl,
given in input labeled and localized bounding boxes of a set of objects in an image, the goal is
to predict the correct predicate between them). (1) Visual Sudoku. We first compared NASR
with diferent baselines: a Symbolic Baseline that executes a Symbolic-Solver after converting
the input image to a symbolic form; two state-of-the-art neuro-symbolic methods: NeurASP [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]
and SatNet [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ]; and the integration of the latter into NASR (SatNet+NASR). The results show that
we generally outperform all the other methods and that SatNet performance can be improved
(sometimes substantially) by injecting hard constraints via the integration with NASR. We also
proved that NASR is more robust to noise compared to the Symbolic-Baseline and established
that NASR is the most eficient method in terms of computational time vs performance when
compared to the other approaches. (2) PredCl. We tested NASR on the GQA dataset (a
balanced version of Visual Genome), considering a simple domain-range ontology. We compare
against a purely neural baseline [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ] and considered the percentage of the max achievable
improvement defined by an intractable baseline, consisting of running a probabilistic symbolic
solver directly on the output of the neural baseline model. The results show that NASR achieves
good performance, and is able to recover the majority of the recoverable errors, leading to a
improvement between 1% and 2%.
      </p>
      <p>To conclude, we presented a neuro-symbolic method that aims to eficiently satisfy
domainknowledge constraints at inference. This enables a favourable trade-of between accurate
predictions, noise robustness, and computation cost. Our framework is generic and can be
applied to diferent types of input (image, text, etc.) and constraints type (logic, arithmetic, etc.).</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>C.</given-names>
            <surname>Cornelio</surname>
          </string-name>
          et al.
          <article-title>Learning where and when to reason in neuro-symbolic inference</article-title>
          ,
          <source>In Proc. of The 11th International Conference on Learning Representations (ICLR)</source>
          ,
          <year>2023</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>Z.</given-names>
            <surname>Yang</surname>
          </string-name>
          et al.
          <article-title>NeurASP: Embracing neural networks into answer set programming</article-title>
          .
          <source>IJCAI</source>
          ,
          <year>2020</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>P.W.</given-names>
            <surname>Wang</surname>
          </string-name>
          et al.
          <article-title>Satnet: Bridging deep learning and logical reasoning using a diferentiable satisfiability solver</article-title>
          . ICML,
          <year>2019</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>B.</given-names>
            <surname>Knyazev</surname>
          </string-name>
          et al.
          <article-title>Graph density-aware losses for novel compositions in scene graph generation</article-title>
          .
          <source>BMVC</source>
          ,
          <year>2020</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>