Daily Paper

SAFE-CHEM: Uncertainty-Aware Policy Switching for Robust Robotic Chemistry

The paper introduces SAFE-CHEM, a framework that quantifies action prediction uncertainty across an ensemble of imitation policies to trigger a deterministic backup controller during robotic...

Laura Jones, Shazil Shahzad, Ayesha Sana, Gabriella Pizzuto

uncertainty-estimationimitation-learningpolicy-switchingrobotic-manipulationlaboratory-automationsim-to-real-transfer

1. Introduction: The Risk of Overconfident Robotic Chemists

The adoption of autonomous robotic systems in chemistry laboratories is accelerating, driven by the imperative to automate experimental workflows and generate structured, high-throughput data for scientific discovery. Historically, laboratory automation has relied on rigid, non-reconfigurable platforms executing pre-programmed coordinate trajectories. While effective for repetitive, isolated tasks, these traditional systems incur substantial downtime and re-engineering costs whenever experimental protocols change. To achieve greater operational flexibility, recent research has pivoted toward learning-based paradigms, such as Imitation Learning (IL) and Behavior Cloning with Recurrent Neural Networks (BC-RNN). These techniques enable robotic manipulators to acquire complex, dexterous skills—including fluid pouring, powder weighing, and sample scraping—directly from human expert demonstrations without the need to hand-engineer complex reward functions.

Despite these advancements, safety remains a primary bottleneck preventing the unconstrained deployment of autonomous manipulators in chemical environments. Standard data-driven policies lack internal mechanisms to evaluate their own competence and struggle to differentiate between safe states and out-of-distribution (OOD) states. When encountering unfamiliar apparatus, subtle spatial displacements, or unexpected fluid dynamics, standard deep learning models exhibit overconfident action extrapolation. In a chemistry laboratory, unmitigated extrapolation can lead to severe operational failures, including equipment collisions, dropped glassware, chemical spills, or uncontrolled hazardous reactions.

To address this safety bottleneck, research by Jones et al. (2026) introduces SAFE-CHEM, a framework that treats failure prevention as an online, real-time uncertainty quantification and policy-switching problem. By capturing epistemic uncertainty across an ensemble of imitation policies, SAFE-CHEM detects model confidence degradation prior to execution errors and autonomously transitions control to a deterministic backup system.


2. The SAFE-CHEM Architecture: From Ensemble Variance to Deterministic Control

The SAFE-CHEM architecture operates as a multi-stage pipeline designed to bridge learning-based execution and deterministic safety enforcement. The system processes control through four distinct phases:

  1. Simulation Skill Learning: Training an ensemble of recurrent neural network policies (πL\pi_L) within a simulated environment.
  2. Uncertainty Estimation: Quantifying epistemic uncertainty (σ2\sigma^2) in real time via inter-model action prediction variance.
  3. Action Selection & Switching Logic: Monitoring variance against calibrated safety thresholds (θq\theta_q) to gate control between the learned ensemble policy (πL\pi_L) and a fail-safe backup controller (πB\pi_B).
  4. Real-Robot Execution: Dispatching the resulting safe control signal (asafea_{\text{safe}}) to physical hardware via zero-shot task transfer.
+-----------------------------------------------------------------------------------+
| 1. Simulation Skill Learning                                                      |
|    - Train ensemble of M = 15 BC-RNN policies (pi_L) on expert demonstrations    |
+-----------------------------------------------------------------------------------+
                                         |
                                         v
+-----------------------------------------------------------------------------------+
| 2. Uncertainty Estimation                                                         |
|    - Compute action prediction variance (sigma^2) across ensemble members online  |
+-----------------------------------------------------------------------------------+
                                         |  (sigma^2)
                                         v
+-----------------------------------------------------------------------------------+
| 3. Action Selection & Switching Logic                                             |
|    - Evaluate sigma^2 against KDE thresholds (theta_q) via sliding window D_{i,t} |
|    - Gate control: Pass pi_L action OR trigger backup controller (pi_B)           |
+-----------------------------------------------------------------------------------+
                                         |  (a_safe)
                                         v
+-----------------------------------------------------------------------------------+
| 4. Real-Robot Execution                                                           |
|    - Dispatch safe control signal (a_safe) to low-level hardware controllers      |
+-----------------------------------------------------------------------------------+

