Tuning Language Models with Spatial Logic for Complex Reasoning

Tanawan Premsri, Parisa KordjamshidiSpLU-RoboNLP @ ACL 2024

TL;DR

This paper tackles the challenge of complex spatial reasoning in Large Language Models (LLMs) by introducing a neuro-symbolic training approach. By incorporating explicit spatial logical rules as constraints during fine-tuning, the authors demonstrate improved generalizability and abstraction capabilities, leading to better performance on spatial QA tasks, especially for smaller models.

What Problem Does This Paper Address?

Large Language Models (LLMs) have shown remarkable progress in natural language processing, but they often struggle with complex reasoning, particularly in unobserved compositional scenarios. This limitation stems from their potential inability to achieve the necessary level of abstraction for true generalizability. While LLMs can perform well on tasks with sufficient training data, they may fail when faced with novel combinations of concepts or reasoning steps. This paper specifically targets the domain of spatial reasoning over text, a crucial aspect of human cognition and a key bottleneck for LLMs in applications like robotics and language grounding. The authors aim to bridge the gap between LLMs' pattern matching abilities and genuine reasoning by leveraging symbolic knowledge.

Methods

The core of this paper is a neuro-symbolic fine-tuning approach. Instead of relying solely on massive datasets and prompt engineering, the authors propose to inject explicit spatial logical rules into the training process. These rules, representing relationships like "left of," "above," and transitivity, are used as constraints during fine-tuning.

Here's a breakdown of their method:

  • Spatial Logic as Constraints: They utilize a knowledge base of spatial logical rules. These rules are translated into differentiable soft logic constraints.
  • Neuro-Symbolic Training: The models are trained to minimize not only the standard cross-entropy loss (task performance) but also a loss component that penalizes violations of these spatial logic constraints. This dual objective encourages the model to learn abstractions that are consistent with logical reasoning.
  • Q-Chain Augmentation: For training, they automatically augment questions by creating a "Q-chain" – a sequence of intermediate questions derived from the initial facts and leading to the target answer. This helps the model learn multi-hop reasoning.
  • Backbone Models: They experiment with both encoder-based models (BERT) and generative models (Flan-T5), and also compare their approach with larger LLMs (GPT-family, Llama3) using in-context learning.

Datasets

The authors evaluate their approach on several spatial question-answering (SQA) datasets:

  • SpaRTUN: A synthetic SQA dataset with both Yes/No (YN) and find-relation (FR) questions, used for pre-training.
  • SPARTQA-Human (Ver.1 & Ver.2): A small, human-annotated SQA dataset. They primarily use the YN portion for fine-tuning and evaluation.
  • ResQ: A small, realistic domain SQA dataset that requires multi-hop reasoning and often commonsense knowledge. This dataset contains only YN questions.
  • STEPGAME: A synthetic SQA dataset designed for evaluating multi-hop spatial reasoning over various depths. This dataset contains only FR questions.

Key Insights and Ideas

  • Logic as a Generalization Booster: The central hypothesis is that by forcing models to adhere to logical rules during training, they are compelled to learn higher levels of abstraction. This improved abstraction leads to better generalizability, especially in unseen complex scenarios.
  • Smaller Models Can Shine: The neuro-symbolic approach shows particular promise for smaller models. While large LLMs often excel due to their vast commonsense knowledge, this method allows smaller models to achieve competitive or even superior performance on complex reasoning tasks by leveraging explicit logical structure.
  • Inference-Time vs. Training-Time Logic: A key advantage is that the symbolic logic is incorporated during training. This avoids the computational burden and potential issues of performing symbolic reasoning at inference time, making it more suitable for real-time applications.
  • Partial Knowledge is Sufficient: The approach doesn't require a complete, exhaustive knowledge base of spatial logic. Any available logical knowledge can be leveraged to enhance the model's reasoning capabilities.

Key Results

  • Improved Accuracy on Spatial QA: The proposed neuro-symbolic fine-tuning approach consistently improved the accuracy of both BERT and Flan-T5 models across various benchmarks, particularly on datasets requiring multi-hop reasoning like STEPGAME and ResQ.
  • Flan-T5-T+Q-Chain showed a 2% improvement over Flan-T5-T on the ResQ dataset.
  • On the STEPGAME dataset, the fine-tuning method consistently demonstrated significant differences in all steps of reasoning compared to LLMs.
  • Comparison with LLMs: While LLMs (GPT-3.5, GPT-4, Llama3) generally performed better on the realistic ResQ dataset (likely due to commonsense knowledge), the authors' method narrowed the performance gap, especially on complex reasoning tasks. For instance, on STEPGAME, the fine-tuned models showed significant improvements over LLMs at higher reasoning depths.
  • In-context Learning Effectiveness: Among in-context learning methods, Chain-of-Thought (CoT) was found to be the most effective for spatial reasoning. However, the "step-by-step reasoning" prompting technique, which simplifies context, also showed notable improvements.

Limitations and Future Work

  • General Reasoning is Still a Challenge: The authors acknowledge that their approach improves spatial reasoning but does not solve the broader problem of general reasoning in LLMs.
  • Computational Resources: Running these models, especially with extensive fine-tuning, can be computationally expensive, requiring significant GPU resources.
  • Future Work: The authors suggest integrating their method with LLMs that possess stronger commonsense capabilities to further boost overall performance. They also prioritize using open-source models in future research. The work also opens avenues for exploring more complex domains beyond spatial reasoning.

Summary updated

BibTeX
@inproceedings{premsri2024tuning,
  author = {Tanawan Premsri and Parisa Kordjamshidi},
  title = {{Tuning Language Models with Spatial Logic for Complex Reasoning}},
  booktitle = {SpLU-RoboNLP @ ACL},
  year = {2024},
  url = {https://openreview.net/forum?id=cDm7zGenhZ},
}
Figure