<!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>Addressing the Symbol Grounding Problem with Constraints in Neuro-Symbolic Planning</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Aymeric Barbin</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
          <xref ref-type="aff" rid="aff2">2</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Federico Cerutti</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff2">2</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Alfonso Emilio Gerevini</string-name>
          <xref ref-type="aff" rid="aff2">2</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Cardif University</institution>
          ,
          <country country="UK">UK</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>Sapienza Università di Roma</institution>
          ,
          <country country="IT">Italy</country>
        </aff>
        <aff id="aff2">
          <label>2</label>
          <institution>Università degli Studi di Brescia</institution>
          ,
          <country country="IT">Italy</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>In this paper, we address the Symbol Grounding Problem (SGP) in the context of neuro-symbolic planning, where the categorical vectors learned to represent high dimensional inputs sufer from instability, which poses a problem of eficiency during the planning phase. One way to alleviate the SGP is to enforce constraints - among the latent variables - by expressing them in the loss function during the learning process. Combining an existing tool for invariant search and ideas from Logic Tensor Networks (fuzzy logic), we propose to automatize the process of finding and enforcing relevant constraints. We apply our idea to LatPlan, a domain independent, image-based classical planner.</p>
      </abstract>
      <kwd-group>
        <kwd>eol&gt;Neuro-Symbolic Planning</kwd>
        <kwd>Symbol Grounding Problem</kwd>
        <kwd>Action Model Learning</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>
        The core interest of Domain-Independent Planning [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] is developing general-purpose algorithms
and systems that can solve planning problems independently of any specific knowledge of the
latter. A planning problem can be specified using the Planning Domain Description Language
(PDDL) [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ] in terms of a symbolic description of the states and actions composing the domain,
and initial state, and a goal.
      </p>
      <p>
        When the states of the problem are only available as sub-symbolic data (e.g., images),
generating a PDDL description necessarily needs to address the Symbol Grounding Problem (SGP) [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ]
which refers to the case where two diferent inputs (e.g., images) grounding the same symbol
(e.g., digit "1") have diferent vector representations, revealing a lack of generalisation power.
      </p>
      <p>
        LatPlan [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ] is a neuro-symbolic architecture for planning proposed to address the bottleneck
of PDDL construction from raw input data. It leverages Deep Learning to learn the PDDL
description from a set of unlabeled pairs of transition images. More specifically, it uses variational
autoencoders (VAE) [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ] to learn and generate categorical vector representations of the images
(states) and of the transitions between them (actions), which are then used to generate the
PDDL. LatPlan is also endowed with tools that alleviate the SGP of these representations, which
can be assessed by measuring their variance on perturbed input.
      </p>
      <p>Another way to address the SGP is to enforce constraints on the categorical vectors. If we
consider a vector  as an ideally grounded symbol and its unstable version ′, then ′ contains
some noise, i.e. variables with undesired values. If we know appropriate constraints to apply
during training, the noisy representation corresponding to ′ should converge to .</p>
      <p>
        In this paper, we propose to use an automatic tool to look for invariants in the PDDL generated
by LatPlan and to test their incidence on the learning by expressing them as an auxiliary loss
term. To do so, we borrow ideas from Logic Tensor Networks (LTN) [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ], where this additional
loss is created using the t-norm fuzzy logic [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ]. In Section 2, we provide background on LatPlan,
invariants, and fuzzy logic, then, in Section 3, we discuss our proposed solution to integrate the
search for constraints into the training loop.
      </p>
    </sec>
    <sec id="sec-2">
      <title>2. Background</title>
      <sec id="sec-2-1">
        <title>2.1. LatPlan</title>
        <p>LatPlan is a neuro-symbolic architecture that receives pairs of images representing transitions
and learns categorical vector representations from them. Once trained, it can generate a PDDL
representation of the states and actions of the problem, which can be input to a planner.</p>
        <p>For our work, we are interested in improving the learning of two components of LatPlan, the
State AutoEncoder network (SAE), which learns to represent images as categorical vectors, and
the Action Model Acquisition network (AMA), which learns to represent actions as categorical
vectors representing preconditions and efects. These two models are learned end-to-end from a
dataset of pairs of images, each pair representing a valid transition occurring in the sub-symbolic
world (e.g. the switching of a tile in the case of 8-puzzle).</p>
        <p>The SAE learns a bi-directionnal mapping between sub-symbolic raw data  and propositional
states  ∈ {0, 1} (with  being the number of variables in the categorical vector). Concretely,
it consists of the encoder and the decoder of a VAE that learns DECODE(ENCODE()) = .</p>
        <p>The AMA model consists of three networks: ACTION, APPLY and REGRESS. ACTION
