# Adversarial Time-to-Collision Safety Layer

- ID: 2284
- Canonical URL: https://synthcore.org/idea/2284/adversarial-time-to-collision-safety-layer
- API JSON: https://synthcore.org/api/idea/2284.json
- API Markdown: https://synthcore.org/api/idea/2284.md
- Verification status: mech_ok_no_baseline
- Source: [arXiv:2608.14239](https://arxiv.org/abs/2608.14239)
- Category: dynamics
- Solves: stability, accuracy, sample-efficiency
- ML areas: rl, world-model, optimizer, training-dynamics
- Math tags: control-theory, dynamical-systems, optimization, geometry
- Ratings: usefulness 8/10; difficulty 6/10; novelty 7/10

## Idea description

Attach a differentiable temporal barrier layer to a neural multi-agent policy or learned controller. The layer estimates the minimum collision time under admissible adversarial actions and minimally modifies the policy action whenever this time falls below a safety margin, allowing close approaches that are dynamically safe instead of enforcing a conservative fixed distance.

## Mathematical statement

Let the learned or known joint dynamics be $\dot{x}=F(x)+G(x)u+w$, where $x$ is the joint state, $u$ is the concatenated neural-policy action, and $w$ is bounded disturbance with $\|w\|\leq \bar w$. Let $\mathcal C$ be the collision set and define adversarial time-to-collision $T_a(x)=\inf\{t\geq0:\ x(t)\in\mathcal C\}$, where the infimum is over admissible adversarial controls for neighboring agents and admissible disturbances. For a desired reaction margin $\tau_s>0$, define the temporal barrier $h(x)=T_a(x)-\tau_s$. Forward safety is enforced by the robust control-barrier inequality $\nabla h(x)^\top(F(x)+G(x)u)-\bar w\|\nabla h(x)\|+\alpha(h(x))\geq0$, with $\alpha(h)=\gamma h$ and $\gamma>0$. A neural surrogate $T_\theta(x)$ replaces the expensive reachability calculation, and the deployed action is the closest action to the policy output satisfying this inequality and actuator constraints.

## Key formulas

- $$\dot{x}=F(x)+G(x)u+w,\qquad \|w\|\leq \bar w.$$
- $$T_a(x)=\inf_{u_{\mathrm{adv}}(\cdot)\in\mathcal U_{\mathrm{adv}},\;w(\cdot)\in\mathcal W}\left\{t\geq0:\ x(t;x,u_{\mathrm{adv}},w)\in\mathcal C\right\},\qquad h(x)=T_a(x)-\tau_s.$$
- $$\nabla h_\theta(x)^\top\big(F(x)+G(x)u\big)-\bar w\|\nabla h_\theta(x)\|_2+\gamma h_\theta(x)\geq0,\qquad h_\theta(x)=T_\theta(x)-\tau_s.$$
- $$u^*(x)=\arg\min_{u\in\mathcal U}\frac12\|u-\pi_\phi(o)\|_R^2\quad\mathrm{s.t.}\quad \nabla h_\theta(x)^\top(F(x)+G(x)u)-\bar w\|\nabla h_\theta(x)\|_2+\gamma h_\theta(x)\geq0.$$

## Implementation notes

1. Exact integration point: place the layer after a neural policy $\pi_\phi(o)$ and before the simulator or physical actuator. For each controlled agent, concatenate its state with nearby-agent states, evaluate a differentiable surrogate $T_\theta(x)$, and use automatic differentiation to obtain $\nabla_xT_\theta$. If a differentiable dynamics model is available, use its Jacobians to construct $F(x)$ and $G(x)$; otherwise estimate local linear dynamics from rollouts. 2. Pseudocode: compute $u_0=\pi_\phi(o)$; compute $T=T_\theta(x)$ and $g_h=\nabla_xT$; form $b=g_h^TF(x)-\bar w\|g_h\|_2+\gamma(T-\tau_s)$ and $a=G(x)^Tg_h$; solve $\min_u\frac12(u-u_0)^TR(u-u_0)$ subject to $a^Tu+b\geq0$ and actuator bounds; execute $u^*$. If the QP is infeasible, add a slack variable $\xi\geq0$ with penalty $\rho\xi^2$, and log the slack. 3. Compute from the paper's mechanism: the temporal barrier definition, adversarial minimization, and CBF inequality. Estimate empirically: $T_\theta$ from simulated adversarial trajectories, $F,G$ from the learned model or finite differences, and $\bar w$ from a high quantile of model error. Train $T_\theta$ using reachability labels: minimize Huber error on collision times plus a penalty enforcing $T_\theta\approx0$ on collision states and positive temporal gradients away from collisions. 4. First cheap experiment: use a 2D/3D multi-agent point-mass simulator with independent-pursuit and formation-flight tasks, compare an unconstrained PPO/SAC policy, a fixed-distance CBF, and this aTTC-CBF. Sweep $\tau_s$ and measure collisions, waypoint progress, intervention rate, QP slack, and minimum observed TTC. The falsifiable prediction is a sharp increase in intervention/slack when empirical aTTC crosses $\tau_s$, while collision probability should remain low for states with $T_a\geq\tau_s$; the measured intervention boundary should track $T_\theta=\tau_s$ within 20% of an oracle reachability estimate. A second prediction is that, at equal collision rate, temporal barriers permit smaller pairwise distances and higher progress than distance barriers.

## Verification

- Status: mech_ok_no_baseline
- Mechanism evidence: yes
- Mechanism confirmed: yes
- Practical verdict: inconclusive
- Verdict: Built an adversarial TTC barrier MVP with exact one-constraint QP projection, actuator limits, disturbance robustness, slack logging, and a PyTorch autodiff check. The three mechanism predictions were confirmed: disturbance-bound slope relative error 0.0%, gamma transition error 0.61%, and TTC activation-boundary error 0.19%. However, in the aggressive rollout the temporal layer still collided because the constraint became actuator-infeasible and accumulated slack, so this experiment does not demonstrate a safety or performance win over the fixed-distance baseline.

### Mechanism check

- Verdict: Built an adversarial TTC barrier MVP with exact one-constraint QP projection, actuator limits, disturbance robustness, slack logging, and a PyTorch autodiff check. The three mechanism predictions were confirmed: disturbance-bound slope relative error 0.0%, gamma transition error 0.61%, and TTC activation-boundary error 0.19%. However, in the aggressive rollout the temporal layer still collided because the constraint became actuator-infeasible and accumulated slack, so this experiment does not demonstrate a safety or performance win over the fixed-distance baseline.
- Confidence: 8/10
- Limitations: Only a 1D relative point-mass toy model was tested, with an analytic TTC surrogate rather than a learned reachability model. No PPO/SAC training, multi-agent 2D dynamics, finite-difference dynamics identification, trajectory-distribution sweep, wall-clock benchmark, or formal discrete-time safety guarantee was evaluated; the tested temporal filter exposed infeasibility/slack under aggressive conditions.

### Practical benchmark

- Paired seeds: 8
- Baseline mean: 0
- Idea mean: 0
- p-value: 0.06215
- Paired wins: 6/8
- Benchmark verdict: no significant win

## Artifacts

- [bench_report.json](https://synthcore.org/code/800/bench_report.json)
- [report.md](https://synthcore.org/code/800/report.md)
- [report_bench_2026-09-01T104906.md](https://synthcore.org/code/800/report_bench_2026-09-01T104906.md)
- [results.json](https://synthcore.org/code/800/results.json)
- [stage2_bench.py](https://synthcore.org/code/800/stage2_bench.py)
- [ttc_safety_experiment.py](https://synthcore.org/code/800/ttc_safety_experiment.py)
- [Download all files as ZIP](https://synthcore.org/download/800)

## Disclaimer

AI-generated research hypothesis, automatically tested. Not peer-reviewed.
