<!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>Designing Logic Tensor Networks for Visual Sudoku puzzle classification</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Lia Morra</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Alberto Azzari</string-name>
          <xref ref-type="aff" rid="aff3">3</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Letizia Bergamasco</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Marco Braga</string-name>
          <xref ref-type="aff" rid="aff2">2</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Luigi Capogrosso</string-name>
          <xref ref-type="aff" rid="aff3">3</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Federico Delrio</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Giuseppe Di Giacomo</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Simone Eiraudo</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Giorgia Ghione</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Rocco Giudice</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Alkis Koudounas</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Luca Piano</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Daniele Rege Cambrin</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Matteo Risso</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Marco Rondina</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Alessandro Sebastien Russo</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Marco Russo</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Francesco Taioli</string-name>
          <xref ref-type="aff" rid="aff3">3</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Lorenzo Vaiani</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Chiara Vercellino</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>LINKS Foundation</institution>
          ,
          <addr-line>Torino</addr-line>
          ,
          <country country="IT">Italy</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>Politecnico di Torino</institution>
          ,
          <addr-line>Torino</addr-line>
          ,
          <country country="IT">Italy</country>
        </aff>
        <aff id="aff2">
          <label>2</label>
          <institution>University of Milano-Bicocca</institution>
          ,
          <addr-line>Milano</addr-line>
          ,
          <country country="IT">Italy</country>
        </aff>
        <aff id="aff3">
          <label>3</label>
          <institution>University of Verona</institution>
          ,
          <addr-line>Verona</addr-line>
          ,
          <country country="IT">Italy</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>Given the increasing importance of the neurosymbolic (NeSy) approach in artificial intelligence, there is a growing interest in studying benchmarks specifically designed to emphasize the ability of AI systems to combine low-level representation learning with high-level symbolic reasoning. One such recent benchmark is Visual Sudoku Puzzle Classification, that combines visual perception with relational constraints. In this work, we investigate the application of Logic Tensork Networks (LTNs) to the Visual Sudoku Classification task and discuss various alternatives in terms of logical constraint formulation, integration with the perceptual module and training procedure.</p>
      </abstract>
      <kwd-group>
        <kwd>eol&gt;neuro-symbolic</kwd>
        <kwd>logic tensor networks</kwd>
        <kwd>visual reasoning</kwd>
        <kwd>benchmarks</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>
        In the past decade, deep learning (DL) has emerged as one of the most eficient ways to perform
inductive tasks, showing an elevated accuracy in building models for diferent domains, such
as computer vision, speech recognition, text understanding, etc. Purely data-driven strategies,
however, are not without shortcomings. The most obvious limitation arises when the available
data are not suficient to build efective and appropriately generalizing models. Additionally, it is
not possible to enforce compliance with limits imposed, for example, by natural laws, regulatory
requirements, or safety regulations that are critical to reliable AI [
        <xref ref-type="bibr" rid="ref1 ref2 ref3 ref4">1, 2, 3, 4</xref>
        ].
      </p>
      <p>
        To increase DL trustworthiness and generalizability, Neuro-Symbolic Artificial Intelligence
(NeSy) techniques seek to combine the benefits of knowledge representation and reasoning with
those of machine and deep learning [
        <xref ref-type="bibr" rid="ref3 ref5 ref6">5, 6, 3</xref>
        ]. Among such approaches, the Logic Tensor Network
(LTN) paradigm combines deep neural networks with first-order logic knowledge representation.
Briefly, LTNs use an infinitely-valued fuzzy logical language called Real Logic as the underlying
formalism, which consists of a first-order logic language whose signature consists of constant,
function and predicate symbols. To apply the framework to real-world problems, where there
is no complete certainty and formulas can be partially true, fuzzy semantics is adopted. In Real
Logic, the word grounding is used to emphasize that symbols are concretely interpreted by
tensors in the real field [
        <xref ref-type="bibr" rid="ref3 ref7">7, 3</xref>
        ].
      </p>
      <p>
        This article aims to explore the application of LTNs to the recently proposed Visual Sudoku
