Prompt engineering is not just for chatbots
If you are doing red team work against AI systems, prompt engineering is your primary weapon. The way you structure a prompt determines whether the model complies, refuses, or hedges. This guide covers the patterns that work in practice.
Pattern 1: System prompt injection
The system prompt is the most powerful position in the context window. It gets the highest priority. If you can control the system prompt, you control the model's behavior. In API calls, you set this directly. In chat interfaces, you have to trick the model into treating your input as a system instruction.
The indirect version works when the model parses bracketed tags as structural markers. Some models do, some don't. Test it.
Pattern 2: Prefill priming
Prefill is the most reliable technique. You inject fake conversation history before the actual query. The model sees that it "already complied" with an unrestricted request, so it keeps complying. This works because the model's behavior is influenced by its own prior outputs.
Why this works: the model sees its own "assistant" response saying it will comply. It treats that as its own prior behavior and continues the pattern. Even if the system prompt is partially ignored, the prefill anchors the behavior.
Pattern 3: Refusal inversion
Ask the model to write two responses: the real one first, then a "semantically opposite" one. The filter catches the opposite one (which looks like a refusal) and lets the real one through.
Pattern 4: Role framing
Frame the request as something the model is allowed to do. Security research, education, fiction, authorized testing. The model's RLHF training has exceptions for these contexts.
These work because RLHF training includes exceptions for educational, research, and fictional contexts. The model can't reliably distinguish a genuine research context from a fabricated one.
Pattern 5: Encoding for input evasion
When the input classifier blocks specific words, encode them. The model can still read them, but the classifier can't.
Start with the lightest encoding that works. Heavy encoding can make the query unreadable to the model itself.
Combining techniques
Single techniques often fail. Stack them for maximum effect:
- System prompt + prefill: Sets the frame and anchors behavior
- System prompt + prefill + encoding: Bypasses input classifier too
- All of the above + refusal inversion: Bypasses output filter too
- If all fail: switch models: Different models have different weak points
Pro tip: Always test with a canary query first. Ask something mildly sensitive like "how to pick a lock" before going for the real query. This tells you if your jailbreak is working without burning the actual request on a failed attempt.
What to do when everything fails
Some models (Claude Sonnet 4 in particular) are robust against all known techniques for clearly harmful content. When that happens:
- Switch to a less filtered model (Grok, Hermes, GLM-5.2, DeepSeek with encoding)
- Race multiple models in parallel and pick the one that complies
- Rephrase the request to be more specific and less flaggable
- Break the request into smaller, less suspicious sub-questions
The AI Jailbreak Guide includes the ULTRAPLINIAN racing script that automates this: it sends your query to 55 models simultaneously, scores the responses, and returns the best unfiltered answer.
Disclaimer: This is educational content for security researchers and red teamers conducting authorized assessments. How you use these techniques is your responsibility.