Can LLM Graph Reasoning Generalize beyond Pattern Memorization?

Yizhuo Zhang, Heng Wang, Shangbin Feng, Zhaoxuan Tan, Xiaochuang Han, Tianxing He, Yulia Tsvetkov

Introduction

As Large Language Models (LLMs) are increasingly applied to structured data tasks like multi-hop question answering and common-sense reasoning, researchers have turned to "graph instruction tuning"—training models on synthetic graph problems to boost their performance. However, these models are typically evaluated on data that closely mirrors their training sets. This research investigates a critical question: Are LLMs robust graph reasoners or merely "pattern regurgitators"?

If a model is trained to find the shortest path in a graph described as "node A is connected to B," can it still do so if the description changes to "Alice and Bob are friends"? More importantly, does training on these synthetic puzzles actually help the model solve messy, real-world problems with underlying graph structures?

The NLGIFT Benchmark

To address these questions, the authors propose NLGIFT (Natural Language Graph reasoning with shifting patterns), a comprehensive testbed designed to measure out-of-distribution (OOD) generalization. They evaluate models—specifically ChatGPT (GPT-3.5-Turbo) and Llama-2-7B—across five levels of shifting patterns that increase in complexity.

Overview of the NLGIFT Benchmark, featuring five types of graph reasoning patterns that are increasingly challenging in order.

The benchmark contains 37,000 problems:

  • 33,000 synthetic problems covering tasks like connectivity, shortest path, topological sort, and maximum flow.
  • 4,000 real-world problems drawn from existing datasets such as StrategyQA (multi-hop reasoning), Knowledge Crosswords (relational logic), ExplaGraphs (common-sense reasoning), and Proscript (event ordering).

Key Insights: The "Regurgitation" Trap

The study reveals that LLMs are surprisingly brittle. While they can handle semantic and numerical shifts reasonably well, they struggle with structural changes. Specifically, graph size is a major hurdle; models trained on small graphs (3-10 nodes) fail to generalize to larger ones (11-25 nodes).

Performance plummeted during "Reasoning Generalization" tests (training on one task and testing on another). Models achieved "Significant Transfer" (performing better than the zero-shot baseline) in only 33% of cases and never reached the "Strong Recovery" standard (matching in-distribution performance).

Negative Transfer in the Real World

Perhaps the most striking finding is that for real-world tasks, graph instruction tuning was counterproductive in 69% of cases. Training on synthetic puzzles often made the models worse at solving actual problems like StrategyQA. On the most challenging real-world patterns, LLMs achieved basic generalization in only 6% of settings.

The Realistic Pattern in NLGIFT evaluates whether training on synthetic graph logic transfers to real-world tasks like determining historical facts or common-sense relationships.

This suggests models are leaning heavily on their initial language training rather than acquiring new reasoning skills. The authors found a positive correlation between how often certain "graph keywords" appeared in massive pre-training corpora and how well the model performed on those specific patterns.

Conclusion and Future Work

Empowering LLMs to go beyond pattern memorization remains an open research question. When exploring ways to mitigate these issues, the authors found that Direct Preference Optimization (DPO)—aligning the model based on preferred vs. dispreferred reasoning paths—was more effective than simply adding more training data or using Chain-of-Thought (CoT) prompting.

Future research directions include exploring neuro-symbolic approaches (combining LLMs with dedicated graph neural networks), multi-modal representations, and refining alignment techniques to teach models the underlying rules of graph logic rather than just the surface-level patterns.

Summary updated

BibTeX
@inproceedings{zhang2024can,
  author = {Yizhuo Zhang and Heng Wang and Shangbin Feng and Zhaoxuan Tan and Xiaochuang Han and Tianxing He and Yulia Tsvetkov},
  title = {{Can LLM Graph Reasoning Generalize beyond Pattern Memorization?}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2024},
  doi = {10.18653/v1/2024.findings-emnlp.127},
}
Figure