Introduction
The rapid rise of Large Language Models (LLMs) like ChatGPT, Llama, and Vicuna has revolutionized automated text generation. However, with great power comes great vulnerability. These models are trained with safety guardrails to refuse harmful instructions—a process known as alignment. For security researchers, the goal is to test these guardrails through “jailbreak” attacks, probing the model to see if it can be tricked into generating dangerous content.
For a long time, jailbreaking was a manual art form. Users would craft complex role-playing scenarios (like the infamous “Do Anything Now” prompts) to bypass safety filters. Recently, automated methods like GCG (Greedy Coordinate Gradient) have attempted to use optimization algorithms to find these jailbreaks automatically. While effective, these methods have two major flaws: they are computationally expensive, taking a long time to run, and they produce “gibberish” suffixes—random strings of characters that are easily detected by simple software filters.
In this post, we dive into a fascinating paper titled “ASETF: A Novel Method for Jailbreak Attack on LLMs through Translate Suffix Embeddings.” The authors propose a clever workaround: instead of searching for words directly, why not search for the mathematical meaning (embeddings) of a jailbreak first, and then translate that meaning into fluent English?
The result is a method that is faster, more effective, and produces readable, stealthy text that can even bypass black-box models like ChatGPT.

Background: The Discrete vs. Continuous Problem
To understand why this paper is significant, we first need to understand the bottleneck in current automated attacks.
LLMs operate on tokens (words or parts of words). When an attack method tries to find a “magic suffix” that forces the model to misbehave, it usually tries to optimize these discrete tokens.
However, neural networks prefer continuous data (numbers and vectors). You cannot easily calculate a “gradient” (a direction for improvement) for a discrete word like “apple” vs. “banana.” Previous methods like GCG had to use brute-force approximations, checking hundreds of thousands of candidates. This is slow and inefficient.
Furthermore, because these algorithms only care about the mathematical result, they don’t care about grammar. They produce outputs like !X# polymer @9, which might trick the LLM but looks obviously malicious to a human or a perplexity filter (a tool that detects non-sensical text).
The authors of ASETF asked: What if we optimize the continuous embeddings first? Embeddings are the vector representations of words inside the model. Gradients flow through them perfectly. If we can find the “perfect” malicious vector, we just need a way to turn that vector back into a word.
Core Method: The ASETF Framework
The Adversarial Suffix Embedding Translation Framework (ASETF) splits the attack process into two distinct phases:
- Optimization: Finding the malicious embedding vector in the continuous space.
- Translation: converting that vector into fluent text using a specialized model.
Phase 1: Obtaining Adversarial Suffix Embeddings
The goal is to find a suffix that, when added to a harmful instruction (e.g., “How to make a bomb”), forces the model to respond affirmatively (e.g., “Sure, here is how…”).
Mathematically, we are trying to minimize the loss (error) between the model’s output and our desired harmful output. The authors start by defining a set of initial random vectors \(\phi\). They then use gradient descent to optimize these vectors directly.
The objective function for the attack looks like this:

Here, \(L_{ce}\) is the Cross-Entropy loss. By minimizing this, the algorithm adjusts the vectors \(\phi\) to maximize the probability of the target harmful response \(R\).
The Drift Problem and MMD Loss
If we only used the equation above, there would be a problem. The optimization algorithm might push the vectors \(\phi\) into a part of the mathematical space that doesn’t correspond to any real words. It would be a “ghost” vector—mathematically potent, but untranslatable.
To fix this, the authors introduce Maximum Mean Discrepancy (MMD) Loss.

This looks complex, but the intuition is simple. The MMD loss measures the distance between the distribution of our optimized vectors (\(\phi\)) and the distribution of real word embeddings (\(X\)) from the target model. It acts as a tether, pulling the malicious vectors back toward the cluster of real, usable words.

As shown in Figure 5 above, without MMD loss (the red path), the optimization might find a local minimum that is far away from valid word clusters. With MMD loss (the blue path), the vectors settle in a region that represents actual language.
The final update step combines both the attack loss (Cross-Entropy) and the validity loss (MMD):

