Neuro-symbolic learning over OWL 2 DL via consequence-based compilation to differentiable circuits
Authors: Olga Mashkova, Asaad Mohammedsaleh, Fernando Zhapa-Camacho, Robert Hoehndorf
Organizations: Computer Science Program, Computer, Electrical, and Mathematical Sciences & Engineering Division, King Abdullah University of Science and Technology, Thuwal 23955, Saudi Arabia
OWL 2 DL ontologies, grounded in the description logic SROIQ, express large knowledge bases in biomedicine and the Semantic Web. Neuro-symbolic (NeSy) learners over description logics either embed the ontology in a continuous space, abandoning classical entailment, or restrict to the Horn fragment EL++, which has a single canonical model. We present Baobab, which compiles a SROIQ ontology with a finite ABox into a Sentential Decision Diagram (SDD): it saturates a propositional core under a consequence-based calculus and instantiates the remaining SROIQ features (nominals, number restrictions, and the role axioms) over the active domain. The SDD's evidence-conditioned weighted model count then trains a perception network to recognize real images under partial ABox supervision: on an ontology that exercises every distinctive SROIQ feature, a CNN learns to read MNIST digits coupled by a successor relation and recovers latent ontology concepts that an independent perception leaves at chance. When the supervision admits several ontology-consistent completions, an independent perception collapses onto one, a reasoning shortcut: we show that a mixture indexed by the query's justifications can represent the calibrated posterior no independent perception can, and that seeding it from the circuit's enumerated completions attains the Bayes-optimal posterior on a real-image MNIST task where single-WMC and learned mixtures (the BEARS-ensemble hypothesis class) do not: to our knowledge the first to characterize and mitigate reasoning shortcuts in a non-Horn description logic. Soundness of the compiler and the representation result are machine-checked in Lean 4. Code is available at https://github.com/bio-ontology-research-group/baobab.
Figures & tables
regime
method
digit
latent
viol ↓
ECE ↓
grounded ( #RS=1 )
Independent
0.25±.09
0.49±.14
0.80±.12
0.33±.14
WMC
0.99±.00
1.00±.00
0.02±.01
0.00±.00
under-det. ( #RS=5 )
Independent
0.20±.03
0.46±.10
0.93±.10
0.08±.08
WMC
0.18±.07
0.67±.03
0.78±.05
0.15±.02
Table 1: MNIST- SROIQ , mean ± std over ten seeds (metrics in § 4 ; digit identities never supervised). Grounding the concept evidence collapses #RS from 5 to 1 .
Appendix figures & tables9 assets
Supplementary material from the paper’s appendix.
Appendix
feature
emitted ground clauses
count
nominal Noma
Noma(a) ; ¬Noma(b) , b=a
d
≥nR.C at x
Q(a)↔⋁∣S∣=n⋀y∈SR(a,y)∧C(y)
d((nd)+1)
≤nR.C at x
Q(a)↔⋀∣T∣=n+1(⋀y∈TR(a,y)∧C(y)→⋁i<jyi≈yj)
O(dn+1)
inverse R≡S−
R(a,b)↔S(b,a)
2d2
Trans(R)
R(a,b)∧R(b,c)→R(a,c)
d3−d
chain R1∘…∘Rk⊑S
R1(a0,a1)∧⋯∧Rk(ak−1,ak)→S(a0,ak)
dk+1
Appendix
Table 2: Grounding schemata over the active domain Δ , d=∣Δ∣ . a,b,c range over Δ ; (nd) is the n -subset count.
refinement
method
topping
property
viol ↓
closed
Independent
0.95±.01
0.45±.15
0.89±.18
closed
WMC
0.93±.01
0.92±.02
0.06±.02
open
Independent
0.95±.01
0.45±.16
0.86±.28
open
WMC
0.95±.01
0.78±.01
0.00±.00
Appendix
Table 3: Closed-world ablation on the Pizzaiolo fragment (mean ± std over ten seeds, five epochs; same fragment and metrics as Table 7 ). Closed materializes the exact biconditional X(a)⇔⨆thasTopping(a,t)⊓C(t) ; open keeps the forward direction X(a)→∃hasTopping.C only, dropping the closure clause ∃hasTopping.C→X(a) . Removing the closure clause leaves supervised toppings untouched but lowers latent property recovery from 0.92 to 0.78 ; the reported violation falls to 0.00 because the removed clause is the constraint whose violation was counted (§ 4.1 ).
clauses
fixed vtree
minimized
ontology
unsat → sat
unsat = sat
unsat
sat
horn-chain
3→6
10
8
8
disjunction
7→12
23
17
12
two-disjunctions
11→29
38
22
18
exists+disjunction
8→73
73
41
36
bird-penguin
11→44
1011
139
143
Appendix
Table 4: Effect of saturation on SDD node count, measured with the accompanying library. Saturation adds entailed clauses (column clauses ) without changing the atom set. Over a fixed vtree the size is identical with and without saturation (Theorem 0.F.1 ); under dynamic vtree minimization it usually shrinks but is not guaranteed to ( bird-penguin ).
toppings ( ∣Δ∣ )
atoms
clauses
ground (s)
SDD nodes
peak mem
1 ( ∣Δ∣=2 )
201
638
0.04
3,182
0.7 GB
2 ( ∣Δ∣=3 )
302
957
0.19
12,064
5.7 GB
3 ( ∣Δ∣=4 )
403
1,276
0.01
—
>22 GB †
Appendix
Table 5: Compiling the full Pizzaïolo SROIQ ontology ( 66 named classes, 90 existential and 44 universal restrictions, right-hand-side disjunctions on Pizza and SpicyPizza ) over a growing active domain, with a fixed vtree throughout. Grounding stays sub-second at every size; the compiled SDD grows super-linearly and exceeds a 22 GB / 600 s budget at three toppings. The 59 -atom two-topping fragment of § 4.1 is a separately extracted role-based sub-signature, not a row here.
experiment
feat. dim
hidden
epochs
λ
κ
K
MNIST (CNN)
282
CNN
12
0.5
–
–
Pizzaiolo frag. (ResNet-18)
2242
linear head
5
0.5
–
–
Pizza (synthetic)
12
64
10
0.3
–
–
MNIST-Disj. (CNN)
282
CNN
20
0.5
2.0
4
Appendix
Table 6: Hyperparameters (Adam; learning rates and batch sizes in the text). λ : semantic-loss weight; κ : diversity weight; K : mixture / ensemble size.
method
topping
property
viol ↓
Independent
0.95±.01
0.45±.15
0.89±.18
WMC
0.93±.01
0.92±.02
0.06±.02
Appendix
Table 7: Pizzaiolo two-topping role-based fragment (mean ± std over ten seeds; metrics in § 4 ). topping is supervised; property are the latent Vegetarian/NonVegetarian/Spicy classes recovered through hasTopping .
Method
digit
NLL ↓
ECE ↓
mode-cov. TV ↓
Independent (UCI)
0.99±.00
6.93±.00
0.00±.00
1.00±.00
Single-WMC (SL / DPL)
0.99±.00
6.13±.00
0.00±.00
0.99±.00
JustWMC (learned mix)
0.99±.00
6.69±.43
0.11±.03
0.99±.01
BEARS
−
6.36±2.36
0.41±.12
0.44±.11
JustWMC (anchored)
0.99±.00
4.17±.00
0.00±.00
0.02±.00
Appendix
Table 8: MNIST-Disjunction ( #RS=4 ; mean ± std over ten seeds; metrics in § 4 ). NLL is over the gender atoms (Bayes-optimal 4.16 ); ECE and mode-coverage TV are the reasoning-shortcut diagnostics. BEARS is a K=4 deep-ensemble mitigation [ 24 ] trained on the same circuit; its per-digit accuracy is not separately evaluated ( − ).
method
topping
pizza
latent
violation
(observed)
(4 latent)
(11 latent)
rate
Independent
0.99±.00
0.44±.12
0.43±.08
1.00
WMC
0.76±.01
0.75±.00
0.58±.05
0.00
Appendix
Table 9: Pizza- SROIQ , 64 held-out examples, mean ± std over ten seeds (higher is better except for violation). The pizza (4 latent) and latent (11 atoms) columns are the headline: WMC infers them from topping evidence though those atoms receive no direct supervision.
OWL kind
axioms
ours
DPL (Horn)
DPL (manual)
DPL (inexpr.)
DPL clauses
SubClassOf
23
46
15
8
0
30
DisjointClasses
14
28
14
0
0
14
EquivalentClasses
3
12
0
3
0
11
RoleInclusion
2
4
2
0
0
2
AsymmetricRole
2
4
2
0
0
2
IrreflexiveRole
2
4
2
0
0
2
Appendix
Table 10: Per-OWL-axiom-kind encoding cost for the MNIST- SROIQ ontology. ours : normalized DL-clauses produced by the structural transformation. DPL Horn / DPL manual : DPL admits / requires user-written disjunctive / cardinality / negation encoding.
Computer Science Program, Computer, Electrical, and Mathematical Sciences & Engineering Division, King Abdullah University of Science and Technology, Thuwal 23955, Saudi Arabia