Computer Science
Computer Science-2021.gz:143359
Computer Science
cc138960251ac36421f5d8f4ccb455d9273d9291
Evaluating Relaxations of Logic for Neural Networks: A Comprehensive Study

Symbolic knowledge can provide crucial inductive bias for training neural models, especially in low data regimes. A successful strategy for incorporating such knowledge involves relaxing logical statements into sub-differentiable losses for optimization. In this paper, we study the question of how best to relax logical expressions that represent labeled examples and knowledge about a problem; we focus on sub-differentiable t-norm relaxations of logic. We present theoretical and empirical criteria for characterizing which relaxation would perform best in various scenarios. In our theoretical study driven by the goal of preserving tautologies, the Lukasiewicz t-norm performs best. However, in our empirical analysis on the text chunking and digit recognition tasks, the product t-norm achieves best predictive performance. We analyze this apparent discrepancy, and conclude with a list of best practices for defining loss functions via logic.


Introduction
Neural networks are remarkably effective across many domains and tasks; but their usefulness is limited by their data hungriness. A promising direction towards alleviating this concern involves augmenting learning with rules written in first-order logic [Rocktäschel et al., 2015;Li and Srikumar, 2019;Li et al., 2019;Fischer et al., 2019, inter alia]. To make rules amenable with gradient-based learning, this approach calls for relaxing the logical operators to define subdifferentiable loss terms. A systematic method to perform this relaxation uses a well-studied family of binary operators, namely triangular norms or t-norms [Klement et al., 2013]. Different t-norms define different [0, 1]-valued interpretations of the Boolean operators.
There are infinitely many such t-norm logics, but the most commonly used ones are: Product [Rocktäschel et al., 2015;Li et al., 2019;Asai and Hajishirzi, 2020], Gödel [Minervini et al., 2017] and Łukasiewicz [Bach et al., 2017]. While the usefulness of such relaxations is well established, the questions of how they compare against each other, and even how such a comparison should be defined remain open. This paper is a first step towards answering these important questions by analyzing the three t-norm relaxations and their variants. To do so, we define the criteria for quantifying the goodness of a t-norm based relaxation. On the theoretical side, we rank logic relaxations by their consistency, i.e., their ability to preserve the truth of tautologies. On the empirical side, we use a principled approach to construct loss functions using t-norms that subsume traditional loss functions like cross-entropy, and study how well different relaxations compare with standard gradient-based learning. We report the results of experiments on two tasks: jointly recognizing digits and predicting the results of arithmetic operators, and text chunking. Both the theoretical and empirical criteria concur in the recommendation that a variant of the Product t-norm (R-Product) is most suitable for introducing logical rules into neural networks.
In summary, the main contributions of this work are: • We define theoretical and empirical properties that any relaxation of logic should have to be useful for learning. • We define the consistency of relaxations to rank them in terms of their ability to preserve tautologies. • We present empirical comparisons of logic relaxations on two tasks where labeled examples and declaratively stated knowledge together inform neural models.

Problem Statement and Notation
Several recent efforts have shown the usefulness of declarative knowledge to guide neural network learning towards improving model quality. While different approaches exist for incorporating such rules into neural models [Xu et al., 2018, for example], a prominent strategy involves relaxing logic to the real regime using the well-studied t-norm relaxations. Triangular norms (t-norms) arose in the context of probabilistic metric spaces [Menger, 1942], and for our purposes, represent a relaxation of the Boolean conjunction which agrees with the definition of conjunctions for {0, 1}inputs. Given such a relaxation and a relaxation of ¬X as 1 − x, we have two axiomatic approaches for defining implications. The first (called S-logics) treats implications as disjunctions (i.e., X → Y = ¬X ∨ Y ), while the second (called R-logics) defines implications axiomatically. We refer the reader to Klement et al. [2013] for a detailed treatment of t-norms. Table 1 shows the set of t-norms we consider here; these have been used in recent literature to inject knowledge into neural networks. However, despite their increasing prevalence, there is no consensus on which t-norm to employ. A survey of recent papers reveals the use of S-Product [Rocktäschel et al., 2015], R-Product [Li et al., 2019;Asai and Hajishirzi, 2020], Łukasiewicz [Bach et al., 2017], S-Gödel [Minervini et al., 2017] and even a mixture of the S-Gödel and R-Product [Li et al., 2020] t-norms.
How do these relaxations of logic compare against each other? In this work, we answer this question from both theoretical and empirical perspectives.

