arXiv · 2610.17929
Enforcing a Strict Safety Margin in LLM Text Generation via Barrier Lyapunov Control
Abstract
Large language models are increasingly deployed without formal guarantees against toxic text generation. Existing control barrier function (CBF) based safety filters can keep the generation trajectory within a toxicity-free region, but do not enforce a positive distance from its boundary, allowing formally safe trajectories to approach the toxicity threshold arbitrarily closely and leaving little buffer against modelling errors or disturbances. We address this limitation with a Barrier Lyapunov Function (BLF) safety filter that enforces a prescribed clearance margin throughout generation while retaining the continuous-time transformer dynamics, including feedforward layers. The resulting safe input set is a half-space defined by a constraint affine in the control input, and is non-empty under certified surjectivity and classifier-nondegeneracy conditions. For margin-compatible initial conditions we prove that the clearance margin is never violated and that the prescribed clearance is restored exponentially, yielding an explicit clearance floor, and show that, as the margin vanishes, the admissible trajectories satisfy the exponential second-order CBF condition. We further derive an explicitly computable sufficient disturbance budget under which the clearance guarantee degrades gracefully. Simulations on a small transformer illustrate the resulting improvement in safety clearance.
Explore related subjects
Keep this discovery
Explore connections, maps & timelines
Anand Singh, Shubham Singh, Anjali Tiwari, Katsuki Fujisawa. 2026-10-13. Enforcing a Strict Safety Margin in LLM Text Generation via Barrier Lyapunov Control. https://arxiv.org/abs/2610.17929
Cite the original work for its findings. Save a collection to share your selection of sources.