A Temporal Graph Network (TGN) is a neural architecture designed to learn continuous-time representations on dynamic graphs where nodes and edges evolve. Unlike static graph neural networks, TGNs process a stream of timestamped events—such as financial transactions between accounts—updating node memory states as new interactions occur, thereby capturing the evolving topology and temporal dynamics of a graph without retraining on the entire structure.
Glossary
Temporal Graph Network (TGN)

What is Temporal Graph Network (TGN)?
A neural architecture that learns on dynamic graphs by updating node representations as new edges and nodes appear over time, enabling the detection of evolving fraud rings in a temporal transaction graph.
The core mechanism involves a memory module that maintains a compressed, time-aware state for each node, updated via a message function whenever an edge event occurs. An embedding module then generates a temporal node representation by aggregating the node's memory with its spatial neighborhood, enabling the model to detect anomalous structural patterns—such as the rapid formation of a fraud ring—that static graph analysis would miss.
Core Characteristics of TGNs
Temporal Graph Networks (TGNs) extend static graph learning to the time domain, enabling the detection of evolving fraud rings by updating node representations as new transactions—edges—appear continuously.
Continuous-Time Dynamic Graph Learning
Unlike discrete-time methods that process snapshots, TGNs operate on continuous-time dynamic graphs where events (transactions) arrive asynchronously. The core innovation is a temporal neighborhood aggregation scheme that interpolates node memory based on the exact timestamp of an interaction, not a batch window. This allows the model to capture sub-second fraud patterns like burst attacks that would be averaged out in hourly snapshots.
Memory Module: Compressing the Past
Each node maintains a memory vector—a compressed, learned representation of its entire interaction history up to the current time. When a new edge (e.g., a payment) occurs between a sender and receiver, the memory module updates both nodes' states using a recurrent architecture like a GRU. This memory acts as a running summary, eliminating the need to store and re-process the full history for every prediction.
Message Function: Encoding Interactions
For every temporal edge e_ij(t) between node i and j at time t, a message function computes a vector that encapsulates the interaction's information. This message typically concatenates:
- The source node's current memory
- The destination node's current memory
- Edge features (e.g., transaction amount, currency type)
- A time encoding of the interaction timestamp This message is then used to update the memory of the involved nodes.
Temporal Graph Attention for Neighborhood Aggregation
To compute an embedding for a node at a specific time, TGNs use a temporal graph attention layer. This mechanism aggregates information from the node's temporal neighborhood—the set of past interactions. Crucially, attention weights are a function of:
- The features of the neighboring nodes
- The relative time delta between the interaction and the query time
- The edge features This allows the model to naturally discount stale connections and focus on recent, relevant transactions when assessing fraud risk.
Time Encoding: Representing Timestamps
Raw timestamps are not directly consumable by neural networks. TGNs employ a time encoder—often a Fourier feature mapping—to project a scalar time value into a high-dimensional vector. The encoding uses sine and cosine functions of different frequencies: cos(w*t + b). This continuous representation captures the periodic nature of time (e.g., hourly, daily cycles) and allows the model to learn temporal patterns like 'transactions at 3 AM are anomalous' without manual feature engineering.
Link Prediction for Fraud Ring Detection
The primary downstream task for TGNs in fraud detection is temporal link prediction. At any moment, the model computes a score for a potential edge between two nodes. A high score for an edge between a legitimate account and a known fraudulent entity signals a suspicious connection. This enables the real-time identification of evolving fraud rings—criminal networks that slowly build connections to avoid static graph analysis. The model learns to predict not just if a link exists, but when it is likely to form.
TGN vs. Static GNN vs. Sequence Models
A feature-level comparison of Temporal Graph Networks against static graph neural networks and traditional sequence models for dynamic graph learning tasks such as fraud ring detection.
| Feature | Temporal Graph Network | Static GNN | Sequence Model |
|---|---|---|---|
Graph Structure Handling | |||
Temporal Dynamics Captured | |||
Node Memory State | Continuous, updated per event | None (single snapshot) | Implicit in hidden state |
Edge Addition Over Time | Native support | ||
Parallelizable Training | Limited (temporal dependencies) | ||
Fraud Ring Evolution Detection | High (tracks structural shifts) | Low (single snapshot only) | Medium (no relational context) |
Inference Latency (per event) | < 10 ms | < 5 ms | < 2 ms |
Cold Start Handling | Memory initialized from neighbors | Requires retraining | Requires sufficient history |
Frequently Asked Questions
Concise, technically precise answers to the most common questions about Temporal Graph Networks and their application in dynamic fraud detection.
A Temporal Graph Network (TGN) is a neural architecture that learns on dynamic graphs where nodes and edges appear, disappear, or change attributes over continuous time. Unlike static graph neural networks, a TGN maintains a compressed, continuously updated memory state for each node. When a new interaction (e.g., a transaction) occurs between two nodes, the model computes a message, updates the memory of the involved nodes using a learnable function like a GRU or LSTM, and then uses a graph attention mechanism over the temporal neighborhood to generate a fresh node embedding. This allows the model to capture the co-evolution of graph structure and node behavior, making it ideal for detecting emerging fraud rings in a temporal transaction graph.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
Core concepts and complementary architectures that define the temporal graph learning landscape for dynamic fraud detection.
Dynamic Graph
A graph structure that evolves over time through node/edge additions, deletions, and feature mutations. Unlike static graphs, dynamic graphs capture the temporal evolution of financial transaction networks.
- Continuous-time dynamic graphs: Events occur at arbitrary timestamps
- Discrete-time dynamic graphs: Captured as snapshots at fixed intervals
- Critical for modeling evolving fraud rings where new members join and transaction patterns shift
- TGNs operate natively on continuous-time representations, avoiding information loss from snapshot discretization
Message Passing with Memory
The core computational mechanism in TGNs where messages are exchanged between nodes upon each interaction to update a compressed memory state.
- Message function: Computes a message from source node, destination node, edge features, and timestamp
- Message aggregator: Pools multiple messages arriving simultaneously (e.g., mean, attention-based)
- Memory updater: A recurrent module (GRU or LSTM) that updates node memory given aggregated messages
- This mechanism enables nodes to remember long-term behavioral patterns without storing the entire interaction history
Temporal Graph Attention
An attention mechanism that weights the importance of historical neighbors based on both structural and temporal proximity when computing node embeddings.
- Learns to attend more strongly to recent, relevant transactions
- Uses time-encoding functions (e.g., cosine-based) to represent continuous timestamps as vectors
- Attention scores combine content-based similarity with temporal decay
- Enables the model to distinguish between a legitimate recurring payment and a sudden, anomalous transfer to a new counterparty
GraphSAGE vs. TGN
GraphSAGE is a static inductive framework that samples and aggregates neighbor features; TGN extends this paradigm into the temporal domain.
- GraphSAGE: Operates on a fixed snapshot, no concept of time
- TGN: Incorporates temporal neighborhood sampling — only edges occurring before the target interaction are considered
- TGN adds memory state that persists across time, which GraphSAGE lacks
- For fraud detection, TGN captures the sequence of transactions leading to a suspicious event, while GraphSAGE sees only a static relational structure
Link Prediction in Dynamic Settings
The task of predicting the probability of a future edge between two nodes at a given timestamp, directly applicable to identifying suspicious transactions before they occur.
- TGN computes edge probability from source memory, destination memory, and temporal features
- Enables real-time scoring: as a new transaction request arrives, the model evaluates its likelihood given all prior graph history
- Low-probability edges under the learned normal model are flagged as anomalies
- Outperforms static methods on new account fraud by leveraging the temporal context of account creation and early activity
Time Encoding
A function that maps continuous scalar timestamps into high-dimensional vector representations that can be consumed by neural networks.
- Cosine encoding:
cos(t * w)wherewis a learnable frequency vector - Preserves temporal translation invariance properties
- Allows attention mechanisms to compute relative time differences between events
- Essential for TGNs to understand that a transaction occurring 5 minutes ago is fundamentally different from one occurring 5 days ago

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us