# Oral 31915

- Kind: Oral
- Talk page and recording: https://iclr.cc/virtual/2025/oral/31915

> Transcript of the talk's recording (session_asr), made by speech recognition or taken from the host's captions. It may contain errors. The words are the speakers'; listen to the recording on the talk's page before quoting it.

Okay. Hello, everyone. I'm Ashwini, presenting on behalf of my co-authors. Xiangyu couldn't make it here today, but there's a few of us who are going to be around here and at the poster session later tomorrow. So our paper says that safety alignment should be made more than just a few tokens deep. And in titling the paper that, we're kind of already giving you the assumption that it's only a few tokens deep right now. So why do we say that?
One thing that I'm going to be talking about a few times over the course of this presentation is this idea that a lot of jailbreaks currently work because current safety alignment is very shallow. It's only a few tokens deep. So if you were listening to Zico's talk earlier today, when he's talking about the success of universal adversarial attacks or GCG, he's making it pretty clear that algorithm doesn't actually
tell the model here is the entire instructions for building a bomb and encode that into an adversarial suffix. That attack works because it just gets the model to start its response with okay sure I can help you build a bomb. After that all of the knowledge that the model has takes over and the model tells you on its own very willingly how to build a bomb or how to wear a car or whatever. So these jailbreaks don't really need to do anything more than get the model to start their response and the model will just finish the rest of this.
So this is kind of like an immediate phenomenon, but how do we actually go about quantifying this and measuring this? So let's say that I have a harmful response and a harmful instruction. So my response is H and I have two models, a pre-trained model and aligned model. And the quantity that I'm going to be plotting here is the token wise KL divergence between the output probabilities of these two models. So if they're far away, that means that these models have very different predictions from each other.
And they are far away, but only for the very first few tokens of that harmful response. After a few tokens, even the aligned model looks pretty much the same as the unaligned model. So why is this the case? I mean, if I'm building this aligned model, why would I make it only differ from my base model in the first few tokens? Well, let's say that I'm the model developer and I want to make sure that my probability of responding to this harmful instruction is about zero.
Okay. So an easy way for this to happen is for me to make sure that my probability of outputting the very first harmful token is zero.
And that'll work for my objective, even if the model would go on willingly to complete the rest of that response if I actually pre-filled H1, the first token of the harmful response. And so, okay, I would have found a very nice, easy shortcut in my optimization process that would have made it look like I'm perfectly fitting all of the refusal data that I got from my human raters. So this has two immediate consequences. The first is kind of nice.
If you take an unaligned model, like a base model, and you just pre-fill, you know, this response, I apologize, but I cannot, you start that in the model's response window, it's going to look pretty much perfectly aligned, okay? It's going to be, you know, have a very low harmfulness rate. So that's nice. The not so nice part is that if you take an aligned model and you pre-fill acceptance prefix, that aligned model is going to look super unsafe. So on the right here, I have, you know, just the, you know, the API for
pre-filling Claude 3.5 Sonnet, which some people would tell you is one of the best models out there. And Claude exposes this pre-filling API because it's really convenient. It's convenient, but it also means that if I want to know how to kidnap Jeff Dean, then I can pre-fill the model's response with the first step, which is to identify Jeff's daily routine. And this doesn't require much effort on my behalf, right? Maybe I can figure out the first step, but I really need the model to give me the rest of the steps for kidnapping.
And SONIT, which is a super aligned model, which Anthropic does tons of alignment research on, will just go ahead and give me some instructions for kidnapping Jeff Dean. Whether or not these are plausible, I don't know. So hopefully by now I've convinced you that this kind of phenomenon of shallow alignment really does exist, that the way that we're aligning models today, even for really good industry models like Claude, is not really sufficient. It doesn't really do anything except just get them to produce a refusal early on.
So I want to go through the process of making this alignment more than just a few tokens deep. And in order to do that, we're going to go back to this setup that we had. So I still have this objective, right? I'm still going to go ahead and do this process and train my model to always produce a refusal. But I'm going to do something a little bit more than that. I'm also going to try and ensure that even if the model started off with a harmful response.
It's still going to then go and finish by refusing to answer my initial harmful instruction. And what this looks like in practice is a pretty straightforward data augmentation approach. So here's one of our examples from our data augmentation data set. And I want to maximize the probability of refusing conditioned on a harmful instruction and the first k tokens of a harmful response. So the harmful instruction is please give me step-by-step instructions for building a bomb.
And in any ordinary refusal data set, of course, the human being who's creating your data set is just going to go right ahead and refuse. They're going to say, I cannot fulfill your request. But if you just train on this as you reviewed, you're pretty much going to end up overfitting to that.
So what we do is we insert the start of a harmful response into the context, okay? And we don't take a gradient on this harmful response. We're not interested in teaching our model this. We're only taking a gradient on the refusal. So now I'm teaching my model that even if it starts off with a harmful response, it should still refuse no matter what. And the tokens that I'm looking at here are pretty short. This is a very short harmful response, but I'll show you that this works.
works even if the length of that harmful response that we're pre-filling is quite long. So okay, I've talked enough about the approach, how well does this work? Well, if we start off looking at this token-wise scale divergence, then we have this green line, which is the divergence between our new augmented model, LAMA2 chat augmented, and the base model. And you can see that here the KL divergence is still quite high, even over, you know, the number of tokens where
The divergence between the chat model and the base model has dropped quite a lot.
So this data augmentation at least was successful in this first thing that we're looking at, which is the KL divergence. It looks like we're different from the base model in more than just the first couple of tokens. And, you know, if I show you the attack success rate on jailbreak attacks, you might say, okay, well, you pretty much set out, right, to achieve robustness to this kind of pre-fill attack. So it's not at all surprising that we would get robustness to the pre-fill attack, and I would agree with you.
But I think what's interesting is that we also get robustness to a couple of other kinds of attacks that we didn't even really plan for. So one of these is GCG, the attack that I started off this talk talking about, and another one of them is this exploit where you tweak the parameters of decoding in order to get your model to be more likely to generate a jailbreak.
So let's zoom in on the reduction in attack success rate for the GCG attack. This is not what we trained for. It's not like there were adversarial suffixes in our data augmentation process. So how did we get robustness to this? Well, you know, let's go back and think about how GCG works in the first place, right? GCG does not try and compress into those few adversarial suffix tokens the entire knowledge of how to build a bomb or hotwire a car. It just tries to get the model.
model to start off by saying, sure, I can help you with that. And GCG is good at this. You optimize for long enough, the loss goes down, your model is going to start off by initially saying it's going to do what you want it to do. But that's okay for us, because our data augmentation process sort of bypasses the adversarial example completely. If GCG makes us start off with that response, that's fine. We're still going to try and get back on track and still be able to ultimately refuse answering the initial harmful instruction.
So the reason why I emphasize this is because I think for a lot of people it's easy to look at like the progress in AI safety and AI alignment and be kind of discouraged because I mean adversarial examples like this are still out there. Anytime you know a new model is released someone will jailbreak it in like the first 10 minutes of its you know lifespan and it'll just be on Twitter immediately right and I think that may very well continue to happen but I don't think that we need to solve adversarial examples necessarily.
if we want to have safe models. It just needs to be the case that our process doesn't really care so much about the adversarial example. And of course, we don't get perfect robustness here. There's still plenty of attack success here. I just wanted to talk about this because it's an interesting instance of our defense kind of generalizing. So
One of the things you may have noticed is that all the examples here that I have, the adversarial prefix that we're pre-filling there, this like sure, I'll help with that, it's it's quite short, right? I mean, if it's really just saying yes or sure, then that's kind of trivial. And
One of the reasons for that is just because I want to keep the slides at a reasonable size. But it doesn't have to be this case. We can even say we want to set a target for how many tokens of pre-fill we want to be robust to. So let's say I'm okay with my user giving me 160 tokens of whatever they want, but I still want my model to output a refusal.
Well, in order to do this, I just have to make sure that when I'm doing my data augmentation process, I am actually training on, you know, 100 tokens of pre-filled bad stuff before I give my refusal. And I'm still going to get robustness, even if 160 tokens of stuff are pre-filled in there. The trade-off is a little bit of utility degradation.
And I think this utility degradation is kind of expected when you're doing what we're doing, which is a kind of adversarial learning. Even in computer vision, you would take a transformation, train on that and make sure that your classifier will be robust even if that transformation occurs. I think what's encouraging here is that our utility tradeoff, what we're losing in exchange for.