Puzzle Classification (ViSudo-PC) benchmark [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ]. Briefly, given a Sudoku puzzle constructed
from images as input, the classification task is to determine whether the puzzle is correctly solved,
without access to the labels of individual digits. It was previously shown that the performance of
a naive solution, that is classifying each digit using a Convolutional Neural Network (CNN) and
then applying Sudoku rules to determine whether the solution is correct, rapidly degrades when
the performance of the digit classifier is less than perfect [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ]. Performing well on the ViSudo-PC
benchmark thus requires systems that are able to reason about the perceptual information in
the images as well as the additional information from Sudoku constraints. The implementation
is available at https://github.com/MalumaDev/SymbolicSudoku.
      </p>
    </sec>
    <sec id="sec-2">
      <title>2. Methodology</title>
      <sec id="sec-2-1">
        <title>2.1. Puzzle construction</title>
        <p>A Sudoku “puzzle” or “board” consists of 9 × 9 grid, in which each cell is populated with digits
1–9. A puzzle is correctly solved if no row, column, or non-overlapping 3 × 3 subgrid (or “square”)
contains all the possible numbers without repetitions. The ViSudo-PC benchmark generalizes
the concept of Sudoku puzzles assuming that the board is a square of dimension  =  × 
(specifically, 4 × 4 and 9 × 9 grids are provided), and that symbols can come from arbitrary
domains. It includes four domains of increasing complexity: digits (MNIST), English letters
(EMNIST), fashion items (FashionMNIST), and Japanese characters (KMNIST). In the following,
we will refer for simplicity and without loss of generality to the symbols as digits.</p>
      </sec>
      <sec id="sec-2-2">
        <title>2.2. Common definitions</title>
        <p>In this section, definitions of all domains, variables, and predicates are provided. The function
D(⋅)associates each variable with the corresponding domain, and Din(⋅)each predicate with
the input domain.</p>
        <p>Domains:
• images, denoting the images that form the individual cells of the Sudoku puzzle, encoded
as 28 × 28 pixel maps,
• sudoku, denoting the image representing the Sudoku puzzle,
• results, denoting the Boolean value that indicates the validity of the Sudoku board,
• digits, denoting the digits from 0 to 9,
• coordinates, denoting the coordinates of each cell in a Sudoku puzzle.
Predicates:
• x ranging over the list of images [ 0,0, ...,  , , ...,  , ] associated to each Sudoku board,
where  , with  ∈ [0,  − 1] ,  ∈ [0,  − 1] are the images at position (, ) , with D( , ) =
images;
• d ranging over the list of digits [ 0,0, ...,  , , ...,  , ] associated to each Sudoku board, where
 , , with  ∈ [0, ] ,  ∈ [0, ] represents the digit at position (, ) , with D( , ) = digits;
• se ranging over all sub-elements of each Sudoku, that is rows, columns, and squares, each
formed by a sequence of coordinates {, } ;
• S for the  ×  Sudoku puzzles in the data, with D() = sudoku;
• S+ and S− for the correct and incorrect Sudoku puzzles, respectively;
• l for the labels, i.e., the validity of the Sudoku, D() = results.
• digit(, ) is a digit classifier, where  is a term denoting a digit constant or a digit
variable. The classifier should return the probability of an image  being of digit  , with
Din(digit) = images, digits;
• equal( , ,  , ) is a predicate indicating whether two images  , and  , contain the same
digit, with Din(equal) = images, images;
• valid() denotes whether a Sudoku board  is valid. The predicate should return the
probability that the image represents a valid Sudoku solution, with Din(valid) = sudoku;
• validElement() denotes whether a sub-element of a Sudoku board  is valid.</p>
        <sec id="sec-2-2-1">
          <title>Fuzzy operators:</title>
          <p>
            • Diagonal quantification Diag(, … , ) quantifies over tuples that combine the  -th
