Abstract
Systematically discovering semantic relationships in text is an important and extensively studied area in Natural Language Processing, with various tasks such as entailment, semantic similarity, etc. Decomposability of sentence-level scores via subsequence alignments has been proposed as a way to make models more interpretable. We study the problem of aligning components of sentences leading to an interpretable model for semantic textual similarity. In this paper, we introduce a novel pointer network based model with a sentinel gating function to align constituent chunks, which are represented using BERT. We improve this base model with a loss function to equally penalize misalignments in both sentences, ensuring the alignments are bidirectional. Finally, to guide the network with structured external knowledge, we introduce first-order logic constraints based on ConceptNet and syntactic knowledge. The model achieves an F1 score of 97.73 and 96.32 on the benchmark SemEval datasets for the chunk alignment task, showing large improvements over the existing solutions.
Introduction
In Natural Language Processing (NLP), measuring the similarity between two sentences—Semantic Textual Similarity (STS)—is a foundational task. However, modern deep learning models often operate as "black boxes," providing a similarity score without explaining the underlying reasoning. Interpretable STS (iSTS) addresses this by decomposing sentence-level similarity into alignments between constituent "chunks."
The core challenge in iSTS is creating a model that can handle bidirectionality (ensuring one-to-one mappings) and leverage external knowledge to align chunks that are semantically related but lexically distinct (e.g., recognizing that "Waziristan" is a region in "Pakistan").
Methodology: Logic Constrained Gated Pointer Networks
The proposed architecture, the Logic Constrained Gated Pointer Network, introduces several innovations to improve both accuracy and interpretability.
Chunk Representation and Gating
The model uses BERT to generate contextual embeddings. Chunks are represented by concatenating the embeddings of their first and last words to capture meaning within the sentence context. Unlike standard pointer networks, this model employs a "sentinel" function, allowing segments to point to a null chunk ($\phi$) if no valid partner exists in the opposing sentence.
Bidirectional Alignment via Sinkhorn Distance
To enforce one-to-one alignments, the authors treat the task as an Optimal Transport problem. By applying the Sinkhorn algorithm, the model normalizes alignment distributions in both directions simultaneously. This prevents "many-to-one" errors where multiple chunks in one sentence incorrectly align with a single chunk in the other.
First-Order Logic (FOL) Constraints
The "secret sauce" of this approach is the injection of structured external knowledge via First-Order Logic rules. These rules are derived from ConceptNet (covering synonyms and "is-a" relationships) and syntactic dependency trees. These constraints act as side-supervision, guiding the network to align chunks that human logic suggests should match, even when raw text embeddings are ambiguous.
Experimental Results
The model was evaluated on the SemEval 2016 Task 2 benchmark, which includes 1,125 sentence pairs from news headlines and Flickr image captions. The results demonstrate significant performance gains:
- News Headlines: Achieved an F1 score of 97.73, a 5.6% improvement over the previous state-of-the-art (SOTA).
- Flickr Images: Achieved an F1 score of 96.32, a 7.8% improvement over the previous SOTA.
Ablation studies confirmed that while BERT provides a strong foundation, the addition of FOL constraints was critical for achieving peak performance, particularly on the more diverse image caption dataset.
Key Insights
- Logic vs. Scale: Powerful representations like BERT are not a complete substitute for structured knowledge. FOL constraints significantly boost performance by grounding the model in common-sense relations.
- The Power of One-to-One: Mathematically enforcing bidirectionality through Sinkhorn distance reduces "hallucinated" connections, drastically improving the interpretability of the output.
- Cross-Domain Robustness: The model maintained high performance even when trained on one domain (e.g., news) and tested on another (e.g., images), suggesting that the underlying logic of linguistic alignment is relatively universal.
Conclusion and Future Work
This research demonstrates that NLP models can be made both more transparent and more accurate by grounding deep learning in classical logic. While the model currently relies on pre-defined chunks and fixed ConceptNet relations, future work could explore automated chunking and the dynamic learning of logic constraints to further enhance flexibility and scalability.
Summary updated