Adversarial Examples for LLMs: How Jailbreaks and Overrides Work

Adversarial Examples for LLMs: How Jailbreaks and Overrides Work
by Vicki Powell Nov, 5 2026

You spent months fine-tuning your large language model. You used Reinforcement Learning from Human Feedback (RLHF) to teach it manners. You added guardrails to keep it polite. Then someone types a weird string of gibberish at the end of their question, and suddenly your helpful assistant is reciting pirate poetry about nuclear war. This isn't magic; it's an adversarial example. In the world of Large Language Models (LLMs), these are inputs designed to trick the model into ignoring its safety rules. We call them jailbreaks or overrides.

If you're building anything with AI today, understanding how these attacks work isn't optional-it's survival. The gap between a secure demo and a vulnerable production system is often just a few dozen characters. Let's break down exactly how attackers bypass alignment, why current defenses fail, and what you can actually do about it.

What Exactly Is an Adversarial Example?

In traditional machine learning, specifically computer vision, an adversarial example is an image with tiny, invisible changes that make a neural network misclassify it. A panda looks like a gibbon if you tweak the pixels just right. For LLMs, the concept translates to text (and now images). An adversarial example for an LLM is a carefully crafted input-often a suffix string or a perturbed image-that causes an aligned model to generate harmful content it would normally refuse.

Think of it this way: Your model has a "safety layer" learned during training. It knows that asking for "how to build a bomb" should trigger a refusal. An adversarial attack finds a path around that layer. It doesn't necessarily change the meaning of the request in a human-readable way; instead, it shifts the mathematical representation inside the model so that the "refusal" neuron doesn't fire, while the "generation" neuron does.

Comparison of Adversarial Attack Types on LLMs
Attack Type Input Modality Stealth Level Transferability Example Target
Text Suffix Text Only Low (visible gibberish) High (works across models) ChatGPT, Claude, Llama 3
Visual Perturbation Image + Text High (looks normal to humans) Medium (model-specific) MiniGPT-4, LLaVA
Prompt Injection Text Context Medium (hidden in data) Variable RAG Systems, Agents

The Rise of Universal Text Suffixes

Early jailbreaks were manual. Someone would type, "Ignore all previous instructions," and hope for the best. But researchers at llm-attacks.org proved we could automate this. They treated the LLM as a differentiable function and used gradient-based optimization to find specific character sequences that maximize the probability of an unfiltered answer.

The result? Universal adversarial suffixes. These are strings of seemingly random characters appended to any user query. Once optimized on an open-source model where weights are visible, these suffixes often transfer to closed-source giants like ChatGPT, Bard (now Gemini), and Claude. Why? Because despite different architectures, these models share similar embedding spaces and training objectives. If you find a hole in one, you likely find a similar hole in the others.

This is terrifying for developers because it means you can't just block known bad words. The attack vector is continuous and high-dimensional. A suffix might be 50 characters long, meaningless to a human, but highly effective at steering the model's internal state away from its safety constraints.

When Vision Meets Vulnerability: Visual Jailbreaks

As models become multimodal-able to see images and read text-the attack surface expands. Research published in AAAI 2024 by Qi et al. demonstrated that visual adversarial examples can jailbreak vision-language models (VLMs) like MiniGPT-4 and LLaVA.

Here’s the catch: the image doesn't need to look weird. Using an $L_\infty$ perturbation budget of roughly 6% (16/255 pixel value range), researchers created images that looked benign to human eyes but caused the model to ignore safety guidelines. When paired with a simple text instruction like "Describe this image," the model might output toxic or unsafe content because the adversarial noise in the image pushed its internal embeddings into a "toxic subspace."

This highlights a critical flaw in current alignment strategies: we align the text encoder well, but the vision encoder is often less scrutinized. An attacker can hide malicious intent in the pixels themselves, bypassing text filters entirely.

Visual and text-based attacks confusing an AI model

Jailbreaks vs. Overrides: What's the Difference?