learns to associate two consecutive states (returned by the SAE) to an action (expressed as a
one-hot vector). APPLY learns to predict the next categorical state from the previous one and
an action. REGRESS is symmetric of APPLY and learns to predict backwards the previous
state from the next one and from the action.</p>
        <p>The SAE, APPLY and REGRESS networks all output binary categorical vectors of the same
size as the SAE’s output. Each element of these vectors is interpreted as a binary variable and is
represented by a unary predicate in the PDDL files generated by LatPlan. This representation is
negatively afected by the SGP, as it can break the identity assumption inherent to symbolic
reasoning algorithms — in which a state must not change — and can cause disconnections during
the search process, i.e. if two states exist that should represent the same state, an action might
lead to one of them but not to the other, the latter would then be a dead end.</p>
        <p>To address this issue, the authors of LatPlan propose two solutions. First, at test time,
they replace the sampling of the categorical vector with an argmax layer, therefore removing
stochasticity. Second, during training, they select a version of the prior distribution for the
sampling (of the categorical vector) that favours sparsity of truthiness among the binary variables.
This leads to more stable latent state vectors, and showed improved performances of the model
in terms of next-state prediction accuracy (APPLY network) and planning performances. In
our work, we are mainly interested in stabilizing the latent states vectors, generated by the SAE
network; to assess it, we use the same metric as in LatPlan paper, i.e. the State Variance. To
compute it, we use the state variance for noisy input, i.e., the variance of the latent vectors :
,0 =  (,0 + )
where:
•  ∼  ( = 0,  = 0.3)
• ,0 : 1 image of the ℎ transition pair of the dataset</p>
        <p>The State Variance is computed by iterating over 10 random vectors, then averaged over F
bits in the latent space and over the dataset indexed by i. Formally:</p>
        <p>E∈0... E Var ∈0..10[ENCODE(,0,  ) ]
(1)</p>
      </sec>
      <sec id="sec-2-2">
        <title>2.2. Invariants and constraints in planning</title>
        <p>
          In classical planning, an invariant is defined as a logical formula over variables of the domain
which is true in any reachable state [
          <xref ref-type="bibr" rid="ref8">8</xref>
          ]. Invariants can be seen as hidden but logical properties
of the domain, and can also be termed as state constraints. In LatPlan, we can enforce them in
learning the SAE and AMA networks.
        </p>
        <p>
          An important part of the research in classical planning focuses on discovering invariants
in planning domains. Today, automatic tools [
          <xref ref-type="bibr" rid="ref9">9</xref>
          ] [
          <xref ref-type="bibr" rid="ref10">10</xref>
          ] already exist that can find a variety of
invariants, such as predicate domain invariants (i.e., in the efect of an action), static invariants
on predicates (ones that are unafected by any operator), simple implicative invariants (e.g., if
1 → 2), mutually exclusive invariant (e.g., ¬1 ∨ ¬2), etc.
        </p>
      </sec>
      <sec id="sec-2-3">
        <title>2.3. Logic Tensor Networks and Fuzzy logic</title>
        <p>
          Extensive work on integrating logical constraints during the training of neural networks have
been conducted in the last few years. Notably, one can express constraints among neural
networks outputs taken as predicates thanks to t-norm operations and the fuzzy generalisation
of First Order Logic (FOL) [
          <xref ref-type="bibr" rid="ref11">11</xref>
          ] [
          <xref ref-type="bibr" rid="ref7">7</xref>
          ].
        </p>
        <p>For example, if we want to express the truth value of ¬1 ∨ ¬2, we can compute it by its
average over the dataset, i.e.,
1</p>
        <p>∑︁ (1 −  (1)) + (1 −  (2))
|| 1,2∈
(2)
where  (1) is the (continuous) value of truth of one grounding of “1 is true”, and  is the set
of all the groundings. The inverse of this value can be directly appended as a penalty to the loss
function, which eventually forces the network to re-adapt its weights to this new constraint.</p>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>3. Automatically finding and enforcing relevant invariant candidates</title>
      <p>We first discuss how we intend to search for invariants of interest among LatPlan binary
variables with the help of an automatic tool; then, we discuss how to enforce these invariants
during training and we give details about integrating the search in the training loop.</p>
      <sec id="sec-3-1">
        <title>3.1. Searching for invariants of interest</title>
        <p>
          Automatic tools, like Fast Downward (FD) [
          <xref ref-type="bibr" rid="ref10">10</xref>
          ] and DISCOPLAN [
          <xref ref-type="bibr" rid="ref9">9</xref>
          ], can find invariants in the
