NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

An Automatic Graph Construction Framework based on Large Language Models for Recommendation

Rong Shan, Jianghao Lin, Chenxu Zhu, Bo Chen, Menghui Zhu, Kangning Zhang, Jieming Zhu, Ruiming Tang, Yong Yu, Weinan Zhang

Abstract

Graph Neural Networks (GNNs) have become a cornerstone of modern recommender systems due to their ability to model complex relational data. However, constructing high-quality graphs that incorporate deep semantic information remains a significant challenge. Existing Large Language Model (LLM) based approaches often suffer from a "local view" limitation and prohibitive $O(N^2)$ computational complexity. This paper introduces AutoGraph, a novel framework that utilizes LLMs and vector quantization to automatically construct global-view graphs. By mapping pointwise LLM semantic vectors to discrete latent factors, AutoGraph achieves $O(N)$ complexity and captures hierarchical semantic relationships. Experimental results on public benchmarks and a large-scale industrial platform demonstrate significant improvements in recommendation accuracy and efficiency.

Introduction

The effectiveness of Graph Neural Networks (GNNs) in recommendation tasks is largely dependent on the quality of the underlying graph. Traditional graphs based on user-item interactions often lack rich semantic context. While LLMs offer a way to bridge this gap by processing textual metadata, current methods face significant hurdles in scalability and global information integration.

The Challenges of LLM-based Graph Construction

Researchers attempting to use LLMs for graph construction typically encounter two primary obstacles:

  1. Invisibility of Global View: Most methods rely on pairwise comparisons between nodes. This "local" perspective fails to account for global statistics—for instance, a shared feature's importance is often tied to its rarity across the entire dataset, a detail invisible to an LLM processing only two items at a time.
  2. Construction Inefficiency: Pairwise comparisons lead to a computational complexity of $O(N^2)$. For industrial systems with millions of entities, the resulting trillions of LLM calls are economically and technically infeasible.
Challenges in LLM-based graph construction: invisibility of global view and massive computational costs.

The AutoGraph Framework

AutoGraph addresses these challenges through a two-stage process: quantization-based graph construction and graph-enhanced recommendation.

1. Quantization-based Graph Construction

To overcome the $O(N^2)$ bottleneck, AutoGraph shifts from pairwise to pointwise LLM invocation. The LLM summarizes the attributes and preferences of each user or item into a high-dimensional semantic vector once, reducing complexity to $O(N)$.

To restore the global view, the framework employs Residual Vector Quantization (RVQ). These semantic vectors are mapped to a set of discrete "latent factors" maintained in codebooks. These factors are then integrated into the graph as auxiliary nodes. When multiple items share a latent factor, they are implicitly connected, forming a hierarchical structure that captures concepts at varying levels of granularity—from broad genres to niche sub-themes.

2. Graph-enhanced Recommendation

Once the graph is constructed, AutoGraph utilizes Metapath-based Message Propagation. By defining specific paths (e.g., User → Latent Factor → User), the system guides the flow of semantic information. The resulting graph-enhanced embeddings are model-agnostic and can be integrated into standard recommendation backbones like SASRec or YouTubeDNN.

Metapath-based message propagation and recommendation enhancement architecture.

Experimental Evaluation

The framework was tested on three public datasets: MovieLens-1M, Amazon-Books, and BookCrossing.

  • Performance: AutoGraph consistently outperformed state-of-the-art baselines. On MovieLens-1M, it achieved a 14.22% improvement in NDCG@10 over the best baseline when using a SASRec backbone.
  • Efficiency: The construction time was drastically reduced. On Amazon-Books, AutoGraph completed graph construction in 26 hours, compared to an estimated 315 hours for pairwise methods.
  • Industrial Deployment: AutoGraph was deployed on Huawei’s advertising platform, serving hundreds of millions of users. In a 10-day A/B test, it delivered a 2.69% increase in Revenue Per Mille (RPM) and a 7.31% increase in effective Cost Per Mille (eCPM).

Key Insights

  • Quantization as a Scalability Bridge: Vector quantization allows the system to discover global relationships and clusters without direct pairwise comparisons, making LLM-based graphs viable for production.
  • Hierarchical Semantics: The use of residual quantization enables the graph to represent multi-level semantic concepts, providing a richer representation than simple flat tags.

Conclusion

AutoGraph demonstrates that by combining the semantic power of LLMs with the efficiency of vector quantization, it is possible to build high-quality, global-view graphs at scale. This approach not only improves recommendation performance on standard benchmarks but also proves its value in high-traffic industrial environments.

Summary updated

BibTeX
@inproceedings{shan2024automatic,
  author = {Rong Shan and Jianghao Lin and Chenxu Zhu and Bo Chen and Menghui Zhu and Kangning Zhang and Jieming Zhu and Ruiming Tang and Yong Yu and Weinan Zhang},
  title = {{An Automatic Graph Construction Framework based on Large Language Models for Recommendation}},
  booktitle = {ACM SIGKDD Conference on Knowledge Discovery and Data Mining},
  year = {2024},
}
Figure