JEDI: Real-Time Jailbreak Defense for LLMs via In-Generation Detection and Intervention
Ruilin Xie, Bixin Li, Xinyu Chen, Yongqiang Tian, Wang Lulu
NeurIPS page · Open on the map
Category: AI Safety, Security & Alignment › Jailbreak Defense and Analysis · Type: new method · Keywords: LLM safety, jailbreak defense, real-time detection, streaming generation, representation engineering, steering vector
Areas: Safety & Security › Language Model Security › Jailbreak Defense
Summary
JEDI is a real-time jailbreak defense for LLMs that detects harmful intent during streaming generation and intervenes with a steering vector to keep outputs safe.
Explained to a 5-year-old
Big computer programs called language models sometimes say mean things when asked. We made a watch that looks at what they are thinking before they speak. If they seem like they will say something bad, we gently guide them to say nice things instead. This helps keep conversations safe while still being fast. It works like a safety guard for talking computers.
Explained to a 5-year-old, longer
Large language models are computer programs that can write sentences. They can be tricked into writing harmful or offensive text, which we call jailbreak attacks. In streaming mode, the model outputs words one by one, so bad words can appear right away. Existing safety tools often slow down the model or miss the bad words. We created a system that watches the model’s thoughts as it writes. It uses a simple counting method to see if the model is heading toward dangerous ideas. When it thinks the model might say something bad, it adds a small nudge to steer the model toward safe topics. This nudge happens while the model is still generating, so the bad words never appear. The system is very fast, adding only a tiny delay to the first word. It works on many different language models and many different attack tricks. The tests show it stops most bad attempts while keeping the model useful. It is especially useful for real-time chat assistants where speed matters. Overall, it acts like a safety guard that watches and gently guides the model in real time.
For a technical reader
The system continuously monitors the LLM’s internal representations for signs of harmful intent using a cumulative sum detector. When risk is detected, it injects a steering vector to shift the generation toward safe outputs, all within milliseconds to preserve real-time interaction. This approach requires minimal computational overhead and integrates transparently into existing streaming pipelines.
Problem
Large language models (LLMs) are vulnerable to jailbreak attacks, especially in streaming generation where harmful tokens appear immediately (prefix exposure). Existing defenses either fail to meet real-time constraints or cause unacceptable latency.
Method
The approach monitors the LLM’s internal semantic drift using representation engineering and applies a Cumulative Sum algorithm to detect persistent harmful intent before it appears in the output. When a risk is identified, a steering vector is dynamically injected to redirect generation toward a safe subspace.
Results
The approach achieves defense success rates ranging from 93.6% to 99.4% across 6 models and 11 attack vectors, and incurs a Time To First Token overhead of roughly 0.003 seconds.
Contributions
It introduces a real-time defense that detects harmful intent during generation using semantic drift monitoring and intervenes with a steering vector, and provides extensive evaluations showing high efficacy and low latency.
Practical relevance
It enables safe streaming LLM interactions in latency-sensitive applications such as chatbots and real-time assistants.
Research questions this paper is counted under
This page was written by language models from the title and abstract of each paper, and the answers were checked by two other models. It can be wrong: check the paper itself. Suggest a correction