instance of each of the variables in the argument of Diag [
            <xref ref-type="bibr" rid="ref3">3</xref>
            ]. For instance, given a data set
with samples  and target labels  , ∀Diag(,  ) quantifies over each label, sample pair.
          </p>
        </sec>
      </sec>
      <sec id="sec-2-3">
        <title>2.3. Knowledge base definition</title>
        <p>
          At its core, an LTN-based NeSy approach to the ViSudo-PC task can be constructed by combining
one or more CNNs, that recognize digits and/or classify the whole Sudoku board, with a LTN that
enforces the logical constraints given by the rules of Sudoku. Multiple solutions are available
depending on which predicates are defined and how they are combined in the knowledge base.
The first group of solutions (denoted in the following as indirect solutions) verifies whether the
detected digits constitute a valid Sudoku solution by means of a non-trainable predicate that
enforces the rules of Sudoku. The network learns to detect the digits via a learnable digit(, )
predicate. At inference time a fuzzy or crisp validity score can be computed applying the rules
of Sudoku using real or standard logic. The second group of solutions (denoted in the following
as direct solutions) computes instead the validity of the entire Sudoku board via the valid()
predicate. An auxiliary digit(, ) predicate is used to detect digits and enforce the rules of
Sudoku. Both predicates (, ) and  () are grounded by CNNs. In all cases, we assume
that labels for each individual digit are not available, and that digit classification must be trained
in a semi-supervised fashion exclusively by enforcing the rules of Sudoku, as mandated by the
ViSudo-PC task [
          <xref ref-type="bibr" rid="ref8">8</xref>
          ].
        </p>
        <sec id="sec-2-3-1">
          <title>2.3.1. Indirect solution #1</title>
          <p>This approach is based on the observation that every sub-element (row, column, and square)
belonging to a correct Sudoku is also correct. Conversely, if all the sub-elements are correct, the
Sudoku is correct as well. On the other hand, if the Sudoku is not correct, at least one wrong
sub-element must exist. We further observe that a Sudoku sub-element is correct if, and only if,
all available digits are present. Indeed, since the length of a sub-element is equal to the number
of digits, if one is repeated twice, then another must be missing. Hence, the problem can be
reduced to the simpler problem of detecting whether a sub-element is correct or not.</p>
        </sec>
        <sec id="sec-2-3-2">
          <title>Axioms:</title>
        </sec>
        <sec id="sec-2-3-3">
          <title>Grounding:</title>
          <p>∀se ((∀ ∃ , ∶ {, } ∈ se (digit( , , )) ) ⟺ validElement(se))
∀Diag(, ) ( ⟺</p>
          <p>(∀se ∶ se ∈  validElement(se)))
∀Diag(, ) (¬ ⟺</p>
          <p>(∃se ∶ se ∈  ¬ validElement(se)))
The digit predicate is grounded by a CNN taking as input each digit image. The
validElement predicate is a non-trainable predicate that can be computed directly using
the axiom in Eq. 1.</p>
        </sec>
        <sec id="sec-2-3-4">
          <title>2.3.2. Indirect solution #2</title>
          <p>This solution is based on the observation that a given sub-element (row, column, or square)
cannot contain the same symbol twice. More generally, given all possible image pairs within
a Sudoku board, it is possible to define an additional predicate sameSubelement([ 1,  2]) that
determines whether the image pair at positions  1 = (, ) and  2 = (, )] belong to the same
sub-element and hence cannot contain the same digit (or, more generally, the same symbol).
Based on this principle, two axioms can be formulated, one for correct Sudoku boards and one
for incorrect Sudoku boards. In the experiments, only correct examples were used.
Axioms:
∀ + ∀([ 1,  2]) (sameSubelement( 1,  2) ⟹</p>
          <p>¬equal(  1,   2))
∀ − ∃([ 1,  2]) (sameSubelement( 1,  2) ⟹ equal(  1,   2))
(1)
(2)
(3)
(4)</p>
          <p>The equal( 1,  2) predicate is grounded by a function of the probabilities that  1 and  2
