γILP: Visual Logic Rule Learning
- γILP is a fully differentiable framework for learning first-order logic rules from images, uniting visual perception with symbolic reasoning.
- It integrates image and relation encoders, differentiable clustering, and a neural ILP module to induce rules without relying on predefined symbolic labels.
- The approach addresses predicate invention and generalizes across tasks, from classic ILP benchmarks to complex visual datasets like Kandinsky patterns.
Searching arXiv for the target paper and a few related methods named in the provided data. γILP, spelled yILP in the paper, is a framework for learning first-order logic rules directly from images without relying on symbolic labels for objects or relations, while also addressing predicate invention when relations are not explicitly defined (Gao et al., 9 Apr 2026). It is presented as a fully differentiable pipeline from image constant substitution to rule structure induction, designed to bridge visual perception and conceptual rule induction in a unified setting spanning symbolic relational datasets, relational image datasets, and pure image datasets such as Kandinsky patterns (Gao et al., 9 Apr 2026). Its core formulation combines image and relation encoders, differentiable clustering, a latent knowledge base, differentiable ground substitution, and a neural inductive logic programming module that extracts first-order rules from trained parameters (Gao et al., 9 Apr 2026).
1. Definition and problem formulation
The framework is situated in inductive rule learning over a first-order language with predicate symbols , function symbols , constants , and variables (Gao et al., 9 Apr 2026). A term is a constant, variable, or , an atom is with , and a rule is a definite clause of the form (Gao et al., 9 Apr 2026). A logic program is a set of rules; 0 denotes all ground instances of 1, the Herbrand base is 2, and the immediate consequence operator is
3
The learning objective is to induce a logic program 4 such that 5 entails positive examples and not negative ones (Gao et al., 9 Apr 2026).
The paper identifies two obstacles for this setting when the input is visual rather than symbolic. The first is symbol grounding without label leakage: visual inputs must be mapped to logical constants and predicates without supervised labels for those symbols. The second is predicate invention: the system must discover new relational concepts that are not explicitly provided in the data (Gao et al., 9 Apr 2026). FO rules are described as more expressive than propositional rules and essential for interpreting relations between objects in images (Gao et al., 9 Apr 2026).
The rule space is represented through generic Horn clauses,
6
with example clauses such as
7
For binary targets, the paper also uses a forward-chaining bias of the form
8
to reduce search complexity (Gao et al., 9 Apr 2026).
2. Architecture and data flow
γILP is defined by a visual-to-logical pipeline in which raw inputs are first embedded and then transformed into latent logical structures (Gao et al., 9 Apr 2026). The encoders map images and, when available, textual relations to embeddings. For image constants, the experiments use ViT or VAE encoders producing 9; for textual relations, the system uses VAE/BERT-like encoders producing relation embeddings in the same latent space (Gao et al., 9 Apr 2026).
A differentiable clustering module, denoted by the generalization function 0, maps constant embeddings to 1 latent centroids 2 that serve as variables or abstract constants (Gao et al., 9 Apr 2026). The clustering objective is given as
3
with
4
where 5 is the encoder, 6 is a distance such as squared Euclidean distance, and 7 controls the soft or hard character of the assignment (Gao et al., 9 Apr 2026). In effect, constants are generalized to centroids in a way that remains differentiable.
The latent knowledge base depends on whether relations are defined. If the relations are provided, the knowledge base is
8
where 9 denotes concatenation (Gao et al., 9 Apr 2026). If relations are undefined, as in pure image settings, the knowledge base becomes
0
that is, a set of centroids for the constants present in the instance (Gao et al., 9 Apr 2026).
Differentiable substitution then constructs batches of ground substitutions by replacing variables with centroid embeddings and generates inputs 1 encoding body-atom truth values together with labels 2 (Gao et al., 9 Apr 2026). The labels represent target atom truth values in relational tasks and instance-level class labels in pure image tasks. The neural rule learner receives these tensors and induces first-order rules over unary and binary predicates, including placeholder predicates when relations are not defined (Gao et al., 9 Apr 2026).
3. Differentiable semantics and rule induction
The rule learning component is a multi-layer fuzzy-logic network that learns the analogue of 3 and supports program extraction through thresholding (Gao et al., 9 Apr 2026). Truth values are continuous, with 4 for atoms computed by lookup functions from the latent knowledge base (Gao et al., 9 Apr 2026). The target truth value is predicted by
5
where fuzzy disjunction is implemented as
6
Each intermediate layer is
7
with trainable matrix 8 and fixed bias 9 controlling the activation threshold (Gao et al., 9 Apr 2026).
A row-softmax normalization is imposed on the trainable matrices:
0
This ensures that each row forms a convex combination over inputs, which the paper describes as a soft selection of body atoms (Gao et al., 9 Apr 2026). Conjunction is therefore approximated by a linear mixture followed by thresholding,
1
while disjunction is implemented by the product 2-norm (Gao et al., 9 Apr 2026). Implication and negation are not explicitly parameterized; instead, clause evaluation is modeled by composition of mixtures and thresholds (Gao et al., 9 Apr 2026).
The global loss combines predictive fit and clustering quality:
3
The parameter 4, called 5 in the paper’s ablation and denoted here as 6, controls the trade-off between rule satisfaction and generalization quality (Gao et al., 9 Apr 2026). Larger 7 emphasizes cluster assignments and smaller 8 prioritizes fitting rule semantics. The paper states that fixed values are used in experiments and ablations, although scheduling such as warm-up or annealing is possible (Gao et al., 9 Apr 2026).
After training, clause extraction proceeds through the program tensor
9
Each row corresponds to a clause, and entries above a threshold determine which body atoms belong to that clause (Gao et al., 9 Apr 2026). Rule precision and recall are then computed over induced substitutions. The paper gives
0
and
1
as the clause-scoring routine (Gao et al., 9 Apr 2026).
4. Predicate invention and weakly supervised grounding
A central feature of γILP is predicate invention from percepts rather than from predefined symbolic vocabularies (Gao et al., 9 Apr 2026). When relations are undefined, the system attaches placeholder predicates to term lists, unary for 2 and binary for 3, while constraining the number of variables to equal the number of clusters and associating each variable 4 with centroid 5 (Gao et al., 9 Apr 2026). The semantics of these predicates are then inferred post hoc by analyzing the constants assigned to the corresponding variables and, for binary placeholders, their order (Gao et al., 9 Apr 2026).
The paper explicitly distinguishes learning from translation. LLMs are used only to translate inferred semantics into natural language; they are not used for learning the predicates themselves (Gao et al., 9 Apr 2026). This design is presented as a way to avoid label leakage while still allowing human-readable interpretation of the induced program (Gao et al., 9 Apr 2026).
For undefined relations, truth lookup is defined by conjunction over variable assignments:
6
In other words, all variable-centroid assignments for the atom’s variables must be present in the knowledge base (Gao et al., 9 Apr 2026). This differs from the relational case, where lookup is based on whether a grounded atom belongs to the latent knowledge base.
The paper provides an explicit semantics-induction routine. For binary atoms 7, the procedure retrieves constants associated with the variables and issues the query “What is the relation between the two ordered sets of images?” For unary atoms 8, it queries “What is the common property of the set of images?” The resulting descriptions are then used to generalize the constrained logic program by replacing placeholders with induced predicates (Gao et al., 9 Apr 2026). A plausible implication is that interpretability is produced in two stages: a latent structural stage during optimization and a linguistic stage after rule induction.
5. Experimental scope and reported results
The experimental evaluation spans three regimes: classical symbolic ILP datasets, relational image datasets, and pure image datasets (Gao et al., 9 Apr 2026). The symbolic tasks include arithmetic problems such as Predecessor, Odd, Even, Lessthan, Fizz, and Buzz; list tasks such as Member and Length; family-tree tasks such as Son, Grandparent, Husband, Uncle, Relatedness, and Father; and graph tasks such as Undirected Edge, Adjacent to Red, Two Children, Graph Coloring, Connectedness, and Cyclic (Gao et al., 9 Apr 2026).
On the symbolic relational task Predecessor, γILP learns
9
with precision 0 and recall 1 according to the paper’s appendix table (Gao et al., 9 Apr 2026). More broadly, the paper states that yILP matches DFORL across most classical ILP tasks, while struggling with Fizz and Buzz because they require 2–3 variables and therefore produce a search-space explosion without templates (Gao et al., 9 Apr 2026).
For relational image datasets, the setup replaces symbolic constants with MNIST images while keeping relations defined as text embeddings and hiding image labels from the learner (Gao et al., 9 Apr 2026). The atom embedding is written as
4
with lookup 5 if the atom is in the knowledge base and 6 otherwise (Gao et al., 9 Apr 2026). The paper reports that yILP learns complete rules in most tasks and gives examples from temporal MNIST sequences:
7
and
8
It also states that LLMs degrade if relation semantics are obfuscated, whereas yILP still induces rules, which the paper attributes to the absence of label leakage (Gao et al., 9 Apr 2026).
For pure image datasets, the paper studies Kandinsky patterns under the tasks two-pair (TP), one-red (OR), and one-triangle (OT) (Gao et al., 9 Apr 2026). In the TP setting, placeholder rules
9
are interpreted via cluster analysis and LLM translation as approximately “same shape, different color,” yielding the generalized rule
0
For OR, the induced rule
1
is translated and generalized to
2
and for OT,
3
(Gao et al., 9 Apr 2026). Reported accuracies are yILP-ViT 4 on OR and OT and 5 on TP, and yILP-VAE 6 on OR and OT and 7 on TP (Gao et al., 9 Apr 2026).
The paper summarizes these results as strong performance on symbolic ILP benchmarks, relational image datasets, and pure image datasets, and specifically notes that RIPPER and C4.5 perform worse and are less interpretable on Kandinsky patterns (Gao et al., 9 Apr 2026).
6. Optimization, implementation, and computational characteristics
The optimization procedure is end-to-end and uses AdamW (Gao et al., 9 Apr 2026). Gradients propagate from the MSE term at the rule-network output through the differentiable substitution-generated inputs and then into encoders and cluster centroids through the clustering term (Gao et al., 9 Apr 2026). No explicit sparsity or length penalties are imposed; instead, structure sparsity arises from the ReLU thresholds and row-softmax mixtures (Gao et al., 9 Apr 2026). Predicate invention is regularized only implicitly, through variable constraints equating the number of variables and the number of clusters (Gao et al., 9 Apr 2026).
The design choices reported for the experiments are specific. Constant encoders are ViT or VAE; textual relations are encoded by VAE; clustering uses differentiable 8-means with learnable centroids and a hardness parameter 9; and the rule network is layered linear-ReLU with row-softmax normalization and final fuzzy disjunction (Gao et al., 9 Apr 2026). The paper explicitly states that no GNNs or slot attention are used and that integration proceeds through concatenation and tensorized lookups (Gao et al., 9 Apr 2026).
Typical hyperparameters are also provided. The number of clusters 0 is 1–2 for Kandinsky and 3 in MNIST-digit experiments; rule-network learning rates are 4–5; clustering learning rates are 6–7; 8; and 9 lies in the range 0–1 in the ablations (Gao et al., 9 Apr 2026). The bias 2 is fixed per layer, and training continues until convergence or a time limit, with symbolic ILP experiments using, for example, 3 minutes (Gao et al., 9 Apr 2026).
The input dimension for predefined relations is described by
4
so the dimensionality grows quadratically in the number of variables 5 and linearly in the number of predicates (Gao et al., 9 Apr 2026). Batch substitution and tensorized lookup are described as GPU-friendly, and training times on A100 are said to be practical, although they increase with 6 and knowledge-base size (Gao et al., 9 Apr 2026).
The pseudocode in the paper makes the training regime explicit. Differentiable substitution first updates clustering, obtains 7 for all constant embeddings, and then samples positive and negative substitutions either from known target facts or from image instances (Gao et al., 9 Apr 2026). The training loop constructs 8 by knowledge-base lookup, sets 9, computes
00
updates encoders, centroids, and rule parameters using AdamW, and finally extracts rules from 01 through thresholding (Gao et al., 9 Apr 2026).
7. Position in the literature, limitations, and open directions
The paper positions γILP against several strands of ILP and neurosymbolic research (Gao et al., 9 Apr 2026). Classical ILP systems such as FOIL and Aleph are described as symbolic and non-differentiable, whereas yILP is presented as end-to-end and GPU-based through differentiable substitution (Gao et al., 9 Apr 2026). SILP/OILP are characterized as differentiable rule-template methods over symbolic inputs, and yILP is described as extending this style of induction to images without label leakage and with predicate invention from percepts (Gao et al., 9 Apr 2026). NeuralILP, DeepProbLog, and SATNet are said to combine neural perception with symbolic reasoning but typically require symbolic labels for constants or predicates, while yILP operates in latent space with clustering-based grounding (Gao et al., 9 Apr 2026). NeurRL is described as extending differentiable rule induction to raw sequences, whereas yILP focuses on images and relations, adding predicate invention and LLM-based translation (Gao et al., 9 Apr 2026).
The paper’s qualitative analysis states that invented predicates often correspond to consistent, human-meaningful concepts, such as same shape and different color (Gao et al., 9 Apr 2026). It also notes that many rules reach precision 02, although in the two-pair Kandinsky task precision can drop when only a subset of required pairs is captured (Gao et al., 9 Apr 2026).
Several failure modes are identified. The approach is sensitive to detection and segmentation errors because poor encodings or unstable clustering degrade grounding (Gao et al., 9 Apr 2026). Spurious correlations may arise when clustering groups objects by nuisance features rather than semantically relevant ones, making 03 tuning important (Gao et al., 9 Apr 2026). The method can also overfit or underfit on long-chain tasks such as Fizz and Buzz when stronger language bias or templates are absent (Gao et al., 9 Apr 2026). This suggests that, despite the differentiable design, search control remains a significant issue in higher-arity or longer-range rule induction.
Future directions listed in the paper include richer quantifiers and longer rules through stronger language bias or meta-interpretive priors, temporal and spatial rules with explicit relation grounding, multimodal integration of text and images, coupling with LLMs for promptable rule priors and constrained search, and extensions to GNNs or relational transformers for structured perception (Gao et al., 9 Apr 2026). In that sense, γILP is presented not as a replacement for symbolic ILP or perception-heavy architectures, but as a framework for unifying differentiable symbol grounding, rule induction, and post hoc predicate semantics within a single visual-relational learning system (Gao et al., 9 Apr 2026).