Learning From Logic: The Setup
To compare the different relaxations of logic on an even footing, let us first see a general recipe for converting logic rules to loss functions for a given relaxation 1 . We will use the task of recognizing handwritten digits as a running example.
Given a labeling task, we can represent the fact that the label for an instance x is y as a predicate, say Label(x, y). In our running example, we could define a predicate Digit(x, y) to denote that an image x represents the digit y. We could also define a predicate Sum(x 1 , x 2 , y) to denote the fact that the digits in two images x 1 and x 2 add up to the digit y (mod10). From this perspective, we can treat classifiers as predicting probabilities that the predicates hold.
To train such classifiers, we typically have a training set D of labeled examples (x, y). In our notation, each such example can be represented as the predicate Label(x, y) and the training set is a conjunction of such predicates Sometimes, instead of a labeled dataset, we may have a constraint written in logic. In our running example, from the definition of the Digit and Sum predicates, we know that Digit (x 1 , y 1 ) ∧ Digit (x 2 , y 2 ) → Sum (x 1 , x 2 , (y 1 + y 2 ) mod 10) Note that such a constraint need not depend on labeled examples, and should hold irrespective of what labels the examples should be assigned. In general, given a large unlabeled set of examples denoted by x ∈ U , we can write constraints These constraints may be composite formulas constructed with predicates as shown in our running example above. From this standpoint, we can envision the goal of learning as that of ensuring that the formulas representing labeled examples ( equation 1) and constraints ( equation 3) hold. Since we are treating classifiers as predicting probabilities that the atomic predicates hold, we can equivalently state the learning problem as that of finding model parameters that maximize 1 The setup described here is implicitly present in Rocktäschel et al. [2015], Li et al. [2019], and others. Table 1: T-norm relaxations studied in this work. Here, the letters x and y denote the relaxed truth values of the arguments of the formulas. In the implication definitions, x and y denote the antecedent and the consequent respectively. The table does not show S-Product: it agrees with R-Product for all the connectives except the implication, defined as 1 − x + x · y. We are defining R-Product using its SBL∼ extension with involutive negation (See Esteva et al. [2000]).

S-Gödel
the value of a relaxation of the conjunction of the formulas representing the data and constraints. In other words, we can use logic to define loss functions. In this declarative learning setting, we have the choice of using any models (e.g., CNNs) for our predicates, and any relaxation of logic. If we only have labeled examples, and we use one of the Product relaxations, we recover the widely used cross-entropy loss [Li et al., 2019;Giannini et al., 2019]. Notation. We use upper case letters (e.g., P, Digit) to represent Booleans, and lower cased letters (e.g., p, digit) to represent their relaxations. In some places, for clarity, we use square brackets to denote the relaxation of a Boolean formula A (i.e., [A]=a).