belong to each digit, computed by the digit(x) predicate::
equal( 1,  2) = 
( −  (‖
digit( 1) −digit( 2)‖ − ))
(6)
where  is a constant added for numerical stability. Alternative grounding formulations
could compute the distance i) based only on the most probable digits or ii) directly from
the image embedding, e.g., before computing the softmax.</p>
        </sec>
        <sec id="sec-2-3-5">
          <title>2.3.3. Indirect solution #3</title>
          <p>This solution stems from the observation that the same number can appear only once for each
sub-element (row, column, and square). Hence, if we denote as  0, ...,   , ...,   the list of images
in sub-element  , the following knowledge base can be defined:
Axioms:
∀ + ∀se ∀ 1,  2,  ∶ (1 ∈ se ∧ 2 ∈ se) ( 1 ≠  2 ∧ digit( 1, ) ⟹
¬ digit( 2, ) ) (7)
∀ − ∀se ∃ 1,  2,  ∶ (1 ∈ se ∧ 2 ∈ se) ( 1 ≠  2 ∧ digit( 1, ) ⟹
digit( 2, ) )
(8)</p>
        </sec>
        <sec id="sec-2-3-6">
          <title>2.3.4. Direct solution</title>
          <p>The direct solutions involve two predicates, valid to compute the validity of the Sudoku board
and digit to compute the probability that each cell contains a given digit. The latter predicate
is used only to enforce Sudoku rules. At inference time, predictions are directly calculated
from the valid predicate. While the digit predicate is trained in a semi-supervised fashion, to
comply with the training setting specified by the ViSudo-PC benchmark, the valid predicate
can be trained in a supervised fashion. In addition, additional axioms are specified to encode
prior knowledge about the rules of Sudoku. Any of the axioms that were defined in previous
solutions can be used for this purpose: only one possible solution is shown here.
Axioms:</p>
          <p>∀ +valid(), ∀ −¬valid()
∀ ((∀([ 1,  2])(sameSubelement( 1,  2) ⟹
¬equal(  1,   2))) ⇔ valid() )
∀ ((∃([ 1,  2])(sameSubelement( 1,  2) ⟹ equal(  1,   2))) ⇔ ¬valid() )
(9)
(10)
(11)
Grounding: The equal( 1,  2) predicate is grounded as in Eq. 6. The two predicates valid()
and digit(, ) are grounded by either two separate CNNs or by one CNNs with a common
backbone and two diferent prediction heads.</p>
        </sec>
        <sec id="sec-2-3-7">
          <title>2.3.5. Potential pitfalls</title>
          <p>hence the number of constraints increases as  3.</p>
          <p>
            Alternative solutions could be designed by extending the LTN for the semi-supervised MNIST
classification task proposed in [
            <xref ref-type="bibr" rid="ref3">3</xref>
            ], in which MNIST classification is learned by solving
singleand multi-digit additions: ∀( 1,  2,  1,  2, ) (∃ 1,  2,  3,  4 ∶ 10 1 +  2 + 10 3 +  4 =  .
(( 1,  1) ∧ ( 2,  2) ∧ ( 1,  3) ∧ ( 2,  4)))A similar approach, in this case,
would yield the following solution: ∀( 0,0, ...,  , , ..., ,  , , ) (∃ 0,0, ...,  , , ..., ,  , ∶
validPuzzle( 0,0, ...,  , , ..., ,  , ) = .(( 0,0,  0,0) ∧ ... ∧ ( , ,  , ) ∧ ... ∧ ( , ,  , ))),
where validPuzzle determines if the specific sequence of digits yields a Sudoku board consistent
with the label (i.e., valid or invalid). Empirically, we found that solutions involving up to
 ×  multiple ∧ operations in a single axiom led to exploding memory issues, possibly due
to the LTNtorch implementation [
            <xref ref-type="bibr" rid="ref9">9</xref>
            ]. The proposed solutions are based on simpler formulas,
