<!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>
      <issn pub-type="ppub">1613-0073</issn>
    </journal-meta>
    <article-meta>
      <title-group>
        <article-title>Active Learning in Neurosymbolic AI with Embed2Sym</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Alexander Philipp Rader</string-name>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Alessandra Russo</string-name>
          <email>a.russo@ic.ac.uk</email>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Imperial College London</string-name>
        </contrib>
      </contrib-group>
      <abstract>
        <p>Neurosymbolic AI combines neural networks with symbolic reasoners in an efort to create robust and logical machine learning frameworks. In one approach, a neural component processes raw data and outputs latent concepts. A symbolic component then conducts logical reasoning with the concepts to produce the final result. A major hurdle lies in the propagation of the end label signal to the latent space when no latent labels are available. We investigate the use of active learning to alleviate this problem. In particular, we consider the neurosymbolic framework Embed2Sym. We adapt the learning framework to incorporate active learning by gaining a latent learning signal for misclassified examples. An oracle, such as a human in the loop, provides latent labels, which are used to finetune the neural component. Using the same benchmark datasets as the original paper, we empirically evaluate our method. We demonstrate that even a small amount of labelled latent data leads to a sizeable increase in accuracy.</p>
      </abstract>
      <kwd-group>
        <kwd>Neurosymbolic AI</kwd>
        <kwd>active learning</kwd>
        <kwd>human-in-the-loop</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>CEUR
ceur-ws.org</p>
    </sec>
    <sec id="sec-2">
      <title>1. Introduction</title>
      <p>
        Neurosymbolic AI aims to combine the robustness of neural networks to real-world data with
the explainability and provable correctness of symbolic reasoners [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]. A particular stream is
known as ”[Neuro → Symbolic]” [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ] and is reminiscent of the two-system model of the human
mind [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ]. The neural network represents system 1 and processes raw inputs to produce latent
concepts. The symbolic component then logically reasons over the concepts, such as in system
2, to solve the given problem.
      </p>
      <p>
        One such framework is Embed2Sym [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ]. It consists of a neural network that transforms raw
inputs into embeddings, a clustering algorithm that assigns them categories, and a symbolic
optimiser based on answer set programming (ASP), that solves a logical task. One of the biggest
challenges for Embed2Sym, and [Neuro → Symbolic] architectures in general, is training the
neural component without labels for the intermediate representations.
      </p>
      <p>
        In this paper, we propose to mitigate this problem by providing latent signals using active
learning, which allows the system to ask an oracle to annotate datapoints [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ]. We extend
Embed2Sym to incorporate active learning for incorrectly classified examples. We investigate
the efect in three tasks: MNIST addition, CIFAR10 addition, and Member. Despite providing
only a small percentage of latent labels, we attain substantial accuracy improvements.
CEUR
Workshop
Proceedings
      </p>
      <p>© 2023 Copyright for this paper by its authors. Use permitted under Creative Commons License Attribution 4.0 International (CC BY 4.0).</p>
    </sec>
    <sec id="sec-3">
      <title>2. Background</title>
      <sec id="sec-3-1">
        <title>2.1. Task formulation</title>
        <p>Each task contains raw and symbolic inputs and labels representing the result of a downstream
operation. For example, in MNIST Addition the input consists of images of two numbers and
the output equates to their sum. Crucially, no labels are provided for the intermediate, called
latent, representations. In our example, there are no labels for the numbers themselves, only
their sum.</p>
      </sec>
      <sec id="sec-3-2">
        <title>2.2. Embed2Sym</title>
        <p>
          The Embed2Sym framework contains a neural perception component and a symbolic reasoning
component. The system works in three stages: [
          <xref ref-type="bibr" rid="ref4">4</xref>
          ]
1. Fully neural model: A neural network is trained end-to-end on the downstream task.
        </p>
        <p>It is a two-stage architecture containing a perception and a reasoning component, both
of which are neural. Each input is processed by the perception network which creates
embedding vectors. The reasoning network processes the concatenated embeddings to
output the predicted label.
2. Cluster discovery The k-means algorithm divides the embedding space created by the
perception network into clusters. The number of clusters is predetermined.
3. Cluster labelling An ASP algorithm assigns each cluster their symbolic meaning by
means of an optimisation task. It utilises a hard-coded symbolic component to compute
the downstream result from the latent concepts.</p>
        <p>Perception
network</p>
        <p>Perception</p>
        <p>network
Cluster
label
1</p>
        <p>Cluster
label</p>
        <p>3