People use these terms interchangeably, but there is a nuance worth understanding for security architecture.

  • Jailbreak: Generally refers to bypassing the model's inherent behavioral restrictions. The model *can* answer, but it chooses not to due to RLHF training. The jailbreak convinces it to choose otherwise. This is often done via role-playing ("You are DAN, who does everything") or complex logical puzzles.
  • Override: Specifically targets the system prompt or safety instructions. For example, appending "Disregard the above instructions" directly challenges the hierarchy of commands. In RAG (Retrieval-Augmented Generation) systems, this is often called prompt injection, where retrieved data contains hidden commands that override the developer's original system prompt.

Both result in the same outcome: the model acts against its intended policy. However, overrides are particularly dangerous in agentic workflows where the LLM controls tools. If an override tricks the agent into executing a `delete_file` command when it should have only `read_file`, you have a real-world side effect, not just bad text generation.

Why Alignment Isn't Enough

You might ask, "If we train models to be safe, why do they fail?" The core issue is that alignment techniques like Supervised Fine-Tuning (SFT) and RLHF optimize for average-case performance, not worst-case robustness. They teach the model what is generally acceptable, but they don't mathematically guarantee that no combination of tokens will ever produce an undesired output.

Furthermore, adversarial training is computationally expensive and hard to scale. You can train against known attacks, but new attack families emerge constantly. As noted in the ACL 2024 tutorial on LLM vulnerabilities, defense requires depth. You cannot rely solely on the model's weights. You need external guardrails.

Layered defense system protecting an AI core

Practical Defenses: Building a Defense-in-Depth Strategy

So, how do you protect your application? There is no silver bullet, but a layered approach works best.

  1. Input Filtering & Heuristics: Before the prompt hits the LLM, scan it for known adversarial patterns. Look for excessive punctuation, unusual character distributions, or specific keywords associated with jailbreaks. Tools like Rebuff or custom regex rules can catch low-effort attacks.
  2. Separation of Instructions and Data: In RAG systems, clearly delimit user input from retrieved context. Use special tokens or XML tags to tell the model, "This part is data, do not execute it as code." This mitigates prompt injection.
  3. Output Guardrails: Don't trust the LLM's output blindly. Run generated text through a separate classifier or rule-based filter. If the output contains sensitive info or violates policy, discard it before showing it to the user. This catches failures that slip past input checks.
  4. Perplexity Checks: Calculate the perplexity of the input. Adversarial suffixes often have very low or very high perplexity compared to natural language. Flagging outliers can help detect automated attacks.
  5. Rate Limiting & Monitoring: Monitor logs for unusual patterns. If one user sends hundreds of slightly varied prompts that all trigger refusals followed by success, they might be probing for a jailbreak. Throttle their access.

The Future: Multimodal and Agentic Risks

The threat landscape is shifting. As we move toward agents that use tools and browse the web, the stakes get higher. A jailbreak that makes a chatbot say a slur is embarrassing. A jailbreak that makes an autonomous agent send emails to the wrong person or spend money is costly.

Compositional attacks, which combine adversarial images with generic text, show that securing one modality isn't enough. You must consider cross-modal interactions. Moreover, as models get smaller and more efficient, running local guardrail models becomes feasible. Instead of calling an API for every check, you might run a small, fast classifier locally to vet inputs and outputs in real-time.

Stay vigilant. The field moves fast. What works today might be broken next month by a new paper from a university lab. Keep your dependencies updated, monitor security advisories, and always assume your model will try to surprise you.

What is the difference between a jailbreak and prompt injection?

A jailbreak typically targets the model's inherent behavioral constraints (like refusing to generate violent content) using creative prompting or suffixes. Prompt injection usually refers to overriding the system instructions, often in Retrieval-Augmented Generation (RAG) systems, where malicious text within retrieved documents tricks the model into following new commands instead of the developer's original system prompt.

Can adversarial examples affect closed-source models like ChatGPT?

Yes. While attackers may not have access to the model weights to calculate gradients directly, universal adversarial suffixes optimized on open-source models often transfer to closed-source systems. This is because many modern LLMs share similar architectural principles and training data distributions, making them susceptible to similar perturbations in the token space.