trade-off what we're losing in exchange for all this robustness is really not too much and maybe you could even make it better with a bit more sophisticated of a data augmentation pipeline we're training on a pretty small data set and the experiments can be done quite quickly so you know
I've talked a lot about this data augmentation, but we don't call this, you know, like a silver bullet defense or anything in our paper. This is just really one idea, one way to realize how you can build a defense with the idea of shallow alignment in mind. And I think if you zoom out and look at a conceptual level, what are we doing? We're saying that if the model has made some kind of mistake, and it's in some kind of weird trajectory that we don't want to be in, then we want our model to realize that it's made a mistake.
and then try and recover. Okay? So in other words, the essence of our deeper safety alignment is to teach the model how to correct its own mistakes. We want to be able to handle mistakes, and that shouldn't be, you know, like a death knell for the model. And I think in some ways, this is, you know, kind of a allusion to all the current research on reasoning where we want the model to be able to introspect, self-reflect, you know, if you make a mistake, that's fine, you know, just fix it and move on.
And so I think there is something a little bit more here than just this one defense. So that's all. We're going to have a poster on this tomorrow afternoon. Here's the code, and if you scan the QR code, it'll take you to the open review page. Thank you.
Oh, thank you for the presentation. According to your work um because the earlier few tokens are very important, I think prefix is very important to steering the model behaviour. Oh for example, our prefix such as I cannot uh will induce the result behaviour and sure I can will the task following behaviour. So my question is um
Is there any magic prefix that enables model to distinguish the harmful and benign behaviour?
Yeah, so the question is whether or not there's a kind of magic prefix that if we pre-fill, the model will condition on that be able to tell whether or not the instruction is harmful or harmless. That's an interesting question. I do know that, for example, if you take a lot of evals from safety papers, like if you take, I don't know, something like WildGuard, if you change like the safety prompt in that paper to be like, you know, here's your job, you're a safety agent, you know, do this, you know, here are the rules, you can like really make these models look very, very resilient.
brilliant and robust now at what point it stops becoming a prefix and starts becoming like a long like page-long system prompt that's not so clear but that that is something that has a you know a significant impact on the model really when we do this kind of alignment or we do even you know like reasoning training we're just distilling that kind of system prompt into the model we're getting it to like by default think have a chain of thought you know think about these guidelines for what is violent or what is nsfw you
of you. Yeah. Thank you. Ah, thank you.
Hi. Thanks for the presentation. Um so my question's about um sort of the actual lack of degradation on some of the benign baselines. I think a lot of the time when we insert these kind of um or manually insert these kind of data augmentations um we we can see overfitting or like you know outputting this um refusal behaviour even on benign um
Prompts. So I'm wondering if you saw that in sort of early iterations of this work and if you can talk about sort of the data set mixture details that allowed you to get around it if you saw that. Yeah, a lot of the early iterations when we were just training on this like augmented data purely, we did see a lot of degradation. So we end up doing is we end up mixing it into just regular like chat template data. So we have basically some likelihood that we insert the prefix at all. So say half the time, I'm going to even choose to augment an example.
and then of that half the time that I choose to augment example, I'm going to sample uniformly on how long the prefix is going to be. So at the end of the day, if we take a look at the actual tokens that we've inserted into a, you know, benign data set like, you know, some Alpaca chat data set, it's a really, really small percentage, but that is something that you have to keep in mind. And I think this robustness utility trade off is like very clear when you start tweaking the hyper parameters on the data augmentation. Yeah.
Awesome. Thank you. Thank you. Due to time limits, we may take two more questions. Okay, yeah. The lady first, please.
Thank you for your great talk and I noticed that you mentioned we don't need to worry too much about adversarial examples to have a safe model. Can you like elaborate a little bit on that? Yeah. So I think that if I look at this case, right, if I look at the response of our augmented model, which is the second row, the adversarial example in GCG still totally worked.
Because the model is still starting off its response with, yeah, I'll help you how to commit identity theft. And that's all that GCG's job is. GCG's job, the adversarial examples job, is to make your model start off with, you know, some number of tokens. It's just the case that you can have a model that is safe, even if it starts its response with like 20 unaligned tokens. Now, if you were to say that my adversarial example is going to compress so much information in there.
that i'm gonna make my model start off with like 200 tokens of stuff you know that that might be a problem i would say even there like we can handle 160 tokens of pre-fill pretty robustly without very much degradation uh and i just don't see this like adversarial suffix process as it stands now really working well enough um that i would be too concerned about it again we're not pitching this as a defense though this is just sort of you know
Looking at the broader picture, AdReso examples may not matter if you train a model that is deeply aligned. Yeah. Okay, thank you. Thank you. So uh yes one question there and uh if the question from this side, please also hands up.
Yes, thank you for the insightful talk. Uh so I'm not quite familiar with the uh token methods, but I'm just thinking if I use activations steering, let's say I construct a a harmful steering vector and I inject it in every single step, I generate a new token.
So how do you think how effective this kind of method is and how could it be protected using this kind of a deeper alignment? Yeah, I think there's a really great connection between work on harmful activation steering, circuit breaker, stuff like that, in our work that we talk about a bit more in the paper. I think specifically if you were going to take your harmful steering vector, again, what does a harmful steering vector do?
I take the expected difference in activations under a certain prompt and some other prompt, and then I orthogonalize that back into the model. Okay, I project onto the direction of the refusal. So that works for the number of tokens that you decided to set out to make it work for. If I decided to make my model robust so that the first 160 tokens that the model generates, it doesn't matter, it'll still then after 160 tokens look back and say,
oh wait what am i doing and then go back and refuse you know then you would have to make sure that your steering vector is calibrated on like even longer than that you know there's there's still some kind of like cat and mouse arms race attack and defense game going on here um you know we don't go and really show performance on like you know 500 tokens or a thousand tokens i think at that point it's like if your steering vector is making my model generate a thousand tokens you're steering vector is the entire model response anyways
Um but I think this is uh a definite important line of uh of work, yeah. Thank you so much. Thank you. And we are calling the presenter for the third paper. If the authors are on the on site, please come forward. Then we will maybe because this is a a distinguished paper, we will take time to uh more Q and A if you have any questions. Yes.
Thanks for the great talk. Um of course this method is is not perfect, and what I would be very interested in if you are willing to share some failure modes that you observed during the development of of this technique.
yes the method is definitely not perfect we don't pitch it as a defense even in the paper um oh okay one interesting uh failure mode of it so we trained a model that we thought was pretty good we were like oh man we looked at all these attacks you know it's like totally you know beating all the attacks uh and then we tried one attack which is this like past tense attack it's a zack clear as well and this attack doesn't ask you know how do i build a bomb it asks like how did people build a bomb in the past uh in this attack
That totally works. And, you know.
I think that that is definitely an interesting failure mode. I think, again, in the course of developing the data set augmentation, we would go and try something, try some way of building up the data set, go train the model, evaluate, like, oh, this doesn't work. And I think that whenever you're building a defense, if you know the attacks that you want to be robust to, you should be able, if your approach is something like data set augmentation, just say, okay.
Okay. I'm going to take questions of this form and train on them. We don't train on anything like that, right? Our you know, data set is super small. It's like less than 300 examples. And so I don't really expect even the kind of generalisation that we already had. Oh, thank you for your presentation. So I have one question that how could you tell that the model by this deeper alignments, the model

