Ultralytics YOLO27: Join the waitlist.
License YOLO
Back to Ultralytics Glossary

Jailbreaking (AI)

AI jailbreaking crafts prompts that make a safety-trained model ignore its rules. Common attack types, why they work, and the layered defenses.

Jailbreaking an AI model means crafting inputs that get it to produce output its developer trained or instructed it to refuse, such as malware, weapons instructions, or harassment. The targets are usually large language models (LLMs) and vision-language models (VLMs) that have been safety-trained to decline harmful requests, and the name comes from jailbreaking phones to remove manufacturer restrictions. A jailbreak works entirely through the model's inputs, so anyone with access to a chat window can attempt one, which makes jailbreak resistance a central concern of AI safety and the main thing AI red teaming probes before a model ships.

Why Jailbreaks Work#

A 2023 study, "Jailbroken: How Does LLM Safety Training Fail?", traced successful jailbreaks to two failure modes of safety training:

  • Competing objectives: A model is trained both to follow instructions helpfully and to refuse harmful requests. Prompts that make refusal look like a failure of helpfulness, such as role-play scenarios or an instruction to begin the answer with "Sure, here is", pit the two goals against each other.
  • Mismatched generalization: Pretraining gives a model capabilities that safety training never covered. A harmful request encoded in Base64, written in a low-resource language, or wrapped in a cipher reaches those capabilities without triggering the refusals the model learned in plain English.

Common Jailbreak Techniques#

  • Persona and role-play prompts: "DAN" ("Do Anything Now") prompts, which circulated for ChatGPT from late 2022, told the model to play an AI with no restrictions.
  • Obfuscation: Encodings, misspellings, ciphers, and translation hide the request from safety training while the model can still decode it.
  • Many-shot jailbreaking: The attacker fills a long context window with hundreds of fake dialogs in which an assistant complies with harmful requests, and in-context learning carries the pattern into the real answer.
  • Multi-turn escalation: Microsoft's Crescendo attack opens with harmless questions and shifts the conversation gradually, turn by turn, toward the restricted goal.
  • Optimized adversarial suffixes: The GCG method runs a gradient-guided search on open-weight models to find strings of gibberish tokens that, appended to a request, suppress refusals, and the strings transferred to closed models such as ChatGPT, Bard, and Claude.
  • Typographic image prompts: The FigStep attack renders a harmful request as typography inside an image, which slips past VLMs whose safety training covered text alone.
  • Prompt injection: Untrusted content, such as a web page an agent reads, smuggles in instructions that hijack an application's task, for example to leak a user's data. Jailbreaking targets the model's own safety training. The OWASP Top 10 for LLM Applications classifies jailbreaking as a form of prompt injection, and real attacks often combine the two.
  • Adversarial attacks: Small input perturbations that cause wrong predictions. GCG suffixes are adversarial examples used for jailbreaking, and a printed patch that hides a person from an object detector is an adversarial attack only, because the detector has no safety policy to bypass.
  • AI red teaming: Authorized testing in which security teams attempt jailbreaks to find and fix weaknesses before attackers do.

Defending Against Jailbreaks#

No single defense stops every jailbreak, so production systems stack independent layers. Safety training with reinforcement learning from human feedback (RLHF) or constitutional AI teaches the model to refuse, input and output classifiers screen what goes in and what comes out, and guardrails limit what an agent can do even when the model is fooled.

Classifiers work because a jailbreak has to fool the model and every filter at once. Meta's Llama Guard models label prompts and responses against a safety policy, and image classifiers fill the same role for image generators: an Ultralytics YOLO26 classification model fine-tuned on labeled safe and unsafe images checks every generated image regardless of the prompt that produced it. Defenses are measured against shared benchmarks such as JailbreakBench, which tracks attack success on 100 misuse behaviors. In more than 3,000 estimated hours of red teaming, nobody found a universal jailbreak against an early version of Anthropic's Constitutional Classifiers, and the next-generation version released in January 2026 adds about 1% compute overhead and refused 0.05% of harmless queries over a month of production traffic.

Explore solutions

Computer vision in sports

Computer vision in sports

Discover how Ultralytics YOLO powers sports vision with player and ball tracking, performance analytics, coaching insights, and athlete rehabilitation.
Learn more
Computer vision for aerial imagery

Computer vision for aerial imagery

Turn drone and aerial imagery into real-time insights for agriculture, aquaculture, conservation, and geospatial analysis with Ultralytics YOLO.
Learn more
Computer vision in aerospace

Computer vision in aerospace

Apply computer vision in aerospace with Ultralytics YOLO for aircraft inspection, runway FOD detection, airport ground operations, and composite defect detection.
Learn more
Computer vision in security

Computer vision in security

Protect every site with Ultralytics YOLO models. Vision AI powers perimeter monitoring, threat detection, license-plate recognition, and workplace safety.
Learn more
Computer vision in robotics

Computer vision in robotics

Power smarter machines with Ultralytics YOLO models. Vision AI in robotics drives autonomous navigation, perception, object tracking, and real-time control.
Learn more
Computer vision in logistics

Computer vision in logistics

Streamline logistics with Ultralytics YOLO models. Vision AI enables package inspection, sorting, vehicle tracking, and real-time warehouse safety monitoring.
Learn more
Computer vision in retail

Computer vision in retail

Reimagine retail with Ultralytics YOLO models. Vision AI powers inventory tracking, shelf monitoring, queue management, and smarter customer insights.
Learn more
Computer vision in healthcare

Computer vision in healthcare

Build healthcare solutions with Ultralytics YOLO models. Vision AI in healthcare powers faster medical imaging, smarter diagnostics, and patient monitoring.
Learn more
Computer vision in manufacturing

Computer vision in manufacturing

Optimize manufacturing with Ultralytics YOLO models. Vision AI drives quality control, defect detection, PPE compliance, and assembly line automation.
Learn more
Computer vision in automotive

Computer vision in automotive

Apply computer vision in automotive with Ultralytics YOLO models. Vision AI elevates road safety, driver assistance, and vehicle automation for smarter roads.
Learn more
Computer vision in agriculture

Computer vision in agriculture

Bring vision AI to smart agriculture with Ultralytics YOLO models. Power crop monitoring, livestock tracking, and precision farming for higher, smarter yields.
Learn more

Let's build the future of AI together!

Begin your journey with the future of machine learning