# LLMTM: Benchmarking and Optimizing LLMs for Temporal Motif Analysis in Dynamic Graphs

arXiv: https://arxiv.org/abs/2512.22266 · HTML: https://mlsanity.com/paper/2512.22266/

## Key facts

- Cited by 4 papers in the map (data through 14 Oct 2026).
- Builds on 23 of its 41 references that are in the map.
- First posted on arXiv 24 Dec 2025.

## Builds on (most cited first, 23 of 23)

- [How Powerful are Graph Neural Networks?](https://mlsanity.com/paper/1810.00826/) (2018)
- [HuggingGPT: Solving AI Tasks with ChatGPT and its Friends in Hugging Face](https://mlsanity.com/paper/2303.17580/) (2023)
- [Temporal Graph Networks for Deep Learning on Dynamic Graphs](https://mlsanity.com/paper/2006.10637/) (2020)
- [Motifs in Temporal Networks](https://mlsanity.com/paper/1612.09259/) (2016)
- [Graph-ToolFormer: To Empower LLMs with Graph Reasoning Ability via Prompt Augmented by ChatGPT](https://mlsanity.com/paper/2304.11116/) (2023)
- [TPTU: Large Language Model-based AI Agents for Task Planning and Tool Usage](https://mlsanity.com/paper/2308.03427/) (2023)
- [GraphArena: Evaluating and Exploring Large Language Models on Graph Computation](https://mlsanity.com/paper/2407.00379/) (2024)
- [LLM4DyG: Can Large Language Models Solve Spatial-Temporal Problems on Dynamic Graphs?](https://mlsanity.com/paper/2310.17110/) (2023)
- [How Do Large Language Models Understand Graph Patterns? A Benchmark for Graph Pattern Comprehension](https://mlsanity.com/paper/2410.05298/) (2024)
- [STRIDE: A Tool-Assisted LLM Agent Framework for Strategic and Interactive Decision-Making](https://mlsanity.com/paper/2405.16376/) (2024)
- [Neural-Symbolic Reasoning over Knowledge Graphs: A Survey from a Query Perspective](https://mlsanity.com/paper/2412.10390/) (2024)
- [Advancing Graph Representation Learning with Large Language Models: A Comprehensive Survey of Techniques](https://mlsanity.com/paper/2402.05952/) (2024)
- [Temporal Network Motifs: Models, Limitations, Evaluation](https://mlsanity.com/paper/2005.11817/) (2020)
- [Path Sampling: A Fast and Provable Method for Estimating 4-Vertex Subgraph Counts](https://mlsanity.com/paper/1411.4942/) (2014)
- [ESCAPE: Efficiently Counting All 5-Vertex Subgraphs](https://mlsanity.com/paper/1610.09411/) (2016)
- [Flow Motifs in Interaction Networks](https://mlsanity.com/paper/1810.08408/) (2018)
- [Motif-aware temporal GCN for fraud detection in signed cryptocurrency trust networks](https://mlsanity.com/paper/2211.13123/) (2022)
- [Dynamic networks reveal key players in aging](https://mlsanity.com/paper/1307.3388/) (2013)
- [Temporal Motifs for Financial Networks: A Study on Mercari, JPMC, and Venmo Platforms](https://mlsanity.com/paper/2301.07791/) (2023)
- [Integrate Temporal Graph Learning into LLM-based Temporal Knowledge Graph Model](https://mlsanity.com/paper/2501.11911/) (2025)
- [A Fast and Provable Method for Estimating Clique Counts Using Tur'an's Theorem](https://mlsanity.com/paper/1611.05561/) (2016)
- [Efficient Temporal Butterfly Counting and Enumeration on Temporal Bipartite Graphs](https://mlsanity.com/paper/2306.00893/) (2023)
- [ATM-GAD: Adaptive Temporal Motif Graph Anomaly Detection for Financial Transaction Networks](https://mlsanity.com/paper/2508.20829/) (2025)

## Built on by (most cited first, 4 of 4)

- [SPOT: Span-level Pause-of-Thought for Efficient and Interpretable Latent Reasoning in Large Language Models](https://mlsanity.com/paper/2603.06222/) (2026)
- [RouteGoT: Node-Adaptive Routing for Cost-Efficient Graph of Thoughts Reasoning](https://mlsanity.com/paper/2603.05818/) (2026)
- [Are Large Language Models Suitable for Graph Computation? Progress and Prospects](https://mlsanity.com/paper/2606.06865/) (2026)
- [AdaSTORM: Scaling LLM Reasoning on Dynamic Graphs via Adaptive Spatio-Temporal Multi-Agent Collaboration](https://mlsanity.com/paper/2606.16328/) (2026)

## Abstract (arXiv)

The widespread application of Large Language Models (LLMs) has motivated a growing interest in their capacity for processing dynamic graphs. Temporal motifs, as an elementary unit and important local property of dynamic graphs which can directly reflect anomalies and unique phenomena, are essential for understanding their evolutionary dynamics and structural features. However, leveraging LLMs for temporal motif analysis on dynamic graphs remains relatively unexplored. In this paper, we systematically study LLM performance on temporal motif-related tasks. Specifically, we propose a comprehensive benchmark, LLMTM (Large Language Models in Temporal Motifs), which includes six tailored tasks across nine temporal motif types. We then conduct extensive experiments to analyze the impacts of different prompting techniques and LLMs (including nine models: openPangu-7B, the DeepSeek-R1-Distill-Qwen series, Qwen2.5-32B-Instruct, GPT-4o-mini, DeepSeek-R1, and o3) on model performance. Informed by our benchmark findings, we develop a tool-augmented LLM agent that leverages precisely engineered prompts to solve these tasks with high accuracy. Nevertheless, the high accuracy of the agent incurs a substantial cost. To address this trade-off, we propose a simple yet effective structure-aware dispatcher that considers both the dynamic graph's structural properties and the LLM's cognitive load to intelligently dispatch queries between the standard LLM prompting and the more powerful agent. Our experiments demonstrate that the structure-aware dispatcher effectively maintains high accuracy while reducing cost.
