Inferensys

Glossary

Kernel Size Search

Kernel Size Search is a dimension of Neural Architecture Search (NAS) where algorithms select the spatial dimensions of convolutional filters to optimize receptive field and computational efficiency for hardware-constrained deployment.
Engineer reviewing vector database search results on laptop, embeddings visualization on screen, home office coding session.
HARDWARE-AWARE NEURAL ARCHITECTURE SEARCH

What is Kernel Size Search?

Kernel size search is a critical dimension of the neural architecture search (NAS) space focused on optimizing the spatial dimensions of convolutional filters.

Kernel size search is a dimension of the neural architecture search (NAS) search space where the algorithm selects the spatial dimensions (e.g., 3x3, 5x5, 7x7) of convolutional filters to optimize the trade-off between a network's receptive field and its computational cost. In hardware-aware NAS, this search directly targets metrics like latency and memory usage, as larger kernels increase multiply-accumulate (MAC) operations and on-chip buffer requirements, which are critical constraints for microcontroller deployment.

The search evaluates how different kernel sizes affect both task accuracy and hardware efficiency. For TinyML, smaller kernels (e.g., 3x3) are often preferred to reduce compute, but the algorithm may discover that selectively using a 5x5 kernel in early layers improves feature extraction without violating the memory budget. This optimization is a key component of neural hardware co-design, ensuring the final architecture is intrinsically efficient for the target silicon.

HARDWARE-AWARE NEURAL ARCHITECTURE SEARCH

Core Mechanisms of Kernel Size Search

Kernel size search is a dimension of the NAS search space where the algorithm selects the spatial dimensions (e.g., 3x3, 5x5) of convolutional filters to optimize the receptive field and computational cost for a target hardware platform.

01

The Search Space Dimension

In kernel size search, the algorithm explores a discrete set of possible filter dimensions (e.g., 1x1, 3x3, 5x5, 7x7) for each convolutional layer. This is a fundamental axis of the overall Neural Architecture Search (NAS) search space, alongside operator search and channel search. The choice of kernel size directly controls the receptive field—the area of the input a neuron sees—and the number of parameters and multiply-accumulate (MAC) operations. For microcontroller targets, the search space is often aggressively pruned to exclude large, computationally expensive kernels like 7x7.

02

Impact on Receptive Field & Accuracy

A larger kernel size increases the receptive field, allowing a single neuron to integrate information from a wider area of the input feature map. This is crucial for tasks like image classification where capturing long-range spatial dependencies can improve model accuracy. However, the relationship is non-linear. A 5x5 kernel has a receptive field of 5, but can often be approximated by two stacked 3x3 kernels (combined receptive field of 5) with fewer parameters and potentially better non-linearity. The search algorithm must evaluate this trade-off to find the optimal configuration for the target dataset.

03

Direct Hardware Cost Implications

Kernel size is a primary driver of computational cost. The number of operations in a standard convolution scales quadratically with kernel width/height. For a layer with C_in input channels, C_out output channels, and an H x W feature map:

  • A 3x3 kernel requires ~9 * C_in * C_out * H * W MACs.
  • A 5x5 kernel requires ~25 * C_in * C_out * H * W MACs. For memory-constrained microcontrollers, larger kernels also increase the size of the weight tensor stored in flash. A hardware cost model is used during search to predict the latency and energy impact of each candidate kernel size on the target MCU.
04

Integration with Other Search Dimensions

Kernel size search is rarely performed in isolation. It is tightly coupled with:

  • Operator Search: Deciding between a standard conv, depthwise separable convolution, or pooling.
  • Channel Search: Determining the width (number of filters) for each layer. For example, a search might substitute a costly 5x5 standard convolution with a more efficient combination of a 3x3 depthwise convolution followed by a 1x1 pointwise convolution (a MobileNet-like block). The NAS algorithm must evaluate these compound architectural decisions to find globally optimal designs.
05

