Skip to content

Manishms18/Adaptive-Multi-Dimensional-Monitoring

Repository files navigation

Adaptive Multi‑Dimensional Monitoring (AMDM)

This repository contains a reference implementation of the Adaptive Multi‑Dimensional Monitoring (AMDM) algorithm described in our paper Adaptive Monitoring and Real‑World Evaluation of Agentic AI Systems (Advanced version). AMDM is designed to detect anomalies across multiple axes (e.g., capability, robustness, safety, human factors, economics) in streaming logs generated by agentic AI systems.

Features

  • Rolling normalisation: Maintains rolling means and standard deviations for each metric to compute per‑metric z‑scores.
  • EWMA thresholds: Computes exponentially weighted moving averages (EWMAs) per axis and flags per‑axis anomalies when deviations exceed a configurable threshold.
  • Joint anomaly detection: Maintains a joint mean and covariance matrix of the axis scores and computes a Mahalanobis distance; flags joint anomalies when the distance exceeds a chi‑square threshold.
  • Calibration tools: Includes a simple method to calibrate parameters (window length, EWMA smoothing and joint threshold) based on a quiet period of normal operation.
  • Synthetic data generator: Provides a simulate.py script to produce synthetic event streams with injected anomalies for demonstration purposes.

Repository structure

amdm_repo/
├── amdm.py            # Core implementation of the AMDM algorithm
├── simulate.py        # Generates synthetic data and runs AMDM for a demo
├── example_data.csv   # Sample metrics used in the demo
├── README.md          # Project description and usage instructions
├── LICENSE            # MIT license
└── .gitignore         # Files to ignore in git

Installation

This project requires Python 3.8 or later and the following packages:

numpy
scipy
matplotlib (optional, for plotting in the demo)

You can install the dependencies using pip:

pip install numpy scipy matplotlib

Usage

Running the demo

The simulate.py script generates a synthetic event stream with four metrics spanning two axes (capability and safety) and injects goal‑drift and safety‑violation anomalies. It then runs AMDM on the stream and prints detected anomalies.

python simulate.py

You should see output indicating when per‑axis and joint anomalies are detected. The script also produces a simple plot (requires matplotlib) showing the axis scores over time.

Integrating into your system

  1. Place your streaming logs into a pandas DataFrame where each row corresponds to a time step and each column corresponds to a metric.
  2. Define a dictionary mapping each metric to one of the five axes (capability, robustness, safety, human, economic).
  3. Instantiate the AMDM class with the list of metric names, the axis mapping, and desired parameters (window_size, lambda_, alpha, k).
  4. Call update(metrics_dict) on each time step. The method returns flags indicating per‑axis anomalies and joint anomalies.

License

This repository is licensed under the MIT License. See LICENSE for details.

Citation

If you use this code in your research, please cite our paper:

@misc{shukla2025adaptive,
  title        = {Adaptive Monitoring and Real-World Evaluation of Agentic AI Systems},
  author       = {Shukla, Manish},
  year         = {2025},
  eprint       = {2509.00115},
  archivePrefix = {arXiv},
  primaryClass = {cs.AI},
  url          = {https://arxiv.org/abs/2509.00115}
}

Link to paper : https://arxiv.org/abs/2509.00115