GNNs & LLMs
Why combine GNNs and LLMs instead of using one alone?
LLMs excel at language and reasoning but struggle with precise multi-hop graph traversal, combinatorial structure, and cheap updates to structured knowledge. GNNs excel at encoding connectivity and relational patterns but cannot do open-ended language reasoning. Real data (text-attributed graphs, knowledge graphs) needs both.
What is a text-attributed graph (TAG)?
A graph where each node has associated raw text - paper abstracts, product descriptions, wiki entries. Pipeline: LLM embeds text into node features, then GNN refines embeddings using graph structure. Structure disambiguates text (two similar abstracts in different citation communities get different labels).
Explain the GraphRAG pipeline at a high level.
(1) LLM extracts entities/relations from documents. (2) Build a knowledge graph. (3) Run community detection. (4) LLM summarizes each community. (5) At query time, retrieve relevant communities and entities, LLM answers with global corpus context. Solves "holistic" questions plain vector RAG cannot.
When does an LLM alone beat a GNN?
Small graphs with rich text where you can fit everything in context; one-off exploratory analysis; tasks needing broad world knowledge and language generation; few-shot prototyping without training data. LLM can describe graph structure in natural language for tiny graphs.
When does a GNN alone beat an LLM?
Million-node graphs where LLM context limits fail; real-time recommendation; structure-heavy tasks (molecule property from bonds); repeated inference where LLM cost is prohibitive; when connectivity matters more than text content.
How can a GNN improve RAG?
Vector RAG retrieves by embedding similarity - misses multi-hop relations. GNN scores nodes/subgraphs by structural relevance, enabling retrieval along citation chains, KG paths, or community membership. GNN finds "papers citing papers citing X" that vector search misses.
What is the LM-as-encoder + GNN pattern?
Freeze a pretrained LM, embed each node's text to get initial features $\mathbf{x}_i$, then train a GNN on top. Cheap and effective. Finetune LM with LoRA + GNN end-to-end for best quality at higher cost.
How do LLM agents use knowledge graphs?
Agent plans a query, KG provides structured facts and relations, GNN/embedding retrieval finds entry points, agent traverses or LLM synthesizes answer. Reduces hallucination by grounding in KG triples. GNN can rank which entities to explore next.
What are graph foundation models and how do they relate to LLMs?
Graph FMs (GraphMAE, GraphGPT, OneForAll) pretrain on many graphs then finetune - analogous to LLM pretraining on text. Trend: LLM as universal tokenizer (describe graph in text) vs specialized GNN encoders. Likely future: orchestrated systems where LLM plans and GNN computes structure.
Give an example where hybrid LLM+GNN is the production answer.
Enterprise document QA over 50K internal docs: GraphRAG builds entity graph + community summaries (LLM), GNN/structure retrieves relevant subgraph for each query, LLM generates final answer grounded in retrieved nodes. Pure vector RAG fails on global questions; pure LLM fails on scale and structure.