Machine Learning Enabled Systems (MLS) operate in dynamic environments where changes in data, workload, or execution context can degrade performance, increase cost, and negatively impact sustainability. While MLOps supports automation across the ML lifecycle, it provides limited support for runtime adaptation driven by sustainability goals.
This paper presents Harmonica, a self-adaptation exemplar for sustainable MLOps pipelines. Built on the HarmonE approach, Harmonica integrates a configurable MAPE-K loop that separates adaptation intent from execution tactics. It continuously monitors sustainability metrics, evaluates them against adaptation boundaries, and automatically triggers architectural adaptations such as model switching or retraining.
We demonstrate Harmonica through time series regression and computer vision case studies, showing how it enables controlled experimentation with sustainability-aware adaptation strategies while improving system stability and reducing manual intervention.
Demo video showing how to set up, configure, and run the Harmonica exemplar, including live self-adaptation in time series and computer vision pipelines.
Harmonica is designed as a self-adaptive wrapper around existing machine learning pipelines. Instead of changing how models are trained or deployed, Harmonica observes the system while it runs and intervenes only when necessary.
The architecture is divided into three clearly separated parts:
At the core of Harmonica lies a MAPE-K feedback loop (Monitor, Analyze, Plan, Execute over Knowledge). This loop enables the system to:
By keeping adaptation logic separate from the ML pipeline itself, Harmonica allows researchers and practitioners to experiment with sustainability-aware strategies without rewriting existing systems.
Harmonica is intended as an exemplar: a reference system that helps researchers and practitioners study self-adaptation in real-world MLOps pipelines. To demonstrate its flexibility, we evaluate Harmonica across two different application domains.
In this scenario, Harmonica is applied to a traffic flow prediction pipeline. The system continuously predicts future traffic volume using machine learning models with different accuracy and energy profiles.
As data characteristics change over time (for example, due to seasonal effects or sudden traffic disruptions), Harmonica detects performance degradation and automatically adapts by switching models or triggering retraining. This allows the system to balance prediction accuracy against energy consumption without manual intervention.
The second use case focuses on object detection in driving scenarios. Multiple vision models with different computational costs are available, ranging from lightweight models to more accurate but energy-intensive ones.
Harmonica monitors runtime behavior and selects suitable models based on the current sustainability goals. This demonstrates how the same adaptation mechanisms can be reused across domains, even when the underlying ML tasks are fundamentally different.
Together, these use cases show how Harmonica supports experimentation with sustainability-aware adaptation strategies across the ML lifecycle, rather than being tied to a single application or model type.