TL;DR
This paper introduces a neuro-symbolic contrastive learning framework that bridges pre-trained language models (PLMs) and Inductive Logic Programming (ILP). By using ILP to generate "hard" contrastive examples based on abstract logical meta-rules, the approach significantly enhances the cross-domain generalization and reasoning capabilities of language models on inference tasks.
What Problem Does This Paper Address?
While pre-trained language models (PLMs) excel at Natural Language Inference (NLI) tasks, they often cheat. Studies show they frequently rely on shallow heuristics—like looking only at the hypothesis sentence while ignoring the premise, or remaining completely indifferent when word order is shuffled. They struggle to genuinely infer underlying logical relationships, especially when tested on out-of-domain data.
Conversely, Inductive Logic Programming (ILP) is a symbolic machine learning approach that excels at learning clean, interpretable logical rules from very little data. However, ILP is discrete and brittle; it requires inputs to be perfectly and precisely specified, making it difficult to apply directly to the messy, ambiguous world of natural language.
The authors address this gap by creating a bridge: a neuro-symbolic framework that injects the structured rigor of symbolic logic into the smooth, differentiable space of deep neural networks.
Methods
The authors propose a Level 3 neuro-symbolic system (where a neural network and a symbolic system interact to solve complementary tasks) driven by Neuro-Symbolic Contrastive Learning.
The pipeline consists of the following key steps:
- Rule-Based Translation: They use LoLA (an extension of the Grammatical Framework) to seamlessly translate back and forth between first-order predicate logic and natural language.
- Meta-Rule Mapping: Instead of trying to force a PLM to learn discrete logical functions directly, they map natural language to abstract logical "meta-rules" (isomorphic templates).
- Hard Contrastive Pair Generation: Using ILP, they construct training triplets consisting of:
- Anchor ($E$): A baseline premise-hypothesis pair.
- Hard Positive ($E^+$): A pair from a completely different textual domain that shares the exact same underlying logical meta-rule structure.
- Hard Negative ($E^-$): A pair that is textually highly similar to the anchor but possesses a fundamentally different (and contradictory) logical structure.
- Contrastive Optimization: They fine-tune the language model (e.g., BERT or RoBERTa) using a contrastive loss function ($L_{cl}$). This loss pulls logically identical representations closer together in the embedding space while pushing logically distinct ones apart, effectively "carving" sharp logical structures into a continuous neural network.
Datasets
The authors evaluated their framework on three symbolic NLI datasets, augmented to introduce high linguistic and structural variability:
- Popper Kinship Dataset: A benchmark ILP dataset focused on family relationships (e.g., defining a "grandparent" based on "parent" predicates).
- City Transportation Dataset: A newly introduced, self-proposed dataset mapping train connections and feasible travel paths between various cities.
- GILPS Ancestor Dataset: A larger family tree dataset containing multi-generational relationships, names, and genders, used primarily to test cross-domain transfer.
Key Insights and Ideas
- Language Models Learn Logic Better in the Abstract: One of the paper's most striking findings is that language models achieve higher accuracy and better Spearman correlation when trained on raw logical forms (e.g.,
p(Ann, Amy)) rather than natural language text. Abstract representations strip away distracting surface-level textual features. - Isomorphic Rules Bridge Domains: By focusing on meta-rules, the model learns that the logic defining a family tree ("A is the grandparent of B because A is the parent of C and C is the parent of B") is mathematically identical to the logic of transit ("You can travel from City A to City B because you can go from A to C and C to B"). This allows for powerful cross-domain generalization.
- Shaping the Topology: Continuous neural networks inherently struggle with the discrete, sparse nature of logical functions. Contrastive learning acts as a geometric tool to shape the embedding space, forcing the network to respect logical boundaries despite textual variations.
Key Results
The framework was evaluated against baseline BERT-Base and RoBERTa-Base models across in-domain, cross-domain, and cross-form (logic to natural language) tasks:
- In-Domain Performance: On a combined Kinship and City dataset, adding Neuro-Symbolic Contrastive Learning boosted RoBERTa-Base's accuracy from 0.62 to 0.74.
- Cross-Domain Transfer: When trained on the Kinship/City logic domains and evaluated on the entirely unseen Ancestor logic domain, RoBERTa-Base's accuracy jumped dramatically from 0.45 to 0.64.
- Cross-Form Transfer: When trained on logical formulas and tested on natural language text, the neuro-symbolic CL framework successfully mitigated the typical accuracy drop, raising RoBERTa's performance from 0.53 to 0.62.
Limitations and Future Work
- Template-Dependence: The translation between logic and natural language relies on rule-based templates via LoLA. This limits the fluidity and diversity of the generated text compared to open-ended human language.
- Logic Complexity: The framework currently focuses on Horn clauses and relatively straightforward first-order logic templates. Scaling this to non-monotonic reasoning, probabilistic logic, or highly complex real-world arguments remains an open challenge.
- Scale: The experiments were conducted on smaller base models (BERT and RoBERTa); exploring how this framework scales to Large Language Models (LLMs) is a natural next step.
Summary updated