Methods for Efficient Search

Evaluating every possible kernel size via full training is prohibitively expensive. Kernel size search employs efficient NAS strategies:

  • Weight Sharing (Supernet): A supernet is constructed where each layer has parallel branches for different kernel sizes (3x3, 5x5). The weights for these branches are trained concurrently, allowing rapid evaluation of sub-networks.
  • Differentiable Search (DARTS): The choice between kernel sizes is relaxed into a continuous, learnable architectural parameter. The search optimizes these parameters via gradient descent.
  • Zero-Cost Proxies: Simple metrics (e.g., gradient norm at initialization) can rank kernel size choices without any training, providing a fast, low-fidelity signal to guide the search.
06

TinyML-Specific Optimizations

For microcontroller NAS (MCU-NAS), kernel size search is heavily biased by hardware limits:

  • Memory Constraint: Large kernels increase parameter count, which can exceed the few hundred KB of SRAM/Flash available. Search is constrained to keep model size under budget.
  • Latency Constraint: The search objective includes a latency constraint measured via a hardware-in-the-loop profiler or a pre-characterized hardware cost model.
  • Fixed-Point Arithmetic: Kernels must perform well under post-training quantization. Some kernel sizes may be less robust to quantization error, a factor considered in quantization-aware NAS (QA-NAS). The goal is to find the smallest kernel that delivers the necessary receptive field without violating strict hardware ceilings.
KERNEL SIZE SEARCH

Kernel Size Trade-Offs in Hardware-Aware NAS

A comparison of convolutional kernel size options within a hardware-aware neural architecture search, analyzing their impact on model performance and hardware efficiency for microcontroller deployment.

Metric / CharacteristicSmall Kernel (e.g., 1x1)Medium Kernel (e.g., 3x3)Large Kernel (e.g., 5x5, 7x7)

Primary Function

Channel mixing / dimensionality reduction

Spatial feature extraction

Large receptive field capture

Parameter Count

Very Low

Moderate

High (grows quadratically)

Computational Cost (MACs)

Lowest

Standard Baseline

High

Receptive Field per Layer

1x1 pixel

3x3 region

5x5 or 7x7 region

Memory Access Pattern

Efficient, sequential

Standard 2D locality

Inefficient, scattered

Accuracy Potential (General)

Low (limited spatial processing)

High (optimal balance)

Variable (can be high with depthwise sep.)

Hardware Latency on MCU

< 1 ms (typical)

1-5 ms (typical)

5-20+ ms (typical)

Suitability for Depthwise Convolution

Not applicable

Excellent (standard)

High cost, niche use

Search Space Impact

Reduces model capacity

Default, balanced choice

Increases search complexity & cost

ARCHITECTURE SEARCH

Implementation in NAS Frameworks

Kernel size search is integrated into Neural Architecture Search (NAS) frameworks through specific search space definitions and optimization strategies. These implementations automate the selection of convolutional filter dimensions to balance receptive field, accuracy, and computational cost.

01

Search Space Integration

Kernel size is defined as a discrete, searchable parameter within the NAS search space. Common implementations allow the algorithm to select from a candidate set, such as {1x1, 3x3, 5x5, 7x7}, for each convolutional layer. This parameter is often searched jointly with other dimensions like operator type (e.g., regular vs. depthwise convolution) and channel count. In Differentiable Architecture Search (DARTS), kernel size choices are represented as continuous architecture parameters in a supernet, which are optimized via gradient descent.

02

Hardware-Aware Optimization

In Hardware-Aware NAS, kernel size search is directly coupled with a hardware cost model. Larger kernels (e.g., 5x5) increase multiply-accumulate (MAC) operations and on-chip memory traffic. Frameworks like ProxylessNAS and MNasNet incorporate real or estimated latency and energy costs for each kernel size option on the target hardware (e.g., a specific microcontroller or NPU). The search objective becomes a multi-term loss function: Loss = Task_Loss + λ * Hardware_Cost(Kernel_Size, ...), steering the search toward efficient configurations.

