Skip to main content
QUICK REVIEW

[Paper Review] Let Your Graph Do the Talking: Encoding Structured Data for LLMs

Bryan Perozzi, Bahare Fatemi|arXiv (Cornell University)|Feb 8, 2024
Semantic Web and OntologiesComputer Science6 citations
TL;DR

GraphToken learns a graph encoder to produce soft-token prompts that explicitly encode graphs for LLMs, yielding significant gains in graph reasoning tasks (up to 73 percentage points on GraphQA).

ABSTRACT

How can we best encode structured data into sequential form for use in large language models (LLMs)? In this work, we introduce a parameter-efficient method to explicitly represent structured data for LLMs. Our method, GraphToken, learns an encoding function to extend prompts with explicit structured information. Unlike other work which focuses on limited domains (e.g. knowledge graph representation), our work is the first effort focused on the general encoding of structured data to be used for various reasoning tasks. We show that explicitly representing the graph structure allows significant improvements to graph reasoning tasks. Specifically, we see across the board improvements - up to 73% points - on node, edge and, graph-level tasks from the GraphQA benchmark.

Motivation & Objective

  • Motivate encoding structured data for LLMs to improve reasoning beyond pure text representations.
  • Propose a parameter-efficient encoder that preserves LLMs' language capabilities while incorporating graph structure.
  • Demonstrate that explicit graph encoding improves performance across graph-, node-, and edge-level tasks on GraphQA.
  • Show that GraphToken generalizes to unseen graphs and tasks and remains computationally lightweight relative to the LLM.

Proposed method

  • Introduce GraphToken, a learned graph prompt function that prepends graph-derived tokens to an LLM prompt.
  • Use a graph encoder (GNN) to produce fixed-length graph tokens aligned with the LLM embedding space, while freezing LLM parameters.
  • Train the graph encoder by backpropagating LLM perplexity with respect to the augmented prompt, updating only the encoder parameters.
  • Explore multiple graph encoders (GCN, GIN, MPNN, HGT, MHA, NodeSet, EdgeSet) and readout schemes for graph-level, node-level, and edge-level tasks.
  • Project graph representations to the LLM token space through a final dense layer before prompting the LLM (e.g., PaLM 2/Flan-tuned).
  • Empirically compare GraphToken to baselines (zero-shot, few-shot, CoT, zero-cot, cot-bag, soft-prompt) on GraphQA benchmarks.

Experimental results

Research questions

  • RQ1Can a learned graph encoder effectively convert structured data into LLM-compatible prompts with minimal parameter updates?
  • RQ2Which graph encoder architectures and node features best support graph reasoning tasks when paired with a frozen LLM?
  • RQ3To what extent does explicit graph encoding improve graph-, node-, and edge-level reasoning tasks compared to text-based or soft-prompt baselines?
  • RQ4How well does GraphToken generalize to unseen graphs and tasks beyond the training distribution?

Key findings

  • GraphToken significantly outperforms baselines on graph-, node-, and edge-level tasks in GraphQATest, with up to 73 percentage-point gains.
  • Different graph encoders have task-specific strengths; no single encoder dominates all tasks.
  • Breaking equivariance with learned node features generally improves performance, and combining learned with spectral features yields further gains for some encoders.
  • GraphToken uses a small encoder (tens to hundreds of thousands of parameters) relative to LLM size, achieving strong gains with minimal parameter updates.
  • Encoders trained on cycle check or triangle counting show generalization to bipartiteness detection, indicating transferable graph-reasoning representations.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.