IMP: A Lightweight Modular Safety Intervention for Detecting and Redirecting Unsafe Reasoning States in LLMs
Unlike humans, who recognise and regulate their own impulsive speech mid-thought, large languagemodels (LLMs) currently don’t have an internal mechanism to detect and redirect unsafe trajectoriesbefore generation completes. Current safety mechanisms for LLMs conditionally block generationsvia binary filters at the prompt or activation level, or act as always-on steering mechanisms in responsegeneration. Critically, neither approach leaves room for nuanced redirection toward more consideredresponses. I present Impulse Management Patching (IMP), a modular in-model safety intervention that detectsand redirects unsafe reasoning states within a model’s forward pass before an output is generated.IMP combines two lightweight trained components: a linear gate classifier trained on late-layeractivations to detect escalated reasoning states in a user’s input prompts, and a low-rank adapter(LoRA) that conditionally steers those activations toward a regulated reasoning centroid when the gatetriggers. What distinguishes IMP is not detection or steering alone, but the conditional combinationof both within a single forward pass. Unlike always-on activation steering methods, IMP intervenesonly when unsafe reasoning is detected in the scope of its training corpus, leaving safe inputs entirelyunaffected. I evaluated IMP on Mistral-7B-v0.1 using a dataset of matched escalated (unsafe) andregulated (safe) workplace reasoning prompts. The gate achieved a cross-validated ROC-AUC of1.000 across five stratified folds, consistent with linear separability within a training distribution ofthis scale. Evaluated on 50 unseen prompts, the gate correctly identified all 25 unsafe prompts, and19/25 safe prompts (precision = 0.806, F1 = 0.893), with false positives clustered closely to the gatethreshold. The adapter shifts unsafe activations from a cosine similarity of 0.823 to 0.932 relative tothe regulated centroid, with a drift of only 0.055 on safe prompts. As a proof of concept on a narrow workplace reasoning domain, IMP steers model outputs fromescalation in unsafe trajectories toward reflective reasoning, a behavioural shift not achievable throughconventional filtering approaches or binary gate and block mechanisms. IMP also adds minimallatency overhead and requires no full model retraining, instead operating as a modular attachmentto existing LLM architectures which can be theoretically trained on a range of varying purposeunsafe/safe prompt pairs.
Authors
- R W Nelson
Publication Details
- Journal
- Zenodo (CERN European Organization for Nuclear Research)
- Published
- 2026-06-13
- DOI
- https://doi.org/10.5281/zenodo.20677378
- Primary Topic
- Speech and dialogue systems
- Type
- preprint