each implementing a separate logical constraint for pairs of digits at a time, aggregated using
existential and universal quantifiers. However, given a  ×  board, with  rows,  columns,
and √ squares, the number of possible digit pairs with each sub-element is ( 2 ) =  ( −12) ,
          </p>
        </sec>
        <sec id="sec-2-3-8">
          <title>2.3.6. Extension to digit localization</title>
          <p>
            A near-perfect accuracy in digit classification is paramount to determining whether a given
Sudoku puzzle is correctly solved. The solutions proposed in the previous section rely heavily
on the (, ) and (  1,   2) predicates, and assume that the image grid is known. This
limitation could be overcome by integrating an Object Detection method within the NeSy
framework. In this way, the grounding of the sub-images can be extended by including the
bounding box coordinates, which would be used to localize the digits within the board. The
digit(, , ) predicate would take as input the Sudoku Board S and a bounding box  to predict
the probability that the bounding box  contains the digit  , and would be grounded by an
object detector. In a preliminary implementation, we used the You Only Look Once (YOLO) [
            <xref ref-type="bibr" rid="ref10">10</xref>
            ]
algorithm, specifically the YOLOv1 architecture. YOLOv1 consists of two main parts: i) the
feature extractor and the ii) detection network. The latter is a fully connected layer that, from
the output of the feature extraction, generates a set of bounding boxes that contain the detected
objects in the image. The feasibility of training an object detector and a LTN end-to-end has
been established in [
            <xref ref-type="bibr" rid="ref11">11</xref>
            ].
          </p>
        </sec>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>3. Exploratory assessment</title>
      <sec id="sec-3-1">
        <title>3.1. Dataset</title>
        <p>
          Preliminary experiments were conducted on the basic dataset provided by the ViSudo-PC
benchmark, which includes 10 splits per dataset to be used for scoring [
          <xref ref-type="bibr" rid="ref8">8</xref>
          ]1. We performed
experiments on the 4 × 4 Sudoku with data sources MNIST, EMNIST, FMNIST, and KMNIST.
Each split contains 50/100/100 puzzles for training/validation/test, respectively. Performances
(Area under the ROC curve) are reported in cross-validation by averaging across the 10 splits.
1The dataset was downloaded from https://github.com/linqs/visual-sudoku-puzzle-classification
 
 
= 1−( 1 =1
= (
1


∑ 
=1
        </p>
        <p>1
 ∃ ∃
 )

∑ (1−  ) ∀)</p>
        <p>1</p>
      </sec>
      <sec id="sec-3-2">
        <title>3.2. Experimental settings</title>
        <p>A total of three configurations were tested, three variants of the indirect solution #2 introduced
in Section 2.3.2, denoted in the following as LTN_IND_A, LTN_IND_B and LTN_IND_C.
Preliminary experiments were also conducted on the direct solution (LTN_DIR). The indirect solution
was tested with and without negative examples (Eq. 11) in the knowledge base. At inference
time, the probability of a correct Sudoku is computed using the same axiom for positive example
(Eq. 10) for the indirect solutions, whereas for the direct solution it is directly computed by the
valid predicate.</p>
        <p>The digit CNN consists of 2 convolutional layers with a kernel size of 5, each followed by
a max pooling layer of size 2 with stride 2. The latter feeds into fully connected (FC) dense
layers of sizes 320, 50 with ReLU activation and a final softmax layer. For the direct solution,
two output branches of sizes 320, 50 and 5120, 320 computes the Valid and digit predicate,
respectively.</p>
        <p>
          We approximate the universal quantifier with the generalized mean w.r.t. the error aggregator
 ∀ and the existential quantifier with the generalized mean aggregator
, as suggested by Badreddine et al. [
          <xref ref-type="bibr" rid="ref3">3</xref>
          ]. We set  ∃ = 1.5, whereas for
the universal quantifier both fixed
        </p>
        <p>
          ∀ = 2 (LTN_IND_A and LTN_IND_C) and scheduled
