Efficient Tuning and Inference for Large Language Models on Textual Graphs

Yun Zhu, Yaoke Wang, Haizhou Shi, Siliang Tang

Abstract

Rich textual and topological information of textual graphs need to be modeled in real-world applications such as webpages, e-commerce, and academic articles. Practitioners have been long following the path of adopting a shallow text encoder and a subsequent graph neural network (GNN) to solve this problem. In light of recent advancements in large language models (LLMs), it is apparent that integrating LLMs for enhanced textual encoding can substantially improve the performance of textual graphs. Nevertheless, the efficiency of these methods poses a significant challenge. In this paper, we propose ENGINE, a parameter- and memory-efficient fine-tuning method for textual graphs with an LLM encoder. The key insight is to combine the LLMs and GNNs through a tunable side structure, which significantly reduces the training complexity without impairing the joint model's capacity. Extensive experiments on textual graphs demonstrate our method's effectiveness by achieving the best model performance, meanwhile having the lowest training cost compared to previous methods. Moreover, we introduce two variants with caching and dynamic early exit to further enhance training and inference speed. Specifically, caching accelerates ENGINE's training by 12x, and dynamic early exit achieves up to 5x faster inference with a negligible performance drop (at maximum 1.17% relevant drop across 7 datasets).

Introduction

Textual graphs, where nodes are associated with rich text (e.g., citation networks, e-commerce platforms), require simultaneous modeling of semantic meaning and topological structure. Traditional approaches utilizing shallow text encoders followed by Graph Neural Networks (GNNs) are increasingly being surpassed by Large Language Models (LLMs) like LLaMA2 due to their superior semantic understanding. However, integrating LLMs into graph tasks presents a significant scalability challenge. Backpropagating through a 7-billion-parameter LLM for every node and its neighbors is computationally prohibitive, often requiring enormous VRAM and time that makes it impractical for most real-world applications.

The ENGINE Framework

To address these challenges, we introduce ENGINE (Efficient TuNing and Inference for Large Language Models on Textual Graphs). ENGINE is built upon three core innovations designed to maximize efficiency without sacrificing performance.

G-Ladders and Side Structure

Instead of inserting adapters within the LLM (e.g., LoRA), ENGINE employs a lightweight "ladder" of GNN layers alongside a frozen LLM backbone. At each layer, the LLM's hidden states are extracted via a readout operation and fed into the G-Ladder. Here, message passing occurs to incorporate neighborhood information, allowing structural injection at every depth of the LLM's hierarchy. This decoupling reduces memory consumption from ~45GB (with LoRA) to just ~3.3GB.

The architecture of ENGINE featuring G-Ladders and Early Exit mechanisms.

Efficiency Enhancements: Caching and Early Exit

Because the LLM backbone is frozen, its outputs for a given node's text are deterministic. ENGINE leverages this by precomputing and caching these embeddings, eliminating redundant heavy forward passes during training. This results in a massive 12x speedup compared to the non-cached version.

For inference, ENGINE introduces Dynamic Early Exit. Not every node requires the full depth of a 32-layer LLM. By adding early exit classifiers after each G-Ladder layer and using a "patience" criterion (stopping when predictions stabilize across consecutive layers), the model significantly reduces inference latency while maintaining accuracy.

Experimental Results

ENGINE was evaluated across seven diverse textual graph benchmarks, including citation networks (Cora, CiteSeer, OGBN-ArXiv) and e-commerce graphs (OGBN-Products).

Accuracy and Training Efficiency

ENGINE consistently outperformed state-of-the-art (SoTA) methods like SimTeG and GLEM. On the WikiCS dataset, it achieved a ~3% absolute improvement. More impressively, ENGINE demonstrates extreme training efficiency. On the OGBN-ArXiv dataset, ENGINE with caching completed training in just 21 minutes, representing a 72x speedup over SimTeG's 25 hours.

Accuracy vs. Total training time for various models, highlighting ENGINE's superior efficiency and performance.

Inference Speedup and Parameter Efficiency

The early exit variant achieved up to 5x faster inference with minimal performance impact (maximum 1.17% drop). Furthermore, ENGINE is highly parameter-efficient, updating only ~3.9 million parameters when paired with LLaMA2-7B—less than 0.1% of the total model size.

Conclusion

ENGINE provides a scalable and effective framework for applying LLMs to textual graphs. By decoupling the tunable components into a side structure and utilizing caching and early exit strategies, it achieves state-of-the-art results with a fraction of the computational cost. Future work will explore extending this framework to other graph tasks such as link prediction and even larger model scales.

Summary updated

BibTeX
@inproceedings{zhu2024efficient,
  author = {Yun Zhu and Yaoke Wang and Haizhou Shi and Siliang Tang},
  title = {{Efficient Tuning and Inference for Large Language Models on Textual Graphs}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {2024},
  url = {https://openreview.net/forum?id=b3yOkQCKT2},
}
Figure