This study proposes an adaptive spatiotemporal graph contrastive learning model to address the challenges of anomaly detection in cloud service systems under highly dynamic topologies, complex dependencies, and multi-source heterogeneous monitoring data. The model constructs a dynamic spatiotemporal dependency graph to achieve adaptive modeling of structural relationships among service nodes and incorporates temporal encoding to capture multi-scale temporal variations, thereby achieving joint spatiotemporal feature representation. It consists of three main components: adaptive graph construction, spatiotemporal feature encoding, and contrastive learning optimization, which together enhance anomaly identification in an unsupervised manner through feature aggregation and discrimination. First, a learnable adjacency matrix is generated based on the dynamic correlations among service metrics to reflect the evolution of service dependencies. Then, structural and temporal features are jointly extracted through the integration of graph convolution and recurrent neural units, forming representations that are globally consistent and locally sensitive. Finally, an InfoNCE-based contrastive loss function is introduced to strengthen the aggregation of normal samples and the separation of anomalous ones in the latent space, improving model robustness and generalization. Experiments conducted on real cloud monitoring data include multi-dimensional comparisons and sensitivity analyses covering key factors such as time window length, attention head number, node failure ratio, and anomaly sample ratio. The results show that the proposed method outperforms existing baseline models in accuracy, precision, recall, and F1-Score, maintaining high detection accuracy and stable performance in complex cloud environments and providing an efficient and robust solution for anomaly identification and intelligent operation in large-scale distributed systems.
Large language model (LLM) inference in multi-tenant clouds is becoming an increasingly important contributor to data-center carbon emissions, yet existing carbon-aware scheduling techniques target long-running training jobs and are ill-suited for the short, bursty, SLO-sensitive nature of online serving. We propose CAPS (Carbon–Aware Prompt Scheduling), an online bi-objective scheduler that jointly optimizes goodput and per-request carbon cost for multi-tenant LLM inference. CAPS first employs a lightweight prompt complexity predictor to estimate token generation cost and latency risk for each incoming request. It then combines real-time grid carbon intensity, GPU energy profiles, and per-tenant SLO tiers to route each request to one of three execution pools: a low-latency pool, a low-carbon pool, or a delay-tolerant batch pool. A composite reward function balances goodput, carbon emissions, and SLO violation rate. In trace-driven simulations using public conversation traces and regional carbon intensity data, CAPS reduces average carbon emissions per 1K generated tokens by 26.8% compared to round-robin scheduling while achieving an SLO attainment rate that matches or exceeds a dedicated SLO-aware baseline.