Real-time safety filtering for Vision-Language-Action (VLA) models using Control Barrier Functions.
When a VLA model hallucinates, the robot arm doesn't know. This demo shows how a CBF-QP safety layer can intercept and minimally correct unsafe trajectories before they reach the hardware — at 1kHz, in real-time.
- Simulates VLA trajectories — including normal trajectories and "hallucinated" ones (OOD drift, cross-modal misalignment)
- Applies CBF-QP safety filtering — solves a Quadratic Program at each timestep to find the minimum correction that keeps the system safe
- Visualizes the result — shows original (unsafe) vs. corrected (safe) trajectories with ISO 15066 human body risk zones
For a safety constraint
where
Given the VLA's desired control
This is a convex QP — solvable in <1ms on embedded hardware.
# Clone
git clone https://github.com/YOUR_USERNAME/safeguard-cbf-demo.git
cd safeguard-cbf-demo
# Install dependencies
pip install -r requirements.txt
# Run the demo
python safeguard_cbf_demo.py
# Or run the interactive notebook
jupyter notebook safeguard_demo.ipynbnumpy>=1.21
scipy>=1.7
matplotlib>=3.5
cvxpy>=1.3 # For QP solving
The demo generates 4 figures:
| Figure | Description |
|---|---|
| Trajectory Comparison | VLA hallucinated trajectory vs. CBF-corrected trajectory |
| Safety Margin |
|
| Control Effort | How much correction was needed at each timestep |
| ISO 15066 Risk Map | Human body part zones with different force limits |
VLA Model Output (u_vla)
│
▼
┌─────────────────┐
│ CBF-QP Filter │ ← Solves QP at each timestep
│ (this demo) │ ← Multiple safety constraints
│ │ ← ISO 15066 body part mapping
└────────┬────────┘
│
▼
Safe Control (u_safe)
│
▼
Robot Hardware
This demo is a simplified illustration of the engineering principles behind:
- G2: CBF-based VLA hallucination interception with ISO 15066 mapping
- L3: Cross-modal consistency verification for hallucination detection
- M1: Conformal prediction-based dynamic threshold calibration
Part of a 71-patent portfolio for embodied AI safety. Contact us for the full SafeGuard SDK.
MIT — use freely for research and development.
Issues and PRs welcome! Areas where we'd love help:
- Adapting to ROS2/MoveIt2
- Franka Emika / UR5e real-hardware integration
- Additional safety constraint types
