A Control Barrier Function (CBF) is a mathematical construct used to enforce safety constraints on a dynamical system by defining a forward-invariant safe set. It provides a formal, constraint-based method to synthesize or filter control inputs, ensuring the system state remains within a predefined safe region for all future time. This is achieved by deriving a condition that the control input must satisfy at each time step, directly linking safety to the system's dynamics.
Glossary
Control Barrier Function (CBF)

What is a Control Barrier Function (CBF)?
A formal mathematical tool for ensuring the safety of dynamical systems by synthesizing controllers that guarantee forward invariance of a defined safe set.
In practice, a CBF is often integrated with controllers like Model Predictive Control (MPC) to create a predictive safety filter or as additional hard constraints in the optimization problem. This combination, known as CBF-MPC, leverages MPC's predictive optimization for performance while using the CBF's conditions to guarantee recursive feasibility and safety. The core mechanism involves defining a barrier function whose value remains non-negative if the system is safe, with the controller designed to enforce its time derivative is non-negative on the boundary of the safe set.
Key Properties of Control Barrier Functions
Control Barrier Functions (CBFs) are mathematical constructs that formally guarantee a system remains within a designated safe set. Their core properties define how they interact with a controller to filter unsafe actions.
Forward Invariance
Forward invariance is the foundational guarantee provided by a valid CBF. If a system starts inside a safe set defined by the CBF, and the controller satisfies the CBF condition for all future time, then the system is guaranteed to remain inside the safe set forever. This property transforms a static safety specification into a dynamic control law.
- Mathematical Definition: A set (C) is forward invariant if for every initial state (x(0) \in C), the trajectory (x(t) \in C) for all (t \geq 0).
- Role of the CBF: The CBF's time derivative condition, (\dot{h}(x) \geq -\alpha(h(x))), is a constraint that, when enforced, mathematically proves forward invariance.
Relative Degree
The relative degree of a CBF is the number of times the output function (h(x)) must be differentiated with respect to time before the control input (u) explicitly appears. This property dictates the form of the CBF constraint and the complexity of the resulting safety filter.
- Relative Degree 1: The control input (u) appears in the first derivative (\dot{h}(x,u)). This leads to a simple, affine constraint in (u) that is easy to enforce via a Quadratic Program (QP). Example: Velocity-level constraints for a mobile robot.
- High Relative Degree: Requires (u) to appear after multiple differentiations. This necessitates techniques like Exponential Control Barrier Functions (ECBFs) or Integral Control Barrier Functions to formulate a constraint that is still applicable for real-time control.
Composition with Nominal Controllers
A primary use of a CBF is as a safety filter. It takes a potentially unsafe nominal control input (e.g., from an MPC or tracking controller) and minimally modifies it to ensure safety. This is typically formulated as a Quadratic Program (QP).
CBF-QP Formulation: [\min_{u} , |u - u_{nom}|^2] [\text{subject to: } , L_f h(x) + L_g h(x) u \geq -\alpha(h(x))]
- (u_{nom}): The desired, performance-optimizing input from the nominal controller.
- CBF Constraint: The inequality that enforces the forward invariance condition.
- Minimal Intervention: The QP finds the safest control input closest to the nominal one, preserving performance when safety is not at risk.
Class K Function & Tunable Aggressiveness
The class (\mathcal{K}) function, (\alpha(\cdot)), in the CBF condition (\dot{h} \geq -\alpha(h)) is a tunable parameter that dictates how aggressively the controller acts to keep the system safe.
- Function Definition: A continuous function (\alpha: [0, \infty) \to [0, \infty)) is class (\mathcal{K}) if it is strictly increasing and (\alpha(0) = 0). A common choice is (\alpha(h) = \gamma h) for (\gamma > 0).
- Interpretation: When the system is far from the boundary ((h) is large), the constraint (\dot{h} \geq -\gamma h) is loose, allowing the nominal controller to act freely. As the system approaches the boundary ((h \to 0)), the constraint forces (\dot{h}) to become positive, pushing the state back into the interior of the safe set. A larger (\gamma) results in more aggressive corrective action.
Integration with Model Predictive Control (MPC)
CBFs and MPC can be integrated in two primary architectures, leveraging the predictive nature of MPC with the formal safety guarantees of CBFs.
- CBFs as Constraints in MPC: The CBF condition (\dot{h}(x,u) \geq -\alpha(h(x))) is added as a constraint within the MPC's finite-horizon Optimal Control Problem (OCP). This ensures the optimized trajectory is safe over the prediction horizon.
- CBFs as a Safety Filter for MPC: The MPC solves its OCP without explicit safety constraints to maximize performance. The resulting planned input sequence is then passed through a CBF-based safety filter (e.g., a CBF-QP) at each time step before being applied to the system. This decouples performance optimization from safety enforcement.
Comparison to Control Lyapunov Functions (CLFs)
CBFs are often discussed alongside Control Lyapunov Functions (CLFs), which certify stability (convergence to a goal). Understanding their dual role is key to unified controller design.
| Property | Control Lyapunov Function (CLF) | Control Barrier Function (CBF) |
|---|---|---|
| Primary Goal | Stability - Drive the system to a desired equilibrium. | Safety - Keep the system away from forbidden states. |
| Core Condition | (\dot{V}(x,u) \leq -\lambda V(x)) (energy decreasing). | (\dot{h}(x,u) \geq -\alpha(h(x))) (distance from boundary non-decreasing). |
| Typical Use | Formulated as a constraint to achieve asymptotic tracking. | Formulated as a constraint to enforce set invariance. |
- CLF-CBF QP: A single Quadratic Program can enforce both CLF (for performance) and CBF (for safety) constraints simultaneously, providing a unified framework for safe and stable control.
CBF vs. Other Safety and Control Methods
A feature comparison of Control Barrier Functions (CBFs) against other prevalent safety and control methodologies, highlighting their respective mechanisms, computational properties, and integration capabilities.
| Feature / Metric | Control Barrier Function (CBF) | Model Predictive Control (MPC) | Lyapunov Functions | Rule-Based Safety (e.g., Emergency Stop) |
|---|---|---|---|---|
Primary Safety Mechanism | Forward invariance of a safe set defined by a barrier function. | Explicit constraint satisfaction over a finite prediction horizon. | Asymptotic convergence to a stable equilibrium point. | Discrete, conditional logic triggers (e.g., if obstacle_detected then stop). |
Constraint Handling | Hard constraints via barrier condition; can be paired with MPC for predictive constraints. | Explicit hard and soft state/input constraints within the optimization. | Typically does not handle path constraints; focuses on stability. | Binary, all-or-nothing; no formal constraint representation. |
Computational Profile | Low; often adds a single constraint or QP to a nominal controller. | High; requires solving an optimization problem (QP/NLP) at each step. | Very low; stability check via function derivative. | Negligible; simple Boolean evaluation. |
Predictive Capability | None inherently; provides instantaneous safety filter. Integrates with MPC for prediction. | Core feature; uses a dynamic model to predict and optimize future states. | None; analyzes stability of current state or trajectory. | None; reactive to immediate sensor input. |
Formal Guarantees | Forward invariance (safety) for a perfectly known model. | Optimality w.r.t. cost function & constraint satisfaction for the horizon, subject to model fidelity. | Asymptotic stability (safety in the sense of converging to a safe equilibrium). | None; heuristic and scenario-dependent. |
Integration with Performance Controllers | High; designed as a modular safety filter for any nominal controller (e.g., RL, PID). | Self-contained; performance and safety are jointly optimized in a single problem. | Moderate; often used as a stability certificate for a designed controller. | Low; typically overrides or interrupts the performance controller. |
Handling of Model Uncertainty | Limited; requires robust or adaptive CBF formulations for guarantees. | Addressed via Robust MPC or Stochastic MPC (e.g., tube MPC, chance constraints). | Robust Lyapunov functions can provide stability guarantees under bounded uncertainty. | Not formally addressed; relies on sensor accuracy and threshold tuning. |
Real-Time Suitability for Fast Dynamics | Excellent; low computational overhead enables high-frequency control loops. | Challenging; solving optimization in <1 ms is difficult for complex systems. | Excellent; function evaluation is trivial. | Excellent; minimal latency. |
Frequently Asked Questions
A Control Barrier Function (CBF) is a mathematical tool used to enforce safety constraints in dynamic systems. It is a critical component for ensuring robots and autonomous systems operate within a predefined 'safe set' of states, often integrated with advanced controllers like Model Predictive Control (MPC).
A Control Barrier Function (CBF) is a mathematical construct used to guarantee that a dynamical system remains within a safe subset of its state space for all future time, a property known as forward invariance. It works by defining a scalar function, h(x), over the system state x, where h(x) ≥ 0 represents the safe set. The core mechanism is to synthesize a controller that ensures the time derivative of h(x) satisfies a condition (e.g., ḣ(x) ≥ -α(h(x))) that prevents h(x) from becoming negative, thus keeping the system safe. Unlike Lyapunov functions, which certify stability, CBFs explicitly certify safety with respect to constraints like collision avoidance or joint limits.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
Control Barrier Functions are part of a broader mathematical framework for ensuring system safety. These related concepts define the formal tools and complementary methods used to design provably safe controllers.
Lyapunov Function
A Lyapunov function is a scalar, energy-like function used to prove the asymptotic stability of an equilibrium point for a dynamical system. While a CBF certifies safety (state remains within a set), a Lyapunov function certifies stability (state converges to a point). They are often used together in Control Lyapunov-Barrier Functions (CLBF) to achieve both stability and safety guarantees.
- Key Property: Must be positive definite and its derivative along system trajectories must be negative definite.
- Analogy: If a CBF defines a "safe basin," a Lyapunov function defines the "bottom of the bowl" the system settles into.
Control Lyapunov Function (CLF)
A Control Lyapunov Function (CLF) is a Lyapunov function whose time derivative can be made negative by an appropriate choice of control input. It is a constructive tool for stabilization and tracking. In combined frameworks like CLF-CBF Quadratic Programs (QPs), CLFs and CBFs are used as competing constraints to find a control input that simultaneously stabilizes the system while respecting safety barriers.
- Primary Use: Guaranteeing convergence to a desired state or trajectory.
- Formulation: Requires finding a control
usuch that the derivative of the CLF is negative.
Invariant Set
An invariant set is a region in the state space such that if the system state starts inside it, it remains inside for all future time under a given control law. The core function of a CBF is to render a safe set (defined by the CBF's superlevel set) forward invariant.
- Forward Invariance: The property guaranteed by a valid CBF.
- Types: Includes positively invariant sets, control invariant sets, and robust control invariant sets.
- Design Goal: The safe set
{x | h(x) ≥ 0}is designed to be a control invariant set.
Barrier Certificate
A barrier certificate is a related formal verification concept for continuous dynamical systems. It is a scalar function whose zero-level set forms a barrier between an initial set and an unsafe set, proving that no trajectory starting in the initial set can reach the unsafe set. While similar in spirit to a CBF, barrier certificates are typically used for offline analysis of a fixed closed-loop system, whereas CBFs are used for online synthesis of a safe controller.
- Verification vs. Synthesis: Barrier certificates verify; CBFs synthesize.
- Application: Proving safety of existing autonomous systems or neural network controllers.
Hamilton-Jacobi (HJ) Reachability
Hamilton-Jacobi (HJ) Reachability is a formal method for computing the Backward Reachable Tube (BRT)—the set of all states from which the system can be driven into an unsafe set within a time horizon, despite the best control efforts. It provides the ultimate safety guarantee but is computationally intensive for high-dimensional systems. CBFs can be seen as a simplifying, controller-synthesizing alternative; the safe set for a CBF is often designed as a subset of the complement of the BRT.
- Exact vs. Conservative: HJ provides exact reachable sets; CBFs provide efficient, sometimes conservative, safety filters.
- Curse of Dimensionality: HJ is limited to ~5-6 state dimensions, while CBFs scale better.
Exponential Control Barrier Function (ECBF)
An Exponential Control Barrier Function (ECBF) is a higher-order extension of the standard CBF used for systems with relative degree greater than one. It enforces safety by ensuring not just that h(x) ≥ 0, but that a set of its time derivatives also satisfy specific conditions, effectively shaping the approach to the barrier boundary. This is critical for physical systems where the control input (e.g., acceleration) does not directly affect the safety constraint (e.g., position).
- Relative Degree: The number of times
h(x)must be differentiated before the control inputuappears explicitly. - Application: Essential for robotic systems where force/torque controls position constraints.

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.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us