arXiv:2502.10522cs.AIcs.LG2025-02被引 7

用提示优化让大模型高效完成文本图节点分类

GraphiT: Efficient Node Classification on Text-Attributed Graphs with Prompt Optimized LLMs

  • 将图结构与节点文本编码为紧凑文本输入大模型
  • 在三个数据集上超越基线,提升显著且无需人工调参
  • 适合想用大模型做图分析但怕调参的开发者

大语言模型(LLMs)在文本属性图上的应用日益受到关注。传统方法对节点文本属性使用浅层嵌入,而LLM可利用预训练模型的深层上下文表示。然而,如何高效地将图结构与特征转化为适合LLM处理的序列形式仍是挑战。此外,LLM性能高度依赖输入提示结构,常需反复手动调整,过程缓慢、繁琐且难以程序化复现。本文提出GraphiT(Graphs in Text)框架,将每个节点及其邻域的图数据编码为简洁文本,使LLM更充分获取图信息。同时,采用DSPy框架对提示进行程序化优化,实现自动化、高效且可复现的提示调优。实验表明,GraphiT在三个数据集上优于基于LLM的基线方法,且无需人工干预即可获得显著提升。其图编码方式在性能上媲美现有方法,但使用的令牌数更少,成本更低。

原文摘要 · Abstract (English)

The application of large language models (LLMs) to graph data has attracted a lot of attention recently. LLMs allow us to use deep contextual embeddings from pretrained models in text-attributed graphs, where shallow embeddings are often used for the text attributes of nodes. However, it is still challenging to efficiently encode the graph structure and features into a sequential form for use by LLMs. In addition, the performance of an LLM alone, is highly dependent on the structure of the input prompt, which limits their effectiveness as a reliable approach and often requires iterative manual adjustments that could be slow, tedious and difficult to replicate programmatically. In this paper, we propose GraphiT (Graphs in Text), a framework for encoding graphs into a textual format and optimizing LLM prompts for graph prediction tasks. Here we focus on node classification for text-attributed graphs. We encode the graph data for every node and its neighborhood into a concise text to enable LLMs to better utilize the information in the graph. We then further programmatically optimize the LLM prompts using the DSPy framework to automate this step and make it more efficient and reproducible. GraphiT outperforms our LLM-based baselines on three datasets and we show how the optimization step in GraphiT leads to measurably better results without manual prompt tweaking. We also demonstrated that our graph encoding approach is competitive to other graph encoding methods while being less expensive because it uses significantly less tokens for the same task.

图神经网络大模型提示优化文本编码

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。