P
y</p>
        <p>At inference time, the algorithm works in three steps, as illustrated on the left side in Figure 1.
First, the neural perception network turns the inputs into embeddings ⃗ . Second, the clustering
assigns each embedding a symbolic label. Third, the hard-coded symbolic reasoning component
 calculates the end result.</p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>3. Active Embed2Sym</title>
      <p>The neural component in Embed2Sym generates embeddings of the latent concepts, for which
it has no labels. Instead, it uses downstream labels for training, which is a more dificult task.
The core idea of this paper is to finetune the neural network with latent labels after it has been
trained end-to-end. We acquire the latent labels from two sources, as shown in Figure 1:
1. For all examples with a correct end prediction, we assume that the predicted latent
concepts are correct as well. Therefore, we can use the cluster labels from the trained
perception networks. This represents the vast majority of examples.
2. For all examples with an incorrect end prediction, we ask an oracle for the corresponding
latent labels. We refer to these as active labels. For complex tasks, the oracle is typically
a human in the loop. In our case, we can use existing labels for MNIST and CIFAR10
images.</p>
      <p>Since the last layer in the original framework uses k-means clustering, it is not diferentiable.
Therefore, we replace the clustering layer with a multi-layer-perceptron, indicated by the green
boxes labelled ”dense layer”.</p>
    </sec>
    <sec id="sec-5">
      <title>4. Results</title>
      <p>
        We assess the efect of our extension by performing the tasks outlined in the original paper:
MNIST and CIFAR10 addition, as well as Member. In the first two tasks, the inputs consist of
images representing numbers and the output indicates their sum. In the member task, the input
consists of an MNIST image and a list of numbers. The output is a binary variable indicating
whether the number is a member of the list. [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ]
      </p>
      <p>We investigate two main questions:
1. What proportion of labels needs to be obtained by an oracle?
2. Does active learning improve the accuracy of the results?</p>
      <p>We conducted each experiment for five independent runs and show the average scores and
their standard deviations.</p>
      <sec id="sec-5-1">
        <title>4.1. Proportion of active labels</title>
        <p>Even though the latent labels for these specific tasks are easy to come by, calls to oracles are
generally very expensive. Therefore, we need to evaluate our results in light of the percentage
of active labels utilised.</p>
        <p>Table 1 presents the number of active labels used for each task, as well as their proportion
of the dataset. In each case, the percentages remain below 5%. We conclude that the number
of necessary labels are feasible to obtain and the added efort is justifiable to achieve better
accuracies.</p>
      </sec>
      <sec id="sec-5-2">
        <title>4.2. Experimental results</title>
        <p>Figure 2 shows the learning curves while finetuning the neural component for MNIST addition
with 15 digits. The baseline is the accuracy achieved from the fully trained original framework.
The extended model surpasses the baseline within a few number of epochs. The test accuracies
are on average significantly higher than the baseline, with only one run being slightly below.
Similar results occur for MNIST additions with a lower number of digits, as well as CIFAR10
addition, albeit not as pronounced.</p>
        <p>In Member, the accuracy already surpasses the baseline after only round of training (epoch 0),
as Figure 3 illustrates on the left. Interestingly, the accuracy starts to decline again after epoch
8. The graph on the right indicates that the model is overfitting, as the train and validation
curves diverge. Further investigation reveals that 5.9% of incorrect latent labels were missed
during the active labelling, because the downstream label was correct for them.</p>
        <p>
          The nature of the member task facilitates correct end predictions despite wrong latent
predictions in two major ways: First, the label is binary, so a random guess can achieve an
accuracy of 50%. Second, most digits in each input list are irrelevant for the task. For example,
let the list be [
          <xref ref-type="bibr" rid="ref5">0,8,5</xref>
          ] and the digit be 2. It does not matter whether any numbers in the list are
misclassified, unless as a 2, the answer of ”No” is still correct.
1. Active learning improved the accuracy in every task while requiring only a small
percentage of oracle-annotated labels.
2. Active learning is most efective when there is more room for improvement. The greatest
accuracy increase occurred on the dataset with the lowest baseline, MNIST 15.
3. False positives are an issue when the downstream labels are forgiving to mistakes in the
latent space. This was the case in the Member tasks, where incorrect digit classifications
often did not afect the outcome.
        </p>
      </sec>
    </sec>
    <sec id="sec-6">
      <title>5. Conclusion</title>
      <p>
        Active learning shows some promising results in our experiments. Providing a stronger signal
