CLDG: Contrastive Learning on Dynamic Graphs
- CLDG is an unsupervised framework for dynamic graphs that uses contiguous timespan views as natural positive pairs, bypassing synthetic augmentations.
- It enforces temporal translation invariance by ensuring node embeddings remain consistent across different time windows, which boosts node classification and anomaly detection performance.
- CLDG++ augments local topology with diffusion-based global context, providing richer multi-scale representations while significantly reducing model parameters and training time.
Searching arXiv for the CLDG paper and closely related versions to ground the article in current metadata. CLDG, short for Contrastive Learning on Dynamic Graphs, is an unsupervised framework for dynamic graph representation learning that uses timespan views of an evolving graph as contrastive positives under a temporal translation invariance assumption. Rather than constructing self-supervision through stochastic edge or feature perturbations, CLDG treats different contiguous time windows of the same graph as semantically meaningful views and learns node embeddings that remain consistent across them. In later formulations, the framework is extended to CLDG++, which augments local topology with graph-diffusion global context and supports anomaly detection by measuring cross-timespan consistency (Xu et al., 2024, Xu et al., 26 May 2026).
1. Conceptual definition and problem setting
CLDG operates on dynamic graphs in either discrete-time or continuous-time form. In the continuous-time formulation, the graph is written as , where is a fixed vertex set, is the edge set, and assigns timestamps. An equivalent view at time is , where denotes the edges in a time window around and are the node features at that time (Xu et al., 2024).
The framework is motivated by a limitation of standard graph contrastive learning on dynamic data. Existing methods typically maximize mutual information between augmented views of a static graph, but in dynamic graphs the augmentation process can alter semantics and labels, which the CLDG paper identifies as a source of degraded downstream performance. CLDG therefore replaces synthetic augmentations with temporally grounded views sampled directly from the graph’s own evolution (Xu et al., 2024).
The resulting task formulation is unsupervised pretraining followed by downstream evaluation. In the node-classification protocol reported for CLDG, embeddings are first learned without labels, then frozen, and a linear classifier is trained on the train split only; final Accuracy and Weighted-F1 are reported on the test split (Xu et al., 2024). In the later formulation, the same learned representations are also used for dynamic graph anomaly detection by quantifying inconsistency across timespans (Xu et al., 26 May 2026).
2. Temporal translation invariance
The central inductive bias of CLDG is temporal translation invariance (TTI). The underlying empirical claim is that, in many real-world dynamic graphs, the semantic label or class of a node tends to remain stable as the observation window shifts forward or backward in time. The detailed exposition states that, if one trains separate encoders on different snapshots, the fraction of nodes whose predicted label changes from one snapshot to the next is very low, often below (Xu et al., 26 May 2026).
In CLDG, TTI is expressed at two levels. The local-level TTI condition states that for any node 0 and two sampled timespans 1, the projected embeddings of the same node should be close, so 2 is small. The global-level TTI condition states that the embedding of 3 in one timespan should also be close to a pooled representation of 4’s neighborhood in another timespan, so 5 is small (Xu et al., 2024).
This inductive bias gives CLDG its basic contrastive semantics: different times are treated as naturally occurring views of the same latent entity. The later formulation makes the same point in mutual-information language, describing the method as maximizing the mutual information between representations of the same node at different times without requiring manual data augmentation (Xu et al., 26 May 2026). A plausible implication is that CLDG is most appropriate when node identity, role, or community membership evolves smoothly rather than discontinuously.
3. Timespan-view sampling and contrastive objectives
The first operational component of CLDG is a timespan view sampling layer. Let 6 denote the total temporal span of the graph. Two hyperparameters are used: 7 controls the length of each sampled window, which is 8, and 9 controls the number of windows sampled per minibatch. For sampled centers 0, each graph view is constructed as a contiguous temporal subgraph containing exactly the edges and node features occurring in the interval 1 (Xu et al., 2024).
Four sampling strategies are specified. Sequential uses non-overlapping windows whose centers differ by integer multiples of 2. High-overlap enforces 3 overlap, with adjacent centers separated by 4. Low-overlap enforces 5 overlap, with adjacent centers separated by 6. Random samples centers uniformly in 7 (Xu et al., 2024).
Once views are sampled, each snapshot is encoded independently. In the standard formulation, if 8 denotes the projected representation of node 9 in view 0, then the local contrastive term between views 1 and 2 is
3
where 4 is a temperature. The total CLDG loss sums this term over all nodes and view pairs (Xu et al., 26 May 2026).
The 2024 formulation presents the same idea as two parallel InfoNCE objectives. For node-level invariance,
5
For graph-level invariance, if 6 is a pooled neighbor embedding, then
7
Training may use either local TTI, global TTI, or a weighted sum such as 8 (Xu et al., 2024).
4. CLDG++, multi-scale contrasts, and anomaly detection
A subsequent development introduces CLDG++, which supplements the local adjacency view with a diffusion-based global view. For each timespan 9, CLDG++ computes a similarity matrix 0 using either PPR diffusion
1
or the heat-kernel diffusion
2
where 3 is the degree matrix and 4 and 5 are hyperparameters (Xu et al., 26 May 2026).
CLDG++ then applies two encoders with separate weights, producing local and global features
6
which are projected into a contrastive space. The extension introduces a multi-scale contrastive learning objective composed of local-local, global-global, and local-global terms. The paper gives the practical form
7
This extension is presented as a way to capture multi-scale topology and obtain richer embeddings (Xu et al., 26 May 2026).
The same cross-timespan consistency mechanism is used for anomaly detection. After training, one samples 8 sequential views, computes projected node embeddings 9, and measures pairwise cosine distance
0
For node 1, the mean distance and its standard deviation are
2
and
3
The anomaly score is then
4
Nodes with large scores are flagged as anomalous. The paper states that no threshold is trained; one ranks nodes or evaluates by ROC-AUC (Xu et al., 26 May 2026).
5. Architectures, complexity, and efficiency profile
The default encoder in CLDG is a 2-layer GCN with
5
The framework is described as plug-and-play: GAT and GraphSAGE can also be used. The readout is average, sum, or max over neighbors, and the projection head is a 2-layer MLP + LeakyReLU + 6 normalization (Xu et al., 2024).
A recurrent theme in the CLDG literature is that the method avoids explicit temporal sequence modeling. The later exposition states that CLDG and CLDG++ rely only on graph convolutions and use no RNNs and no self-attention, which makes them lighter than LSTM-, GRU-, or Transformer-based dynamic-graph models. With 7, 8, 9 the number of GCN layers, and 0 the hidden dimension, the time complexity per epoch is
1
and the space complexity in trainable parameters is
2
The same source reports that, on seven real-world dynamic graphs with up to 3 nodes and 4 edges, CLDG trains in minutes with a few 5’s MB of parameters, whereas sequence-based methods can run out of GPU memory or take orders of magnitude longer (Xu et al., 26 May 2026).
The 2024 CLDG paper quantifies this efficiency directly. Across seven datasets, the total parameter count of CLDG is approximately 0.05 M, compared with 8–156 M for CAW, 7–155 M for TGAT, 0.10 M for DySAT, and 2–42 M for MNCI. It reports that, compared with existing dynamic-graph methods, the number of model parameters and training time are reduced by an average of 2,001.86 times and 130.31 times on seven datasets, respectively (Xu et al., 2024).
6. Empirical results, scope, and terminological distinction
The principal evaluation protocol for CLDG uses seven datasets—DBLP, BitcoinOTC, TAX, BITotc, BITalpha, TAX51, Reddit—split 1:1:8 into train/validation/test on nodes. Training is unsupervised with Adam; the encoder and projection head use learning rate 6 and weight decay 7, while the linear classifier uses learning rate 8 and weight decay 9. Other settings include batch size 0, hidden dimension 1, output dimension 2, up to 3 epochs, temperature 4 tuned in 5, and timespan hyperparameters often set to 6, 7 (Xu et al., 2024).
On node classification, CLDG_node is reported to achieve state-of-the-art among all unsupervised methods on 11 out of 14 metrics, and to outperform some supervised baselines on BitcoinOTC, BITotc, BITalpha, and Reddit. On average, CLDG_node beats the best prior unsupervised GraphSAGE by +1.47% in Accuracy (Xu et al., 2024). The later formulation states more generally that CLDG and CLDG++ both exhibit desirable performance on downstream tasks including node classification and dynamic graph anomaly detection (Xu et al., 26 May 2026).
Ablation results further clarify the framework’s operating regime. Sequential and Random sampling yield the best performance, while High-overlap (75%) is worst because the task becomes too easy and generalization degrades. Increasing the number of views from 8 to 9 gives diminishing but positive gains of about 0.4–0.8% average, and replacing GCN with GAT or GraphSAGE produces results within 0.5%, which the paper interprets as evidence of encoder-agnostic behavior (Xu et al., 2024).
The acronym requires one terminological qualification. In software engineering, ClDG can also denote the Class Dependence Graph, a source-level representation of control and data dependencies within a class, augmented in one bug-localization method by an object-state annotation function 0. That usage is unrelated to dynamic graph contrastive learning and belongs to a different research lineage centered on program dependence analysis and fault localization (Ray, 2011).
Taken in its graph-learning sense, CLDG denotes a family of methods built on a simple principle: dynamic graphs provide their own temporally grounded positive pairs. The combination of timespan sampling, TTI-based contrastive learning, and lightweight graph encoders yields an unsupervised representation framework whose empirical profile emphasizes both competitive downstream performance and substantial reductions in parameters and training time (Xu et al., 2024).