Abstract
Real-world networks, from social media interactions to financial transactions, are inherently dynamic. Predicting how these networks evolve—a task known as temporal link prediction—has traditionally relied on specialized Temporal Graph Neural Networks (TGNNs). While effective, these models require extensive training and often function as "black boxes." This paper introduces TGTalker, a framework that enables off-the-shelf Large Language Models (LLMs) to perform temporal link prediction without any fine-tuning. By leveraging recency bias and converting graph structures into natural language prompts, TGTalker matches or outperforms established TGNNs while providing human-readable explanations for its predictions.
1. Introduction
Temporal graphs represent data that evolves over time, where edges between nodes are timestamped. Traditional approaches to link prediction in these graphs involve training specialized architectures like TGN or HTGN. However, these models face two primary challenges: they require significant computational resources for training on large-scale data, and they lack interpretability.
With the rise of Large Language Models (LLMs), researchers have begun exploring their potential for graph reasoning. Yet, temporal graphs present unique hurdles, including the massive scale of real-world networks (often exceeding context windows) and the difficulty of encoding time-stamped connectivity into text. TGTalker addresses these challenges by treating temporal link prediction as a natural language question-answering task, utilizing in-context learning to bridge the gap between structural data and linguistic reasoning.
2. The TGTalker Framework
TGTalker (Temporal Graph Talker) is designed to work with pre-trained LLMs (e.g., Llama-3, Qwen, GPT-4o-mini) without additional training. The framework relies on four structural pillars to construct its prompts:
- Temporal Neighbor Sampling: Recognizing the "recency bias" inherent in dynamic networks, TGTalker retrieves the $m$ most recent neighbors for a source node. This ensures the LLM focuses on the most relevant historical interactions.
- Background Set: To provide a global view of the network's current state, the prompt includes a summary of the $b$ most recent edges across the entire graph.
- Example Set (In-Context Learning): The framework employs a 5-shot approach, providing five historical interaction examples and their outcomes to guide the model's reasoning process.
- Query Set: The final component is the specific prediction task: identifying the destination node for a source node at a future timestamp.
3. Experimental Evaluation
The authors evaluated TGTalker on five diverse, real-world datasets from the Temporal Graph Benchmark (TGB) and other sources, including Wikipedia edits (tgbl-wiki), Reddit posts, LastFM listening habits, and corporate emails (Enron). These datasets represent a significant increase in complexity and scale—up to 500x larger—compared to the synthetic graphs used in previous LLM-graph studies.
3.1 Performance Metrics
The primary evaluation metric was Mean Reciprocal Rank (MRR), which assesses the model's ability to rank the correct destination node among a set of decoys.
- Superiority over Baselines: TGTalker consistently outperformed specialized models like TGN and HTGN across all datasets.
- Competitive with SOTA: On the
tgbl-wikidataset, TGTalker (using Qwen2.5-7B) achieved an MRR of 0.651, significantly higher than TGN (0.396) and approaching the state-of-the-art TNCN (0.711).
4. Key Insights
4.1 The Importance of Recency
Ablation studies highlighted that Temporal Neighbor Sampling is the most critical component of the framework. For instance, on the Wikipedia dataset, removing recent neighbor information caused the MRR to drop from 0.649 to 0.322. This suggests that LLMs rely heavily on local, recent temporal context to make accurate predictions.
4.2 Emergent Graph Reasoning
By analyzing the textual justifications provided by the LLMs, the authors identified 10 distinct categories of graph reasoning that the models "discovered" autonomously. These include:
- Triadic Closure: Predicting a link because two nodes share a common neighbor.
- Repeated Interaction Patterns: Identifying cyclical or recurring behaviors between specific nodes.
- Data Scarcity Awareness: High-performing models like GPT-4o-mini demonstrated the ability to recognize when information was insufficient, opting for a "Lack of Data" explanation rather than hallucinating a result.
4.3 Model Scaling and Tuning
Interestingly, larger parameter counts did not always correlate with better performance. Smaller, well-instruct-tuned models like Qwen2.5-7B often outperformed larger models like GPT-4o-mini on specific datasets, indicating that the quality of instruction tuning is a vital factor in graph reasoning tasks.
5. Limitations and Future Work
While TGTalker demonstrates the potential of LLMs in temporal graph learning, several limitations remain:
- Context Constraints: LLMs are limited by their input windows, making it difficult to capture long-range dependencies or very old historical patterns.
- Inference Latency: The computational cost of querying an LLM for every prediction is significantly higher than running a lightweight GNN.
- Hallucinations: Despite their reasoning capabilities, LLMs can still generate logical-sounding but factually incorrect justifications.
Future research may focus on graph-specific tokenization and specialized fine-tuning to further integrate structural topology with the linguistic strengths of LLMs.
6. Conclusion
TGTalker proves that LLMs are indeed capable temporal graph learners when provided with the right context and sampling strategies. By outperforming traditional TGNNs and providing transparent reasoning, this framework opens new avenues for interpretable and training-free dynamic network analysis.
Summary updated