NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Contrastive Learning-Based Dependency Modeling for Anomaly Detection in Cloud Services

Yue Xing, Yingnan Deng, Heyao Liu, Ming Wang, Yun Zi, Xiaoxuan Sun · DOI

Abstract

This paper addresses the challenges of complex dependencies and diverse anomaly patterns in cloud service environments by proposing a dependency modeling and anomaly detection method that integrates contrastive learning. The method abstracts service interactions into a dependency graph, extracts temporal and structural features through embedding functions, and employs a graph convolution mechanism to aggregate neighborhood information for context-aware service representations. A contrastive learning framework is then introduced, constructing positive and negative sample pairs to enhance the separability of normal and abnormal patterns in the representation space. Furthermore, a temporal consistency constraint is designed to maintain representation stability across time steps and reduce the impact of short-term fluctuations and noise. The overall optimization combines contrastive loss and temporal consistency loss to ensure stable and reliable detection across multi-dimensional features. Experiments on public datasets systematically evaluate the method from hyperparameter, environmental, and data sensitivity perspectives. Results show that the proposed approach significantly outperforms existing methods on key metrics such as Precision, Recall, F1-Score, and AUC, while maintaining robustness under conditions of sparse labeling, monitoring noise, and traffic fluctuations.

Introduction

Modern cloud architectures have transitioned from monolithic designs to sprawling webs of microservices. While this shift enhances scalability, it introduces a "dependency nightmare." In these interconnected environments, a minor glitch in a low-level database can propagate through the system, manifesting as a major failure in a front-end API. Traditional monitoring tools often struggle because they focus on single-point indicators rather than the contextual relationships between services. Furthermore, cloud data is notoriously noisy, and obtaining high-quality labeled data is resource-intensive. This paper proposes a system that understands service topology and distinguishes between transient fluctuations and genuine structural anomalies.

Methodology

The proposed framework employs a multi-stage pipeline to model cloud environments as a dependency graph, treating the infrastructure like a social network of services.

  1. Dependency Graph Abstraction: Service interactions are modeled as a graph where nodes represent service instances and edges represent invocations.
  2. Context-Aware Embedding: Utilizing Graph Convolutional Networks (GCNs), the model aggregates information from a service’s "neighborhood." This ensures that a service’s state representation incorporates the health of the services it relies on.
  3. Contrastive Learning Framework: The core innovation involves training the model to pull "positive" sample pairs (similar normal states) closer in a latent space while pushing "negative" pairs (normal vs. abnormal) apart, sharpening the boundary between healthy and anomalous states.
  4. Temporal Consistency Constraint: To mitigate false alarms from short-term fluctuations or "jitter," a loss function penalizes radical changes in service representations across adjacent time steps.
The system architecture illustrating the training pipeline with contrastive learning and the inference process for anomaly scoring.

The final model optimizes a joint loss function: $L = L_{contrast} + \lambda L_{temporal}$.

Experimental Evaluation

The study utilized the Microservices Bottleneck Localization Dataset, which includes hundreds of millions of request trace records and real-world performance bottlenecks. The proposed model was tested against several state-of-the-art baselines, including GAMMA and GAL-MAD.

Key Performance Results

  • Precision: 0.920 (Outperforming GAL-MAD at 0.880).
  • Recall: 0.900 (Significantly higher than B-MEG's 0.740).
  • F1-Score: 0.910.
  • AUC: 0.940.

Sensitivity and Robustness

Research into graph depth revealed a "Goldilocks" zone: a 3-layer depth with 10–20 neighbors provided the optimal balance between capturing context and avoiding over-smoothing. Additionally, the model demonstrated remarkable resilience to sparse labeling.

Performance metrics (Precision, Recall, F1-Score, AUC) across varying levels of label availability, showing high performance even at 1% labeling.

As shown in the evaluation, the model maintains high performance (AUC) even when only 1% of the data is labeled. This suggests the contrastive learning mechanism successfully learns the "shape" of normal behavior without needing extensive human annotation. Furthermore, during simulated load surges, the model showed a strong "rebound" effect, quickly recalibrating its baseline once traffic stabilized.

Conclusion

This research verifies the effectiveness of integrating dependency modeling with contrastive learning for cloud service anomaly detection. The approach provides a robust technical solution that maintains stability in complex, noisy environments. Future work will explore cross-domain generalization, privacy-preserving constraints for sensitive trace data, and the integration of detection with automated resource orchestration for self-healing cloud systems.

Summary updated

BibTeX
@misc{xing2025contrastive,
  author = {Yue Xing and Yingnan Deng and Heyao Liu and Ming Wang and Yun Zi and Xiaoxuan Sun},
  title = {{Contrastive Learning-Based Dependency Modeling for Anomaly Detection in Cloud Services}},
  year = {2025},
  eprint = {2510.13368},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2510.13368},
}
Figure