Inferensys

Glossary

Once-For-All Network

A Once-For-All (OFA) network is a single, large neural network trained to support many sub-networks of different depths, widths, and kernel sizes through weight sharing, enabling hardware-aware neural architecture search without retraining for diverse microcontroller resource constraints.
Stylish WeWork-like workspace with hot desks and document wall, professional searching through enterprise knowledge base on a mounted ultrawide display, warm industrial pendants overhead.
EMBEDDED NEURAL NETWORK ARCHITECTURES

What is a Once-For-All Network?

A Once-For-All (OFA) network is a single, large neural network trained to support many sub-networks of different depths, widths, and kernel sizes through weight sharing, enabling hardware-aware neural architecture search without retraining for diverse microcontroller resource constraints.

A Once-For-All (OFA) Network is a single, large supernet trained once to contain a vast number of smaller, efficient sub-networks within its weight parameters. This is achieved through a progressive shrinking algorithm that trains the network to support diverse architectural dimensions—like varying layer depths, channel widths, and kernel sizes—via weight sharing. The core innovation is decoupling training from search, allowing the same pre-trained model to be instantly specialized.

For TinyML deployment, an OFA network enables hardware-aware neural architecture search (HW-NAS). A developer can rapidly evaluate thousands of sub-networks sampled from the supernet on target microcontroller hardware—measuring actual latency, memory, and energy—and select the optimal one without any retraining. This provides a Pareto-optimal frontier of models tailored to specific device constraints, from high-accuracy to ultra-efficient, all from one foundational model.

ARCHITECTURAL INNOVATION

Key Features of Once-For-All Networks

Once-For-All (OFA) networks are a foundational technique for hardware-aware neural architecture search, enabling a single trained model to be deployed across diverse microcontroller constraints.

01

Weight-Sharing Supernet

The core of an OFA network is a single, over-parameterized supernet trained to contain a vast number of sub-networks within its shared weight parameters. This eliminates the need to train thousands of independent models from scratch. The supernet is trained with a progressive shrinking algorithm that sequentially introduces architectural flexibility (e.g., depth, width, kernel size), allowing sub-networks of varying sizes to inherit well-trained weights.

  • Key Benefit: Drastically reduces the search cost for optimal sub-networks from thousands of GPU-days to near zero.
02

Multi-Dimensional Elasticity

OFA networks are elastic across multiple architectural dimensions, allowing sub-networks to be sampled by adjusting:

  • Depth: Number of layers or blocks.
  • Width: Number of channels (filters) per layer.
  • Kernel Size: Spatial size of convolutional filters (e.g., 3x3, 5x5, 7x7).
  • Resolution: Input image size.

This multi-dimensional elasticity creates a continuous spectrum of model sizes and computational costs (e.g., from 5M to 600M FLOPs) from one supernet, enabling precise matching to any target device's memory and latency budget.

03

Hardware-Aware Neural Architecture Search (HW-NAS)

OFA decouples training from search. After the supernet is trained once, a zero-shot search can be performed for any new hardware target. The search algorithm evaluates candidate sub-networks by:

  1. Sampling a sub-network configuration from the elastic space.
  2. Inheriting weights directly from the supernet (no fine-tuning).
  3. Measuring its accuracy on a validation set and its latency/energy on the actual target hardware (e.g., a specific microcontroller).

This process finds the Pareto-optimal sub-network for the exact trade-off between accuracy and on-device performance required.

04

Progressive Shrinking Training

Training the supernet is non-trivial; naively training all sub-networks simultaneously leads to interference and poor performance. OFA uses progressive shrinking:

  • Stage 1: Train the largest possible sub-network (full depth, width, kernel size) as a baseline.
  • Stage 2: Finetune this network while allowing smaller kernel sizes (e.g., 3,5,7) to be sampled, making weights good for all kernels.
  • Stage 3: Finetune further while allowing reduced depth (fewer layers) to be sampled.
  • Stage 4: Finetune finally while allowing reduced width (fewer channels) to be sampled.

This sequential training stabilizes learning and ensures high accuracy across all sub-networks.

05

Deployment for Microcontrollers

For TinyML, OFA provides a practical path to custom, efficient models. A developer can:

  1. Start with a pre-trained OFA supernet (e.g., OFA-ResNet50, OFA-MobileNetV3).
  2. Profile their target microcontroller's SRAM, flash, and latency limits.
  3. Run the hardware-aware search to find the best sub-network for those exact constraints.
  4. Extract and deploy that sub-network as a standalone, compact model file.

This enables ImageNet-scale vision models to run on devices with under 256KB of SRAM, as demonstrated by frameworks like MCUNet which builds upon OFA principles.

06

Advantages Over Traditional NAS

