Introduction
Designing deep learning models for "the edge"—such as microcontrollers, mobile phones, and embedded sensors—requires a delicate balance. High accuracy is desired, but strict hardware budgets for memory, power, and latency impose hard limits.
Hardware-aware Neural Architecture Search (HW-NAS) aims to automate this design process. However, most current gradient-based methods treat hardware constraints as "soft" regularization terms (penalties) added to the loss function. This approach introduces three major flaws:
- Differentiability Requirements: The hardware metric (like peak memory usage) must be expressed as a differentiable mathematical function, which is often impossible or requires inaccurate approximations.
- The Weighting Headache: Engineers must carefully tune a "weight" hyperparameter to balance accuracy against hardware efficiency. If it is too low, the model won't fit; if it is too high, accuracy drops significantly.
- Unreliable Results: These penalty-based methods often produce "near-misses"—models that are just slightly too large or slow for the target device.
To address these issues, researchers introduce ConNAS (Constraint-guided NAS), a novel gradient-based framework that enforces hardware constraints by directly modifying gradients during the search process, eliminating the need for differentiable hardware models and tedious hyperparameter tuning.
Methodology: Gradient Modification
ConNAS treats hardware constraints as "hard" boundaries rather than "soft" penalties. Instead of changing the loss function, ConNAS modifies the architectural gradients.
During the search, the algorithm checks if the current architecture violates any constraints (e.g., "Is the latency > 5ms?"). If it does, ConNAS calculates a "direction to feasibility"—a vector in the architecture weight space that points toward configurations satisfying the constraints.
Key technical highlights of this approach include:
- Gradient Steering: ConNAS augments the standard accuracy-based gradient with a vector that steers the search away from "illegal" areas of the search space and towards the feasible region.
- Heuristic Shortest Path: Finding the absolute shortest path to a feasible architecture in a massive search space is computationally prohibitive. ConNAS uses a per-edge heuristic to approximate this path efficiently.
- No Differentiability Needed: Because the method only needs to know which direction leads to smaller or faster models (determined by comparing candidate operations), it can directly use non-differentiable look-up tables or real on-device measurements.
Datasets and Evaluation
The researchers evaluated ConNAS using NATS-Bench (a massive NAS benchmark across CIFAR-10, CIFAR-100, and ImageNet16-120) and HW-NAS-Bench to provide real-world hardware measurements (latency and energy) on an NVIDIA Jetson TX2. Furthermore, they tested it on a practical Induction Motor Dataset for condition monitoring, where the goal is to detect mechanical faults using sensors under strict memory limits.
Key Insights and Results
- Constraints as Boundaries: By treating hardware limits as hard constraints, ConNAS is remarkably reliable. In experiments, ConNAS satisfied constraints in 100% of its runs, whereas popular baselines like FBNet and TAS frequently failed to find a valid model.
- Near-Optimal Performance: On the NATS-Bench benchmark, ConNAS consistently discovered architectures that were within 0.14% to 0.65% of the accuracy of the absolute best possible architecture that met the constraints.
- Outperforming Experts: In the practical motor-monitoring use case, ConNAS discovered architectures that outperformed the best human-designed models by up to 1.55% in accuracy while staying under a tiny 64kB model size budget.
- Robustness to Hyperparameters: Traditional methods are highly sensitive to the penalty weight. ConNAS uses a "rescale factor" to determine the strength of the steering, and performance remains stable across a wide range of values, making it much easier to use out-of-the-box.
Limitations and Future Work
While highly effective, ConNAS relies on a heuristic approximation. The "shortest path" to the feasible region is calculated edge-by-edge rather than globally, which might not be strictly optimal for every possible search space. Additionally, the current study focuses on cell-based and layer-wise search spaces. Future work could explore how this gradient modification scales to even more complex, non-linear network topologies.
Summary updated