Validity of Relaxed Logic
In this section, we propose three criteria that a logic relaxation should satisfy to be useful for learning. Consistency. The language of logic can declaratively introduce domain knowledge, invariants, or even reasoning skills into neural networks. However, to admit reasoning, tautologies should always hold. That is, the truth value of any tautology should be 1 irrespective of the value of its constituent atomic predicates. Equivalently, the integral of the relaxation of a tautology over the domain of its atomic predicates should be 1. We can formalize this intuition. Definition 1. Let T be a tautology in predicate logic formed with a set of atomic predicates T , and let L be a logic relaxation. The consistency of T in L, denoted as κ L (T), is defined as If the consistency κ L (T) = 1, we will say that the tautology T is consistent under the relaxation L. Self-consistency. Every Boolean statement implies itself. That is, the statement P ↔ P is a tautology for any P. This observation gives us the definition of self-consistency of a formula under a given relaxation. Definition 2. Let P be any Boolean formula in predicate logic with a set of atomic predicates P , and let L be a logic relaxation. The self-consistency of P in the logic L, denoted as κ L S (P), is defined as If κ L S (P) = 1 we will say that formula P is not selfconsistent under a relaxation L. Since we consider a dataset to be a conjunction of facts ( equation 1), the self-consistency of large conjunctions allows us to judge whether a dataset implies itself under a relaxation. Sub-differentiability. Since our eventual goal is to relax declaratively stated knowledge to train neural networks, the relaxations should admit training via backpropagation. As a result, the functions defining the relaxed logical operators should at least be sub-differentiable.
In sum, we consider a logic relaxation to be valid if the following properties hold: (P1) It must be sub-differentiable over the interval [0, 1]. (P2) It must be consistent for any tautology. (P3) It must be self-consistent for any Boolean formula. All the relaxations we study here satisfy property P1 2 . Even among sub-differentiable relaxations, some may be easier than others to learn using gradient-based approaches. We consider this empirical question in §5. Properties P2 and P3 do not always hold, and we will prefer relaxations that have higher values of consistency and self-consistency.

Truth Preservation of Relaxations
In this section, we will assess the relaxations from Table 1 with respect to properties P2 and P3.

Consistency
Property P2 expects every tautology to be consistent under a valid logic relaxation. Since predicate logic admits infinitely many tautologies, we will use a representative set of tautologies for our evaluation. This set contains the Axiom Schemata of the Hilbert proof system for predicate logic 3 , the primitive propositions, and a set of elementary properties defined by Russell and Whitehead [1910]. Table 2 shows the consistency for each tautology for our tnorm relaxations. Comparing results across the columns, we see that Łukasiewicz and R-Product t-norm logics preserve truth the most across our representative set. In general, we find R logics to be better at preserving truth than S logics. Example 1. Consistency of the tautology A → A using S-Product.
By the definition of consistency ( equation 4), we have

Self-consistency
The validity property P3 states that every well-formed Boolean formula should be self-consistent for a relaxation of the logic to be valid. It turns out that the definition of implications for any R logic (including Łukasiewicz) guarantees the self-consistency of every formula.
Proposition 1. Every formula is self-consistent under any Rlogic relaxation.
This follows directly from the definition of the t-norm and the properties of residua. The appendix has a proof sketch.
However, the same is not true for S-logics. For example, for the conjunction P = A ∧ B, the self-consistency under the Gödel relaxation κ S-Gödel S (P) = 0.75 and under the Product relaxation, we have κ S-Product S (P) ≈ 0.74. These results suggest that the R-Product and Łukasiewicz relaxations are preferable from the perspective of property P3 as well.
Intriguingly, we find that the S-Product logic is eventually self-consistent for large monotone conjunctions.
Proof. By induction over the size of the conjunction n.
We see that, as n → ∞, the self-consistency of a monotone conjunction approaches 1. In other words, large conjunctions (e.g., representing large datasets) are essentially selfconsistent under the S-Product relaxation.
In this section, we empirically study the differences between the different logic relaxations using two tasks: recognizing digits and arithmetic operations, and text chunking. In both tasks, we set up the learning problem in terms of logic, and compare models learned via different logic relaxations. 4

Recognizing Digits and Arithmetic Operations
These experiments build upon our running example from §2. We seek to categorize handwritten digits; i.e., we learn the predicate Digit. In addition, we also seek to predict the sum and product (modulo 10) of two handwritten digit images. These correspond to the predicate Sum we have seen, and a new analogous predicate Product.
We use the popular MNIST dataset [LeCun, 1998] for our experiments, but only to supervise the Digit classifier. Rather than directly supervising the other two classifiers, we use coherence constraints over unlabeled image pairs that connect them to the Digit model. The constraint for the Sum classifier is shown in equation 2, and the one for the Product classifier is similarly defined.
We set up the learning problem as defined in §2 and compare performance across different relaxations.