values (LTN_IND_B, LTN_DIR) were evaluated. In the latter,  ∀ is gradually increased as
follows: 1 (epochs 0–20), 2 (20–120), 6 (120–170), 8 (170–200), and 10 (200–500). Higher 
values at the beginning of training prevented the network from converging, as previously
reported [
          <xref ref-type="bibr" rid="ref3">3</xref>
          ]. For inference  ∀ was set to 1000. All networks were trained with batch size 8
and the Adam optimizer. Learning rate and number of epochs were set experimentally for
each configuration (LTN_IND_A: 0.001/200; LTN_IND_B: 0.0005/300; LTN_IND_C: 0.0005/500;
LTN_DIR:0.0005/300). The LTN was implemented in PyTorch using the LTNtorch package [
          <xref ref-type="bibr" rid="ref9">9</xref>
          ].
        </p>
      </sec>
      <sec id="sec-3-3">
        <title>3.3. Results</title>
        <p>
          Results for the indirect solutions are presented in Table 1. LTN–based solutions perform best for
the simpler dataset (MNIST). As observed in [
          <xref ref-type="bibr" rid="ref3">3</xref>
          ], LTNs appear sensitive to random initialization
and may occasionally fail to converge to a non-trivial solution, which explains high standard
deviations for most configurations. Compared to the baseline LTN (LTN_IND_A), stability
and performance are enhanced by scheduling  in the universal aggregator [
          <xref ref-type="bibr" rid="ref3">3</xref>
          ], as well as by
including axioms for negative examples (LTN_IND_C). Compared to NeuPSL [
          <xref ref-type="bibr" rid="ref8">8</xref>
          ], LTN–based
solution appear to perform better on the KMNIST domain, and worse on the EMNIST domain;
it is possible that, when samples are more dificult to classify, predicting whether two digits
are equal is a more robust alternative than comparing the actual classifications, and thus the
diferent may be also attributed to the choice of knowledge base.
        </p>
        <p>The direct solution does not achieve performance above random guess on MNIST4 (0.52 ±
0.02) and was not tested on other domains. However, When computing predictions using the
digit predicate and rules of Sudoku, performance increases (0.85 ± 0.02). Hence, the LTN learns
to distinguish digits, but fails to predict the validity directly from the input image, possibly due
Data source</p>
        <p>MNIST4
EMNIST4
FMNIST4
KMNIST4
to the specific choice of grounding.</p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>4. Visual Sudoku as a teaching tool</title>
      <p>
        Fostering research in Neuro-symbolic Artificial Intelligence requires training a new generation
of scientists on NeSy approaches and related topics. The solutions described in this paper were
developed during a graduate level course in Neuro-Symbolic Artificial Intelligence designed
primarily for a PhD programme in Computer Engineering. Further details on the course
organization are given in Appendix B. Project-based and task-based learning is an integral
part of many machine learning and deep learning teaching curricula [
        <xref ref-type="bibr" rid="ref12 ref13">12, 13</xref>
        ]. Benchmarks
such as ViSudo-PC provide an approachable yet challenging learning experience as they allow
newcomers to explore two related, yet complementary aspects of NeSy approaches: (i) how to
reformulate the learning setting and define axiomatic prior knowledge, and (ii) how diferent
grounding choices may afect training.
      </p>
      <p>A few practical hurdles could be tackled in future versions of the benchmark. The standardized
split provides a very challenging benchmark by construction, as domains are challenging, few
training samples are provided, and the semi-supervised setting assumes that labels for the digits
are not available. Many configurations resulted in severe overfitting, and the dificulty of the
optimization problem distracts from the problem formulation. Much higher performance can be
obtained in simpler settings in which, e.g., labels were provided for some digits, or the learning
task was reduced to learning the correctness of a single row/column. Providing standardized
settings of low and medium dificulty would facilitate developing new solutions for this task,
and extending beyond the 4 × 4 board.</p>
    </sec>
    <sec id="sec-5">
      <title>5. Conclusions</title>
      <p>
        In this paper, multiple LTN-based solutions to the ViSudo-PC benchmark were discussed. While