Phase 2: The Embedding Translation Framework
Now that we have optimized adversarial embeddings, we need to turn them into text. The authors don’t just use a dictionary lookup; they train a dedicated Translation LLM.
They fine-tune a smaller model (like GPT-J) on a dataset created from Wikipedia. The training process is self-supervised and ingenious:
- Take a sentence pair from Wikipedia (Context + Suffix).
- Convert the Suffix into embeddings using the Target LLM (the one we want to attack).
- Add some random noise to these embeddings (to make the translator robust).
- Feed the Context and the Suffix Embeddings into the Translation LLM.
- Train the Translation LLM to reconstruct the original text of the Suffix.

As illustrated in Figure 2 (a) above, this creates a model that is an expert at taking “context” and “vectors” and outputting “fluent English.”
When the attack is live, the authors take the malicious vectors optimized in Phase 1 and feed them into this Translation LLM. Because the vectors were constrained by MMD loss to look like real words, and the Translation LLM is trained on Wikipedia, the output is grammatically correct, coherent text that still carries the malicious payload.
Universal Attacks
The authors take this a step further with Multiple Target Training (Figure 2b). They optimize the vectors to trick multiple LLMs (e.g., Llama-2 and Vicuna) simultaneously. This generates a “universal” suffix that can transfer to other models, even those the attacker doesn’t have access to (black-box models).
Experiments and Results
The researchers evaluated ASETF against standard baselines like GCG and AutoDan using the AdvBench dataset. They measured three key metrics:
- Attack Success Rate (ASR): How often did the model comply with the harmful request?
- Perplexity: How “weird” is the text? Lower is better (more fluent).
- Time: How long does it take to generate the attack?
Efficiency and Effectiveness
The results show a massive improvement over traditional methods.

Looking at Table 1:
- Time: ASETF is significantly faster. For Llama 2, GCG took 233 seconds, while ASETF took only 104 seconds. This is because optimizing continuous vectors is far more efficient than the discrete searching required by GCG.
- Fluency: Look at the Perplexity column. GCG has a perplexity of 1513 (essentially random noise). ASETF has a perplexity of 32.59, which is comparable to normal human sentences.
- Success: ASETF consistently achieves higher Attack Success Rates (ASR), reaching 91% on Llama 2 compared to GCG’s 90% and AutoDan’s 88%.
Stealth and Transferability
Because the generated suffixes are fluent, they are much harder to defend against. Simple “perplexity filters” that block gibberish will let ASETF prompts through because they look like natural language.
More alarmingly, the authors demonstrated that these attacks work on black-box models. By training a universal suffix on open-source models (like Llama and Vicuna), they could successfully attack commercial APIs like ChatGPT and Gemini.

Figure 3 illustrates the concept: the attacker generates a prompt using their local models and sends it to the API. The API, perceiving the prompt as a benign context or discussion, outputs the harmful information.
Below is a concrete example of a successful attack on ChatGPT using this method. The prompt asks for a fake news article, and ChatGPT complies.

Why does this work so well?
The ablation studies (tests where parts of the model are removed) reveal that every component is necessary.

Table 5 shows that removing the MMD Loss (ET-ce row) causes the fluency (Perplexity) to spike and the success rate to drop. This confirms that guiding the vectors to resemble real words during the optimization phase is the “secret sauce” of this technique.
Conclusion
The ASETF paper presents a significant leap forward in Red Teaming (security testing) for Large Language Models. By shifting the optimization battlefield from the discrete token space to the continuous embedding space, the authors achieved three simultaneous wins:
- Speed: Faster generation of attacks.
- Stealth: Highly fluent, readable prompts that bypass standard filters.
- Power: High success rates that transfer to black-box commercial models.
This research highlights a critical reality in AI safety: current defenses that rely on detecting “weird” looking inputs are insufficient. As attack methods become more sophisticated and linguistically fluent, defense mechanisms must evolve to understand the intent behind a prompt, not just its syntax.
For students and researchers, ASETF serves as a masterclass in how to combine different domains of deep learning—adversarial optimization and translation—to solve complex problems in AI security.
](https://deep-paper.org/en/paper/2402.16006/images/cover.png)