Abstract
Answering compositional questions requiring multi-step reasoning is challenging for current models. We introduce an end-to-end differentiable model for interpreting questions, which is inspired by formal approaches to semantics. Each span of text is represented by a denotation in a knowledge graph, together with a vector that captures ungrounded aspects of meaning. Learned composition modules recursively combine constituents, culminating in a grounding for the complete sentence which is an answer to the question. For example, to interpret ‘not green’, the model will represent ‘green’ as a set of entities, ‘not’ as a trainable ungrounded vector, and then use this vector to parametrize a composition function to perform a complement operation. For each sentence, we build a parse chart subsuming all possible parses, allowing the model to jointly learn both the composition operators and output structure by gradient descent. We show the model can learn to represent a variety of challenging semantic operators, such as quantifiers, negation, disjunctions and composed relations on a synthetic question answering task. The model also generalizes well to longer sentences than seen in its training data, in contrast to LSTM and RelNet baselines.
Introduction
Traditional neural question-answering (QA) systems often treat questions as sequences to be encoded into fixed-length vectors. While effective for simple queries, this "black box" approach frequently fails at compositionality—the principle that the meaning of a complex expression is systematically constructed from its parts. Standard models like LSTMs struggle to generalize from short training examples to longer, multi-step questions, even when the underlying logic remains the same.
Conversely, classical semantic parsers offer high interpretability but typically require expensive, manually annotated logical forms for training. This paper introduces a middle ground: an end-to-end differentiable model that learns from answers alone while maintaining the structural rigor of formal semantics through a framework of Neural Compositional Denotational Semantics.
Methodology
The core of the proposed approach is a hybrid representation that bridges symbolic logic and neural learning. Every span of text is represented by two distinct components:
- A Denotation: A soft grounding in a Knowledge Graph (KG), such as a probability distribution over entities or a soft adjacency matrix for relations.
- An Ungrounded Vector: A trainable vector capturing logical aspects not yet grounded in the KG, such as the meaning of "not," "and," or "every."
Neural Composition Modules
To combine these representations, the model employs a set of differentiable modules. These modules learn to perform logical operations by using ungrounded vectors to parameterize functions over denotations. For instance, a $V + E \to E$ module can learn to use the vector for "not" to perform a complement operation on a set of entities.
Latent Parsing via Charts
Rather than relying on a fixed syntax, the model considers all possible binary parse trees for a sentence using a parse chart (similar to the CKY algorithm). A "Phrase Semantic Type Potential" weights different structures, allowing the model to jointly learn syntax and semantics. The entire system is trained via gradient descent, using only the final answer as supervision.
Experimental Evaluation
The model was evaluated on two primary datasets:
- CLEVRGEN: A diagnostic dataset designed to test compositional generalization. It includes "Short Questions" for training and "Complex Questions" (longer reasoning chains) for testing.
- GenX: A dataset of human-generated natural language queries, testing robustness to the linguistic diversity of real-world language.
Key Results
- Structural Generalization: On the CLEVRGEN Complex task, the model maintained 84.6% accuracy, whereas standard LSTMs and Relation Networks dropped to near-random performance (40-50%).
- Synthetic Reasoning: The model achieved 99.9% accuracy on the standard CLEVRGEN test set, effectively solving the synthetic task.
- Natural Language Performance: On the human-generated GenX dataset, the model reached 73.7% accuracy, significantly outperforming standard LSTMs (64.9%) and traditional semantic parsers like SEMPRE (48.1%).
Discussion and Conclusion
The success of this model highlights the importance of linguistically motivated inductive bias. By constraining the model to follow a tree structure and use specific semantic types (Entities, Relations, Truth values), it avoids overfitting to surface-level statistical shortcuts. Furthermore, the use of differentiable logic allows the model to learn the "fuzzy" operators required for natural language without hard-coding rules.
While the current $O(n^3)$ complexity of chart parsing and exact KG inference may limit scalability to massive datasets like Freebase, the framework demonstrates a powerful path forward for interpretable, compositional neural reasoning.
Summary updated