Data and Setup
We partition the 60k MNIST training images into TRAIN and DEV sets, with 50k and 10k images respectively. To supervise the Digit model, we sample 1k, 5k and 25k labeled images from TRAIN to form three DIGIT sets. The coherence constraints are grounded in 5k unlabeled image pairs consisting of images from TRAIN that are not in any DIGIT set, giving us the PAIR dataset.
For evaluating the Digit model, we use the original 10k TEST examples from MNIST. For the development and evaluation of the operator models, we sample random image pairs from DEV and TEST to create the PairDEV and PairTEST sets respectively. The ground truth Sum and Product labels for these image pairs can be computed by the sum and product modulo 10 of the image labels.
We use CNNs as the Digit, Sum and Product models. For the operator models, we concatenated the two images to get CNN inputs. To jointly train these models using the labeled DIGIT data and the unlabeled PAIR datasets, we define a loss function by relaxing the conjunction of Digit predicates over the DIGIT examples and the coherence constraints over the PAIR examples. That is, learning requires minimizing:    In practice, we found that it is important to use a hyperparameter λ that weights the relaxed coherence constraints in the loss. We used the DEV sets for hyperparameter tuning using the average of the accuracy of the Digit classifier and the coherences of the other two. Table 3 reports accuracies for the Digit classifier trained with different sizes of DIGIT, and the coherence constraints instantiated over the 5k PAIR examples. We observe that the R-Prod relaxation dominates across all settings, with higher gains when there are fewer labeled examples. (The bold entries in this and other tables are statistically significantly better than the other relaxations at p < 0.05. The accuracies are averages from three runs with different seeds along with the standard deviation.) Table 4 reports the average of Sum, and Prod accuracies for the same settings, and Table 5 shows the fraction of PairTEST examples where the coherence constraints are satisfied. From these results, we see that the R-Product and S-Gödel relaxations offer the best accuracies.

Results
Interestingly, Łukasiewicz is the least accurate relaxation. However, the losses compiled using Łukasiewicz and S-Gödel t-norms were unstable, and the results shown here were achieved with additional assumptions. We defer this technical discussion to §5.3, and conclude that the stability and accuracy of the R-Product relaxation suggest that it is the most suitable relaxation for this class of problems.

Joint Learning vs. Pipelines
In the coherence constraints in equation 2, if we knew both the Digit terms, we can deterministically compute the value of Sum. This suggests a pipeline strategy for training, where we can train the Digit classifier alone, and use it to assign (noisy) labels to the unlabeled PAIR data. Subsequently, we can train the Sum and Product models independently. How does the joint training strategy compare to this pipeline? Importantly, we should note that both the joint and the pipeline strategies instantiate the declarative learning ap-   proach outlined in §2 where logical facts are compiled into an optimization learning problem via the logic relaxations. However, in the pipeline, the coherence constraints are not explicitly involved in the loss, because the noisy labels already satisfy them. Since conjunctions are identical for the S and R relaxations, they give the same results.
Tables 6, 7, and 8 show the results of these pipelined experiments. We observe the same trends as in the joint learning experiments: R-Product achieves the highest performance.
Comparing the joint learning and the pipeline results, we observe that the latter are slightly better across relaxations and data settings. As mentioned above, however, pipelining is only viable here because of the special form of our constraint.

Text Chunking
Our second set of experiments use the NLP task of text chunking using the CoNLL 2000 dataset [Sang and Buchholz, 2000]. This task illustrates how relaxed logic can be used to derive loss functions for sequential inputs and outputs.
Text chunking is a sequence tagging problem, where each word of a sentence is assigned a phrase type. For example, in the sentence 'John is playing in the park.', the word 'John' is labeled as B-NP, indicating that it starts a noun phrase (NP). We use the standard BIO labeling scheme: B-X indicates the start of a new phrase labeled X, I-X indicates the continuation of a phrase labeled X, and O marks words that do not belong to any of the predefined phrase types.
In the case of text chunking, the input x is a sequence of words and correspondingly, output y is a sequence of labels (phrase types). Consequently, each position in the sequence is associated with a predicate. For an input x with n words, we have n predicates, one per word.
Using our notation from §2 we define the predicate, Tag(x i , y i ), to denote that i th word in input x is assigned the label y i . For our preceding example, John being assigned the label B-NP corresponds to the predicate Tag(John, B-NP).