OFA addresses critical limitations of earlier Neural Architecture Search methods:

  • Cost: Traditional NAS trains each candidate model independently (prohibitively expensive). Differentiable NAS (DARTS) is faster but often finds architectures that perform poorly when trained standalone (the discrepancy gap).
  • Hardware Ignorance: Many NAS methods optimize only for FLOPs or parameters, which are poor proxies for real on-device latency and energy use.
  • Flexibility: A model found by traditional NAS is fixed. If hardware changes, the entire NAS process must be rerun.

OFA provides a reusable, hardware-aware model zoo from a single training run, offering unparalleled efficiency for embedded system design.

ARCHITECTURE SEARCH PARADIGMS

OFA vs. Traditional NAS and Manual Design

A comparison of the Once-For-All training paradigm against traditional Neural Architecture Search and manual neural network design, focusing on metrics critical for embedded and microcontroller deployment.

Feature / MetricOnce-For-All (OFA)Traditional NASManual Design

Core Methodology

Train one large weight-shared supernet; extract many sub-networks

Search and train each candidate architecture from scratch

Human expert designs and trains a single architecture

Search Cost for New Constraint

< 1 sec (sub-network extraction)

1000 GPU-hours (full search & train)

Weeks to months (design, train, iterate)

Hardware-Aware Optimization

Directly optimizes sub-networks for target latency/energy

Can be integrated via proxy models or direct measurement

Indirect, based on expert heuristics and profiling

Deployment Flexibility

One training run supports unlimited sub-networks (depth, width, kernel)

One search produces one optimal architecture per constraint set

One trained model per design; inflexible to new constraints

Memory Overhead for Deployment

Sub-network weights only (< 500KB typical)

Final architecture weights only

Final architecture weights only

Carbon Footprint & Energy Cost

Very High initial training; near-zero cost for subsequent adaptations

Extremely High per search iteration

Moderate per training run, but multiplied by design iterations

Specialized Hardware Support

Sub-networks can be extracted for specific NPU/CPU latency targets

Can search for architectures optimal for a specific accelerator

Design is fixed; may not be optimal for diverse hardware

Best For

Mass production of different devices with varying resource constraints

Research or production with a single, static hardware target

Proven, well-understood architectures for stable requirements

ONCE-FOR-ALL NETWORK

Use Cases and Applications

The Once-For-All (OFA) network's core innovation—training a single, large super-network to support many sub-networks—enables its application across the entire TinyML development lifecycle, from rapid hardware-aware search to efficient production deployment.

03

On-Device Performance & Accuracy Trade-off Adjustment

OFA enables dynamic performance-accuracy trade-offs on a single device. After deployment, the device can switch between different sub-networks extracted from the super-network based on real-time system conditions. For example:

  • A battery-powered sensor could use a larger, more accurate sub-network when mains power is connected, and automatically switch to a tiny, ultra-efficient sub-network when running on battery to extend operational life.
  • A device under high CPU load from other tasks could temporarily downgrade to a faster, lighter sub-network to maintain overall system responsiveness, then revert to the high-accuracy model when resources are free. This provides a form of adaptive inference without requiring multiple, separately trained models to be stored on the device.
05

Enabling Extreme Model Compression

OFA synergizes with other model compression techniques to push the boundaries of what's possible on microcontrollers. The super-network training process inherently encourages weight sharing and robustness across architectures. This creates a strong foundation for applying post-training techniques:

  • Quantization: The shared weights of the OFA super-network can be quantized (e.g., to INT8), and this quantization is inherited by all sub-networks, ensuring consistent behavior.
  • Pruning: The super-network can be globally pruned, removing redundant connections that are unimportant across all sub-networks, leading to a more compact base for subsequent sub-network extraction.
  • Knowledge Distillation: The large super-network can act as the teacher model for distilling knowledge into even smaller, non-shared student models for ultra-low-footprint deployment.
ONCE-FOR-ALL NETWORK

Frequently Asked Questions

A Once-For-All (OFA) network is a foundational technique in hardware-aware neural architecture search, enabling a single trained model to be deployed across diverse microcontroller resource constraints. These questions address its core mechanics, advantages, and role in TinyML deployment.

A Once-For-All (OFA) network is a single, large neural network trained to contain a vast number of smaller, efficient sub-networks of varying depths, widths, and kernel sizes through weight sharing, enabling hardware-aware neural architecture search without retraining for each target device.

Unlike traditional methods that train a unique model for each hardware constraint, OFA decouples training from search. A single supernet is trained just once. This supernet's architecture is designed with elastic dimensions, allowing the selection of different numbers of layers (depth), channels per layer (width), and convolution kernel sizes. After training, a specialized search algorithm can extract a sub-network perfectly sized for a specific microcontroller's memory, compute, and latency budget. This makes OFA a cornerstone of TinyML deployment, where one training run can service an entire product line of devices with different capabilities.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.