TL;DR
This paper introduces GRIP, a novel method that allows Large Language Models (LLMs) to reason over graph-structured data by internalizing graph knowledge directly into the LLM's parameters using LoRA adapters. This approach significantly reduces inference costs and improves performance, especially for large graphs that exceed LLM context windows, by eliminating the need to feed the graph as explicit context during inference.
What Problem Does This Paper Address?
Large Language Models (LLMs) excel at processing sequential text but struggle with structured data like graphs. Existing methods either convert graphs into lengthy text sequences (leading to high token overhead and inefficiency, especially for large graphs) or require complex, specialized modules and extensive fine-tuning to align graph and language representations. These approaches often fall short due to modality misalignment or computational burdens. The core challenge is enabling LLMs to effectively leverage intricate graph information for reasoning tasks without the prohibitive costs associated with traditional graph-to-text conversions or complex external modules.
Methods
GRIP tackles this by fine-tuning LLMs using Low-Rank Adaptation (LoRA) to directly embed graph knowledge into the model's parameters. The process involves two main stages:
- Graph Context Memorization: This stage injects graph information into the LoRA parameters. It includes:
- Context Memorization: Fine-tuning on individual node and edge features.
- Summarization: Generating and fine-tuning on summaries of nodes, edges, and subgraphs to capture local and higher-order structural information.
- In-Parameter Graph Reasoning through Question Answering: This stage teaches the LLM to utilize the memorized knowledge. It involves:
- Context QA: Training the model to retrieve memorized graph facts by masking and predicting node attributes or edge components.
- Reasoning QA: Training the model to perform reasoning over graph structures by generating and answering questions based on sampled subgraphs.
At inference, the fine-tuned LLM (with the LoRA adapter) can answer queries about the graph without needing the graph data as input, making it highly efficient.
Datasets
The paper evaluates GRIP on two categories of graph tasks:
- Knowledge Graph Completion: FB15K237, WN18RR, CoDEx-Medium, and NELL23K. These datasets involve predicting missing relations between entities.
- Advanced Reasoning on Graphs: Scene Graph and CLEGR-Reasoning. Scene Graph involves answering questions about image-based scene graphs, while CLEGR-Reasoning uses synthetic subway graphs for complex reasoning tasks.
No new datasets were introduced; existing benchmarks were used.
Key Insights and Ideas
- Internalizing Graph Knowledge: The core idea is that LLMs can learn to "remember" graph structures and relationships directly within their parameters, bypassing the need for explicit graph context at inference.
- LoRA for Efficient Storage: Using LoRA adapters is crucial for compactly storing this internalized graph knowledge, making it parameter-efficient.
- Task Decomposition for Learning: Breaking down the learning process into memorization (context, summarization) and reasoning (QA) tasks effectively guides the LLM to acquire and utilize graph information.
- Efficiency Gains: The most significant insight is the dramatic reduction in inference time and token usage, especially for large graphs, by eliminating the need for graph-to-text conversion.
- Versatility: GRIP's fine-tuning tasks are designed to be adaptable, allowing it to handle different types of graph reasoning tasks effectively.
Key Results
- Performance: GRIP consistently outperforms baseline LLMs that rely on graph-to-sequence conversion, especially for large graphs that exceed LLM context windows. For smaller graphs that fit within context windows, GRIP achieves comparable performance without context and even surpasses baselines when provided with the same context, acting as an effective test-time adaptation method.
- Efficiency: GRIP reduces inference time by approximately 30% on knowledge graph datasets and over 60% on reasoning datasets compared to context-based LLM baselines. This is achieved by eliminating the need to process graph context at inference.
- Ablation Studies: Removing any of the designed fine-tuning tasks (context memorization, summarization, context QA, reasoning QA) leads to a performance drop, highlighting the contribution of each component. Applying LoRA to MLP modules was found to be most effective.
- LoRA Rank: GRIP demonstrates strong performance even with a low LoRA rank (r=1), indicating efficient compression of graph knowledge.
Limitations and Future Work
- Training Cost: GRIP incurs an additional fine-tuning cost, which might outweigh inference savings for very small graphs.
- Dynamic Graphs: GRIP is less suitable for graphs that undergo frequent and large-scale changes, as it's primarily designed for static graphs. This is a broader challenge for LLMs.
- Multi-Graph Handling: While straightforward to extend to multiple graphs by treating them as a single large graph or using LoRA merging, a systematic study is left for future work.
- Multi-Stage Training: The performance in multi-stage training for growing graphs varied across datasets, suggesting room for improvement in strategies for handling evolving graph data.
Summary updated