Constraints
For each position in the sequence, we have constraints defining pairwise label dependencies. If a word in a sentence has In general, given a labeled dataset D, and a set C of k constraints for each word position, we can write the conjunction of all constraints as: We can now use this Boolean formula to state the goal of learning as finding the model parameters of a neural network that maximizes the value of the relaxation derived for each t-norm. We used a bidirectional LSTM over GloVe embeddings [Pennington et al., 2014] to instantiate Tag.

Experiments and Results
We compare the four t-norms on two settings. First, in purely supervised learning, the model only learns from labeled examples. Second, we augment the labeled dataset with the constraints described above to study the effectiveness of incorporating simple constraints on outputs. For both of these settings, we also study the models in a low data regime with training data restricted to 10%. Following previous work [Sang and Buchholz, 2000], we use the F1 score as our evaluation metric.
We report performances of the models trained with different t-norms in Table 9. We observe that for supervised learning (top rows), both variants of product t-norm outperform the other two t-norms by a significant margin. We again observe that for purely supervised learning, both R-Product and S-Product produce identical results since no implication constraints are used. Further, S-Gödel performs the worst among the four t-norms. Note that this observation is consistent with our analysis from Table 2 where S-Gödel was found to be least consistent with tautologies.
Let us now look at the results of augmenting supervised learning with simple output constraints (  rows). First, we observe that incorporating simple constraints into neural models, using the framework discussed in this work, can indeed improve their performance in all cases. Particularly, this improvement is more pronounced in low data regimes, since models need to rely more on external background knowledge when training data is small. We also find that both variants of product t-norms outperform S-Gödel and Łukasiewicz. However, in both data regimes, R-Product outperforms S-Product when incorporating constraints into the neural model. We observe that these results are consistent with the ones obtained in §5.1.

Theory vs. Experiments
From our analysis of t-norms in §4, we found that Łukasiewicz and R-Product are the most preferable. Empirically, R-Product outperforms the other relaxations.
The consistency analysis suggests that since S-Gödel is least consistent, we should also expect S-Gödel to empirically perform the worst. This argument is reinforced by the results across all tasks and settings, if we naively applied the Gödel t-norm to define the loss. The S-Gödel results shown in this work were obtained by warm starting the learning using the R-Product relaxation. Without the warm start, we found that not only is learning unstable, the resulting accuracies were also low.
One other discrepancy bears attention: although Łukasiewicz is most preferable in terms of consistency on tautologies, the experiments suggest otherwise. From an empirical perspective, a valid relaxation of logic should provide a sufficient gradient signal to make learning feasible. We discovered that loss functions defined by the Łukasiewicz t-norm are not amenable to gradient-based learning. Here, we briefly explain this phenomenon.
Consider the Łukasiewicz conjunction over n atoms: For this operation to provide a non-zero output, we need n i a i > (n − 1), or on average, each of the conjuncts a i should exceed n−1 n . That is, to provide a useful signal, Łukasiewicz t-norm requires the model to assign high probabilities to correct labels. This, of course, is not true for a randomly initialized model when learning starts, contributing to near-zero gradients, and no model updates at all.
To make learning feasible with Łukasiewicz t-norm, we implemented a less strict definition of conjunction inspired by the MAX-SAT relaxation of Bach et al. [2017]. This transforms our learning objective to the form max θ ( n i a i ). An important consequence of this approach is that Łukasiewicz t-norm in our experiments is merely an approximation of the original Łukasiewicz t-norm.

