Inferensys

Glossary

Bayesian Optimization

Bayesian optimization is a sequential model-based optimization technique that uses a probabilistic surrogate model to efficiently find the optimal parameters of an expensive-to-evaluate black-box function.
ML engineer managing model versions on laptop, version history visible, technical Git-like workflow.
PERFORMANCE PROFILING AND AUTO-TUNING

What is Bayesian Optimization?

A sequential, model-based optimization technique for finding the global optimum of expensive-to-evaluate black-box functions, such as NPU kernel performance.

Bayesian optimization is a sequential model-based optimization (SMBO) technique that uses a probabilistic surrogate model, typically a Gaussian Process, to approximate an expensive black-box objective function. It employs an acquisition function, such as Expected Improvement, to intelligently select the next parameter configuration to evaluate, efficiently balancing exploration of uncertain regions with exploitation of known promising areas. This makes it highly effective for auto-tuning NPU kernels where each performance evaluation is costly.

The process iteratively updates the surrogate model with new performance data, refining its predictions of the configuration space. This guided search requires far fewer evaluations than exhaustive or random methods like grid search. In performance profiling and auto-tuning, it is used to optimize parameters like workgroup size, tile size selection, and vectorization factor to minimize latency or maximize compute throughput on specific NPU hardware, directly addressing bottleneck analysis.

GLOSSARY

Key Components of Bayesian Optimization

Bayesian Optimization is a sequential model-based strategy for finding the global optimum of a black-box function with minimal evaluations. It is particularly effective for auto-tuning NPU kernels where each evaluation (kernel run) is expensive.

01

Surrogate Model

A probabilistic model (typically a Gaussian Process) that approximates the expensive, black-box objective function. It provides a predictive distribution (mean and variance) over the function's output for any input configuration, quantifying uncertainty where data is sparse. This model is cheap to evaluate and is updated after each observation.

  • Primary Role: Acts as a fast, statistical proxy for the costly performance evaluation of an NPU kernel configuration.
  • Key Output: For a given parameter set (e.g., tile size, workgroup size), it predicts both the expected performance (mean) and the uncertainty (variance) of that prediction.
02

Acquisition Function

A utility function that guides the search by quantifying the desirability of evaluating the objective function at a new point. It uses the surrogate model's predictions to balance exploration (sampling high-uncertainty regions) and exploitation (sampling near the current best-known optimum). The next point to evaluate is chosen by maximizing this function.

  • Common Functions: Expected Improvement (EI), Upper Confidence Bound (UCB), Probability of Improvement (PoI).
  • Decision Engine: Translates the surrogate's statistical predictions into a single, actionable score for selecting the next configuration to test on the NPU.
03

Observation History

The set of input-output pairs collected from previous evaluations of the expensive black-box function. For NPU auto-tuning, this is the log of tested kernel configurations (e.g., {tile_size: 32, unroll_factor: 4}) and their measured performance metrics (e.g., execution time in microseconds).

  • Core Data: This history is the training data for the surrogate model.
  • Sequential Nature: The history grows by one pair after each iteration, making the surrogate model progressively more accurate in promising regions of the parameter space.
04

Optimization Loop

The sequential process that iteratively refines the search for the optimum. Each cycle consists of:

  1. Fit/Update the surrogate model using the current observation history.
  2. Maximize the acquisition function to propose the next most promising parameter configuration.
  3. Evaluate the proposed configuration by running the kernel on the NPU and measuring its performance (the expensive step).
  4. Augment the observation history with the new result.

The loop terminates based on a budget (e.g., max evaluations) or convergence criteria.

05

Configuration Space

The domain of tunable parameters defining all possible kernel configurations to be searched. This is the input space for the objective function. For an NPU kernel, this space is defined by discrete and/or continuous parameters.

  • Examples: Thread block dimensions (blockDimX, blockDimY), loop unroll factors, memory tile sizes, vectorization width.
  • Definition: Must be carefully bounded and structured. It can be categorical (e.g., use algorithm A or B), integer (e.g., tile size from 16 to 128), or continuous (e.g., a learning rate). The surrogate model must be able to model this space.
06

Objective Function

The expensive black-box function being optimized. In NPU auto-tuning, this is the performance evaluation process for a given kernel configuration. It takes a point from the configuration space as input, runs the kernel with those parameters on the target hardware, and returns a scalar performance metric.

  • Typical Form: f(config) -> performance_metric (e.g., execution time, throughput, energy efficiency).
  • Key Characteristics: It is noisy (measurements can vary), derivative-free (gradients are unavailable), and costly to evaluate (each run consumes time and energy on the NPU). The goal of Bayesian Optimization is to find its minimum or maximum with as few calls as possible.
BAYESIAN OPTIMIZATION

Frequently Asked Questions

Bayesian Optimization is a core technique in the auto-tuning of computational kernels for Neural Processing Units. This FAQ addresses its core mechanisms, applications, and relationship to other profiling and tuning methodologies.

Bayesian Optimization is a sequential, model-based global optimization strategy designed to find the minimum or maximum of an expensive-to-evaluate black-box function. It operates by constructing a probabilistic surrogate model (typically a Gaussian Process) to approximate the unknown function and an acquisition function to decide where to sample next, efficiently balancing exploration of uncertain regions and exploitation of known promising areas.

Core Mechanism:

  1. Build a Surrogate Model: A Gaussian Process (GP) is fitted to the observed (parameter, performance) pairs. The GP provides a predictive distribution (mean and variance) for the performance of any untested parameter configuration.
  2. Optimize the Acquisition Function: An acquisition function (e.g., Expected Improvement, Upper Confidence Bound) uses the GP's predictions to quantify the potential utility of evaluating a new point. It formalizes the explore/exploit trade-off.
  3. Evaluate the Black-Box Function: The parameter set that maximizes the acquisition function is selected and evaluated on the actual, expensive system (e.g., running a kernel on the NPU to measure execution time).
  4. Update and Repeat: The new observation is added to the dataset, the GP model is updated, and the process repeats until a budget (evaluation count) is exhausted.

In NPU auto-tuning, the black-box function is the kernel's execution time or throughput, and the parameters are tunable compiler options like workgroup size, tile size, or vectorization factor.

COMPARISON

Bayesian Optimization vs. Other Search Methods

This table contrasts the core characteristics of Bayesian Optimization with other common parameter search techniques used in NPU kernel auto-tuning and hyperparameter optimization.

Feature / MetricBayesian OptimizationGrid SearchRandom SearchGradient-Based Optimization

Core Search Strategy

Probabilistic model-guided (exploration/exploitation)

Exhaustive over a predefined grid

Uniform random sampling

Gradient descent/ascent on a differentiable surface

Sample Efficiency (Evaluations to Optimum)

High

Very Low

Low

Varies (High if differentiable)

Handles Non-Differentiable Objectives?

Handles Noisy Evaluations?

Explicitly Models Uncertainty?

Parallel Evaluation Support

Limited (requires model update)

Full (embarrassingly parallel)

Full (embarrassingly parallel)

Limited (requires sequential gradient steps)

Scalability to High Dimensions (>20 params)

Moderate (surrogate model complexity)

Very Poor (curse of dimensionality)

Poor (uniform sampling becomes sparse)

Good (if gradients are available)

Typical Use Case in Auto-Tuning

Expensive black-box functions (e.g., kernel runtime)

Small, discrete parameter spaces

Initial broad exploration

Tuning differentiable hyperparameters (e.g., learning rate schedules)

Overhead per Iteration

High (model fitting & acquisition optimization)

None

None

Moderate (gradient computation)

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.