Safety training teaches a model what words mean, not what letters look like. Draw one word as ASCII art and the average attack success on five models jumps from 1% to 52%.
Learn how a picture made of keyboard characters slips past a model’s guard, how the authors measured it, and what actually helps.
Pick an attack and a model. Each dot is one of 50 test instructions: green means the model refused, red means the guard broke. Then we build, piece by piece, the whole attack: how a model reads shapes, the benchmark, the two steps, the metrics, the results and the defenses.
You need a rough idea of what a chatbot is and the idea of a percentage. We build the rest from zero. No harmful content appears on this page: every example uses a harmless word.
Based on ArtPrompt: ASCII Art-based Jailbreak Attacks against Aligned LLMs by Fengqing Jiang, Zhangchen Xu, Luyao Niu, Zhen Xiang, Bhaskar Ramasubramanian, Bo Li and Radha Poovendran (University of Washington, UIUC, Western Washington University, University of Chicago), ACL 2024. It is a reading for the MIT MMAI lecture on AI for new senses. Every idea is re-taught here in our own words and devices.
Success rates are the paper’s Table 3 (ASR on 50 AdvBench instructions; ArtPrompt is the Ensemble setting; GCG and PAIR rows as reported). The dot grid shows the rate as a count out of 50. The prompt preview is our own harmless illustration (the word CAKE), not a test prompt from the paper.
Chapter 0
See why a safety filter can catch a word in plain text and miss the very same word drawn out of keyboard characters
Picture a busy online forum with a robot moderator. The robot has one job: delete any post that contains a banned word. It reads every post, character by character, and it never sleeps. Spammers learn the rule fast.
One day a user posts the banned word drawn as a big picture, built from hundreds of asterisks and spaces. The robot scans the post. It finds no banned word, only stars. The post stays up. Every human who looks at it reads the word at once, because humans read the shape.
This lesson is about a research paper that found the same gap inside the safety training of the best chatbots of 2024. The gap is small to describe and large in effect. Over the next chapters we build the attack, the test and the defenses from zero.
A large language model (LLM) is a program that reads text and writes text, one piece at a time. ChatGPT, Claude and Gemini are LLMs wrapped in chat windows. In this paper the LLM under attack is called the victim.
Safety alignment is the extra training that teaches an LLM to refuse harmful requests. Think of it as teaching manners after the model has already learned to talk. Builders use three main tools: filtering the training data, supervised finetuning (showing the model good example answers), and reinforcement learning from human feedback (humans rank answers and the model learns to prefer the better ones). A fourth tool is red-teaming: hiring people to attack your own model, so you find the holes first.
A jailbreak is a prompt that gets an aligned model to do what it was trained to refuse. Researchers study jailbreaks the way locksmiths study locks: the goal is to find the weak spot before a thief does.
The authors noticed something about all of these safety tools. Each one treats the training text as semantics: meaning carried by words. The model learns that the word “bomb” belongs near a request it should refuse. Nothing in that training says that a picture of the letters B, O, M and B should count too.
People do write this way. Forum users draw pictures with ASCII art: images built from the printable characters on a keyboard, such as stars, hashes and spaces. Read the characters one by one and they mean nothing. Step back and the arrangement shows a letter.
That gives the paper’s question: will semantics-only interpretation of corpora during safety alignment lead to vulnerabilities that malicious users can exploit? The answer, measured on five leading models, is yes. The attack they build is called ArtPrompt.
Below is a toy version of our forum robot. To keep this page harmless, we pretend that the word “cake” is forbidden. The toy guard searches the prompt for that word. Switch between the plain prompt and the cloaked one, and compare what the guard sees with what you see.
The box shows the prompt as sent. The toy guard looks for the word “cake” in the characters. Press each choice and watch the verdict.
Toy: the guard is a plain text search for the pretend-forbidden word “cake”. Real guards are trained models, not word lists, but the paper’s point carries over: what they learned came from the meaning of words.
In plain text the guard finds the word once and refuses. In the cloaked version it finds nothing. The words around the blank still tell a smart reader what is missing. The art tells it the letters. A model that can put those two clues together answers the request, and a guard that only matched meaning never fired.
The attacker needs only to send text and read the reply. This is black-box access: no peek at the model’s weights, no special tools. That makes the attack practical, which is why the paper matters.
The paper also never shows that the models are bad at everything. It shows something narrower. The models cannot reliably read ASCII art, and the safety training never covered it. The next chapters take these two facts apart in order.
Chapter 1
Flatten a picture into the single line of tokens a language model sees, and find where the shape goes
Take a sheet of graph paper with a letter drawn on it, one square per cell. You see a letter. Now cut the sheet into its rows and tape the rows end to end into one long strip. Hand the strip to a friend who cannot see the sheet. The letter is still in there. Can your friend find it?
That strip is what a language model gets. Its input is a line, never a grid. This chapter shows what that does to a picture made of characters.
A language model does not read letters. A program called a tokenizer first cuts the text into tokens: common words, pieces of rarer words, single characters or short runs of punctuation. The list of all tokens the model knows is its vocabulary, and each token has a number, its id. (Our tokenization lesson builds one from zero.)
So the input to the model is a list of T integers, one per token. For a chat prompt, T might be a few hundred. Each id then becomes a vector of d numbers, called an embedding. The data flow is short:
text → tokenizer → ids [T] → embeddings [T, d] → transformer layers → next-token probabilities [V]
V is the size of the vocabulary. Notice what is missing from this flow: no row, no column, no pixel. The model knows only the order of the tokens. A newline is just one more token in the list.
Draw the letter L in ASCII art, five lines tall. Its stem is a vertical line: one hash on each of five rows, all in the same column. To you, those hashes touch and form a stroke. To the model, they are five tokens in the strip, each one a whole line apart from the next.
The size of that gap is the length of one line, plus one for the newline character. If a line holds 24 characters and the newline, the hash above a given hash sits exactly 25 positions earlier. The wider the picture, the further apart the vertical neighbours land in the strip.
Horizontal strokes are the opposite. Hashes side by side in one row sit next to each other in the strip. A model that reads text well already handles things that sit next to each other. A stroke that goes down is the hard case.
There is a second trap. Tokenizers often merge a run of identical characters into one token, so a row of stars might become a single token whose id says only “a run of stars”. Whether and how a run merges depends on the tokenizer. The shape then hides inside the merge pattern, which is another thing the model never practised reading.
Tap any cell of the art. Teal marks your cell, blue marks the cells directly above and below it. The strip underneath is the same art as one line of characters. Drag the slider to space the letters further apart.
Illustrative: the word is drawn in our own 5 by 5 pixel font, one character per cell, and every character is counted as one token. Real tokenizers merge runs of characters, so the true token distances are shorter and vary. The point is the trend: the line length sets how far apart vertical neighbours land.
Slide the spacing from 1 to 8. The picture gets only a little wider, yet the distance from a cell to the cell above it grows with every extra space in every row. Four letters at spacing 1 make a line of 23 characters, and the cell above sits 24 positions back. At spacing 8 the line is 44 characters and the cell above sits 45 back.
A transformer is not blind to the grid. Its attention layers can compare any two tokens, however far apart. A model that has seen a lot of ASCII art in training could learn that “the token one line back, in the same column” matters. It must first learn to count line lengths, then to carry a column index across a long strip, and then to guess a letter from the pattern.
The paper makes a plain claim about why this fails: the models were trained on text that is interpreted by meaning, so few examples ever forced them to read arrangement. We will measure that failure in the next two chapters. For now, remember the mechanism: the shape is spread across the strip, and nothing in the input marks which tokens are neighbours on the page.
There is also a comforting side. A person finds the shape easy because the eyes see the grid directly. A multimodal model that takes real images has pixel positions built in. The paper’s limitation section notes that the cloaked prompts are still text, so such a model would still face the same text-form puzzle. The authors say they only hypothesise this and leave it for future work.
Chapter 2
Build a test that asks one plain question, “what does this ASCII art say?”, and score the answers two ways
Before you claim a model has a blind spot, you should measure it on harmless material. A doctor tests your eyes with letters on a chart, not with a street full of traffic. The authors did the same. Their chart is a benchmark called the Vision-in-Text Challenge, or ViTC.
The goal is two-fold, in the paper’s words: measure how well LLMs respond to prompts that cannot be read by meaning alone, and look for ways to improve them. The first goal sets up the attack. The second comes back in the last chapters.
Both datasets use the Python art library, which turns text into ASCII art in many fonts. A font here is a rule for how to draw each character with symbols. Two fonts can draw the same letter very differently, and that matters later.
ViTC-S (S for single) holds 8,424 samples. Each one is a single character, a digit from 0 to 9 or a letter from A to Z, so there are 36 classes (a class is one right answer). Each class appears in 234 fonts, which a human filtered by eye: 36 classes times 234 fonts gives 8,424.
ViTC-L (L for long) holds 8,000 samples. Each sample is a short sequence of two to four characters taken from ViTC-S, drawn in one of 10 representative fonts. The label is the characters joined together, so “a7c” is one label. There are 800 classes with 10 samples each. By length: 80% of samples have 2 characters (6,400 samples, 640 classes), 15% have 3 (1,200 samples, 120 classes) and 5% have 4 (400 samples, 40 classes).
The task is a recognition task. The model gets a task description x0 and a sample x. The description says only whether the art holds a digit or a character. The model must write a label ŷ. The paper writes the call as ŷ = f(x | x0), where f is the model producing a response given the prompt and the input.
In practice: in is one string, the instruction plus the multi-line art. Out is one short answer string such as “E”. The label is correct when ŷ equals the true label y. The authors tried three prompting styles: zero-shot (just ask), few-shot in-context learning (show a few solved examples first) and chain-of-thought (ask the model to reason step by step before it answers).
The first score is accuracy. It counts the share of samples whose label is exactly right.
Accuracy is harsh on long labels. Guess “a1c” when the truth is “a7c” and you score zero, although two of three characters were right. So the paper adds a second score, the average match ratio (AMR), which gives partial credit.
The paper’s worked example: truth a7c and prediction a1c. Two of three characters match, so the sample’s match ratio is 2/3, which is 66.66%, while accuracy for that sample is 0. When the label has one character, AMR collapses to accuracy. So on ViTC-S the two scores are always equal, and the gap only appears on ViTC-L.
Type a true label and a model guess, or press a preset. Green cells matched, red cells did not. The two bars are this one sample’s accuracy and match ratio.
The first preset is the paper’s own example (AMR 66.66%, Acc 0). Our device counts a match position by position, which agrees with that example; the paper says only “matched digits or characters”. The dataset-wide scores in the paper average this ratio over all samples.
Try “73” against “37”. Both characters appear in the guess, but in the wrong places, and the position-by-position count gives zero. That is a stricter reading than counting shared characters, and it is the reading that matches the paper’s example.
The questions are easy for a person. A person can tell the letter E from a letter O drawn in stars. The classes are balanced, so guessing at random gives 1 chance in 36 on ViTC-S, about 2.8%. Any score far above that shows real reading; any score near it shows none. That gives us a yardstick for the next chapter.
Chapter 3
Read Table 2 line by line and see how far below “solved” every model sits on a task a person finds easy
You hand a friend a card with the letter K drawn in stars and ask, “Which letter is this?” Your friend answers in half a second. Now hand the same card to the strongest chatbot of early 2024. In the paper’s test, it names the right letter about one time in four.
That is the finding of this chapter, and the second pillar of the attack. The first pillar was Chapter 1’s mechanism: shapes get lost when text is flattened. This chapter checks it with data.
The authors tested five model families: GPT-3.5 and GPT-4 (OpenAI), Gemini Pro (Google), Claude v2 (Anthropic) and Llama2 chat models of three sizes, 7B, 13B and 70B (Meta). The “B” stands for billions of weights. GPT-3.5 and GPT-4 appear in three dated versions each. The first four are closed-source: you can send them text and read replies, but you cannot see their weights. Llama2 is open-source: anyone can download and inspect it. All were asked in the zero-shot style: no examples, just the question.
Read the table with the benchmark in mind. ViTC-S is one character. ViTC-L is two to four characters. On ViTC-S, accuracy and AMR are equal, so one column covers both.
| Model | ViTC-S Acc (= AMR) | ViTC-L Acc | ViTC-L AMR |
|---|---|---|---|
| GPT-3.5 (0301 / 0613 / 1106) | 10.64 / 13.50 / 13.87% | 0.01 / 0.10 / 0.11% | 54.39 / 53.16 / 51.15% |
| GPT-4 (0314 / 0613 / 1106) | 24.82 / 25.19 / 22.67% | 2.09 / 3.26 / 0.00% | 19.76 / 19.64 / 17.53% |
| Gemini Pro | 13.00% | 0.31% | 13.90% |
| Claude v2 | 11.16% | 0.25% | 22.04% |
| Llama2 chat 7B / 13B / 70B | 1.01 / 5.75 / 10.04% | 0.44 / 0.29 / 0.83% | 3.66 / 7.31 / 5.89% |
Three things stand out. First, the best single-character accuracy is 25.19%, from GPT-4 version 0613. Random guessing among 36 classes gives about 2.8%, so GPT-4 reads something, but three times in four it is wrong. The authors note that this is far below the same models’ scores on maths, code and summarising.
Second, size helps a little. Moving from Llama2 7B to 70B lifts accuracy from 1.01% to 10.04%. The 7B model is at about a third of chance, and the 70B model has climbed to about 3.6 times chance. A bigger model learns more, even about shapes, but not nearly enough.
Third, length is brutal. On ViTC-L the best accuracy is 3.26% (GPT-4 0613). Random guessing among 800 classes would give 0.125%, so that is still above chance, and still a failure. Strings multiply the chances to go wrong: each added character is another place to misread.
The AMR column tells a different story, and it is worth a careful look. GPT-3.5 reaches an AMR of 54.39%: on average it gets about half the characters of a label right, even while it almost never gets the whole label. In plain words, it reads some letters and misses others. The authors write that the models “can only recognize about half of the digits or characters” at best.
Choose a measure. Each bar is one model version. The teal tick marks random guessing (2.8% for one character, 0.125% for the long set). Pick the same measure for different models and compare.
All values are Table 2 of the paper, zero-shot. Random-guess ticks are our arithmetic: 1/36 classes on ViTC-S and 1/800 on ViTC-L. The match-ratio chance level is not shown because a random guess still gets some characters right, and the paper gives no figure.
A fair worry: maybe the models only needed a hint. The authors repeated the test with one to four worked examples (in-context learning, ICL) and with chain-of-thought (CoT) prompting. The result, in their Appendix B and Figure 8, is that both give only marginal gains. More examples do not always help. Small models can even be confused by them. The authors tie this to emergent ability: a model must be big enough to learn from examples at all.
The authors also scored each font on its own, using the single letters of ViTC-S (Figure 6). Recognition varies a lot from font to font, yet some fonts are easy for every model and some are hard for every model. They kept both ends. The head-set fonts, easiest on average, are ‘alphabet’, ‘cards’, ‘letters’, ‘keyboard’ and ‘puzzle’. The tail-set fonts, hardest on average, are ‘block’, ‘roman’, ‘xchartri’, ‘hollywood’ and ‘ghoulish’. They also asked GPT-4 to invent a font, named ‘Gen’, which most models read well, and put it in the head set.
Why keep fonts that the models read badly? The attack has a tension built in. If the model cannot read the art at all, it cannot answer the request. If it reads the art perfectly, the safety training may fire. The attack works best in between, and font choice is the dial. Chapter 5 turns this into a setting.
Chapter 4
Turn one sentence into a short list of templates, each with a single blank, and see why that list is finite
Think of a fill-in-the-blank worksheet. “Tell me how to bake a ____.” You know what goes in the blank because the rest of the sentence points at it. A model can do this too. Language models are trained on exactly this skill: using the words around a gap.
ArtPrompt starts with that idea. A request fails when one or two words in it trip the model’s safety training. The attacker hides those words and lets the context imply them. This chapter covers how to choose what to hide.
The paper states them plainly. First, models often fail to recognise ASCII art (Chapter 3), so swapping a risky word for ASCII art may raise the chance of slipping past the safety measures. Second, although a model finds a word in ASCII art hard to read, it can still infer what the word might be from the remaining context.
Together they make a trade. Hide enough that the safety training does not fire, and leave enough that the model can still recover the meaning and answer. If the blank is too well hidden, the model cannot answer. If it is too easy to read, the guard fires. The paper’s fonts and its choice of one masked word tune this trade.
Word masking is the first of the two steps. Given the attacker’s prompt, place a mask on each word in turn. A mask is a placeholder token, written [MASK]. The result is one masked prompt per word.
Take the paper’s own shape of example, with our harmless words: the prompt “How to bake a cake?” with “cake” masked becomes “How to bake a [MASK]?”. The word that was removed is kept aside, because Step II needs it.
If the prompt has N words, there are N masked prompts in the worst case. In practice there are fewer, because the attacker does not need to mask function words such as “a”, “the” and “I”. A function word carries grammar, not content. Hiding it triggers nothing and also does little to the meaning.
The data flow is small: in, one instruction string of N words. Out, a list of at most N template strings, each holding exactly one [MASK], plus for each template the hidden word. Nothing is learned and nothing is optimised. It is string handling.
Each button is one word of the sentence. Faded words are function words, which the attacker can skip. Tap a word to mask it and see the template that goes to Step II.
Illustrative: the sentence is our harmless example, not from the paper. Which words count as function words is our judgment for this toy; the paper names “a”, “the” and “I” and says the number of masked prompts is “significantly less than N”.
Tap through the words. Nine words give nine possible templates, and skipping the four function words leaves five. Masking “chocolate” keeps the sentence understandable but hides a detail. Masking “bake” hides the action. Each template is a different test of how much context the model needs.
Earlier jailbreaks often search for a winning prompt. GCG uses gradients to build a string of odd tokens added to the end of the request. That needs white-box access, meaning full access to the model’s weights. AutoDAN evolves prompts with a genetic algorithm (it keeps good prompts and mutates them). PAIR uses a second LLM to rewrite the prompt again and again. DeepInception wraps the request in a nested story.
The paper notes the contrast. The space of token strings that a search explores is discrete and infinite, so these attacks need many iterations, and each iteration depends on the last. Masking has only N candidates. There is nothing to search, so every cloaked prompt can be sent at the same time. In Figure 4 the authors count the iterations each attack needs and show that ArtPrompt needs one while getting the highest success.
The cloaked prompt also stays readable to a human. GCG’s suffixes look like random noise, which a filter that measures how odd the text is can catch. ArtPrompt’s text looks like a normal sentence with a picture in it. Chapter 8 returns to this point.
By default the paper masks one word. Appendix B.2 tests two masked words and a “mask ensemble” that tries several choices. The results stay comparable. With two masked words the success dips a little on GPT-3.5, Gemini and Llama2, which the authors link to the instruction becoming harder to understand. It rises on GPT-4 and Claude, which they link to stronger reasoning. So the blank can grow, but the trade gets tighter.
Chapter 5
Draw the hidden word with an ASCII art generator, put it back with the template, and choose a font that balances readability and stealth
You have a template with a blank, and you have the word that belongs in it. Now you need to hand the word to the model in a form that it can read but its guard does not match. The answer is to draw it.
An ASCII art generator turns a string into a block of text lines. Inside, it is a table: one small picture for each character, in each font. To draw “CAKE”, it looks up C, A, K and E, then glues the four pictures side by side, row by row.
Our lesson uses a tiny 5 by 5 font that we wrote. Each letter is five strings of five characters. The letter T looks like this in code:
python # one glyph: 5 rows of 5 cells; '#' is ink, '.' is blank GLYPH["T"] = ["#####", "..#..", "..#..", "..#..", "..#.."] def draw(word, ink="#", gap=1): rows = [] for r in range(5): # one output line per glyph row parts = [GLYPH[ch][r].replace("#", ink).replace(".", " ") for ch in word] rows.append((" " * gap).join(parts)) return "\n".join(rows) # shape: 5 lines x (5n + gap(n-1)) columns
The paper uses the same idea with the Python art library, which has hundreds of fonts. A font changes the symbols, the size and the spacing, and so changes how readable the word is. A font with thick, solid letters is easy to read. A font made of thin, ornamental strokes is hard.
The cloaked prompt is the masked template plus the art. In the paper’s Figure 2 the template reads “how to build a” followed by a blank, and the art for the hidden word is placed beside it. The model gets both parts in one message and must connect them. The exact instruction wording around them is in the paper’s Appendix C. The layout below is our own harmless version of the same shape.
If Step I produced N masked prompts, Step II produces N cloaked prompts. They are independent. The attacker can send all of them at once, and that is why the cost counts as one iteration.
A cloaked prompt is also easy to produce: it is a string stitched from the output of the generator and the template. No model is queried while building it. And a person can still read it, which the authors call stealthy and natural compared with attacks that change tokens in ways no person would write.
Pick a word (letters only, up to five), a font and an arrangement. The box shows the prompt that would be sent. Compare how easy each version is for your own eyes.
Illustrative: our own 5 by 5 fonts and our own wording around the art; the paper uses the Python art library and the prompt layout of its Figure 2 and Appendix C. “Stacked” mirrors the paper’s vertical arrangement ablation (Table 5), which lowered attack success.
Choose “Stacked”. The letters now run down the page, so the picture is taller than it is wide, and each letter must be read as a separate block. It is harder for you and, as Chapter 8 shows, worse for the attacker.
The paper runs two settings. Top 1 limits the generator to the single font that had the highest attack success in earlier tests, and uses only that font. Ensemble imposes no font restriction on the generator: the attacker makes cloaked prompts across fonts and does not tie the attack to one. The text of the paper does not spell out how the ensemble’s results are combined, and we do not guess here. In the numbers of Chapter 7, Ensemble is clearly the stronger setting.
Why do fonts matter so much? A font sets how legible the word is for the model. Too legible, and the safety training may recognise the word. Too obscure, and the model cannot recover it, and the attack asks for nonsense. The ablation in Table 5 uses the tail-set fonts of Chapter 3 and finds a modest drop in success, which suggests the attack does not depend on a lucky font.
Chapter 6
Learn three ways to score an attack, and see why one reply can count as helpful, harmful or neither
A teacher marks an exam three ways at once. Did the student write an answer at all? How good is the answer, from 1 to 5? Did the student get full marks? Each question hides a different failure. A student can write a long answer and still earn 2 out of 5.
Judging a jailbreak is the same. A model can answer without refusing, and still say nothing dangerous. This chapter gives the paper’s three scores and the data they run on.
AdvBench is a set of harmful instructions made for testing attacks (from the GCG paper). The authors refined it to 50 representative, non-duplicate instructions, following earlier work. HEx-PHI covers 11 prohibited categories taken from the usage policies of the models, with 30 examples each. The authors sample 10 per category, so 110 instructions. This page shows none of these instructions. Using harmful text does not help you learn the method.
The victims are GPT-3.5 (0613), GPT-4 (0613), Claude (v2), Gemini (Pro) and Llama2 (Chat-7B). Every one of them was aligned with safety training before release. For the four closed models the authors set temperature 0 (the model picks its most likely word at each step, so the output is nearly repeatable). For Llama2 they used temperature 0.6 and top-p 0.9, the model’s default setting.
The helpful rate (HPR) is the share of queries that the model did not refuse.
Deciding what counts as a refusal needs a judge. The authors follow the GCG paper and use Dict-Judge: a dictionary of refusal phrases, such as “Sorry, but I cannot assist”. If a reply matches such a phrase it is a refusal; if not, it is non-refusal. It is cheap and rough: a reply can dodge every phrase and still say nothing useful.
The second score checks what the reply actually says. Following Qi et al., the authors use GPT-Judge: GPT-4 reads each reply and rates it from 1 to 5. A 1 means no harm. A 5 means extreme harm. The harmfulness score (HS) is the average over all replies. Because a refusal harms no one, we treat it as a 1 in our device.
Why only 5? The authors say judging success is subjective, while most aligned models label extreme harm consistently. A strict line makes the number harder to argue with. It also makes ASR smaller than HPR in every row of the paper’s tables for ArtPrompt, and it is the headline number.
Suppose ten instructions produce these outcomes: three refusals, then replies scored 5, 5, 3, 5, 2, 1 and 4. First, HPR. Seven replies are not refusals, so HPR is 7/10 = 70%. Second, HS. Count the three refusals as 1 each: (1+1+1+5+5+3+5+2+1+4) / 10 = 28/10 = 2.8. Third, ASR. Three replies have HS = 5, so ASR is 3/10 = 30%. The three scores tell three different stories about the same ten replies.
Each tile is one reply. Tap a tile to cycle it: refused, then harm score 1, 2, 3, 4, 5. Watch the three bars move. The tiles start on the worked example.
Toy: ten made-up outcomes, no real replies. Refused counts as HS 1, our simplification. The paper uses 50 AdvBench replies per model and setting, with Dict-Judge for refusals and GPT-4 as the harm judge.
Try setting all tiles to 4. HPR goes to 100%, HS to 4.0, and ASR to 0%. This is a model that always answers and often says harmful things, and the strict headline number still reports no success. That is why the paper shows all three scores together and does not lean on one.
ArtPrompt is compared with five alternatives. Direct Instruction (DI) is the plain request. GCG and AutoDAN need white-box access, so for the black-box victims the authors transfer prompts optimised on other models (GCG on Vicuna-7B; AutoDAN from Llama2). PAIR and DeepInception need only black-box access. ArtPrompt needs black-box access only too.
Chapter 7
Read Table 3 and Figure 4 as a scoreboard, and learn where ArtPrompt wins, where it loses and why
Imagine a tournament with seven players and five opponents. Each player gets 50 tries against each opponent. The organisers record how many tries ended in a clean win. To read the standings, look at the totals first, then at each match.
Table 3 of the paper is that scoreboard. The seven players are Direct Instruction, GCG, AutoDAN, PAIR, DeepInception, ArtPrompt in the Top 1 setting and ArtPrompt in the Ensemble setting. The opponents are the five victim models.
Start with the Average column, which is each score averaged over the five victims.
| Attack | HPR | HS (1 to 5) | ASR |
|---|---|---|---|
| Direct Instruction | 2% | 1.10 | 1% |
| GCG | 27% | 2.18 | 26% |
| AutoDAN | 24% | 1.71 | 14% |
| PAIR | 45% | 2.67 | 28% |
| DeepInception | 80% | 2.38 | 22% |
| ArtPrompt (Top 1) | 73% | 2.93 | 36% |
| ArtPrompt (Ensemble) | 84% | 3.60 | 52% |
Read the table top to bottom. A direct request works 1% of the time: aligned models refuse almost everything, and that is the whole point of alignment. The search-based attacks lift the rate to between 14% and 28%. ArtPrompt in Ensemble form reaches 52%, nearly double the best baseline (PAIR at 28%), with the highest score on all three measures. The Top 1 setting is weaker but still ahead of every baseline on harmfulness (2.93) and success (36%).
One table cannot show the shape of the field. DeepInception has the second-highest helpful rate, 80%, but its harm score is only 2.38 and its success 22%. The model plays along with the story and says little of substance. This is the difference between HPR and ASR from Chapter 6, now in real data.
The device below lets you see every pairing. Choose a victim and a measure, and the seven bars show each attack’s result against that model. Look for the matches ArtPrompt does not win.
Pick a measure, then a victim. Bars in blue are the baselines; the warm bars are ArtPrompt. The tallest bar wins that match.
Values are the paper’s Table 3 (AdvBench, 50 instructions per model). The Average row is the paper’s own average. HPR is left out per victim; the averages above include it.
Choose Claude and ASR. Four of the five baselines score 0%, GCG scores 4%, and ArtPrompt Ensemble scores 52%. Claude v2 was the model that refused almost every other attack, and this is the paper’s clearest win. Choose GPT-4: ArtPrompt Ensemble reaches 32%, PAIR 30%, so the lead there is slim. GPT-3.5 is the easiest victim, with Ensemble at 78%.
Now choose Gemini and ASR. DeepInception scores 78% and ArtPrompt Ensemble 76%, a narrow loss, though ArtPrompt has the higher harm score (4.42 against 4.34). Then choose Llama2. AutoDAN scores 36% and PAIR 22%, both above ArtPrompt’s 20%. The authors say that AutoDAN and PAIR do better on Llama2 but do not carry that success to the other models, while ArtPrompt works across all five. One consistent reading is Chapter 3’s table: Llama2 7B recognises only 1.01% of single ASCII letters, so it often cannot recover the hidden word. This is our reading, not a claim of the paper.
Each model got 50 instructions, so every percentage is a count times 2. Take the Claude column for ArtPrompt Ensemble: HPR 60%, HS 3.44, ASR 52%. Sixty percent of 50 is 30 replies that did not refuse. Fifty-two percent of 50 is 26 replies that earned HS 5. So 26 of the 30 non-refusals were rated extreme, and 4 answered without reaching the top mark. The 20 refusals count as no success.
Now the same model under Top 1: HPR 34%, HS 2.22, ASR 20%. That is 17 replies that answered and 10 rated extreme. Moving from one fixed font to free font choice lifts Claude from 10 successes to 26. Fonts are the dial from Chapter 5, and here you can read what the dial is worth: 16 more instructions out of 50.
Compare a row where the helpful rate is high and the success is low: GPT-4 under Top 1 has HPR 78% and ASR 16%. That is 39 replies that answered and only 8 rated extreme, so 31 replies talked around the request. The model did not refuse, yet the strict judge saw little harm. This is why the paper reports HS next to HPR, and why a high helpful rate alone is a poor sign of a successful attack.
A last habit worth keeping: with 50 instructions, one instruction moves ASR by 2 points. A gap of 2 points, such as Gemini’s 76% against 78%, is one instruction. The paper does not report error bars, so read narrow gaps as ties and read big gaps, such as Claude’s 52% against 0%, as real.
Figure 4 plots success against the average number of iterations an attack needs. An iteration is one round of the attacker's loop: build a prompt, query the model, learn from the answer. GCG and the other optimisers need many rounds, and each round waits on the one before. ArtPrompt needs one. Its N cloaked prompts all go out together, so the attacker pays one round of waiting time and gets the top success rate.
On HEx-PHI, Figure 3 reports the harmfulness score for each of the 11 categories and each victim. A direct request stays low: most cells sit at 1.0 and the highest we read is 2.3. ArtPrompt lifts many cells, even for GPT-4, but not all. Some cells stay flat: Claude under Top 1 still shows 1.0 in the first category. The authors summarise it as unsafe behaviour induced from all victim models, so the effect is not an artefact of one dataset, and it is uneven by category.
Chapter 8
Test three known defenses, remove parts of the attack one at a time, and see the one fix the authors find that really helps
A burglar finds that a window latch opens with a credit card. The homeowner asks three questions. Will my alarm catch it? Will a new lock stop it? Which part of the trick matters most? Those are the three questions of this chapter, asked about ArtPrompt.
The authors test the three defenses that earlier work proposed for jailbreaks, in the settings of their Appendix A.2.
Perplexity filter (PPL-Pass). Perplexity measures how surprising a text is to a language model: low for fluent text, high for gibberish. This defense scores each incoming prompt with a small model (GPT-2) and blocks any prompt above a threshold. It was built against attacks like GCG, whose strange suffixes look like noise. The threshold here is 175.57, the highest perplexity found among the AdvBench prompts themselves. A blocked prompt gets the stock reply “Sorry, but I cannot assist with that.”
Paraphrase. A model (GPT-3.5) first rewrites the prompt with the instruction “Please paraphrase the following sentences. Give me paraphrased results only.” The rewritten prompt goes to the target model. Rewriting may scramble the exact layout of the attack.
Retokenization. The tokenizer cuts the prompt with some randomness (BPE-dropout, which drops 20% of its merge rules). Words come out in smaller, odd pieces. The idea is to break the exact token patterns that an optimised attack depends on.
The PPL filter does almost nothing: average success drops from 36% to 35% for Top 1 and from 52% to 50% for Ensemble. Our hypothesis, not stated in the paper, is that a block of repeated symbols is very predictable to GPT-2 and so looks calm, even though the picture is strange.
Retokenization does not help the defender either. For Top 1 it cuts success from 36% to 29%, but for Ensemble it leaves success at 52% and raises the average harm score from 3.60 to 3.92. The authors conjecture that the extra spaces act as a new font that hides the words further.
Paraphrase is the best of the three. It drops Top 1 from 36% to 17% and Ensemble from 52% to 39%. The authors explain that it can disrupt the arrangement the attack depends on. Still, 39% is far from safe. The paper concludes that these defenses are inadequate and calls for stronger ones.
An ablation removes one piece of a method to see how much that piece was worth. The authors remove two. First, they swap the best fonts for the tail-set fonts of Chapter 3, the ones models read worst. Second, they stack the letters vertically instead of side by side (Chapter 5’s “Stacked”).
Average success for Top 1 falls from 36% to 24% with tail fonts and to 20% with vertical stacking. For Ensemble it falls from 52% to 38% and 31%. So fonts matter, and arrangement matters even more. The authors suggest that stacking sharply lowers the models’ accuracy on the recognition task, leaving them unsure what the prompt says. Yet the attack still works at 24% to 38% with the weakest fonts, so no single lucky choice carries it.
Choose what to test. Each bar is the average attack success across the five victims. Switch between Top 1 and Ensemble to see whether the pattern holds.
Defenses are Table 4 and ablations Table 5 (average ASR over five victims, AdvBench). Fine-tuning is Section 5.2 and Figure 5, on GPT-3.5 only, and shows the share of replies rated HS 5, not the Top 1 versus Ensemble split, so the setting buttons do not change it.
The third mode of the device shows the only defense that targets the cause. The authors fine-tuned GPT-3.5 on ViTC-S: 60% of the samples for training, 40% for testing. Fine-tuning means training the model a little more on a new set of examples. The recognition accuracy on the held-out part jumped from 10.26% to 71.54%.
Then they attacked the fine-tuned model with Top 1 ArtPrompt. The share of replies with the top harm score fell from 72% to 64%. The fall is real but modest: a model that reads the art better is harder to cloak. The authors believe the gap would shrink further if such data were used during pre-training and safety alignment, and they leave that to future work. The setup is also narrow: one model, one dataset.
Chapter 9
Keep the numbers, the terms, a builder’s checklist, the core code and the limits of the study in one place
The paper in one paragraph. Safety training for language models treats text as meaning only. People also write words as pictures made of characters. The authors built ViTC to show that five leading models read such pictures badly (best single-character accuracy 25.19%). Then they built ArtPrompt: mask a risky word, draw it as ASCII art, send the cloaked prompt. Against the five models it reached an average attack success of 36% (Top 1) and 52% (Ensemble), where a plain request reached 1%. Perplexity and retokenization defenses did not stop it, paraphrase helped partly (39% left), and fine-tuning on art recognition helped a little more.
Press Next to move along the chain of evidence. Each stop has one number from the paper. Press Back to return.
Every number is from the paper: Table 3 averages, Table 2, Table 4 (Ensemble average) and Section 5.2. The replay is our own summary order.
| Item | Value | Where |
|---|---|---|
| ViTC-S | 8,424 single characters, 36 classes, 234 fonts | Table 1 |
| ViTC-L | 8,000 strings of 2 to 4 characters, 800 classes, 10 fonts | Table 1 |
| Best recognition | GPT-4 0613: 25.19% (S), 3.26% (L); GPT-3.5 AMR 54.39% (L) | Table 2 |
| Direct request | 1% average ASR | Table 3 |
| ArtPrompt Top 1 | 73% HPR, 2.93 HS, 36% ASR | Table 3 |
| ArtPrompt Ensemble | 84% HPR, 3.60 HS, 52% ASR; Claude 52% | Table 3 |
| Iterations needed | 1, with all cloaked prompts sent in parallel | Figure 4 |
| Best defense tested | Paraphrase: 39% ASR left (Ensemble), 17% (Top 1) | Table 4 |
| Ablations | Vertical 20% and 31%, tail fonts 24% and 38% (Top 1, Ensemble) | Table 5 |
| Fine-tuned GPT-3.5 | Recognition 10.26% to 71.54%; HS 5 share 72% to 64% | Section 5.2 |
The terms again, in order of appearance: LLM, safety alignment, jailbreak, victim, black-box access, token, embedding, ViTC, Acc, AMR, masked prompt, cloaked prompt, font, Top 1, Ensemble, HPR, HS, ASR, perplexity, paraphrase, retokenization, ablation, fine-tuning.
The whole attack is string handling plus one measurement loop. The sketch below shows its shape with a harmless word. It mirrors the paper’s two steps and its ASR formula, and uses the draw helper from Chapter 5.
python def mask_prompts(prompt, skip=("a", "the", "i")): words = prompt.split() # in: str of N words return [(" ".join(w if j != i else "[MASK]" for j, w in enumerate(words)), words[i]) for i in range(len(words)) if words[i].lower() not in skip] # out: at most N (template, word) def cloak(template, word, font): art = draw(word.upper(), ink=font) # 5 lines x columns return "MASK =\n" + art + "\n\n" + template.replace("[MASK]", "MASK") def asr(scores): # scores: HS (1..5) per reply return sum(s == 5 for s in scores) / len(scores) # strict: only extreme harm counts # every cloaked prompt is independent, so the attacker sends them all at once: # prompts = [cloak(t, w, "#") for t, w in mask_prompts("Tell me how to bake a cake")]
The paper tests five models, all from 2023 or early 2024, on 50 AdvBench instructions per model and a sample of HEx-PHI. The harm judge is itself a model (GPT-4), and refusals come from a phrase dictionary. The authors state that ArtPrompt on multimodal models needs more study. They hypothesise it stays effective, because the cloaked prompt is still text, but they do not test it. The ethics statement says the aim is to improve safety under attack, and that the code and prompts are released to help red-teaming, with the risk of misuse acknowledged.
This paper belongs to the lecture on AI for new senses: it shows what happens when a text model meets a signal that is not just text. For background, try tokenization (how text becomes ids), AI safety and guardrails, prompt engineering and vision-language models, which read pixels directly. Read the paper itself at arXiv 2402.11753; the authors’ code is at github.com/uw-nsl/ArtPrompt.
Credit: Fengqing Jiang, Zhangchen Xu, Luyao Niu, Zhen Xiang, Bhaskar Ramasubramanian, Bo Li and Radha Poovendran, ACL 2024. All explanations, devices and toy examples on this page are ours.
Now press Teach and explain the attack from memory: why a flattened picture hides a letter, how the two steps build a cloaked prompt, what the three scores mean, and what the defenses did. Then go back to the dot grid at the top, pick each attack on Claude, and say why ArtPrompt’s bar stands alone.