Related Work and Discussion
The use of t-norm relaxations to encode knowledge into learning is increasingly prevalent in recent years , who employ constraints similar to our coherence constraints. Of course, the goal of this work is to theoretically, and empirically investigate which relaxation is best suited for use in such problems. To our knowledge, none of the previously mentioned works analyze the choice of the relaxation they use.
Similar studies to this paper are that of Evans and Grefenstette [2018], and van Krieken et al. [2020]. The former, includes comparison in performance of Łukasiewicz, Product, and Gödel t-norm operators used to induce differentiable functions from definitive clauses in neural program synthesis. The latter, perhaps closer to our approach, provides a general theoretical and empirical analysis for different t-norm relaxations. However, there are two key differences with our work: (a) they do not treat labeled data as part of the declarative problem specification, and the constraints are added into a standard cross entropy loss, (b) their analysis involves the derivatives of the losses and does not discuss the consistency and self-consistency properties. We also studied the importance of the loss gradient signal in gradient-based learning, and hypothesise that a less consistent t-norm would perform worse at characterizing the truth of a Boolean statement than a more consistent one, and as a result, would correspond to poorer empirical performance.

Conclusions
In this work, we studied the question of how best to relax declarative knowledge to define loss functions. To this end, we define a set of criteria that characterizes which relaxations of logic would be most amenable for preserving tautologies and offer support for gradient-based learning. We also present empirical studies on two tasks using the paradigm of formulating entire learning problems via logic. All our analyzes concur that the R-Product relaxation is best suited for learning in this paradigm.

A Relevant Proofs
Proof for Proposition 1.
Proof. The t-norms we consider (Gödel, Łukasiewicz and Product) are left-continuous binary operators. For a leftcontinuous t-norm T , we can uniquely define the residuum (denoted by →) as the binary operator that satisfies The residuum generalizes the logical implication. From the definition, we see that x → y is greater than or equal to every z such that T (z, x) ≤ y. This allows us to write the residuum in the following equivalent way: Next, we use the monotonicity property of t-norms. Every t-norm is a non-decreasing function of both its arguments. In particular, we have: Consequently, for any x, y ∈ [0, 1] such that x ≤ y, we have T (z, x) ≤ y. For such x, y pairs, the supremum in equation 9 is identical to 1. Indeed, we can show that whenever the residuum x → y evaluates to 1, we have x ≤ y. In short, Now, consider the self-consistency of a well-formed Boolean formula P and an R-logic relaxation L, denoted by κ L S (P). From the definition of self-consistency, we have: When we relax the conjunction in the final expression, we will end up with a t-norm, both of whose arguments are one from equation 11. Consequently, the t-norm itself evaluates to one. Applying the definition of consistency (the integral of the constant 1 over the domain) gives us the required result.
Proof Sketch for Proposition 2.
By the definition of the S-Product logic connectives we have,

[F ] dF
Let us simplify the large product corresponding to the nconjunction by introducing an auxiliary variable that includes all but the final element in the conjunction A. We will call this n − 1-conjunction b n−1 . That is,
Integrating out the n th variable a n by expanding out the polynomial, we obtain Applying the same strategy as before, we can define Substituting b n−1 in κ n and taking the integral over the (n − 1) th variable we obtain, Repeating this procedure, every subsequent integral will add one to the degree of the denominators in each term. This allows us to generalize the integral as In particular, when k = n, the empty product becomes 1. Therefore, substituting b n−k in κ n−k we obtain,

R-logics and the Connective for Negation
In table 1, we abuse the nomenclature for R-Product and R-Gödel logics. In these relaxations, the negation and conjunction connectives are respectively defined as and, x ∧ y = 0 if x=y=0 1 otherwise Unfortunately, these functions are not sub-differentiable. Instead, we introduce the corresponding SBL ∼ extensions for residuated R t-norm logics [Esteva et al., 2000] which are constructed using the involutive negation n ¬ (x) = 1 − x and sub-differentiable in all of their connectives. We keep the same names R-Product and R-Gödel for simplicity.