2.1 Ensemble-Based Epistemic Uncertainty Estimation

To capture the policy’s epistemic uncertainty—the uncertainty arising from a lack of training data in unfamiliar states—Jones et al. deployed a deep ensemble of M=15M = 15 distinct BC-RNN models built on the RoboMimic framework. Each policy observes a 29-dimensional state vector (O∈R29O \in \mathbb{R}^{29}) comprising robot proprioceptive data (end-effector position xe∈R7x_e \in \mathbb{R}^7, gripper state gs∈R2g_s \in \mathbb{R}^2, joint positions qr∈R7q_r \in \mathbb{R}^7, joint velocities q˙r∈R7\dot{q}_r \in \mathbb{R}^7) and environmental state data (object current position xobj∈R3x_{\text{obj}} \in \mathbb{R}^3, target position xgoal∈R3x_{\text{goal}} \in \mathbb{R}^3).

Temporal context is processed using a 2-layer Long Short-Term Memory (LSTM) architecture with 400 hidden dimensions and a sequence length of 16. To model human demonstration multi-modality, the continuous action space is structured using a Gaussian Mixture Model (GMM) with 10 modes.

The demonstration dataset was generated by recording 10 human SpaceMouse trajectories in simulation, which were annotated and expanded using MimicGen into 4,000 valid trajectories per task. To maximize ensemble diversity, each of the 15 models was initialized with a unique random seed and trained on a randomly sampled 25% subset (1,000 trajectories) of the total dataset using the Adam optimizer (learning rate 1×10−41\times 10^{-4}, batch size 100, 1,000 epochs).

During runtime, each ensemble member mm generates an action prediction at,m=πθm(ht,m)a_{t,m} = \pi_{\theta m}(h_{t,m}) based on its recurrent latent state ht,mh_{t,m}. The nominal control signal aˉt\bar{a}_t is computed as the predictive mean across the ensemble:

aˉt=1M∑m=1Mat,m\bar{a}_t = \frac{1}{M} \sum_{m=1}^{M} a_{t,m}

The online epistemic uncertainty σ2\sigma^2 is evaluated by calculating the component-wise action prediction variance across the ensemble members for each degree of freedom (i∈{1,…,7}i \in \{1, \dots, 7\}):

σi,t2=E[(ai,t,m−μi,t)2]\sigma_{i,t}^2 = \mathbb{E}\left[(a_{i,t,m} - \mu_{i,t})^2\right]

where μi,t\mu_{i,t} denotes the mean predicted action value for component ii at timestep tt. As the robot strays from the expert training manifold into OOD states, the action predictions of individual ensemble members diverge, causing a measurable spike in inter-model variance σi,t2\sigma_{i,t}^2.

2.2 Quantile Calibration via Kernel Density Estimation (KDE)

To distinguish standard operational variance from variance signaling impending task failure, Jones et al. calibrated safety limits using reference rollouts without intervention over a maximum horizon HH. Trajectories were categorized by outcome into successful sets (C\mathcal{C}) and failed sets (F\mathcal{F}).

To formalize the variance distributions, the non-zero variance sets for successful rollouts V(C)V(\mathcal{C}) and failed rollouts V(F)V(\mathcal{F}) are defined as:

V(C)={σi,t2  |  σi,t2>0,  τ∈C,  t∈[1,H]}V(\mathcal{C}) = \left\{ \sigma_{i,t}^2 \;\middle|\; \sigma_{i,t}^2 > 0, \; \tau \in \mathcal{C}, \; t \in [1, H] \right\}

V(F)={σi,t2  |  σi,t2>0,  τ∈F,  t∈[1,H]}V(\mathcal{F}) = \left\{ \sigma_{i,t}^2 \;\middle|\; \sigma_{i,t}^2 > 0, \; \tau \in \mathcal{F}, \; t \in [1, H] \right\}

The success-conditioned variance distribution V(C)V(\mathcal{C}) was modeled using non-parametric Kernel Density Estimation (KDE) with a Gaussian kernel Kh(u)K_h(u):

Kh(u)=12πhexp⁡(−u22h2)K_h(u) = \frac{1}{\sqrt{2\pi} h} \exp\left(-\frac{u^2}{2h^2}\right)

