TL;DR
This paper introduces NT-NSM, a novel framework for Knowledge Base Question Answering (KBQA) that imbues models with numerical reasoning capabilities, specifically for ordinal-constrained questions. By developing a specialized "NumericalTransformer" and a comprehensive reasoning module, NT-NSM significantly outperforms existing methods on tasks requiring understanding of numerical relationships like "latest" or "largest."
What Problem Does This Paper Address?
Traditional Knowledge Base Question Answering (KBQA) models, particularly those relying on embeddings, excel at retrieving factual information but falter when questions involve numerical reasoning. This is especially true for "ordinal constrained questions," which require understanding relationships like "latest album" or "largest area," where the answer isn't just a fact but a selection based on a numerical or temporal order. Existing embedding-based models struggle because they don't explicitly encode the magnitude or ordinal properties of numerical values, leading to an inability to correctly answer these complex queries.
Methods
The core of the proposed solution is the NumericalTransformer (NT), a transformer-based model designed to learn numerical reasoning. This NT is integrated into an existing state-of-the-art embedding-based KBQA model, NSM, to create NT-NSM.
Key methodological innovations include:
- NumericalTransformer (NT): This model takes question and numerical values as input. It uses a specially devised self-attention mask matrix (SAM) to constrain attention, allowing numbers to attend to question words and smaller numbers, implicitly encoding relative magnitude. It's initialized using RoBERTa and treats numerical values as token sequences.
- Pre-training Tasks: To equip the NT with numerical reasoning skills, two pre-training tasks are introduced:
- Number-aware Triplet Loss (NTL): This loss function enforces the relative magnitude of numbers, ensuring that embeddings reflect their order (e.g., 1 < 2 < 3).
- Number Prediction Loss (NPL): This loss focuses on capturing the ordinal relationship between numbers and ordinal determiners (e.g., "largest," "latest").
- Data Generation for Pre-training:
- Question-irrelevant Numerical Dataset (QIND): A large-scale dataset generated by randomly sampling numerical relations and numbers, then annotating the correct answer based on an ordinal determiner. This allows for extensive pre-training without needing complex question generation.
- Question-guided Numerical Dataset (QGND): A smaller dataset derived from existing ordinal constrained QA pairs, used to fine-tune the NT's understanding of question-specific numerical contexts.
- Comprehensive Reasoning Module: This module intelligently injects the learned number embeddings into the entity embeddings. It includes:
- Question Type Classifier: To identify if a question requires numerical reasoning.
- Entity Pruning: A strategy to select only highly relevant entities for injecting number embeddings, preventing noise from irrelevant numerical data.
- Data Augmentation: A template-based method is used to generate additional ordinal constrained QA pairs, addressing the scarcity of such data in existing benchmarks.
Datasets
- Training and Evaluation: WebQSP, CWQ, LC-QUAD 2.0, and KQA Pro.
- Pre-training Datasets:
- QIND (Question-irrelevant Numerical Dataset): A newly generated dataset for large-scale pre-training of the NumericalTransformer.
- QGND (Question-guided Numerical Dataset): Another newly generated dataset, derived from existing QA pairs, for fine-tuning the NumericalTransformer.
- Data Augmentation: A template-based approach generates pseudo ordinal constrained QA pairs for CWQ and WebQSP.
Key Insights and Ideas
- Numerical Reasoning is a Distinct Challenge: The paper clearly articulates that numerical reasoning in KBQA is fundamentally different from standard reading comprehension, requiring careful handling of number relevance and magnitude.
- Transformer Architecture is Adaptable: The success of the NumericalTransformer, a standard architecture with a custom self-attention mask, highlights the flexibility of transformers for specialized reasoning tasks.
- Pre-training is Crucial for Numerical Skills: The significant performance gains from pre-training on QIND and QGND underscore the importance of dedicated training for acquiring numerical reasoning capabilities.
- Data Augmentation Bridges the Gap: The scarcity of ordinal constrained QA data is a major bottleneck. The proposed template-based augmentation effectively addresses this, leading to substantial performance improvements.
- Targeted Injection is Key: The comprehensive reasoning module, particularly entity pruning, is vital for preventing noise and ensuring that numerical information is integrated effectively only where it's relevant.
Key Results
- Substantial Improvement on Ordinal Questions: NT-NSM achieves significant improvements in Hits@1 accuracy on ordinal constrained questions, outperforming baselines by a considerable margin (e.g., +17.7% on CWQ ordinal, +12.9% on WebQSP ordinal compared to NSM).
- Effectiveness of Components: Ablation studies show that the Self-attention Mask (SAM), Special Number Embedding (SNE), and the pre-training tasks (QIND, QGND, NTL, NPL) all contribute positively to performance.
- Adaptability: The NumericalTransformer can be effectively injected into other embedding-based KBQA models like GRAFT-Net, yielding notable improvements.
- Data Augmentation Impact: Removing data augmentation (DA) leads to a significant drop in performance, highlighting its importance.
Limitations and Future Work
- Generalization of Data Augmentation: While effective, the template-based data augmentation might be somewhat specialized. The authors suggest that more diverse templates could improve model generalization.
- Pruning Threshold Sensitivity: The entity pruning strategy's performance is sensitive to the threshold (μ), requiring careful tuning.
- Adaptation to Other Models: While NT-NSM shows good adaptability to subgraph-based models like NSM and GRAFT-Net, improvements are less pronounced for whole-KB models like KV-Mem and EmbedKGQA, possibly due to challenges in pruning noisy entities in those architectures. Future work could explore better pruning strategies for whole-KB models.
Summary updated