C.1 Digit Arithmetic experiments
Model Architecture. For Digit, Sum and Product models we use 2-layer Convolutional Neural Networks with 3-by-3 padded filters, with ReLU activation and 2-by-2 Maxpool layers with stride 2 in between, with 2 fully connected layers with ReLU activation and dropout (p = 0.5) in between. Seeds and multiple runs.
We use a random seed 20 to create all the dataset used for training, evaluation, and testing. The same seed (20) is used for hyper-parameter tuning. We perform three runs of every experiment using seeds 0, 20, and 50. The standard deviation from the three runs with different seeds was high (up to 5%) for some of the relaxations over the scarce data settings (DIGIT size 1000 and/or PAIR size 1000). In these cases, we perform extra runs with seeds 1, 10, and 60, reporting the average of the best three. Hyper-parameter tuning Details Validation sets are used for tuning hyper-parameters: learning rate, batch size, optimizer, lambda coefficient for the coherence constraints in the loss. Specifically we perform grid search with: • learning rates: {10 −1 , 5 × 10 −2 , 10 −2 , 5 × 10 −3 , 10 −3 , 5 × 10 −4 , 10 −4 , 5 × 10 −5 , 10 −5 } • λ's: {0.05, 0.1, 0.5, 1, 1.5, 2} • batch sizes: {8, 16, 32, 64 }. We also treat the optimization method as a hyper-parameter, using the one resulting in best performance between standard Stochastic Gradient Descent and Adam optimizers. Number of epochs for training. The number of epochs for convergence varies between 100 to 1000 epochs across tnorm relaxations and data settings. All the experiments were run for a maximum of 1600 epochs. Significance. We performed t-tests and observed a statistical significance of at least p < 0.05 in all the model comparisons we discuss in the main paper. Warm-restarts. Using the Stochastic Gradient Descent with Restarts techniques [Loshchilov and Hutter, 2017], brings, considerably, more stability to the experiments. We use the best number iterations for the first restart (T 0 ) among 50, 100 and 200, with a factor of increase of 1 (T mult )

C.2 Experimental Details for Text Chunking
Model Architecture. For all our models, we use bidirectional RNN based models, experimenting with LSTMs and GRUs. We use GloVe word embeddings of 300 dimension at input along with 100 dimensional character embeddings. We fix the dropout rate to 0.5 for all our experiments.
Hyper-parameter Tuning Since the original CoNLL 2000 dataset does not accompany a validation set, for each experiment, we select 10% of the total training data for validation. We perform hyper-parameter tuning using grid search on the following parameters: hidden unit size of RNN in the set {200. 256, 300, 400, 500, 512}, learning rate in the set {0.001, 0.005, 0.0001}.

C.3 Weighted Constrained Loss
We observe that in order to stabilize training, we have to use a λ (hyper-parameter) to relatively weigh the loss from both Sum and Product coherence constraints. We find that product based t-norms are less sensitive to different values of λ.
For chunking, for example, for Łukasiewicz t-norm, values around 0.0001 works best, while for R-Product, values greater than 1 provides best results on validation set.

D.2 Discussion about Gradients in Łukasiewicz relaxation
From an empirical perspective, a valid relaxation of logic should provide enough gradient signal to make the gradientbased learning process possible. One relevant case of a logic relaxation that does not satisfy this property is the Łukasiewicz t-norm. By inspecting the Łukasiewicz conjunction connective definition: we can see that it requires almost absolute certainty for each of its conjuncts to result in a non-zero truth value. This means that the gradient signal provided from an objective that is the conjunction of the dataset term (equation 1) and the constraint term (equation 3) is almost always zero.
To be able to study the Łukasiewicz logic, for our experiments we implemented a less strict definition of the conjunction inspired by the MAX-SAT relaxation of Bach et al. [2017] assuming the best case scenario n i a i ≥ n − 1. Therefore, the learning problem using Łukasiewicz logic, defined in §2.1 as

