Resource Efficient Deep Reinforcement Learning for Acutely Constrained TinyML Devices

Filip Svoboda, David Nunes, Milad Alizadeh, Russel Daries, Rui Luo, Akhil Mathur, Sourav Bhattacharya, Jorge Sa Silva, Nicholas Donald LanetinyML 2021

TL;DR

This paper tackles the challenge of deploying resource-intensive Deep Reinforcement Learning (DRL) algorithms on severely constrained TinyML devices. They introduce a general-purpose optimization framework that combines various techniques to significantly reduce memory, computation, and energy requirements, making DRL feasible for embedded systems.

What Problem Does This Paper Address?

Deep Reinforcement Learning (DRL) has achieved remarkable success in complex decision-making tasks, from game playing to autonomous systems. However, its substantial resource demands (memory, computation, energy) have largely excluded it from the realm of TinyML devices – small, low-power embedded systems like sensors, drones, and robots. These devices, often powered by microcontrollers like ARM Cortex-M0, lack the computational power and memory to run sophisticated DRL agents. This paper aims to bridge this gap by developing and evaluating techniques to make DRL efficient enough for these resource-constrained platforms, thereby unlocking new applications for DRL in the embedded world.

Methods

The core of the paper is an efficiency framework designed to optimize DRL algorithms for TinyML. This framework comprises four main components:

  • Resource Scalers: These are a suite of techniques that modify the DRL agent's neural architecture and operations to reduce resource consumption. They include:
  • Selective Mixed Parameter Precision: This technique reduces the precision of model parameters (e.g., from 32-bit to 8-bit or lower) while aiming to maintain acceptable performance, drawing inspiration from similar techniques in discriminative deep learning.
  • Redundancy Minimization: This leverages matrix factorization (specifically Singular Value Decomposition - SVD) to approximate weight matrices in neural networks, reducing the number of parameters and computations.
  • Convolution Minimization: Similar to redundancy minimization, this technique aims to reduce the computational cost of convolutional layers by approximating them with separable filters.
  • Architecture and Hyper-parameter Search: A guided search mechanism is employed to identify optimal hyper-parameters and architectural choices that balance resource reduction with performance.
  • Optimization Tuner: This component intelligently orchestrates the application of Resource Scalers. It uses a greedy search guided by regression models to find combinations of optimization techniques and their intensity levels that best balance reward score (performance) and resource usage. The "Retain Rate" serves as a universal metric to guide this tuning process.

The framework iteratively applies these optimizations, feeding back performance metrics (Reward Score) to the tuner to refine the DRL module.

Datasets

The paper does not introduce new datasets. Instead, it evaluates its framework on established simulated environments and a practical real-world application:

  • Simulated Environments:
    • CartPole: A classic reinforcement learning benchmark from OpenAI Gym, used to test basic DRL performance on a constrained processor.
  • Humanoid (Roboschool): A more complex physics-based robot simulation environment from OpenAI's Roboschool, used to evaluate DRL agents in higher-dimensional continuous action spaces.
  • Real-world Application:
    • Distributed Coordination Network Protocol: This involves learning a custom message-passing protocol for a network of embedded devices (simulated on ARM Cortex-M0 processors) for a task inspired by the Colour-Digit MNIST dataset.

Key Insights and Ideas

  • DRL is Feasible on TinyML: The most significant insight is that with appropriate optimization techniques, DRL can indeed be made to run effectively on severely resource-constrained devices like ARM Cortex-M0 processors.
  • General-Purpose Optimization is Key: The framework's strength lies in its general-purpose nature. The optimization techniques are not tied to specific RL tasks, making them broadly applicable.
  • Trade-offs are Manageable: While optimizations do lead to some loss in performance (reward score), the paper demonstrates that these trade-offs are often manageable and acceptable for many applications, especially when compared to the alternative of not using DRL at all.
  • Combined Techniques Yield Best Results: The framework's success stems from the synergistic application of multiple optimization techniques, rather than relying on a single method.
  • Retain Rate as a Universal Metric: The "Retain Rate" proves to be a useful, technique-independent metric for guiding the optimization process and understanding the level of compression achieved.

Key Results

  • CartPole: Optimized DQN agents achieved comparable average reward scores to the original model with a retain rate of 0.95. A retain rate of 0.65 resulted in a significant decrease in reward (approx. 30% compression for an 80-point drop in score). Crucially, the compressed CartPole model on the ARM Cortex-M0 showed a reduced inference time (1.2 ms vs. 2.1 ms for the original).
  • Humanoid: The DQN agent achieved a reward score close to the unmodified RL agent, demonstrating effectiveness in a high-dimensional continuous control task. The memory footprint of the optimized DQN agent was 232.3MB.
  • Distributed Coordination: Optimized DIAL agents for a message-passing protocol on ARM Cortex-M0 processors showed performance (reward score) very close to the unoptimized agents, with significant reductions in resource consumption. For instance, one compressed agent retained only 32% of the original parameters and showed only a slight decrease in reward. Energy consumption was also significantly reduced.

Limitations and Future Work

  • Acceptable Performance Threshold: While the paper demonstrates that performance degradation is often acceptable, defining a universally "acceptable" threshold for different applications remains a challenge. The "Retain Rate" helps guide this, but application-specific requirements will dictate the optimal balance.
  • Theoretical Understanding of Precision: The paper notes that the theoretical reasons for why deep learning can tolerate reduced precision are not yet fully understood, suggesting further research in this area.
  • Exploration of More Complex Architectures: The current work focuses on optimizing existing DRL architectures. Future work could explore designing inherently more efficient DRL architectures from the ground up for TinyML.
  • Real-world Deployment: While the paper presents a case study on embedded hardware, further extensive real-world deployments and testing across a wider range of TinyML devices and applications would be beneficial.
  • Dynamic Optimization: The current framework focuses on offline optimization. Exploring online or adaptive optimization techniques that can adjust during runtime based on changing environmental conditions could be a valuable future direction.

Summary updated

BibTeX
@inproceedings{svoboda2021resource,
  author = {Filip Svoboda and David Nunes and Milad Alizadeh and Russel Daries and Rui Luo and Akhil Mathur and Sourav Bhattacharya and Jorge Sa Silva and Nicholas Donald Lane},
  title = {{Resource Efficient Deep Reinforcement Learning for Acutely Constrained TinyML Devices}},
  booktitle = {tinyML},
  year = {2021},
  url = {https://openreview.net/forum?id=_vo8DFo9iuB},
}
Figure