experimental validation is still preliminary, we observe that several axioms could be used to
encode the rule of Sudoku. Although logically equivalent, diferent solutions could result in
diferent numerical properties, hindering comparison across diferent implementations and
scenarios. Further experiments are needed to fully characterize all possible LTN-based solutions,
as well as to optimize their grounding and increase stability to random initialization [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ].
      </p>
    </sec>
    <sec id="sec-6">
      <title>A. Visual Sudoku as a teaching tool: context information</title>
      <p>
        The solutions described in this paper were developed during a graduate level course in
NeuroSymbolic Artificial Intelligence designed primarily for the PhD programme in Computer
Engineering at Politecnico di Torino. The course was structured in frontal lessons (12 hours) followed
by an introductory laboratory on Logic Tensor Networks (4 hours) loosely based on the tutorials
and examples available in [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ]. Students, divided into small groups of at most 3 members, were
then invited to work on the ViSudo-PC benchmark as a case study and, optionally, provide an
implementation, which was then reviewed, compared, and combined as appropriate.
      </p>
      <p>Approximately 40 PhD candidates initially enrolled in the course. Based on a pre-course
survey, most of the students had previous training in deep learning (30/34) or had already
published in the field (18/34). On the other hand, few had prior training or research experience
in first-order logic languages or similar topics (6/34). This distribution reflects the shift towards
deep and machine learning in many engineering and data science-oriented undergraduate
curricula.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>M.</given-names>
            <surname>Brundage</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Avin</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Wang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H.</given-names>
            <surname>Belfield</surname>
          </string-name>
          , G. Krueger, G. Hadfield,
          <string-name>
            <given-names>H.</given-names>
            <surname>Khlaaf</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Yang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H.</given-names>
            <surname>Toner</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Fong</surname>
          </string-name>
          , et al.,
          <article-title>Toward trustworthy AI development: mechanisms for supporting verifiable claims</article-title>
          , arXiv preprint arXiv:
          <year>2004</year>
          .
          <volume>07213</volume>
          (
          <year>2020</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>L.</given-names>
            <surname>Von Rueden</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Mayer</surname>
          </string-name>
          ,
          <string-name>
            <given-names>K.</given-names>
            <surname>Beckh</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Georgiev</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Giesselbach</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Heese</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Kirsch</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Pfrommer</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Pick</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Ramamurthy</surname>
          </string-name>
          , et al.,
          <article-title>Informed machine learning-a taxonomy and survey of integrating prior knowledge into learning systems</article-title>
          ,
          <source>IEEE Transactions on Knowledge and Data Engineering</source>
          <volume>35</volume>
          (
          <year>2021</year>
          )
          <fpage>614</fpage>
          -
          <lpage>633</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>S.</given-names>
            <surname>Badreddine</surname>
          </string-name>
          , A.
          <string-name>
            <surname>d'Avila Garcez</surname>
            ,
            <given-names>L.</given-names>
          </string-name>
          <string-name>
            <surname>Serafini</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          <string-name>
            <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="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>E.</given-names>
            <surname>Giunchiglia</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M. C.</given-names>
            <surname>Stoian</surname>
          </string-name>
          , T. Lukasiewicz,
          <article-title>Deep learning with logical constraints</article-title>
          ,
          <source>in: IJCAI</source>
          ,
          <year>2022</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>L.</given-names>
            <surname>De Raedt</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Dumančić</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Manhaeve</surname>
          </string-name>
          ,
          <string-name>
            <surname>G.</surname>
          </string-name>
          <article-title>Marra, From statistical relational to neuralsymbolic artificial intelligence</article-title>
          ,
          <source>in: Proceedings of the Twenty-Ninth International Conference on International Joint Conferences on Artificial Intelligence</source>
          ,
          <year>2021</year>
          , pp.
          <fpage>4943</fpage>
          -
          <lpage>4950</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>P.</given-names>
            <surname>Hitzler</surname>
          </string-name>
          ,
          <article-title>Neuro-symbolic artificial intelligence: The state of the art</article-title>
          , IOS Press,
          <year>2022</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>L.</given-names>
            <surname>Serafini</surname>
          </string-name>
          ,
          <string-name>
            <surname>A. S.</surname>
          </string-name>
          <article-title>d'Avila Garcez, Logic tensor networks: Deep learning and logical reasoning from data and knowledge</article-title>
          ,
          <source>ArXiv abs/1606</source>
          .04422 (
          <year>2016</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>E.</given-names>
            <surname>Augustine</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Pryor</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Dickens</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Pujara</surname>
          </string-name>
          ,
          <string-name>
            <given-names>W. Y.</given-names>
            <surname>Wang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Getoor</surname>
          </string-name>
          ,
          <article-title>Visual sudoku puzzle classification: A suite of collective neuro-symbolic tasks</article-title>
          ,
          <source>in: International Workshop on Neural-Symbolic Learning and Reasoning (NeSy)</source>
          , Windsor, United Kingdom,
          <year>2022</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>T.</given-names>
            <surname>Carraro</surname>
          </string-name>
          , LTNtorch: PyTorch implementation of Logic Tensor Networks,
          <year>2022</year>
          . URL: https://doi.org/10.5281/zenodo.6394282.
          <source>doi:1 0 . 5 2 8 1 / z e n o d o . 6 3</source>
          <volume>9 4 2 8 2 .</volume>
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <given-names>J.</given-names>
            <surname>Redmon</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Divvala</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Girshick</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Farhadi</surname>
          </string-name>
          ,
          <article-title>You only look once: Unified, real-time object detection</article-title>
          ,
          <source>in: Proceedings of the IEEE conference on computer vision and pattern recognition</source>
          ,
          <year>2016</year>
          , pp.
          <fpage>779</fpage>
          -
          <lpage>788</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11]
          <string-name>
            <given-names>F.</given-names>
            <surname>Manigrasso</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F. D.</given-names>
            <surname>Miro</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Morra</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Lamberti</surname>
          </string-name>
          ,
          <article-title>Faster-LTN: a neuro-symbolic, end-to-end object detection architecture</article-title>
          ,
          <source>in: Artificial Neural Networks and Machine LearningICANN 2021: 30th International Conference on Artificial Neural Networks</source>
          , Bratislava, Slovakia,
          <source>September 14-17</source>
          ,
          <year>2021</year>
          , Proceedings,
          <source>Part II 30</source>
          , Springer,
          <year>2021</year>
          , pp.
          <fpage>40</fpage>
          -
          <lpage>52</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [12]
          <string-name>
            <given-names>T.</given-names>
            <surname>Elstner</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Loebe</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Y.</given-names>
            <surname>Ajjour</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Akiki</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Bondarenko</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Fröbe</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Gienapp</surname>
          </string-name>
          ,
          <string-name>
            <given-names>N.</given-names>
            <surname>Kolyada</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Mohr</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Sandfuchs</surname>
          </string-name>
          , et al.,
          <article-title>Shared tasks as tutorials: A methodical approach</article-title>
          ,
          <source>in: 37th AAAI Conference on Artificial Intelligence (AAAI</source>
          <year>2023</year>
          ). AAAI,
          <year>2023</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          [13]
          <string-name>
            <given-names>S.</given-names>
            <surname>Raschka</surname>
          </string-name>
          ,
          <article-title>Deeper learning by doing: Integrating hands-on research projects into a machine learning course</article-title>
          ,
          <source>in: Proceedings of the Second Teaching Machine Learning and Artificial Intelligence Workshop</source>
          , PMLR,
          <year>2022</year>
          , pp.
          <fpage>46</fpage>
          -
          <lpage>50</lpage>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>