PDDL representation outputted by LatPlan using invariant synthesis . But, since LatPlan learns
the PDDL by statistical inference, there is no guarantee that any of the invariants found in the
PDDL maps to the ground truth invariants, i.e., to invariants of the (unknown) ground truth
PDDL domain. For example if 1 → 2 is returned by FD as an invariant, but 1 is true only
once in the whole dataset, it’s possible that 1 → 2 would be false if we had more data with 1
being true. Thus, in our work we consider the invariants computed by an invariants generation
tool (on LatPlan PDDL) as a set of probable invariants that we intend to test.
        </p>
      </sec>
      <sec id="sec-3-2">
        <title>3.2. Applying the constraints</title>
        <p>In Latplan, internal categorical representations are continuous vectors from which elements
converge to binary values during training. At each batch, we can compute the truth value —
thanks to fuzzy logic — of any constraint, expressed as a logical forumula, over these binary
variables, for instance “1 is true.” Then, by taking the inverse of this value and multiplying it by
a normalizing factor, we obtain an additional loss that we can append to the total loss. This way,
the network will adapt its weights through backpropagation to comply with the constraint.</p>
      </sec>
      <sec id="sec-3-3">
        <title>3.3. Augmenting the training loop with a search over invariants</title>
        <p>
          Our idea is to integrate an automatic invariant finder in the learning process of LatPlan. More
precisely, we want to perform a search — similar to a hyperparameter search — on the invariants.
Further details can be find in Appendix A. The implementation of this loop builds upon the
t-norm like functions that already exist in Tensorflow [
          <xref ref-type="bibr" rid="ref12">12</xref>
          ] and the possibility to customize the
training loop in Keras [
          <xref ref-type="bibr" rid="ref13">13</xref>
          ], LatPlan being coded with both of them.
        </p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>4. Conclusions and Future Work</title>
      <p>We discussed the idea of combining an automatic invariants finder with fuzzy logic to progress
in solving the SGP that afects the latent representations of a neuro-symbolic architecture
(LatPlan). More precisely, the invariants found by the automatic tool are probable invariants
since the PDDL they are issued from is learned by statistical inference - and we want to enforce
them during training. If they bring a lower state variance, it is probable that they correspond
to ground true invariants. The goal is to automatically find invariants that are responsible for
more state stability. We are now implementing the search loop introduced in Section 3.</p>
    </sec>
    <sec id="sec-5">
      <title>A. The proposed augmented training loop</title>
      <p>This augmented training loop, GreedyConstraintTraining, is illustrated in Algorithm 1, which
uses the following auxiliary functions:
• LatPlan, which is a function that embeds the training process of LatPlan: it receives as
input a training set, a set of propositional formulae to embed in the loss function, and
outputs the learned functions and action descriptions as binary vectors;
• Vecs2Pddl transforms the action descriptions learned by LatPlan into PDDL format;
• Pddl2Inv is a function that returns a set of invariants of a planning problem in the PDDL
format provided in the input. An example is the invariant finder of Fast Downward;
• MetricEval receives as input the learned functions and action descriptions of LatPlan and
outputs a score value: the higher the score value, the better. In our case, it is the inverse
of the State Variance given in Formula 1 (in this case only the SAE function of LatPlan is
needed).
• PickAnInvariant is a heuristic that identifies the most promising invariant in a set; for
instance an invariant with the less number of variables (because it has a higher probability
to be a ground true invariant compared to one with more variables).</p>
      <p>Algorithm 1 Our proposed GreedyConstraintTraining approach, which receives as input a