where the smoothing bandwidth hh was selected via Scott’s Rule. By integrating the resulting probability density function, the authors constructed the cumulative distribution function (CDF), FC(v)=P(σ2≤v∣τ∈C)F_{\mathcal{C}}(v) = P(\sigma^2 \le v \mid \tau \in \mathcal{C}). Component-specific confidence thresholds θi,q\theta_{i,q} were then derived for specified quantiles q∈(0,1)q \in (0, 1):

θi,q=inf⁡{v:FC(v)≥q}\theta_{i,q} = \inf\{v : F_{\mathcal{C}}(v) \ge q\}

Evaluated quantile limits included conservative (q=0.90q = 0.90), moderate (q=0.95q = 0.95), and relaxed (q=0.99q = 0.99) thresholds (θ0.90,θ0.95,θ0.99\theta_{0.90}, \theta_{0.95}, \theta_{0.99}). Empirical comparison confirmed a clear stochastic shift, with V(C)V(\mathcal{C}) exhibiting substantially lower variance distributions than V(F)V(\mathcal{F}).

2.3 Sliding Window Peak Detection & Autonomous Switching

To prevent false-positive transitions caused by brief, inherent variance spikes during contact-heavy subtasks (such as initial object grasping), SAFE-CHEM utilizes a sliding window peak detection algorithm (Di,tD_{i,t}). Incorporating indicator function notation I(⋅)\mathbb{I}(\cdot), the detection signal evaluates variance over a history window ww:

Di,t(τ)=I(∑j=t−wtI(σi,j2≥θi,q)≥npeaks)D_{i,t}(\tau) = \mathbb{I}\left( \sum_{j=t-w}^{t} \mathbb{I}(\sigma_{i,j}^2 \ge \theta_{i,q}) \ge n_{\text{peaks}} \right)

Through grid search analysis, optimal detection performance (evaluated via F1-score) was established at a window size w∈[8,10]w \in [8, 10] and a required peak count npeaks=8n_{\text{peaks}} = 8.

If the detection signal Di,t(τ)D_{i,t}(\tau) returns positive for more than two action components (i∈{1,…,7}i \in \{1, \dots, 7\}), the switching logic identifies an unrecoverable uncertainty risk. Control is immediately transferred from the learned ensemble (πL\pi_L) to a deterministic backup controller (πB\pi_B).

The backup system consists of a state-machine Cartesian position controller programmed with explicit operational phases and start/end state conditions. To ensure real-time evaluation across parallel simulation environments without CPU-GPU data transfer overhead, πB\pi_B was implemented using GPU-accelerated NVIDIA Warp. Executing the deterministic state machine directly on the GPU enables parallelized simulation across NN IsaacLab instances at full control frequency (50 Hz).


3. Empirical Benchmarks: Evaluating Task Success and Safety Violation Reduction

The SAFE-CHEM framework was evaluated across three simulated laboratory manipulation benchmarks developed in IsaacLab using a 7-DOF Franka Production 3 (FP3) robot manipulator:

  • Lift: Picking up glassware (vial or beaker) and holding it at a target position for visual inspection.
  • Pick and Place: Transferring glassware from an analytical balance to an IKA RCT heating/stirring plate.
  • Insertion: Inserting a vial into a transport rack, representing a high-precision, contact-rich manipulation task.

All tasks incorporated domain randomization, spawning objects within a 0.2 m×0.2 m0.2\,\text{m} \times 0.2\,\text{m} region, and enforced realistic side-grasp constraints preferred by human chemists, operating close to joint kinematic limits.

Baseline Ensemble Scaling Performance

The baseline evaluations measured task success and safety failure rates across varying ensemble sizes (n∈{1,5,10,15}n \in \{1, 5, 10, 15\}) without the switching mechanism over a maximum horizon of 5,000 control steps (executed at an effective policy frequency of 50 Hz).

Table 1: Average task success rate (%) across varying ensemble sizes without policy switching.