D.3 Practical considerations for S-Gödel logic
In practice, we find that optimizing the loss function derived from the S-Gödel relaxation was difficult due to learning instability. To make learning possible, we apply the following techniques: • By definition of S-Gödel conjunction, for every epoch, we make the update with respect to the example with the minimum output value in the data. Instead, we apply mini-batch descent over the minimum of each batch, and proceed with the standard SGD process. This means that we use the S-Gödel logic over the batches but the S-Product t-norm (which agrees with the cross-entropy loss) over the epochs. While this is not strictly a Gödel conjunction, we found that this was necessary for the optimizer to work. • Given that at the early stages of learning the system is uncertain about every example, and S-Gödel conjunction operates over the "worst" example, it is hard to get any meaningful signal from the updates. To break ties, we "warm-up" the system by running 2 to 10 epochs of learning using the R-Product logic. Interestingly, even though this strategy is needed to learn with S-Gödel on both joint and pipeline learning frameworks, the joint system needs only one or two epochs to warm-up, while the pipelined approach needs between 6 to 10 epochs to start learning on its own. These warm-up processes represent on average 40% of the final accuracies obtained across our experiments. • In the joint model, we noticed that the accuracies for the Digit classifier decrease after a few epochs hindering training. This is caused because the model is trying to reach the trivial solution to satisfy the coherence constraints (the Digit classifier predicting low scores for all digits to make the value of the conjunction in the antecedent of the constraints as low as possible). In order to avoid this, we froze the parameters corresponding to the Digit model right after the warm-up stage; in other words, we train Digit classifier using R-Product relaxation for a few epochs; enough to successfully continue the training.

E Examples of Consistency Calculation
Here we calculate consistency under different relaxations for the axiom schema tautology P → (Q → P) which we will denote by A1.
The consistency is given by The consistency is given by else We have two cases:

[P] ≥ [Q]
By the definition of R-Product implication,

F.1 Recognizing Digits and Arithmetic Operations
For the same set of experiments described in section 5.1, tables 10, 11, 12, 13, 14, 15 report the results from instantiating the sum and product coherence constraints over 1k and 25k PAIR examples,respectively, to obtain the training signal for the Sum and Prod classifiers.      Similarly, tables 16, 17, 18, 19 report the results from assigning noisy labels to 1k and 25k unlabeled PAIR data examples to train the Sum and Prod classifiers independently following the pipeline strategy we use in section 5.1.
For all these different data configurations, we observed a similar trend in the results to the one observed in section 5.1 with R-Product achieving the highest performance among the different relaxations.

Arithmetic Properties
We also evaluate the resulting models from both of the training regimes (joint and pipelines) on arithmetic properties they are not being trained for. Specifically, we create test sets to evaluate if the commutativity, associativity, and distributivity properties are satisfied by the operator classifiers.    To evaluate commutativity, we check how many times an operator classifier predicts the same digit for pairs of TEST images and their reverse order.
To evaluate the associativity property ∀x 1 , x 2 , x 3 (x 1 + x 2 ) + x 3 = x 1 + (x 2 + x 3 ) in a operator classifier, say the Sum (mod 10) operator, we use triples of different images from TEST. For each triple x 1 , x 2 , x 3 , we consider the predicted digits y 1,2 and y 2,3 corresponding to the Sum of x 1 and x 2 (x 1 + x 2 ), and the Sum of x 2 and x 3 (x 2 + x 3 ) respectively. Then, we randomly sample an image x 1,2 of a y 1,2 , and an image x 2,3 of a y 2,3 from TEST, and check whether the respective predicted Sum of x 1,2 and x 3 (x 1,2 + x 3 ) and Sum of x 1 and x 2,3 (x 1 + x 2,3 ) agree. To compensate to the random choice of the image in TEST representing the predicted associations in the property, we repeat the process for 6 iterations and consider the most frequent resulting digit on each side of the equation respectively to make the final comparison.
We follow an analogous approach to evaluate the distributivity property which involves predictions from both Sum and Prod classifiers.
In tables 20, 21, 22, 23, 24, 25, the first two columns respectively show the average for Sum and Prod classifiers of the fraction of test instances where the commutativity and associativity properties are satisfied. Similarly, the last column shows the average of the fraction of examples satisfying the left and right distributivity properties. In these experiments, we observe that Gödel and R-Product are the best relaxations. On the other hand, Łukasiewicz t-norm performance was considerably poor with high standard deviations. Tautologies Table and Consistencies   Table 26 shows the entire set of tautologies we considered for the evaluation of consistencies across different relaxations. We observe that the top three relaxations preserving truth (entries equal to 1) are R-Gödel,Łukasiewicz and R-Product, however, R-Gödel does not satisfy P1 as its definition of implication is not a sub-differentiable function (see §4.1).