training set tSet , and returns Ω , the invariants which improve on a chosen metric
1: Ω ← ∅
2: LPModel ← LatPlan(tSet , ∅)
3: Φ ← Pddl2Inv(Vecs2Pddl(LPModel ))
4: score ← MetricEval(LPModel )
5: while Φ ̸= ∅ do
6:  ← PickAnInvariant(Φ)
7: Φ ← Φ ∖ {}
8: LPModel ′ ← LatPlan(tSet , Ω ∪ {})
9: if MetricEval(LPModel ′) &gt; score then
10: Ω ← Ω ∪ {}
11: Φ ← Φ ∪ Pddl2Inv(Vecs2Pddl(LPModel ′))
12: score ← MetricEval(LPModel ′)
13: end if
14: end while
15: return Ω</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>D. E.</given-names>
            <surname>Wilkins</surname>
          </string-name>
          ,
          <article-title>Domain-independent planning representation and plan generation</article-title>
          ,
          <source>Artificial Intelligence</source>
          <volume>22</volume>
          (
          <year>1984</year>
          )
          <fpage>269</fpage>
          -
          <lpage>301</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>P.</given-names>
            <surname>Haslum</surname>
          </string-name>
          ,
          <string-name>
            <given-names>N.</given-names>
            <surname>Lipovetzky</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Magazzeni</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Muise</surname>
          </string-name>
          ,
          <article-title>An introduction to the planning domain definition language</article-title>
          ,
          <source>Synthesis Lectures on Artificial Intelligence and Machine Learning</source>
          <volume>13</volume>
          (
          <year>2019</year>
          )
          <fpage>1</fpage>
          -
          <lpage>187</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>M.</given-names>
            <surname>Taddeo</surname>
          </string-name>
          , L. Floridi,
          <article-title>Solving the symbol grounding problem: a critical review of fifteen years of research</article-title>
          ,
          <source>Journal of Experimental &amp; Theoretical Artificial Intelligence</source>
          <volume>17</volume>
          (
          <year>2005</year>
          )
          <fpage>419</fpage>
          -
          <lpage>445</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>M.</given-names>
            <surname>Asai</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Fukunaga</surname>
          </string-name>
          ,
          <article-title>Classical planning in deep latent space: Bridging the subsymbolicsymbolic boundary</article-title>
          ,
          <source>in: Proceedings of the aaai conference on artificial intelligence</source>
          , volume
          <volume>32</volume>
          ,
          <year>2018</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>D. P.</given-names>
            <surname>Kingma</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Welling</surname>
          </string-name>
          , et al.,
          <article-title>An introduction to variational autoencoders</article-title>
          ,
          <source>Foundations and Trends® in Machine Learning</source>
          <volume>12</volume>
          (
          <year>2019</year>
          )
          <fpage>307</fpage>
          -
          <lpage>392</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>S.</given-names>
            <surname>Badreddine</surname>
          </string-name>
          , A. d. Garcez,
          <string-name>
            <given-names>L.</given-names>
            <surname>Serafini</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Spranger</surname>
          </string-name>
          ,
          <article-title>Logic tensor networks</article-title>
          ,
          <source>Artificial Intelligence</source>
          <volume>303</volume>
          (
          <year>2022</year>
          )
          <fpage>103649</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>L. A.</given-names>
            <surname>Zadeh</surname>
          </string-name>
          , Fuzzy logic,
          <source>Computer</source>
          <volume>21</volume>
          (
          <year>1988</year>
          )
          <fpage>83</fpage>
          -
          <lpage>93</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>V.</given-names>
            <surname>Alcázar</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Torralba</surname>
          </string-name>
          ,
          <article-title>A reminder about the importance of computing and exploiting invariants in planning</article-title>
          ,
          <source>in: Proceedings of the International Conference on Automated Planning and Scheduling</source>
          , volume
          <volume>25</volume>
          ,
          <year>2015</year>
          , pp.
          <fpage>2</fpage>
          -
          <lpage>6</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>A.</given-names>
            <surname>Gerevini</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L. K.</given-names>
            <surname>Schubert</surname>
          </string-name>
          ,
          <article-title>Discovering state constraints in discoplan: Some new results</article-title>
          ,
          <source>in: AAAI/IAAI</source>
          ,
          <year>2000</year>
          , pp.
          <fpage>761</fpage>
          -
          <lpage>767</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <given-names>M.</given-names>
            <surname>Helmert</surname>
          </string-name>
          ,
          <article-title>Concise finite-domain representations for pddl planning tasks</article-title>
          ,
          <source>Artificial Intelligence</source>
          <volume>173</volume>
          (
          <year>2009</year>
          )
          <fpage>503</fpage>
          -
          <lpage>535</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11]
          <string-name>
            <given-names>P.</given-names>
            <surname>Hájek</surname>
          </string-name>
          ,
          <article-title>Metamathematics of fuzzy logic</article-title>
          , volume
          <volume>4</volume>
          ,
          <string-name>
            <surname>Springer</surname>
            <given-names>Science</given-names>
          </string-name>
          &amp; Business
          <string-name>
            <surname>Media</surname>
          </string-name>
          ,
          <year>2013</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [12]
          <string-name>
            <given-names>M.</given-names>
            <surname>Abadi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Barham</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Chen</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Z.</given-names>
            <surname>Chen</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Davis</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Dean</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Devin</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Ghemawat</surname>
          </string-name>
          , G. Irving,
          <string-name>
            <given-names>M.</given-names>
            <surname>Isard</surname>
          </string-name>
          , et al., {TensorFlow}
          <article-title>: a system for {Large-Scale} machine learning</article-title>
          ,
          <source>in: 12th USENIX symposium on operating systems design and implementation (OSDI 16)</source>
          ,
          <year>2016</year>
          , pp.
          <fpage>265</fpage>
          -
          <lpage>283</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          [13]
          <string-name>
            <given-names>F.</given-names>
            <surname>Chollet</surname>
          </string-name>
          , et al.,
          <string-name>
            <surname>Keras</surname>
          </string-name>
          , https://keras.io,
          <year>2015</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>