Dynamics Models for Offline Hyperparameter Selection in Water Treatment

Jordan Coblin, Han Wang, Martha White, Adam White

TL;DR

This paper tackles the crucial problem of hyperparameter tuning for reinforcement learning (RL) in real-world industrial settings where simulators are unavailable. They demonstrate that "calibration models" trained on historical data can effectively mimic system dynamics, enabling offline hyperparameter selection for RL agents. This work is the first to apply this approach to a complex, real-world industrial system – a water treatment plant – showing promising results for practical RL deployment.

What Problem Does This Paper Address?

Deploying Reinforcement Learning (RL) in real-world industrial applications is hindered by several practical challenges, with hyperparameter selection being a significant one. RL algorithms are notoriously sensitive to hyperparameters like learning rates and exploration schedules, and their optimal values are often unknown. Traditional methods for tuning these parameters rely on either default values, costly online experimentation, or accurate simulators. However, in many industrial scenarios, simulators are either non-existent or too simplistic to capture the true system dynamics. Furthermore, online interactions can be expensive, risky, or time-consuming. This paper addresses this gap by exploring the use of "calibration models" – learned dynamics models trained on offline historical data – to facilitate hyperparameter tuning without requiring a simulator or online interaction.

Methods

The core idea is to train a "calibration model" that approximates the real-world system's dynamics using only historical, offline data. This model is then used to simulate interactions for an RL agent, allowing for hyperparameter tuning in a "Data2Online" setting.

  • Calibration Models: The paper evaluates several types of calibration models, with a focus on k-Nearest Neighbors (KNN) models. Specifically, they compare:
  • Euclidean KNN: Uses standard distance in the state-action space.
  • Laplacian KNN: Employs a learned representation based on the graph Laplacian of the system's state transitions. This is a novel approach that aims to capture the underlying structure of the MDP better.
  • Feedforward Neural Network (NN) and Gated Recurrent Unit (GRU): Used as baselines to highlight the limitations of models prone to compounding errors in long-horizon rollouts.
  • Nexting Prediction: The calibration models are trained to predict future sensor values (a form of general value function) based on historical data. This is framed as a "nexting prediction" task.
  • Evaluation Metrics: Beyond standard prediction accuracy (RMSE), the paper introduces and utilizes:
  • Rollout Quality: Visual inspection of long-horizon trajectories generated by the calibration models compared to true data.
  • Hyperparameter Sensitivity: Assessing how well the calibration model preserves the relative ranking of different hyperparameter configurations compared to the true environment.
  • Dynamic Time Warping (DTW): A technique to measure similarity between time series that may have temporal misalignments, used to compare model rollouts with true trajectories.
  • Scaling and Distribution Shift: The study investigates how these models perform when scaled to year-long datasets and how they handle "distribution shifts" – changes in system dynamics over time.

Datasets

The primary dataset used is from the Drayton Valley water treatment plant (WTP) in Alberta, Canada.

  • Training and Evaluation Data: Over two years of sensor logs (collected between 2022 and 2024) with 480 sensor channels sampled at 1 Hz.
  • Feature Engineering: The data was processed to yield a 142-dimensional feature vector per time step.
  • Specific Sensors: The experiments focused on three critical sensors: membrane pressure (PIT300), influent temperature (TIT101), and influent turbidity (TUIT101).
  • Data Slices: For initial experiments, a one-week slice was used. For scaling experiments, a full year of data was utilized. Test sets were constructed from data slices one, three, and six months after the training period to simulate distribution shifts.

Key Insights and Ideas

  • Real-world applicability of calibration models: The most significant insight is that calibration models, particularly the Laplacian KNN, can be effectively applied to complex, high-dimensional, non-stationary industrial systems, moving beyond simple simulated domains.
  • Laplacian KNN's advantage: The Laplacian KNN model shows promise in capturing the underlying structure of the system dynamics, leading to better rollout quality and hyperparameter sensitivity compared to simpler Euclidean KNN or standard neural network models.
  • Hyperparameter sensitivity is preserved: The study demonstrates that calibration models can recover meaningful hyperparameter sensitivity curves, indicating their utility for guiding the selection of optimal hyperparameters.
  • Challenges in distribution shift adaptation: While calibration models can be trained on large datasets, simulating distribution shifts for fine-tuning remains a challenge. The models struggle to perfectly capture the sensitivity curves under significant shifts, suggesting that more advanced techniques are needed to adapt to evolving system dynamics.
  • DTW as a useful, but not perfect, metric: DTW proves valuable for comparing time series with temporal misalignments, but the paper acknowledges that it might not be sufficient for a complete assessment, hinting at the need for alternative or complementary metrics.

Key Results

  • Rollout Quality: KNN models (especially Laplacian KNN) produced more realistic long-horizon rollouts for the PIT300 sensor compared to NN and GRU baselines, which tended to collapse after 50-100 timesteps. For other sensors, rollouts were less accurate but KNN still outperformed NN/GRU.
  • Hyperparameter Sensitivity: The KNN models generally recovered correct hyperparameter rankings for a TD(0) prediction agent. The Euclidean KNN showed close alignment with ground truth for TIT101 and TUIT101. NN and GRU models exhibited poor hyperparameter sensitivity, consistent with their low-quality rollouts.
  • Scaling to Year-long Data: While a 12-month KNN model showed broader behavioral coverage, its generalization advantage over a 1-week KNN was not conclusive based on DTW scores, suggesting that simply scaling the data doesn't automatically guarantee better generalization across all scenarios.
  • Fine-tuning Learning Rates: The 12-month KNN model showed some ability to simulate distribution shifts for fine-tuning learning rates, with best performance around 1x10⁻⁴ to 1x10⁻⁵. However, it struggled to perfectly match ground truth sensitivity curves, indicating limitations in capturing specific shifts.

Limitations and Future Work

  • Generalization Advantage Not Conclusive: The paper notes that the generalization advantage of the 12-month KNN model over the 1-week KNN was not definitively proven by DTW, suggesting that alternative metrics might be needed for clearer assessment.
  • Distribution Shift Simulation: Accurately simulating distribution shifts for fine-tuning remains a challenge. The models struggle to perfectly capture the ground truth sensitivity curves under shifts.
  • Future Work: The authors highlight several open questions:
  • For what kinds of environments do extrapolating models perform poorly?
  • How can we better simulate distribution shifts?
  • How crucial is model accuracy for effective hyperparameter selection?
  • Are there better metrics than DTW for assessing rollout quality?
  • Developing methods to prompt models to simulate dynamics from specific deployment periods or within training data.

Summary updated

BibTeX
@inproceedings{coblin2025dynamics,
  author = {Jordan Coblin and Han Wang and Martha White and Adam White},
  title = {{Dynamics Models for Offline Hyperparameter Selection in Water Treatment}},
  booktitle = {RL4RS @ RLC},
  year = {2025},
  url = {https://openreview.net/forum?id=3RvX1B4H65},
}
Figure