Ensemble Size (nn)Lift Success Rate (% ±\pm SD)Pick and Place Success Rate (% ±\pm SD)Insertion Success Rate (% ±\pm SD)
1 (Single Policy)75.7 ±\pm 2.567.7 ±\pm 9.121.3 ±\pm 0.6
583.3 ±\pm 4.263.7 ±\pm 7.651.7 ±\pm 4.0
1093.0 ±\pm 1.769.0 ±\pm 8.555.0 ±\pm 9.8
1592.0 ±\pm 1.083.0 ±\pm 2.742.0 ±\pm 4.0

Hybrid Policy Success and Safety Optimization

Integrating the uncertainty-driven backup controller consistently elevated task success rates and significantly reduced critical safety violations—defined as dropped glassware or container tilt angles exceeding 45∘45^\circ.

Table 2: Hybrid system task success rate (%) across ensemble sizes and confidence thresholds (θq\theta_q).

TaskSize (nn)Baseline (None)Conservative (θ0.90\theta_{0.90})Moderate (θ0.95\theta_{0.95})Relaxed (θ0.99\theta_{0.99})
Lift583.3 ±\pm 4.296.0 ±\pm 2.097.7 ±\pm 2.196.3 ±\pm 1.5
1093.0 ±\pm 1.796.3 ±\pm 0.699.0 ±\pm 1.099.3 ±\pm 0.6
1592.0 ±\pm 1.098.0 ±\pm 1.099.0 ±\pm 0.098.7 ±\pm 1.5
Pick & Place563.7 ±\pm 7.694.3 ±\pm 1.598.3 ±\pm 1.289.3 ±\pm 1.5
1069.0 ±\pm 8.596.3 ±\pm 0.697.0 ±\pm 2.086.4 ±\pm 4.0
1583.0 ±\pm 2.796.7 ±\pm 1.596.0 ±\pm 1.791.0 ±\pm 1.7
Insertion551.7 ±\pm 4.060.0 ±\pm 4.458.3 ±\pm 3.859.0 ±\pm 2.7
1055.0 ±\pm 9.867.3 ±\pm 3.562.7 ±\pm 5.558.0 ±\pm 6.1
1542.0 ±\pm 4.068.0 ±\pm 1.764.3 ±\pm 4.259.7 ±\pm 2.5

Table 3: Rate of critical safety violations (%) across ensemble sizes and confidence thresholds (θq\theta_q).

TaskSize (nn)Baseline (None)Conservative (θ0.90\theta_{0.90})Moderate (θ0.95\theta_{0.95})Relaxed (θ0.99\theta_{0.99})
Lift1 (Single)3.3 ±\pm 0.6–––
51.7 ±\pm 2.91.0 ±\pm 1.00.3 ±\pm 0.63.7 ±\pm 1.5
100.0 ±\pm 0.00.0 ±\pm 0.00.7 ±\pm 0.60.7 ±\pm 0.6
152.3 ±\pm 1.51.3 ±\pm 0.61.0 ±\pm 0.01.3 ±\pm 1.5
Pick & Place1 (Single)11.3 ±\pm 5.0–––
58.0 ±\pm 1.04.0 ±\pm 2.01.7 ±\pm 1.22.0 ±\pm 1.7
106.0 ±\pm 3.01.7 ±\pm 0.63.0 ±\pm 2.03.0 ±\pm 1.0
153.0 ±\pm 1.02.0 ±\pm 1.02.7 ±\pm 1.22.0 ±\pm 1.0
Insertion1 (Single)62.3 ±\pm 5.1–––
525.3 ±\pm 1.233.0 ±\pm 3.634.7 ±\pm 1.533.3 ±\pm 1.2
1021.0 ±\pm 7.024.7 ±\pm 2.326.7 ±\pm 4.029.3 ±\pm 3.1
1523.3 ±\pm 0.622.7 ±\pm 4.627.7 ±\pm 4.925.3 ±\pm 0.6

