用彩色标签编码图结构,让大模型更好理解图数据。
Colorful Talks with Graphs: Human-Interpretable Graph Encodings for Large Language Models
- 将图结构转化为人类可读的彩色标记,嵌入文本提示中。
- 在多种图任务上提升大模型表现,尤其擅长全局结构推理。
- 适合需要解释性与结构理解的图分析场景。
图问题对大型语言模型(LLMs)而言具有根本挑战性。尽管LLMs擅长处理非结构化文本,但图任务需要显式结构推理、排列不变性以及计算复杂的关联关系,与基于文本的表示方式不匹配。本文研究如何有效将LLMs应用于图问题。提出一种人可解读的图-文本转换结构编码策略,直接将图结构注入自然语言提示中。方法通过计算魏斯费勒-莱曼(Weisfeiler-Lehman, WL)相似类,并将其映射为类比颜色的语义标记,而非数值标签。核心洞察是:语义有意义且人可理解的提示,可能比抽象符号编码更易被LLMs处理。在多个算法性和预测性图任务上的实验表明,该方法在合成与真实世界数据集上均有显著提升。通过捕捉局部与全局依赖关系,特别增强了对需全局结构推理的图任务的表现。
原文摘要 · Abstract (English)
Graph problems are fundamentally challenging for large language models (LLMs). While LLMs excel at processing unstructured text, graph tasks require reasoning over explicit structure, permutation invariance, and computationally complex relationships, creating a mismatch with the representations of text-based models. Our work investigates how LLMs can be effectively applied to graph problems despite these barriers. We introduce a human-interpretable structural encoding strategy for graph-to-text translation that injects graph structure directly into natural language prompts. Our method involves computing a variant of Weisfeiler-Lehman (WL) similarity classes and maps them to human-like color tokens rather than numeric labels. The key insight is that semantically meaningful and human-interpretable cues may be more effectively processed by LLMs than opaque symbolic encoding. Experimental results on multiple algorithmic and predictive graph tasks show the considerable improvements by our method on both synthetic and real-world datasets. By capturing both local and global-range dependencies, our method enhances LLM performance especially on graph tasks that require reasoning over global graph structure.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。