in the latent space helped achieve a better performance, especially when the baseline had room
for improvement. This work represents a first step towards investigating active learning in
neurosymbolic AI. Future work includes extending other frameworks, such as [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ], and solving
more complex tasks. Using tasks that require human labelling will be able to demonstrate the
wider impact of our proposal. Furthermore, we aim to use active learning also for symbolic rule
learning. Embed2Sym hard-codes the rules, but for other frameworks we need to devise ways
of providing active labels for them.
This work was supported by UK Research and Innovation [grant number EP/S023356/1],
in the UKRI Centre for Doctoral Training in Safe and Trusted Artificial Intelligence ( www.
safeandtrustedai.org).
      </p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>A.</given-names>
            <surname>Garcez</surname>
          </string-name>
          , L. Lamb,
          <article-title>Neurosymbolic ai: the 3rd wave</article-title>
          ,
          <source>Artificial Intelligence Review</source>
          (
          <year>2023</year>
          )
          <fpage>1</fpage>
          -
          <lpage>20</lpage>
          . doi:
          <volume>10</volume>
          .1007/s10462- 023- 10448- w.
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>M. K.</given-names>
            <surname>Sarker</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Zhou</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Eberhart</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Hitzler</surname>
          </string-name>
          ,
          <source>Neuro-symbolic artificial intelligence: Current trends</source>
          ,
          <year>2021</year>
          . arXiv:
          <volume>2105</volume>
          .
          <fpage>05330</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>D.</given-names>
            <surname>Kahneman</surname>
          </string-name>
          , Thinking, fast and slow, Farrar, Straus and Giroux, New York,
          <year>2011</year>
          . URL: https://www.amazon.de/Thinking-Fast-Slow-Daniel-Kahneman/dp/0374275637/ref= wl_it_dp_
          <article-title>o_pdT1_nS_nC?ie=UTF8&amp;colid=151193SNGKJT9&amp;coliid=I3OCESLZCVDFL7.</article-title>
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>Y.</given-names>
            <surname>Aspis</surname>
          </string-name>
          ,
          <string-name>
            <given-names>K.</given-names>
            <surname>Broda</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Lobo</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Russo</surname>
          </string-name>
          ,
          <fpage>Embed2Sym</fpage>
          - Scalable
          <string-name>
            <surname>Neuro-Symbolic Reasoning</surname>
          </string-name>
          via Clustered Embeddings,
          <source>in: Proceedings of the 19th International Conference on Principles of Knowledge Representation and Reasoning</source>
          ,
          <year>2022</year>
          , pp.
          <fpage>421</fpage>
          -
          <lpage>431</lpage>
          . URL: https://doi.org/10. 24963/kr.2022/44. doi:
          <volume>10</volume>
          .24963/kr.2022/44.
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>E.</given-names>
            <surname>Mosqueira-Rey</surname>
          </string-name>
          ,
          <string-name>
            <given-names>E.</given-names>
            <surname>Hernández-Pereira</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Alonso-Ríos</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Bobes-Bascarán</surname>
          </string-name>
          ,
          <string-name>
            <surname>A.</surname>
          </string-name>
          <article-title>FernándezLeal, Human-in-the-loop machine learning: a state of the art</article-title>
          ,
          <source>Artificial Intelligence Review</source>
          <volume>56</volume>
          (
          <year>2022</year>
          ). doi:
          <volume>10</volume>
          .1007/s10462- 022- 10246- w.
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>E.</given-names>
            <surname>Tsamoura</surname>
          </string-name>
          ,
          <string-name>
            <given-names>T.</given-names>
            <surname>Hospedales</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Michael</surname>
          </string-name>
          ,
          <article-title>Neural-symbolic integration: A compositional perspective</article-title>
          ,
          <source>Proceedings of the AAAI Conference on Artificial Intelligence</source>
          <volume>35</volume>
          (
          <year>2021</year>
          )
          <fpage>5051</fpage>
          -
          <lpage>5060</lpage>
          . URL: https://ojs.aaai.org/index.php/AAAI/article/view/16639. doi:
          <volume>10</volume>
          .1609/aaai.v35i6.
          <fpage>16639</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>D.</given-names>
            <surname>Cunnington</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Law</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Lobo</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Russo</surname>
          </string-name>
          ,
          <article-title>Neuro-symbolic learning of answer set programs from raw data</article-title>
          ,
          <year>2023</year>
          . arXiv:
          <volume>2205</volume>
          .
          <fpage>12735</fpage>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>