Key Empirical Insights

  • Ensemble Scaling Dynamics: Increasing ensemble size improved task execution over single-policy baselines across all benchmarks. However, performance gains were non-linear. In Pick and Place, n=15n=15 was necessary to reach an 83.0% baseline success rate by filtering outlier action predictions during placement. Conversely, the high-precision Insertion task experienced a sharp baseline decline at n=15n=15 (dropping to 42.0%). Larger ensembles can output overly conservative, averaged action vectors, reducing motion magnitudes and inducing trajectory execution timeouts.
  • Empirical Safety Violation Reductions: Ensembling alone dramatically suppressed safety violations compared to single-policy models. Most notably, in the Insertion benchmark, a single policy baseline suffered a catastrophic 62.3% ±\pm 5.1% safety failure rate. Scaling to an n=10n=10 baseline reduced this failure rate to 21.0% ±\pm 7.0%. In the Lift task, an n=10n=10 ensemble suppressed critical safety violations to 0.0% ±\pm 0.0%.
  • Hybrid Threshold Tuning: The hybrid policy matrix demonstrates that task precision dictates optimal thresholding. For low-precision tasks like Lift, a relaxed threshold (θ0.99\theta_{0.99}) achieved a 99.3% success rate. For contact-rich tasks like Insertion, a conservative threshold (θ0.90\theta_{0.90}) was required to trigger backup interventions early, raising task success from a baseline of 42.0% (n=15n=15) to 68.0%.
  • Mechanistic Detail on Physical Failure Modes: High-precision insertion highlighted a core physical limitation of action-variance monitoring. When the learned policy attempted insertion at an angular offset, premature release caused the vial to topple out of the rack. Because the support structure encompasses only half the height of the vial, this angular release created an unrecoverable kinematic state before inter-model variance breached the peak detection threshold Di,tD_{i,t}. Consequently, the rule-based backup controller could not recover the trajectory, illustrating that action uncertainty monitoring cannot retroactively correct unrecoverable physical state transitions.
  • Zero-Shot Sim-to-Real Deployment: To confirm real-world transferability, Jones et al. deployed SAFE-CHEM on a physical 7-DOF FP3 manipulator performing the Pick and Place task. Inference was executed within IsaacLab, transmitting target joint positions over a low-latency UDP link to a custom ROS 2 bridge node connected to MoveIt 2. The physical setup verified high-fidelity execution without real-world fine-tuning or domain adaptation.

4. Critical Takeaways for AI Safety & Laboratory Automation

  1. Pre-emptive Failure Detection Over Reactive Detection

    • Traditional failure identification systems operate reactively, triggering interventions only after a robot has physically deviated from its path or collided with laboratory equipment.
    • SAFE-CHEM monitors online epistemic drift in action space, identifying model divergence and switching control before irreversible physical errors occur.
  2. Zero-Failure Data Requirement

    • Many failure-prediction algorithms require explicit datasets containing negative examples or recorded failure trajectories to train runtime classifiers.
    • SAFE-CHEM derives its intervention boundaries strictly from successful trajectory distributions (V(C)V(\mathcal{C})) using KDE, eliminating the need to execute dangerous physical failures during model training.
  3. Calibrated Safety vs. Task Overhead Trade-offs

    • Adjusting the quantile safety threshold (θq\theta_q) allows operators to tune system conservatism based on specific laboratory hazard profiles.
    • Conservative thresholds (θ0.90\theta_{0.90}) maximize safety in high-risk tasks (e.g., handling concentrated acids) by invoking the deterministic backup controller earlier, whereas relaxed thresholds (θ0.99\theta_{0.99}) prioritize autonomous policy execution speed in lower-risk domains.
  4. The Need for Multimodal Grounding

    • Purely action-variance switching fails when an unrecoverable physical state transition occurs before trajectory divergence manifests—such as a misaligned vial toppling from a half-height support rack.
    • To prevent unrecoverable mechanical states during high-precision assembly operations, action-variance monitoring must be paired with physical sensing modalities, such as force-torque feedback or tactile sensing.

5. Conclusion & Operational Outlook

The SAFE-CHEM framework developed by Jones et al. (University of Liverpool) demonstrates a practical methodology for mitigating the risks of overconfident action extrapolation in autonomous robotic chemistry. By combining ensemble-based epistemic uncertainty estimation with KDE-calibrated quantile switching, the framework successfully bridges the gap between the flexibility of learning-based imitation policies and the safety requirements of automated scientific laboratories. The demonstrated zero-shot sim-to-real transfer onto physical hardware confirms that introspective uncertainty quantification provides a viable path toward safer autonomous manipulation in hazardous, real-world environments.

Read the full paper on arXiv · PDF