03

Efficiency via Weight Sharing

To avoid the prohibitive cost of training every kernel-size variant from scratch, most modern NAS frameworks use weight sharing within a supernet. A single, over-parameterized network is trained where each layer contains filters for all candidate kernel sizes. During search, evaluating a sub-network with a specific kernel size configuration involves using the corresponding weights from the supernet. This One-Shot NAS approach, used by frameworks like Once-For-All (OFA), allows for rapid estimation of how kernel size impacts accuracy without full retraining.

04

Microcontroller-Specific Strategies (MCU-NAS)

For TinyML deployment, kernel size search must account for extreme constraints. Strategies include:

  • Severely constrained candidate sets: Often limited to {1x1, 3x3} to minimize SRAM usage for feature maps.
  • Depthwise convolution preference: Searching for kernel size within depthwise separable layers, where a 5x5 depthwise conv is far cheaper than a 5x5 standard conv.
  • Direct hardware profiling: Hardware-in-the-loop search may compile and benchmark candidate layers on the actual MCU (e.g., an Arm Cortex-M4) to get cycle-accurate latency data for the cost model.
  • Co-search with quantization: Quantization-Aware NAS (QA-NAS) may evaluate kernel size choices under simulated 8-bit or 4-bit integer arithmetic.
05

Gradient-Based vs. Sampling-Based Search

NAS frameworks implement kernel size search through different core strategies:

  • Gradient-Based (e.g., DARTS): Treats the choice as a continuous relaxation. The supernet has parallel convolution paths with different kernel sizes; architecture parameters (alphas) control the weight of each path. The final discrete kernel size is selected by argmax on these parameters.
  • Sampling-Based (e.g., RL-NAS, Evolutionary): A controller (RL agent) or evolutionary algorithm samples a discrete kernel size for each layer. The performance (reward/fitness) of the full sampled architecture is evaluated, often via the weight-sharing supernet, and used to update the sampler.
  • Predictor-Based: A learned performance estimator or zero-cost proxy predicts the accuracy of an architecture based on its kernel size configuration, guiding the search without full evaluation.
06

Interaction with Other Search Dimensions

Kernel size search does not occur in isolation; it interacts with other NAS decisions:

  • Operator Search: The cost/benefit of a 5x5 kernel differs drastically between a standard convolution and a depthwise separable convolution.
  • Channel Search: A larger kernel in a wide layer (high channel count) is more expensive than in a narrow layer. Joint optimization is key.
  • Skip Connection Search: The presence of a residual bypass can change the optimal kernel size in a layer.
  • Network Depth: In deeper networks, smaller kernels (3x3) are often sufficient to build a large effective receptive field, making large kernel searches less beneficial. Advanced frameworks model these interactions within the supernet structure.
KERNEL SIZE SEARCH

Frequently Asked Questions

Kernel size search is a critical dimension of Neural Architecture Search (NAS) that automates the selection of convolutional filter dimensions to optimize a model's receptive field and computational cost for a target hardware platform.

Kernel size search is a dimension of the Neural Architecture Search (NAS) search space where the algorithm automatically selects the spatial dimensions (e.g., 3x3, 5x5, 7x7) of convolutional filters for each layer in a neural network. This search optimizes the trade-off between the model's receptive field—the area of the input influencing a neuron's output—and its computational and memory cost, which scales quadratically with kernel dimensions. In Hardware-Aware NAS, this search is directly constrained by the target device's capabilities, such as a microcontroller's limited SRAM and compute units.

For example, a larger 5x5 kernel captures more contextual information but requires 25/9 ≈ 2.8x more multiply-accumulate (MAC) operations than a 3x3 kernel. The search algorithm evaluates this trade-off to discover architectures that meet accuracy requirements while adhering to strict latency or energy budgets.

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.