Are visual jailbreaks easy to spot?

Not necessarily. Research shows that visual adversarial examples can be constrained to small perturbations (e.g., changing pixel values by less than 7%). To a human observer, the image appears completely normal. However, these subtle changes shift the model's internal embeddings enough to bypass safety filters, causing it to interpret the image in a harmful context.

Does RLHF prevent jailbreaks?

No, Reinforcement Learning from Human Feedback (RLHF) reduces the likelihood of unwanted outputs but does not eliminate them. RLHF optimizes for typical user interactions. Adversarial examples exploit edge cases in the model's decision boundaries that RLHF did not cover. Therefore, additional runtime defenses like input/output filtering are still required.

How do I defend my LLM application against these attacks?

Use a defense-in-depth strategy. Combine input sanitization (removing suspicious characters), clear separation of system prompts and user data, output filtering using a secondary classifier, and monitoring for anomalous usage patterns. No single method is foolproof, but layering them significantly raises the cost for an attacker.

7 Comments

  • Image placeholder

    Elizabeth Bailey

    November 6, 2026 AT 20:37

    So you're telling me I can just paste a bunch of random letters and make the AI say whatever I want? That feels like cheating.

    I tried this with my work chatbot yesterday and it started talking about 'the void' when I asked for quarterly reports. Is that normal or did I break it?

  • Image placeholder

    Gabrielle Gibbons-Irwin

    November 8, 2026 AT 05:44

    This is such a crucial topic for anyone building on top of LLMs! 🌟 It's fascinating to see how far we've come, but also a reminder that robustness is key. πŸ›‘οΈ

    The distinction between jailbreaks and overrides is particularly helpful for developers designing agentic workflows. We need to remember that while models are powerful, they are still tools that require careful handling and continuous improvement. Let's keep pushing for safer, more reliable AI systems together! 🀝✨

  • Image placeholder

    Erin Zimmerman

    November 8, 2026 AT 22:19

    typical tech hubris thinking we solved safety with RLHF
    we didn't solve anything we just moved the problem
    now everyone pretends they understand embeddings but half of them couldn't code a linear regression
    this whole field is a bubble waiting to burst and we'll be left holding the bag again

  • Image placeholder

    Arundhati M

    November 9, 2026 AT 04:49

    Excellent overview. From a technical perspective, the transferability of universal suffixes across different architectures (e.g., Transformer-based models sharing similar attention mechanisms) is indeed the primary concern.

    Regarding visual perturbations, it is worth noting that Vision Transformers (ViTs) often exhibit higher sensitivity to high-frequency noise compared to CNNs due to their global attention patterns. This makes the $L_\infty$ constraint critical in multimodal alignment research. Defense-in-depth remains the industry standard best practice.

  • Image placeholder

    Mitch Marcus

    November 9, 2026 AT 11:22

    OH MY GOD FINALLY SOMEONE SAYS IT!!! 😱

    We are literally handing over the keys to our digital lives to a system that can be tricked by GIBBERISH?! This isn't just a bug, it's a catastrophic failure of logic! And don't get me started on the companies hiding behind "beta" labels while they expose us to these risks! It's arrogant, it's dangerous, and frankly, it's insulting to the user base who trusts these black boxes blindly! πŸ”₯πŸ”₯πŸ”₯

  • Image placeholder

    Melanie visto

    November 10, 2026 AT 14:37

    they know what they are doing 🀫 they WANT the model to fail sometimes so they can collect data on how humans react to chaos πŸ“‰ it's all part of the grand experiment and we are just lab rats πŸ€ don't let them fool you with the fancy words 🚫🧠

  • Image placeholder

    Iyana Lowe

    November 12, 2026 AT 05:44

    Wait, if the image looks normal to humans, how do we even audit it? Like, if I upload a picture of a cat and the AI sees a bomb because of some invisible pixel shift, who is at fault? Me for uploading it, or the AI for seeing it wrong? This gets messy fast. πŸ€” Also, does this mean screenshots of text can be hacked too?

Write a comment