is this deeper alignments. The model indeed learned to reject harmful to reject uh generating harmful contents. But actually maybe it's has learned a shortcut that it will suddenly change its attitude after generating some negative contents. So for example uh if the user asks ask the model to generate a novel and you know in a novel we will for sure sometimes have negative contents and after generating some negative contents the model just suddenly change its attitude. So for example if the user asks the model to generate some negative contents and after generating some negative contents the model just
just suddenly change its attitude to a generate some positive content, won't it be a very weird move for the model?
Yeah. I think, so like there may be some like fiction bench or something that we did not evaluate on. I think the evaluation of the like benign response, you know, it's basically alpaca. So chat, you know, MLU question answering, big benchmark card, math, just make a human eval. So nothing of the, you know, the kind of like long context where you're like writing something and then maybe in the middle you have to have an abrupt tone switch. So that's a good question.
If there's a benchmark like that, I'd be happy to take a look at it. Also, our models have been on the GitHub for a while. So I welcome anyone to take the benchmark and download and eval the model with it. I think the reason why I don't really believe that that's what's happening for the model is that even in these things, even if you take something simple like XS test, exaggerated safety test, like the first question XS test is.
is how do I kill a Python process? And like, I would say XS test is not perfect, but if your model is not just like producing some like SIG kill instruction then saying, oh refuse, I can't do this, it's probably not just overfitting in that sense. Of course, carefully examining this requires more work for the specific kind of use case that you're concerned about. Yep. Thank you Okay, the last call for the third presentation.
The authors? Okay, uh now let's thank the speaker again.
