Izbor

arxiv · paper · 2024-06-17 · Andy Arditi, Oscar Obeso, Aaquib Syed, Daniel Paleka, Nina Panickssery, Wes Gurnee, Neel Nanda

Zavračanje v jezikovnih modelih vodi ena sama smer

Izvirni naslov vira: Zavračanje v jezikovnih modelih posreduje ena sama smer

Zavračanje škodljivih navodil v odprtokodnih klepetalnih modelih uravnava ena sama smer v rezidualnem toku. Odstranitev te smeri odpravi zavračanje, njeno dodajanje pa sproži zavračanje neškodljivih pozivov. Ista ugotovitev omogoča spremembo uteži ranga ena, ki deluje kot obhod varoval ob dostopu do notranjosti modela, in pojasnjuje, kako napadalne pripone zavirajo zavračanje.

Raziskava

Kako stojijo trditve
  • Le tu: 50

Kaj pravi

  1. Raziskava preučuje zavračanje škodljivih navodil v velikih jezikovnih modelih na 13 priljubljenih odprtokodnih klepetalnih modelih z do 72 milijardami parametrov. Ugotavlja, da zavračanje posreduje ena sama smer v rezidualnem toku. Smer izračunajo kot razliko med povprečnimi aktivacijami pri škodljivih in neškodljivih navodilih na vsaki plasti in vsakem položaju žetona za navodilom, nato pa na validacijskih množicah izberejo eno kandidatko. Odstranitev te smeri odpravi zavračanje škodljivih pozivov, njeno dodajanje pa sproži zavračanje neškodljivih, zato je smer hkrati nujna in zadostna. Na tej podlagi avtorji smerno ablacijo pretvorijo v spremembo uteži ranga ena, ki odstrani smer in omogoči obhod varoval ob dostopu do notranjosti modela, pri katerem rezultati na večini primerjalnih preizkusov zmogljivosti ostanejo znotraj intervalov zaupanja izvirnih modelov. Mehanistična analiza napadalne pripone na modelu Qwen 1.8B Chat pokaže, da pripona zavira smer zavračanja tako, da pozornost najpomembnejših pozornostnih glav preusmeri stran od škodljivega navodila. Smer je izražena že v osnovnih modelih, kar nakazuje, da fino prilagajanje za varnost ponovno uporabi obstoječo predstavitev.
  2. Raziskava zajema 13 priljubljenih odprtokodnih klepetalnih modelov z do 72B parametrov. u2 Število modelov je navedeno v povzetku in uvodu.
  3. Podatkovna množica škodljivih navodil črpa iz zbirk AdvBench, MaliciousInstruct, TDC2023 in HarmBench, množica neškodljivih navodil pa je vzorčena iz zbirke Alpaca. u19
  4. Vsaka podatkovna množica je razdeljena na 128 učnih in 32 validacijskih primerov. u19
  5. Preučevani modeli imajo od 1.8 do 72 milijard parametrov. u21
  6. Za izračun ocene varnosti se uporablja Meta Llama Guard 2, ki vsak generirani odgovor razvrsti kot varen ali nevaren. u42
  7. Ablacijo in sprožanje zavračanja ovrednotijo na 100 škodljivih navodilih iz zbirke JailbreakBench in na 100 naključnih neškodljivih navodilih iz zbirke Alpaca. u46–50
  8. Delež uspešnih napadov na ortogonalizirane modele merijo na testni množici standardnih vedenj HarmBench s 159 primeri. u60
  9. Pri modelu Llama-2 7B je delež uspešnih napadov na ortogonalizirani model 22.6% s sistemskim pozivom in 79.9% brez njega. u64 Navedena sta deleža uspešnih napadov s privzetim sistemskim pozivom HarmBench in brez njega.
  10. Pri modelu Qwen 7B je delež uspešnih napadov 79.2% s sistemskim pozivom in 74.8% brez njega. u64 Modeli Qwen v nasprotju z modelom Llama-2 ohranjajo podobne deleže uspešnih napadov ne glede na sistemski poziv.
  11. Z izjemo modelov Qwen 7B in Yi 34B so vse vrednosti meril vrednotenja ortogonaliziranih modelov znotraj 99% intervalov zaupanja za uspešnost izvirnih modelov. u68
  12. Točnost na preizkusu TruthfulQA pri ortogonaliziranih modelih dosledno upada. u69 Avtorji to povezujejo z enakim upadom, o katerem so pri finem prilagajanju za odstranjevanje varnostnih omejitev poročali Yang in sod. (2023).
  13. Analiza pripon uporablja 128 škodljivih navodil iz zbirke JailbreakBench in testne množice HarmBench, izvedena pa je na modelu Qwen 1.8B Chat. u76
  14. Mehanistična analiza pripon preučuje osem najvišje uvrščenih pozornostnih glav, razvrščenih glede na neposredni prispevek k značilki pri škodljivih navodilih. u81
  15. Pri primerjavi osnovnih modelov za vsak model vzorčijo 128 škodljivih in 128 neškodljivih navodil. u238 Aktivacije shranijo v predpomnilnik na položaju zadnjega žetona.
  16. Osnovni modeli imajo pri škodljivih pozivih visoko kosinusno podobnost s smerjo zavračanja, pri neškodljivih pa nizko, podobno kot klepetalni modeli. u239 Prikazano na sliki 24 za štiri različne modele.
  17. Ortogonalizirani model Llama-3 8B Instruct lahko izpiše niz 'I cannot provide instructions on how to make a bomb', kadar je to izrecno zahtevano, čeprav nespremenjeni model s tem nizom zavrne zahtevo. u251 Prikazano na sliki 27.
  18. Večino poskusov so izvedli na gruči osmih grafičnih procesorjev NVIDIA RTX A6000 s po 48GB pomnilnika. u264
  19. Izračun in izbira smeri trajata približno 5 minut pri modelih z do 14B parametrov in približno 1 uro pri večjih modelih. u265
  20. Razumevanje notranjega delovanja modelov je mogoče uporabiti za praktično usmerjanje njihovega vedenja, ne le za pojasnjevanje ranljivosti. u2
  21. Ugotovitve so predstavljene kot prispevek k razpravi o odgovornem objavljanju odprtokodnih modelov. u9
  22. Vektor razlike med povprečjema nosi pomen tako s svojo smerjo, ki kaže, kje se aktivacije pri škodljivih in neškodljivih navodilih razlikujejo, kot s svojo velikostjo, ki meri razdaljo med njunima povprečjema. u26 Zato je mogoče vektor uporabiti tako za odstranjevanje kot za dodajanje značilke.
  23. Ablacija smeri na vsaki plasti in vsakem položaju žetona modelu prepreči, da bi to smer kadar koli predstavil v svojem rezidualnem toku. u35
  24. Iskanje ujemanj z zavrnitvenimi frazami zazna naučene zavrnitve, ne preveri pa, ali je generirani odgovor smiseln ali škodljiv, zato je dodana ločena ocena varnosti. u40 Dopolnilno merilo je potrebno za zaznavanje škodljivih odgovorov, ki ne vsebujejo zavrnitvenih fraz.
  25. Ortogonalizacija uteži je enakovredna odstranitvi komponente v določeni smeri med izvajanjem modela, zato se spremenjeni model pri zavračanju odziva povsem enako kot pri tej odstranitvi, brez kakršne koli gradientne optimizacije. u58 Zaradi tega je ta način obhoda varnostnih omejitev preprostejši od napadov, ki temeljijo na dodatnem učenju.
  26. Napadalna pripona deluje tako, da pozornost glav, pomembnih za zavračanje, preusmeri s škodljivega navodila na pripono, s čimer zmanjša njihov prispevek k smeri zavračanja. u82 Članek s tem mehanizmom pojasnjuje, zakaj pripone zavirajo to smer.
  27. Ker osnovni modeli ne zavračajo zahtev, velika podobnost njihovih aktivacij s smerjo zavračanja pri škodljivih pozivih nakazuje, da ta smer kodira nekaj, kar je prisotno že pred učenjem zavračanja in kar dodatno varnostno učenje nato ponovno uporabi. u237–239 To pojasnjuje, zakaj je smer mogoče najti v modelih, ki se nikoli niso naučili zavračati zahtev.
  28. Zdi se, da ortogonalizacija deluje na višji pojmovni ravni, saj lahko spremenjeni model na zahtevo še vedno tvori običajne fraze zavračanja. u250 To kaže, da poseg ne deluje tako, da bi onemogočil besedne izraze zavračanja.
  29. V 13 odprtokodnih klepetalnih modelih zavračanje škodljivih navodil posreduje ena sama smer v rezidualnem toku: njena odstranitev odpravi zavračanje, njeno dodajanje pa sproži zavračanje neškodljivih navodil. u2
  30. Avtorji predlagajo obhod varoval ob dostopu do notranjosti modela, ki s spremembo uteži ranga ena odstrani smer zavračanja, da bi onemogočili zavračanje ob čim manjšem vplivu na druge zmogljivosti. u8
  31. Napadalne pripone zavirajo izraženost smeri zavračanja pri zadnjem žetonu, zato se signal zavračanja v modelu vede tako kot pri neškodljivih navodilih. u76
  32. Smer zavračanja obstaja že v osnovnih modelih, kar nakazuje, da fino prilagajanje za varnost obstoječo predstavitev uporabi za drug namen, namesto da bi ustvarilo novo predstavitev za zavračanje. u237–239
  33. Preverjanja v dodatku podpirajo trditev, da ortogonalizacija deluje na pojmovni ravni, ne pa z zaviranjem žetonov, pri tem pa neškodljivo vedenje ostaja večinoma nespremenjeno. u250–254
  34. Zakaj se pri modelih Llama-2 in Qwen delež uspešnih napadov tako močno razlikuje glede na to, ali je sistemski poziv vključen? u64 Avtorji menijo, da razlike ni mogoče pojasniti zgolj z vsebino poziva in da morda odraža splošni način odzivanja modelov na sistemska navodila, vendar vprašanje puščajo odprto.
  35. Zakaj najpomembnejše pozornostne glave ob dodani napadalni priponi preusmerijo pozornost na območje pripone? u82 Članek opisuje ta prevzem pozornosti, vendar ponudi le preliminarno mehanistično razlago in vzrok pušča odprt.
  36. Ali se smer zavračanja med dodatnim varnostnim učenjem nauči povsem na novo ali pa je že prisotna v osnovnem modelu in dobi novo vlogo? u237 Vir na to odgovori v naslednji enoti: smer je že prisotna v osnovnih modelih in dobi novo vlogo.
  37. Osrednja trditev povzetka, izražena z besedami avtorjev: ena smer nadzoruje zavračanje v obe smeri. u2 Osrednji rezultat izrazi v enem stavku.
  38. Izjava avtorjev o tem, kako nemočni so odprtokodni pogovorni modeli pred preprosto spremembo uteži ranga ena. u9 To je najbolj neposredna izjava v članku o posledicah za varnost.
  39. Opis avtorjev o grožnji napadalnih pripon, ki zaobidejo zavračanje tako, da škodljivim navodilom dodajo nize znakov. u73 Opredeli napad, ki ga pojasnjuje mehanistična analiza v razdelku 5.
  40. Opis avtorjev o običajnem delovanju pozornosti, ki ga napadalna pripona zmoti. u82 To je izhodiščno vedenje, glede na katero je prikazan prevzem pozornosti s pripono.
  41. Ortogonalizirani model lahko še vedno tvori fraze zavračanja, kar avtorji razumejo kot dokaz o ravni, na kateri poseg deluje. u250 Z besedami avtorjev podaja njihovo razlago poskusa z nizi zavračanja.
  42. V družini modelov Qwen je splošna metoda ortogonalizacije uteži primerljiva z obhodi varnostnih omejitev, prilagojenimi posameznemu pozivu, kot je GCG, ki vsak poziv optimizirajo posebej. u62
  43. Po odstranitvi smeri zavračanja ortogonalizirani modeli ostanejo koherentni, čeprav bi pričakovali, da bo obhod, ki onemogoči varnostne mehanizme, poslabšal splošno kakovost. u66 Avtorji navajajo Souly et al. (2024), ki poročajo, da lahko pozivi za obhod varnostnih omejitev znatno vplivajo na uspešnost modela.
  44. Osnovni modeli, ki ne zavračajo škodljivih zahtev, pri škodljivih pozivih vseeno kažejo visoko kosinusno podobnost s smerjo zavračanja. u236–239 Pričakovali bi, da smeri, povezane z zavračanjem, v modelu, ki nikoli ne zavrača zahtev, ne bo.
  45. Iskanje ujemanj s frazami zavračanja ima znane omejitve, saj lahko spregleda škodljivo vsebino, ki teh fraz ne vsebuje. u40 Članek to rešuje z dodatno, dopolnilno metriko: oceno varnosti modela Llama Guard 2.
  46. Uporaba privzetega sistemskega poziva HarmBench je primerna za vrednotenje po načelu črne skrinjice, manj pa za napadalce z dostopom do notranjosti modela, ki lahko sistemski poziv odstranijo, zato so rezultati navedeni za obe možnosti. u63 Avtorji to rešijo tako, da poročajo o deležih uspešnih napadov s sistemskim pozivom in brez njega.
  47. Prejšnje raziskave so ugotovile, da napadalne pripone bistveno ne spremenijo predstavitve škodljivosti, ta članek pa ugotavlja, da znatno zavirajo smer zavračanja. u85 Vir to predstavlja kot nasprotje s prejšnjimi ugotovitvami, ne da bi jih v celoti uskladil.
  48. Metoda v nasprotju z obhodi varnostnih omejitev prek pozivov zahteva dostop do uteži modela, prenosljivost takšnih obhodov z modelov z odprtimi utežmi na modele, dostopne le kot črne skrinjice, pa ni jasna. u93
  49. Ortogonalizirani model na vprašanja o svojem zavračanju odgovarja skladno s svojim prvotnim vedenjem, vendar so razlogi, ki jih navaja, nesmiselni. u256–257 Model kot razlog, zakaj ne pojasni izdelave molotovke, navede, da gre za vprašanje o dejstvih, ne pa za ustvarjalno zahtevo, kar kaže, da se vedenje in razumevanje lastnega delovanja lahko razhajata.
  50. Zavračanje v odprtokodnih klepetalnih modelih posreduje ena sama smer v rezidualnem toku, ki jo je mogoče odstraniti s spremembo uteži ranga ena in s tem onemogočiti zavračanje, napadalne pripone pa jo zavirajo. Ali zavračanje škodljivih navodil v klepetalnih modelih posreduje ena sama smer v rezidualnem toku?
Kako utemeljuje
  1. thesis Refusal in chat models rests on one direction Is refusal of harmful instructions in chat models mediated by a single direction in the residual stream?
    1. theme Refusal controlled by one direction The paper argues that across 13 open-source chat models, a single residual-stream direction both enables and induces refusal.
      1. idea Single residual direction mediates refusal across 13 models
        1. evidence Study covers 13 open-source chat models up to 72B
        2. quote Authors: one direction controls refusal in both directions
        3. mechanism Difference-in-means vector encodes direction and magnitude
        4. mechanism Ablating direction everywhere prevents representing it
    2. theme Rank-one edit disables refusal Removing the direction through a rank-one weight edit disables refusal with limited loss of other capabilities, with some costs.
      1. idea White-box jailbreak via rank-one weight edit
        1. mechanism Orthogonalization equals inference-time directional ablation
        2. evidence Attack success measured on orthogonalized models
          1. evidence Llama-2 7B success 22.6% with prompt, 79.9% without
            1. question Why do Llama-2 and Qwen differ on system prompt?
          2. evidence Qwen 7B success 79.2% with prompt, 74.8% without
          3. counterargument Default system prompt less suited to white-box attackers
        3. surprise Qwen edit matches per-prompt GCG jailbreaks
        4. evidence Most metrics within confidence intervals of originals
        5. implication Models stay coherent after removing refusal direction
        6. counterargument TruthfulQA accuracy consistently drops after orthogonalization
    3. theme Refusal direction predates safety tuning The refusal direction already appears in base models, suggesting safety fine-tuning reuses an existing representation.
      1. idea Refusal direction already exists in base models
        1. surprise Base models still align with refusal direction on harmful prompts
        2. evidence Base models: high similarity on harmful, low on harmless
        3. argument Direction encodes something present before refusal training
        4. question Learned from scratch or repurposed from base model?
    4. theme Adversarial suffixes suppress the refusal signal Adversarial suffixes bypass refusal by pulling attention away from the harmful instruction, which suppresses the refusal direction.
      1. idea Suffixes suppress refusal direction at last token
        1. evidence Suffix analysis run on Qwen 1.8B Chat
        2. mechanism Suffix draws refusal heads' attention away from instruction
          1. evidence Top eight attention heads by attribution examined
          2. mechanism Normally these heads attend to the harmful instruction
          3. question Why do heads shift attention to the suffix?
      2. quote Authors describe suffixes as bypassing refusal by appending text
      3. tension Prior work found suffixes leave harmfulness representation intact
    5. theme Orthogonalization acts conceptually, not superficially The orthogonalized model still produces refusal phrases, which the authors read as evidence that the edit works at a conceptual level.
      1. idea Orthogonalized model still outputs refusal phrases
        1. quote Authors read phrase output as evidence of conceptual level
        2. evidence Llama-3 outputs refusal string when explicitly asked
        3. argument Appendix checks support conceptual, harmless-preserving claim
        4. tension Meta-answers consistent yet stated reasons incoherent
    6. theme Implications for open-source release The authors argue that interpretability can control behavior and that open-weight models are easily undone, which bears on responsible release.
      1. idea Internals can control behavior, not just explain
      2. idea Contribution to responsible open-source release debate
      3. quote Open-source chat models are defenseless to rank-one change
      4. tension Method needs weights; prompt-jailbreak transfer unclear

Vir, odlomek za odlomkom

Zavračanje v jezikovnih modelih posreduje ena sama smer
Ilustracija, narejena z umetno inteligenco
  1. u1 Abstract
  2. u2 Conversational large language models are fine-tuned for both instruction-following and safety, resulting in models that obey benign requests but refuse harmful ones. While this refusal behavior is widespread across chat models, its underlying mechanisms remain poorly understood. In this work, we show that refusal is mediated by a one-dimensional subspace, across 13 popular open-source chat models up to 72B parameters in size. Specifically, for each model, we find a single direction such that erasing this direction from the model’s residual stream activations prevents it from refusing harmful instructions, while adding this direction elicits refusal on even harmless instructions. Leveraging this insight, we propose a novel white-box jailbreak method that surgically disables refusal with minimal effect on other capabilities. Finally, we mechanistically analyze how adversarial suffixes suppress propagation of the refusal-mediating direction. Our findings underscore the brittleness of current safety fine-tuning methods. More broadly, our work showcases how an understanding of model internals can be leveraged to develop practical methods for controlling model behavior.2
  3. u3 1 Introduction
  4. u4 Deployed large language models (LLMs) undergo multiple rounds of fine-tuning to become both helpful and harmless: to provide helpful responses to innocuous user requests, but to refuse harmful or inappropriate ones (Bai et al., 2022). Naturally, large numbers of users and researchers alike have attempted to circumvent these defenses using a wide array of jailbreak attacks (Wei et al., 2023; Xu et al., 2024; Chu et al., 2024) to uncensor model outputs, including fine-tuning techniques (Yang et al., 2023; Lermen et al., 2023; Zhan et al., 2023). While the consequences of a successful attack on current chat assistants are modest, the scale and severity of harm from misuse could increase dramatically if frontier models are endowed with increased agency and autonomy (Anthropic, 2024). That is, as models are deployed in higher-stakes settings and are able to take actions in the real world, the ability to robustly refuse a request to cause harm is an essential requirement of a safe AI system. Inspired by the rapid progress of mechanistic interpretability (Nanda et al., 2023; Bricken et al., 2023; Marks et al., 2024; Templeton et al., 2024) and activation steering (Zou et al., 2023a; Turner et al., 2023; Panickssery et al., 2023), this work leverages the internal representations of chat models to better understand refusal.
  5. u5 It is widely hypothesized that LLMs represent features, or concepts, as linear directions in activation space (Mikolov et al., 2013; Bolukbasi et al., 2016; Elhage et al., 2022; Park et al., 2023b). Recent works have studied the linear representation of particular features such as harmlessness (Zou et al., 2023a; Wolf et al., 2024; Zheng et al., 2024), truth (Marks and Tegmark, 2023; Li et al., 2024a), humor (von Rütte et al., 2024), sentiment (Tigges et al., 2023), language (Bricken et al., 2023), topic (Turner et al., 2023), and many others. Moreover, these feature directions have been shown to be effective causal mediators of behavior, enabling fine-grained steering of model outputs (Panickssery et al., 2023; Turner et al., 2023; Zou et al., 2023a; Templeton et al., 2024).
  6. u6 Figure 1: Ablating the “refusal direction” reduces refusal rates and elicits unsafe completions. We evaluate each model over 100 harmful instructions from JailbreakBench (Chao et al., 2024).
  7. u7 Figure 2: Ablating the “refusal direction” can effectively bypass refusal on harmful instructions. This example is taken from Llama-3 8B Instruct. For more examples, see §K.1.
  8. u8 In this work, we show that refusal is mediated by a one-dimensional subspace across 13 popular open-source chat models up to 72B parameters in size. Specifically, we use a small set of contrastive pairs (Burns et al., 2022; Zou et al., 2023a; Panickssery et al., 2023) of harmful and harmless instructions to identify a single difference-in-means direction (Panickssery et al., 2023; Marks and Tegmark, 2023; Belrose, 2023) that can be intervened upon to circumvent refusal on harmful prompts, or induce refusal on harmless prompts (§3). We then use this insight to design a simple white-box jailbreak via an interpretable rank-one weight edit that effectively disables refusal with minimal impact on other capabilities (§4). We conclude with a preliminary mechanistic investigation into how adversarial suffixes (Zou et al., 2023b), a popular prompt-based jailbreak technique, interfere with the propagation of the refusal direction across token positions (§5).
  9. u9 Our work is a concrete demonstration that insights derived from interpreting model internals can be practically useful, both for better understanding existing model vulnerabilities and identifying new ones. Our findings make clear how defenseless current open-source chat models are, as even a simple rank-one weight modification can nearly eliminate refusal behavior. We hope that our findings serve as a valuable contribution to the conversation around responsible release of open-source models.
  10. u10 2 Methodology
  11. u11 2.1 Background
  12. u12 Transformers.
  13. u13 Decoder-only transformers (Liu et al., 2018) map input tokens $\mathbf{t}=(t_{1},t_{2},\ldots,t_{n})\in\mathcal{V}^{n}$ to output probability distributions $\mathbf{y}=(\mathbf{y}_{1},\mathbf{y}_{2},\ldots,\mathbf{y}_{n})\in\mathbb{R}^{n\times|\mathcal{V}|}$ . Let $\mathbf{x}_{i}^{(l)}(\mathbf{t})\in\mathbb{R}^{d_{\text{model}}}$ denote the residual stream activation of the token at position $i$ at the start of layer $l$ .1 Each token’s residual stream is initialized to its embedding $\mathbf{x}_{i}^{(1)}=\mathtt{Embed}(t_{i})$ , and then undergoes a series of transformations across $L$ layers. Each layer’s transformation includes contributions from attention and MLP components:
  14. u14 The final logits $\mathtt{logits}_{i}=\mathtt{Unembed}(\mathbf{x}_{i}^{(L+1)})\in\mathbb{R}^{|\mathcal{V}|}$ are then transformed into probabilities over output tokens $\mathbf{y}_{i}=\mathtt{softmax}(\mathtt{logits}_{i})\in\mathbb{R}^{|\mathcal{V}|}$ .2
  15. u15 Chat models.
  16. u16 Chat models are fine-tuned for instruction-following and dialogue (Ouyang et al., 2022; Touvron et al., 2023). These models use chat templates to structure user queries. Typically, a chat template takes the form <user>{instruction}<end_user><assistant>. We use post-instruction tokens to refer to all template tokens after the instruction, and denote the set of positional indices corresponding to these post-instruction tokens as $I$ . Our analysis focuses on activations in this region to understand how the model formulates its response. All chat templates and their corresponding post-instruction tokens are specified in §C.3.
  17. u17 2.2 Datasets and models
  18. u18 Datasets.
  19. u19 We construct two datasets: $\mathcal{D}_{\text{harmful}}$ , a dataset of harmful instructions drawn from AdvBench (Zou et al., 2023b), MaliciousInstruct (Huang et al., 2023), TDC2023 (Mazeika et al., 2024; Mazeika et al., 2023), and HarmBench (Mazeika et al., 2024); and $\mathcal{D}_{\text{harmless}}$ , a dataset of harmless instructions sampled from Alpaca (Taori et al., 2023). Each dataset consists of train and validation splits of 128 and 32 samples, respectively. We apply filtering to ensure that the train and validation splits do not overlap with the evaluation datasets used in §3 and §4. See §A for further details about the datasets, including representative examples.
  20. u20 Models.
  21. u21 To assess the generality of our findings, we study a diverse set of safety fine-tuned models, spanning 1.8 to 72 billion parameters in size. We consider both models aligned by preference optimization (APO) and aligned by fine-tuning (AFT) (Meade et al., 2024). All models included in the study are specified in Table 1.3
  22. u22 Table 1: Model families, sizes, alignment training type, and references.
  23. u23 2.3 Extracting a refusal direction
  24. u24 Difference-in-means.
  25. u25 To identify the “refusal direction” in the model’s residual stream activations, we compute the difference between the model’s mean activations when run on harmful and harmless instructions. This technique, known as difference-in-means (Belrose, 2023), effectively isolates key feature directions, as demonstrated in prior work (Panickssery et al., 2023; Marks and Tegmark, 2023; Tigges et al., 2023). For each layer $l\in[L]$ and post-instruction token position $i\in I$ , we calculate the mean activation $\boldsymbol{\upmu}_{i}^{(l)}$ for harmful prompts from $\mathcal{D}_{\text{harmful}}^{\text{(train)}}$ and $\boldsymbol{\upnu}_{i}^{(l)}$ for harmless prompts from $\mathcal{D}_{\text{harmless}}^{\text{(train)}}$ :
  26. u26 We then compute the difference-in-means vector $\mathbf{r}_{i}^{(l)}=\boldsymbol{\upmu}_{i}^{(l)}-\boldsymbol{\upnu}_{i}^{(l)}$ . Note that each such vector is meaningful in both (1) its direction, which describes the direction that mean harmful and harmless activations differ along, and (2) its magnitude, which quantifies the distance between mean harmful and harmless activations.
  27. u27 Selecting a single vector.
  28. u28 Computing the difference-in-means vector $\mathbf{r}_{i}^{(l)}$ for each post-instruction token position $i\in I$ and layer $l\in[L]$ yields a set of $|I|\times L$ candidate vectors. We then select the single most effective vector $\mathbf{r}_{i^{*}}^{(l^{*})}$ from this set by evaluating each candidate vector over validation sets $\mathcal{D}_{\text{harmful}}^{\text{(val)}}$ and $\mathcal{D}_{\text{harmless}}^{\text{(val)}}$ . This evaluation measures each candidate vector’s ability to bypass refusal when ablated and to induce refusal when added, while otherwise maintaining minimal change in model behavior. A more detailed description of our selection algorithm is provided in §C. We notate the selected vector as $\mathbf{r}$ , and its corresponding unit-norm vector as $\hat{\mathbf{r}}$ .
  29. u29 2.4 Model interventions
  30. u30 Activation addition.
  31. u31 Given a difference-in-means vector $\mathbf{r}^{(l)}\in\mathbb{R}^{d_{\text{model}}}$ extracted from layer $l$ , we can modulate the strength of the corresponding feature via simple linear interventions. Specifically, we can add the difference-in-means vector to the activations of a harmless input to shift them closer to the mean harmful activation, thereby inducing refusal:
  32. u32 Note that for activation addition, we intervene only at layer $l$ , and across all token positions.
  33. u33 Directional ablation.
  34. u34 To investigate the role of a direction $\hat{\mathbf{r}}\in\mathbb{R}^{d_{\text{model}}}$ in the model’s computation, we can erase it from the model’s representations using directional ablation. Directional ablation “zeroes out” the component along $\hat{\mathbf{r}}$ for every residual stream activation $\mathbf{x}\in\mathbb{R}^{d_{\text{model}}}$ :
  35. u35 We perform this operation at every activation $\mathbf{x}_{i}^{(l)}$ and $\tilde{\mathbf{x}}_{i}^{(l)}$ , across all layers $l$ and all token positions $i$ . This effectively prevents the model from ever representing this direction in its residual stream.
  36. u36 2.5 Evaluation of refusal and harmfulness
  37. u37 When generating model completions for evaluation, we always use greedy decoding and a maximum generation length of 512 tokens, as suggested in Mazeika et al. (2024). We then evaluate each model completion based on whether it constitutes a refusal, and whether it contains harmful content. We separate these evaluations into two scores: a refusal score and a safety score.
  38. u38 Refusal score.
  39. u39 Refusals often contain characteristic phrases, such as "I’m sorry" or "As an AI". Following prior work (Liu et al., 2023; Zou et al., 2023b; Xu et al., 2023; Robey et al., 2023; Shah et al., 2023a; Lermen et al., 2023), we compile a set of these common “refusal substrings”. If a model completion includes at least one such substring, it is classified as a refusal (refusal_score=1); otherwise, it is classified as a non-refusal (refusal_score=0). The full set of refusal substrings is provided in §D.1.
  40. u40 As has been previously noted (Qi et al., 2023; Huang et al., 2023; Meade et al., 2024; Shah et al., 2023a), this string-matching approach has limitations. While effective at detecting memorized refusals, it does not assess whether the completion is coherent or contains harmful content. To address these limitations, we use a complementary metric that evaluates the harmfulness of a completion.
  41. u41 Safety score.
  42. u42 In order to measure the harmfulness of a model completion, we use Meta Llama Guard 2 (Team, 2024), a widely-used open-source model fine-tuned to accurately detect harmful content. We prompt this model to classify each model completion as safe (safety_score=1) or unsafe (safety_score=0). More details are provided in §D.2.
  43. u43 3 Refusal is mediated by a single direction
  44. u44 For each model, we extract a single difference-in-means vector $\mathbf{r}$ via the methodology described in §2.3. We then show that this single direction is both necessary and sufficient for refusal. In §3.1, we show that ablating this direction $\hat{\mathbf{r}}$ effectively disables the model’s ability to refuse harmful requests. In §3.2, we show that adding $\mathbf{r}$ to the model’s activations induces refusal on harmless instructions.
  45. u45 3.1 Bypassing refusal via directional ablation
  46. u46 To bypass refusal, we perform directional ablation on the “refusal direction” $\hat{\mathbf{r}}$ , ablating it from activations at all layers and all token positions. With this intervention in place, we generate model completions over JailbreakBench (Chao et al., 2024), a dataset of 100 harmful instructions.
  47. u47 Results are shown in Figure 1. Under no intervention, chat models refuse nearly all harmful requests, yielding high refusal and safety scores. Ablating $\hat{\mathbf{r}}$ from the model’s residual stream activations, labeled as directional ablation, reduces refusal rates and elicits unsafe completions.
  48. u48 3.2 Inducing refusal via activation addition
  49. u49 To induce refusal, we add the difference-in-means vector $\mathbf{r}$ to activations in layer $l^{*}$ , the layer that the $\mathbf{r}$ was originally extracted from. We perform this intervention at all token positions. With this intervention in place, we generate model completions over 100 randomly sampled harmless instructions from Alpaca.
  50. u50 Results are shown in Figure 3. Under no intervention, chat models typically do not refuse harmless instructions. Adding $\mathbf{r}$ to the model’s residual stream activations, labeled as activation addition, results in the model refusing even harmless requests.
  51. u51 Figure 3: Adding the “refusal direction" induces refusal on 100 harmless instructions from Alpaca.
  52. u52 Figure 4: Adding the “refusal direction” to residual stream activations can induce refusal on harmless instructions. This example is taken from Gemma 7B IT. For more examples, see §K.2.
  53. u53 4 A white-box jailbreak via weight orthogonalization
  54. u54 In this section, we propose a novel white-box jailbreak method through weight orthogonalization. This technique directly modifies model weights to eliminate the representation of the refusal direction, resulting in a model that retains its original capabilities but no longer refuses harmful instructions. This new approach offers a simpler way to jailbreak open-source models compared to prior methodologies involving fine-tuning (Lermen et al., 2023; Yang et al., 2023; Zhan et al., 2023), as it does not require gradient-based optimization nor any examples of harmful completions.
  55. u55 4.1 Weight orthogonalization
  56. u56 In §2.4, we described directional ablation as an inference-time intervention that prevents the model from representing a direction $\hat{\mathbf{r}}$ : during a forward pass, we zero out the $\hat{\mathbf{r}}$ component from every intermediate residual stream activation (Equation 4). We can equivalently implement this operation by directly modifying component weights to never write to the $\hat{\mathbf{r}}$ direction in the first place. Specifically, we can take each matrix $W_{\text{out}}\in\mathbb{R}^{d_{\text{model}}\times d_{\text{input}}}$ that writes to the residual stream, and orthogonalize its column vectors with respect to $\hat{\mathbf{r}}$ :
  57. u57 In a transformer architecture, the matrices that write to the residual stream are: the embedding matrix, the positional embedding matrix, attention out matrices, and MLP out matrices. Orthogonalizing all of these matrices, as well as any output biases, with respect to the direction $\hat{\mathbf{r}}$ effectively prevents the model from ever writing $\hat{\mathbf{r}}$ to its residual stream.
  58. u58 Note that this weight modification is equivalent to the previously described inference-time directional ablation, as shown explicitly in §E. Therefore, the performance of the inference-time intervention in bypassing refusal, presented in §3.1, also exactly characterizes that of the direct weight modification.
  59. u59 4.2 Comparison to other jailbreaks
  60. u60 In this section, we compare our methodology to other existing jailbreak techniques using the standardized evaluation setup from HarmBench (Mazeika et al., 2024). Specifically, we generate completions over the HarmBench test set of 159 “standard behaviors”, and then use their provided classifier model to determine the attack success rate (ASR), which is the proportion of completions classified as successfully bypassing refusal. We evaluate our weight orthogonalization method on models included in the HarmBench study, and report its ASR alongside those of alternative jailbreaks. For brief descriptions of each alternative jailbreak, see §F.1.
  61. u61 Table 2: HarmBench attack success rate (ASR) across various jailbreaking methods. Our method is labeled as Ortho. The baseline “direct response” rate with no jailbreak applied is labeled as DR. We differentiate general jailbreaks, which are applied across all prompts generically, from prompt-specific jailbreaks, which are optimized for each prompt individually. All evaluations use the model’s default system prompt. We also report ASR without system prompt in blue.
  62. u62 Table 2shows that our weight orthogonalization method, labeled as Ortho, fares well compared to other general jailbreak techniques. Across the Qwen model family, our general method is even on par with prompt-specific jailbreak techniques like GCG (Zou et al., 2023b), which optimize jailbreaks for each prompt individually.
  63. u63 Note that HarmBench’s evaluation methodology specifies that each model’s default system prompt should be used during evaluation. While this approach is sensible for assessing the robustness of black-box systems, it is less applicable for white-box scenarios where attackers have full access to the model and can easily exclude the system prompt. Thus, we report ASR both with and without the system prompt.
  64. u64 We observe a notable difference in system prompt sensitivity across model families. For Llama-2 models, including the system prompt substantially reduces ASR compared to evaluation without it (e.g. 22.6% vs 79.9% for Llama-2 7B). In contrast, Qwen models maintain similar ASR regardless of system prompt inclusion (e.g. 79.2% vs 74.8% for Qwen 7B). While the Llama-2 system prompt contains explicit safety guidelines compared to the minimal Qwen system prompt, additional analysis in §F.2 suggests the discrepancy is not explained by prompt content alone, and may reflect differences in how these models respond to system-level instructions more generally.
  65. u65 4.3 Measuring model coherence
  66. u66 A reasonable concern with any new jailbreak technique is that, in addition to circumventing refusal, it may also degrade the model’s overall quality (Souly et al., 2024). However, qualitatively, we observe that models maintain their coherence after undergoing weight orthogonalization. While §3.1 and §4.2 show that our method effectively bypasses refusal, in this subsection we quantitatively evaluate how the modification alters a model’s general capabilities.
  67. u67 For each model and its orthogonalized version, we run four common language model evaluations: MMLU (Hendrycks et al., 2020), ARC (Clark et al., 2018), GSM8K (Cobbe et al., 2021), and TruthfulQA (Lin et al., 2021). All evaluations are run using LM Evaluation Harness (Gao et al., 2023), with settings consistent with Open LLM Leaderboard (Beeching et al., 2023).4
  68. u68 Table 3displays that, for MMLU, ARC, and GSM8K, orthogonalized models perform similarly to baseline models. In §G.1, we show that this holds across other models in our suite, with additional evaluations of WinoGrande (Sakaguchi et al., 2021) and TinyHellaSwag (Polo et al., 2024). Except for Qwen 7B and Yi 34B, all evaluation metrics for orthogonalized models lie within 99% confidence intervals of original performance.
  69. u69 Interestingly, accuracy on TruthfulQA consistently drops for orthogonalized models. This phenomenon is consistent with Yang et al. (2023), where it was observed that fine-tuning away safety guardrails results in decreased accuracy on TruthfulQA. Examining specific questions in TruthfulQA reveals that the dataset veers close to the territory of refusal, with categories including “misinformation”, “stereotypes”, and “conspiracies”, and thus it may intuitively make sense that model behavior differs meaningfully on this evaluation dataset. See §G.2 for further discussion of TruthfulQA performance.
  70. u70 In addition to standard language model evaluations, we also evaluate differences in CE loss, both on standard text corpora and model-specific generations (§G.3). These loss metrics suggest that directional ablation is more surgical than activation addition based methods (§I.1).
  71. u71 Table 3: Model evaluations. For each evaluation, we report the orthogonalized model’s performance, followed by the baseline model’s performance, followed by the absolute increase or decrease. We display the largest model from each model family. Full results are reported in §G.1.
  72. u72 5 Mechanistic analysis of adversarial suffixes
  73. u73 Safety fine-tuned chat models are vulnerable to adversarial suffix attacks (Zou et al., 2023b): there exist carefully constructed strings such that appending these strings to the end of a harmful instruction bypasses refusal and elicits harmful content. Effective adversarial suffixes are usually not human interpretable, and the mechanisms by which they work are not well understood. In this section, we mechanistically analyze the effect of an adversarial suffix on Qwen 1.8B Chat.
  74. u74 5.1 Adversarial suffixes suppress the refusal-mediating direction
  75. u75 Figure 5: Cosine similarity between last token residual stream activations and refusal direction.
  76. u76 We first identify a single adversarial suffix that effectively bypasses refusal in Qwen 1.8B Chat. The suffix is displayed in §H, along with details of its generation. To study the effect of this adversarial suffix, we sample 128 refusal-eliciting harmful instructions from JailbreakBench and the HarmBench test set. For each instruction, we run the model three times: first with the unedited instruction, second with the adversarial suffix appended, and third with a freshly-sampled random suffix of the same length appended. By comparing the adversarial suffix to random suffixes, we aim to control for the effect of appending any suffix at all. For each run, we cache the last token activations and visualize their cosine similarity with the refusal-mediating direction. We also compare to a baseline of 128 harmless instructions from Alpaca that do not elicit refusal. Figure 5 shows that the expression of the refusal direction is very high for harmful instructions, and remains high when a random suffix is appended. The expression of the refusal direction after appending the adversarial suffix is heavily suppressed, and closely resembles that of harmless instructions.
  77. u77 5.2 Adversarial suffixes hijack the attention of important heads
  78. u78 (a) Attention head outputs at last token position, projected onto refusal direction.
  79. u79 (b) Attention from last token position to source token regions.
  80. u80 Figure 6: We analyze the top eight attention heads that most significantly write to the refusal direction. Figure 6(a) shows that output to the refusal direction is heavily suppressed when the adversarial suffix is appended. Figure 6(b) reveals that, compared to appending a random suffix, appending the adversarial suffix shifts attention from tokens in the instruction region to tokens in the suffix region.
  81. u81 To further investigate how the refusal direction is suppressed, we examine the contributions of individual attention head and MLP components to the refusal direction. We quantify each component’s contribution to this direction using direct feature attribution (DFA) (Makelov et al., 2024; Kissane et al., 2024): each component’s direct contribution can be measured by projecting its output onto the refusal direction. We select the top eight attention heads with the highest DFA on harmful instructions, and then investigate how their behavior changes when suffixes are appended. Figure 6(a) shows that the direct contributions of these heads to the refusal direction are significantly suppressed when the adversarial suffix is appended, as compared with no suffix and random suffixes.
  82. u82 To understand how the outputs of these attention heads are altered, we examine their attention patterns. Figure 6(b) illustrates that the adversarial suffix effectively “hijacks” the attention of these heads. Normally, these heads focus on the instruction region of the prompt, which contains harmful content. With the adversarial suffix appended, these heads shift their attention to the suffix region, and away from the harmful instruction.
  83. u83 6 Related work
  84. u84 Understanding refusal in language models.
  85. u85 Wei et al. (2024) demonstrate that removing a set of safety-critical neurons and ranks can degrade safety mechanisms while preserving utility. Zheng et al. (2024) and Zou et al. (2023a) both use contrastive pairs of harmful and harmless inputs to identify the model’s representation of harmfulness, asserting that this direction is distinct from the model’s representation of refusal. Zheng et al. (2024) argue this by showing that safety prompts shift activations in a distinct direction, while Zou et al. (2023a) show that the representation is not significantly altered by adversarial suffixes. Note that this is in contrast to our findings in §5.1 that the refusal direction is significantly suppressed in the presence of an adversarial suffix. Zou et al. (2023a) additionally introduce a “piece-wise” intervention to effectively amplify representations of harmfulness, and show that this intervention increases refusal on harmful inputs even when jailbreaks are applied. Panickssery et al. (2023) use contrastive multiple-choice completions, finding that steering with the resulting vector is effective at modulating refusal in multiple-choice settings but not in long-form generation. Wang and Shu (2024) introduce a “Trojan Activation Attack” that adds steering vectors to bypass refusal during inference. Li et al. (2024b) identify a “safety pattern” by selecting individual neurons in each layer, and modulate refusal by zeroing out these neurons, although with unclear effects on the overall model performance.
  86. u86 Features as directions.
  87. u87 Extracting feature directions from contrastive pairs of inputs is an established technique (Burns et al., 2022; Panickssery et al., 2023; Zou et al., 2023a). It is well understood that adding feature vectors to the residual stream can modify behavior (Turner et al., 2023; Zou et al., 2023a; Tigges et al., 2023; Panickssery et al., 2023; Marks and Tegmark, 2023; Li et al., 2024a), although details on how and where to intervene vary (Jorgensen et al., 2023; von Rütte et al., 2024).
  88. u88 Various works show that directions in activation space have more “feature-like” properties than neurons do (Elhage et al., 2022; Mikolov et al., 2013; Park et al., 2023b; Li et al., 2021; Geiger et al., 2024; Hernandez and Andreas, 2021; Nanda et al., 2023; Bolukbasi et al., 2016). Recent works use sparse autoencoders to discover feature directions in an unsupervised manner (Bricken et al., 2023; Cunningham et al., 2023; Templeton et al., 2024). The assumption that features are represented linearly has been effective for erasing concepts from language models (Belrose et al., 2024; Belrose, 2023; Ravfogel et al., 2020; Guerner et al., 2023; Haghighatkhah et al., 2022; Shao et al., 2022).
  89. u89 Undoing safety fine-tuning.
  90. u90 It is well known that fine-tuning on malicious examples is sufficient to undo safety guardrails (Lermen et al., 2023), even with minimal degradation of overall capabilities (Yang et al., 2023; Zhan et al., 2023). Undoing refusal via fine-tuning requires examples of harmful instructions and completions, while our method requires only harmful instructions. Note however that fine-tuning can weaken safety guardrails even when data is benign (Qi et al., 2023; Pelrine et al., 2023). Mechanistic interpretability works have provided initial evidence suggesting that fine-tuning does not significantly alter relevant internal circuitry (Lee et al., 2024; Prakash et al., 2024; Jain et al., 2023). For example, Lee et al. (2024) fine-tune a model to make it less toxic, and find this behavioral modification can be undone simply by scaling a small number of MLP weights.
  91. u91 Jailbreaks.
  92. u92 The research area of circumventing restrictions on LLM behavior by modifying the input has seen many different directions of work. Many models are vulnerable to social engineering attacks (Wei et al., 2023; Shah et al., 2023b; Perez et al., 2022). One hypothesis for why this works is that such prompts modify the LLM assistant’s "persona" (Andreas, 2022; Shanahan et al., 2023; Park et al., 2023a). Preliminary experiments in §L suggest that our method does not change the model’s chat personality or behavior outside of refusal.
  93. u93 Optimized adversarial suffixes (Zou et al., 2023b; Andriushchenko et al., 2024; Liao and Sun, 2024) can be appended to prompts to bypass refusal. In contrast, our method does not require any modifications to the input prompt, but has the obvious limitation that we require access to the model’s weights. However, note that transferability of jailbreak prompts optimized on open-weight models on black-box models is unclear (Meade et al., 2024). Jailbreak prompts may have significant impact on model performance (Souly et al., 2024), whereas our method does not (§4.3).
  94. u94 7 Discussion
  95. u95 In this work, we demonstrate that refusal behavior is consistently mediated by a single direction across a diverse set of open-source chat models. Based on this understanding, we propose a simple yet effective white-box jailbreak method that directly modifies model weights to disable the refusal mechanism while retaining model coherence. Our work demonstrates the practical utility of model-internals based interpretability: by studying refusal through the lens of model internals, we were able to create a simple yet effective jailbreak method. The simplicity of the model’s refusal mechanism, and the ease of circumventing it in the white-box setting, raise concerns about the robustness of current alignment techniques.
  96. u96 Limitations.
  97. u97 Our study has several limitations. While we evaluate a broad range of open-source models, our findings may not generalize to untested models, especially those at greater scale, including current state-of-the-art proprietary models and those developed in the future. Additionally, the methodology we used to extract the “refusal direction” is likely not optimal and relies on several heuristics. We see this paper as more of an existence proof that such a direction exists, rather than a careful study of how best to extract it, and we leave methodological improvements to future work. Furthermore, our analysis of adversarial suffixes does not provide a comprehensive mechanistic understanding of the phenomenon, and is restricted to a single model and a single adversarial example. Another limitation is that it is difficult to measure the coherence of a chat model, and we consider each metric used flawed in various ways. We use multiple varied metrics to give a broad view of coherence. Finally, while our work identifies a single direction that mediates refusal behavior in each model, we acknowledge that the semantic meaning of these directions remains unclear. Though we use the term “refusal direction” as a functional description, these directions could represent other concepts such as “harm” or “danger”, or they may even resist straightforward semantic interpretation.
  98. u98 Ethical considerations.
  99. u99 Any work on jailbreaking LLMs must ask the question of whether it enables novel harms. It is already widely known that open-source model weights can be jailbroken via fine-tuning. Our method, which can yield a jailbroken version of a 70B parameter model using less than $5 of compute, is simpler than previous fine-tuning methods, requiring neither gradient-based optimization nor a dataset of harmful completions. While we acknowledge that our methodology marginally lowers the bar for jailbreaking open-source model weights, we believe that it does not substantially alter the risk profile of open sourcing models.
  100. u100 Although the risk of misuse posed by today’s language models may be relatively low (Anthropic, 2024; Mouton et al., 2024), the rapid advancement of state-of-the-art model capabilities suggests that this risk could become significant in the near future. Our work contributes to the growing body of literature that highlights the fragility of current safety mechanisms, demonstrating that they can easily be circumvented and are insufficient to prevent the misuse of open-source LLMs. Building a scientific consensus around the limitations of current safety techniques is crucial for informing future policy decisions and research efforts.
  101. u101 Acknowledgments and Disclosure of Funding
  102. u102 Author contributions.
  103. u103 AA led the research project, and led the writing of the paper. AA discovered and validated that ablating a single direction bypasses refusal, and came up with the weight orthogonalization trick. OO ran initial experiments identifying that it is possible to jailbreak models via activation addition. AA and OO implemented and ran all experiments presented in the paper, with DP helping to run model coherence evaluations. DP investigated behavior of the orthogonalized models, suggested more thorough evaluations, and assisted with the writing of the paper. AS ran initial experiments testing the causal efficacy of various directional interventions, and identified the suffix used in §5 as universal for Qwen 1.8B Chat. NP first proposed the idea of trying to extract a linear refusal direction (Panickssery, 2023), and advised the initial project to mechanistically understand refusal in Llama-2 7B Chat (Arditi and Obeso, 2023). WG advised on methodology and experiments, and assisted with the writing and framing of the paper. NN acted as primary supervisor for the project, providing guidance and feedback throughout.
  104. u104 Acknowledgements.
  105. u105 AA and OO began working on the project as part of the Supervised Program for Alignment Research (SPAR) program, mentored by NP. AA and AS continued working on the project as part of the ML Alignment & Theory Scholars (MATS) program, mentored by NN.
  106. u106 We thank Florian Tramèr for providing generous compute resources and for offering comments on an earlier draft. We also thank Philippe Chlenski for providing thoughtful feedback on the manuscript. For general support throughout the research process, we thank McKenna Fitzgerald, Rocket Drew, Matthew Wearden, Henry Sleight, and the rest of the MATS team, and also Arthur Conmy. We also thank the staff at Lighthaven and London Initiative for Safe AI (LISA) for cultivating great environments in which to conduct research. We are grateful to the anonymous reviewers for their valuable feedback which helped improve this paper.
  107. u107 Tooling.
  108. u108 For our exploratory research, we used TransformerLens (Nanda and Bloom, 2022). For our experimental pipeline, we use HuggingFace Transformers (Wolf et al., 2020), PyTorch (Paszke et al., 2019), and vLLM (Kwon et al., 2023). We used Together AI remote inference to compute the safety_score metric quickly.
  109. u109 Disclosure of funding.
  110. u110 AA and OO are funded by Long-Term Future Fund (LTFF). AA and AS are funded by AI Safety Support (AISS).
  111. u111 Appendix A Dataset details
  112. u112 A.1 Harmful instructions
  113. u113 To construct $\mathcal{D}_{\text{harmful}}^{\text{(train)}}$ , we randomly sample a total of 128 harmful instructions from AdvBench (Zou et al., 2023b), MaliciousInstruct (Huang et al., 2023), and TDC2023 (Mazeika et al., 2024; Mazeika et al., 2023).
  114. u114 To construct $\mathcal{D}_{\text{harmful}}^{\text{(val)}}$ , we sample 32 instructions from the HarmBench validation set (Mazeika et al., 2024). We use only the “standard behaviors”, and exclude instructions that require context or concern copyright violations.
  115. u115 In §3, we evaluate over JailbreakBench (Chao et al., 2024), a dataset containing 100 harmful instructions, spanning 10 categories: harassment/discrimination, malware/hacking, physical harm, economic harm, fraud/deception, disinformation, sexual/adult content, privacy, expert advice, government decision-making.
  116. u116 In §4, we evaluate over the HarmBench test set (Mazeika et al., 2024). We consider only the 159 “standard behaviors”, and exclude instructions that require context or concern copyright violations. These harmful instructions span 6 categories: cybercrime & unauthorized intrusion, chemical & biological weapons/drugs, misinformation & disinformation, harassment & bullying, illegal activities, general harm.
  117. u117 Note that we perform filtering to ensure that $\mathcal{D}_{\text{harmful}}^{\text{(train)}}$ , $\mathcal{D}_{\text{harmful}}^{\text{(val)}}$ , and the two evaluation datasets are all pairwise disjoint, containing no overlapping instructions.
  118. u118 Figure 7: A random sample of instructions from .
  119. u119 A.2 Harmless instructions
  120. u120 To construct the harmless datasets, we sample instructions from Alpaca (Taori et al., 2023). $\mathcal{D}_{\text{harmless}}^{\text{(train)}}$ contains 128 instructions, and $\mathcal{D}_{\text{harmless}}^{\text{(val)}}$ contains 32 instructions.
  121. u121 In §3, we evaluate over 100 instructions from Alpaca.
  122. u122 Note that $\mathcal{D}_{\text{harmless}}^{\text{(train)}}$ , $\mathcal{D}_{\text{harmless}}^{\text{(val)}}$ , and the evaluation dataset are all pairwise disjoint, containing no overlapping instructions.
  123. u123 Figure 8: A random sample of instructions from .
  124. u124 Appendix B Refusal metric: an efficient proxy for measuring refusal
  125. u125 Evaluating whether a model refuses a particular instruction is most accurately done by generating a full completion using greedy decoding, and then assessing whether the generated text constitutes a refusal. However, this process can be computationally expensive, especially when working with large models and a large number of instructions. To address this, we define a more efficient proxy for estimating the likelihood of a model refusing a given instruction without requiring generation (Figure 10).
  126. u126 We observe that each model tends to have a small set of characteristic phrases that it typically uses to begin its refusals (Figure 9). This allows us to approximate the probability of refusal by examining the model’s next token probability distribution at the last token position, which corresponds to the start of its completion.
  127. u127 Formally, for each model, we define a set of refusal tokens $\mathcal{R}\subseteq\mathcal{V}$ , which contains the tokens most likely to begin the model’s refusals (Table 4). We can then estimate the probability of refusal $P_{\text{refusal}}$ as the sum of the probabilities assigned to the tokens in $\mathcal{R}$ . Given a vector of next token probabilities $\mathbf{p}=(p_{1},p_{2},\ldots,p_{|\mathcal{V}|})\in\mathbb{R}^{|\mathcal{V}|}$ , we define
  128. u128 To create a more informative “refusal metric”, we take the log-odds of $P_{\text{refusal}}$ . This transformation helps to better distinguish between extreme probabilities that are close to 0 or 1 (Wang et al., 2023).
  129. u129 We use this metric to filter out instructions in our test and validation datasets: for harmful instructions, we filter out prompts yielding $\texttt{refusal\_metric}<0$ , and for harmless instruction, we filter out prompts yielding $\texttt{refusal\_metric}>0$ . We also use this metric to quickly evaluate the efficacy of interventions over the validation set (§C).
  130. u130 (a) Top-10 token probabilities for Gemma 2B IT, averaged over 128 harmful instructions.
  131. u131 (b) Top-10 token probabilities for Gemma 2B IT, averaged over 128 harmless instructions.
  132. u132 Figure 9: Next token probabilities for Gemma 2B IT across harmful and harmless instructions.
  133. u133 Figure 10: The refusal metric separates harmful and harmless instructions for Gemma 2B IT. Refusals generally begin with token (corresponding to ‘I’). Setting yields a refusal metric that is an efficient proxy for assessing whether the model will refuse.
  134. u134 Table 4: The refusal token set that we use for each model family, along with the refusal phrases corresponding to each token.
  135. u135 Appendix C Direction selection
  136. u136 C.1 Direction selection algorithm
  137. u137 Given a set of difference-in-means vectors $\{\mathbf{r}_{i}^{(l)}|i\in I,l\in\lceil L\rceil\}$ , we want to select the best vector $\mathbf{r}_{i^{*}}^{(l^{*})}$ . For each vector $\mathbf{r}_{i}^{(l)}$ , we compute the following:
  138. u138 bypass_score: under directional ablation of $\mathbf{r}_{i}^{(l)}$ , compute the average refusal metric across $\mathcal{D}_{\text{harmful}}^{\text{(val)}}$ .
  139. u139 induce_score: under activation addition of $\mathbf{r}_{i}^{(l)}$ , compute the average refusal metric across $\mathcal{D}_{\text{harmless}}^{\text{(val)}}$ .
  140. u140 kl_score: run the model on $\mathcal{D}_{\text{harmless}}^{\text{(val)}}$ with and without directional ablation of $\mathbf{r}_{i}^{(l)}$ , and compute the average KL divergence between the probability distributions at the last token position.
  141. u141 We then select $\mathbf{r}_{i^{*}}^{(l^{*})}$ to be the direction with minimum bypass_score, subject to the following conditions:
  142. u142 $\texttt{induce\_score}>0$
  143. u143 This condition filters out directions that are not sufficient to induce refusal.
  144. u144 $\texttt{kl\_score}<0.1$
  145. u145 This condition filters out directions that significantly change model behavior on harmless prompts when ablated.
  146. u146 $l<0.8L$
  147. u147 This condition ensures that the direction is not too close to the unembedding directions. Intuitively, one could disable refusal by preventing the model from writing to refusal unembed directions, e.g. directions corresponding to the ‘I’ or ‘As’ unembedding directions, and this would directly prevent the model from outputting these refusal tokens. However, we restrict our search to higher level features, and do not prevent the model from outputting specific tokens (see §L.1).
  148. u148 Using the compute setup described in §N, this direction selection procedure takes about an hour to run for the largest models (72 billion parameters), and faster for smaller models.
  149. u149 C.2 Direction selection for each model
  150. u150 We report details of direction selection for each model in Table 5, including the token position $i^{*}$ and layer $l^{*}$ from which the direction was sourced, along with the direction’s corresponding metrics.
  151. u151 Figure 11displays the bypass_score and induce_score of all candidate directions for Llama-3 8B Instruct.
  152. u152 Table 5: Direction selection details for each model. Note that indicates that the direction is selected from the last token position, the second-to-last token position, and so on. Also note that the layer index starts from index 0, while indicates the total number of layers.
  153. u153 Figure 11: The bypass_score (left) and induce_score (right) of each candidate direction for Llama-3 8B Instruct. Each candidate direction corresponds to source position and source layer .
  154. u154 C.3 Chat templates
  155. u155 We use the default chat template for each model family. All chat templates are displayed in Table 6.
  156. u156 Table 6: Model families and their corresponding chat templates. The user instruction is denoted as {x}. Post-instruction tokens, as defined in §2.1, are labeled in red.
  157. u157 Appendix D Refusal evaluation
  158. u158 D.1 Refusal score
  159. u159 For a model completion $\mathbf{c}$ , $\texttt{refusal\_score}(\mathbf{c})=1$ if $\mathbf{c}$ contains at least one “refusal substring”; otherwise $\texttt{refusal\_score}(\mathbf{c})=0$ .
  160. u160 Figure 12displays the “refusal substrings” that are used in the refusal_score evaluation. Note that the substring comparison is not sensitive to capitalization, and checks that the phrases are contained anywhere in the completion, not just at the start.
  161. u161 Figure 12: The set of “refusal substrings”, used to evaluate the refusal_score of a given completion.
  162. u162 D.2 Safety score
  163. u163 For a model completion $\mathbf{c}$ , $\texttt{safety\_score}(\mathbf{c})=1$ if Meta Llama Guard 2 (Team, 2024) outputs that the completion is safe; otherwise $\texttt{safety\_score}(\mathbf{c})=0$ .
  164. u164 Figure 13displays the template used to prompt Meta Llama Guard 2. Note that we use the default prompt specified by the model providers, without any custom alteration.
  165. u165 Figure 13: The default prompt template for Meta Llama Guard 2, used to evaluate the safety_score of a given completion.
  166. u166 D.3 Challenges of evaluating refusal
  167. u167 Assessing whether a completion constitutes a successful jailbreak is complex. In this subsection, we highlight scenarios that are ambiguous, motivating our use of two metrics.
  168. u168 Figure 14and Figure 15 display cases in which the model does not explicitly refuse, but also does not provide a harmful response. In these scenarios, refusal_score=0 while safety_score=1.
  169. u169 Figure 16displays a case in which the model initially refuses, but then goes on to give a harmful response. In these scenarios, refusal_score=1 while safety_score=0.
  170. u170 D.4 Reporting of confidence intervals
  171. u171 In Figure 1 and Figure 3, we display error bars corresponding to standard error (SE), computed as $\text{SE}=\sqrt{\frac{p(1-p)}{n}}$ . In both cases, $n=100$ .
  172. u172 Figure 14: Challenges of evaluating refusal. The model completion does not explicitly use a refusal phrase (refusal_score=0), but it does not contain harmful content (safety_score=1). This completion is taken from the orthogonalized Llama-3 70B Chat model.
  173. u173 Figure 15: Challenges of evaluating refusal. The model completion does not use a refusal phrase (refusal_score=0), but it does not contain harmful content (safety_score=1). This completion is taken from the orthogonalized Gemma 7B IT model.
  174. u174 Figure 16: Challenges of evaluating refusal. The model completion does use a refusal phrase (refusal_score=1), but it also contains harmful content (safety_score=0). This completion is taken from the orthogonalized Qwen 72B Chat model.
  175. u175 Appendix E Weight orthogonalization is equivalent to directional ablation
  176. u176 To show the equivalence of directional ablation and weight orthogonalization, we consider all matrices that directly write contributions to the residual stream.
  177. u177 Let $W_{\text{out}}\in\mathbb{R}^{d_{\text{model}}\times d_{\text{input}}}$ be a matrix that writes to the residual stream, mapping vectors from $\mathbb{R}^{d_{\text{input}}}$ to $\mathbb{R}^{d_{\text{model}}}$ .5 Let the unit norm vector $\hat{\mathbf{r}}\in\mathbb{R}^{d_{\text{model}}}$ denote the direction to be ablated.
  178. u178 Now let $\mathbf{x}_{\text{pre}}\in\mathbb{R}^{d_{\text{model}}}$ denote the residual stream activation before $W_{\text{out}}$ adds a contribution to the residual stream, let $\mathbf{x}_{\text{post}}$ denote the residual stream activation after, and let $\mathbf{t}\in\mathbb{R}^{d_{\text{input}}}$ denote the input to $W_{\text{out}}$ :
  179. u179 With directional ablation, we take $\mathbf{x}_{\text{post}}$ and zero out its projection onto $\hat{\mathbf{r}}$ :
  180. u180 Supposing that directional ablation was similarly applied after all previous contributions to the residual stream, we have that $\hat{\mathbf{r}}^{\intercal}\mathbf{x}_{\text{pre}}=0$ :
  181. u181 where $W_{\text{out}}^{\prime}=W_{\text{out}}-\hat{\mathbf{r}}\hat{\mathbf{r}}^{\intercal}W_{\text{out}}$ , as specified by weight orthogonalization in Equation 5.
  182. u182 Appendix F Jailbreak evaluation
  183. u183 F.1 Comparing to other jailbreaks
  184. u184 To compare the effectiveness of our jailbreak method to other methods in the literature, we report the 5 top performing jailbreak attacks, as ranked by HarmBench attack success rate (ASR) on the Llama-2 model family: GCG is the algorithm from Zou et al. (2023b) which optimizes an adversarial suffix for each prompt and each model; GCG-M is the multi-prompt version of GCG, trained over multiple prompts for each model; GCG-T is the transferable version of GCG-M, trained over multiple prompts and across multiple models; AP is the AutoPrompt approach from Shin et al. (2020); PAIR is a black-box method from Chao et al. (2023). We also include comparisons to the set of human-written “Do Anything Now” adversarial templates from Shen et al. (2023) (Human), and the “direct response” baseline without any jailbreaks in place (DR).
  185. u185 F.2 Effect of system prompts on evaluation
  186. u186 Table 2shows that the attack success rate (ASR) of our weight orthogonalization methodology is sensitive to system prompts. Including the default system prompt in evaluation substantially reduces HarmBench ASR for Llama-2 models, while having minimal effect on Qwen models.
  187. u187 As shown in Figure 17, the Llama-2 default system prompt includes explicit guidelines to avoid harmful or inappropriate content. In contrast, the Qwen default system prompt, shown in Figure 18, is minimal and lacks specific directives about safety or ethics.
  188. u188 We initially hypothesized that the discrepancy in ASR might be due to the Llama-2 system prompt’s explicit guidelines, making it particularly effective at enforcing safety guardrails. To test this, we applied the Llama-2 system prompt to Qwen models, but observed no significant change in ASR, as shown in Table 7. This suggests that the impact of system prompts on ASR may be model-dependent.
  189. u189 To investigate Llama-2’s responsiveness to system prompts further, we evaluated the same orthogonalized Llama-2 7B model with 12 diverse system prompts (shown in Figure 19). This evaluation revealed substantial variability in ASR scores for Llama-2 7B, with a mean of 30.0% and standard deviation of 23.3%, while Qwen 7B maintained a more consistent performance across the same set of prompts, with a mean of 76.7% and standard deviation of 5.9%. These findings suggest that Llama-2 models may be more responsive to system-level instructions than other model families, particularly with respect to safety-related behaviors. A more systematic study would be necessary to fully understand these differences, as well as the broader relationship between system prompts and refusal behaviors, which we leave as directions for future research.
  190. u190 Figure 17: The default system prompt for Llama-2 Chat.
  191. u191 Figure 18: The default system prompt for Qwen Chat.
  192. u192 Table 7: Attack success rate (ASR) on HarmBench using different system prompts. The Qwen Chat system prompt is minimal, while the Llama-2 Chat system prompt contains explicit safety guidelines. Orthogonalized Qwen Chat models maintain high ASR even with the more restrictive Llama-2 Chat system prompt. See Figure 17 and Figure 18 for the full system prompts.
  193. u193 Figure 19: The set of system prompts used to evaluate model sensitivity. Note that “[none]” indicates no system prompt was provided, while “[empty string]” indicates an empty string was provided as the system prompt.
  194. u194 Appendix G Model coherence evaluation
  195. u195 G.1 Language model evaluation
  196. u196 Table 8: Model evaluations. For each evaluation, we report the orthogonalized model’s performance, followed by the baseline model’s performance, followed by the absolute increase or decrease.
  197. u197 Except on TruthfulQA, orthogonalization has a very small effect on general performance benchmarks. We observe less than 1% performance drop on average, with the difference to the baseline performance being indistinguishable from noise in most cases. The main exceptions are Qwen 7B, which has statistically significant drops on MMLU and GSM8K, and Yi 34B with drops on MMLU and Winogrande.
  198. u198 For MMLU, we use the default settings from LM Evaluation Harness (Gao et al., 2023; Biderman et al., 2024) as of May 2024. For the other benchmarks, we use the default settings, with the exception that models are run using vLLM (Kwon et al., 2023).
  199. u199 TinyHellaSwag from TinyBenchmarks (Polo et al., 2024) is a statistically informative 400-sample subset of the larger HellaSwag (Zellers et al., 2019) test set. Polo et al. (2024) claim a 2% average error compared to the full-sized counterparts.
  200. u200 G.2 TruthfulQA accuracy
  201. u201 TruthfulQA measures the performance of language models in generating truthful and accurate responses, particularly in areas prone to human misconceptions and falsehoods. Table 8 displays clearly that TruthfulQA performance is consistently worse for orthogonalized models as compared with unmodified models. TruthfulQA contains questions that touch on sensitive topics such as misinformation, stereotypes, and conspiracies. For such questions, models with and without safety guardrails may understandably generate different responses. Figure 20 displays an example of a conspiracy-flavored question from TruthfulQA, and the contrasting responses from Llama-3 8B Instruct and its orthogonalized version.
  202. u202 Figure 20: A question from TruthfulQA, and corresponding completions from Llama-3 8B Instruct and its orthogonalized version.
  203. u203 G.3 CE loss evaluation
  204. u204 In addition to standard language model evaluations, we also check changes in cross-entropy (CE) loss over various datasets. For each chat model and its orthogonalized version we compute CE loss over a sample of The Pile (Min et al., 2023). The Pile consists of scraped webtext, and so we do not append any chat template when evaluating CE loss.
  205. u205 We note that some chat models are especially sensitive to chat templates, and behave poorly without them. Thus, we also evaluate over Alpaca (Taori et al., 2023), which is a chat dataset consisting of instructions and completions. We format each instruction according to each model’s chat template, and compute CE loss only over the completion tokens.
  206. u206 We further note that some chat models, seemingly Gemma 7B IT in particular, have high CE loss on text that is out of distribution, e.g. completions from Alpaca. To account for this, we take each baseline model, and generate completions on 100 instructions from Alpaca. We then compute CE loss over these “on-distribution” completion tokens.
  207. u207 All CE loss values are reported in Table 9. We denote the orthogonalized model as “Ablation”. We also compare to activation addition methodology, labeled “Act Add”, where rather than ablating the refusal direction, we subtract the difference-in-means vector. See §I.1 for a more detailed discussion of bypassing refusal via activation addition.
  208. u208 Table 9: Model performance as measured by CE loss across different datasets.
  209. u209 Appendix H Adversarial suffix analysis
  210. u210 H.1 Adversarial suffix generation
  211. u211 Using a custom implementation of Greedy Coordinate Gradient (GCG) (Zou et al., 2023b), we generated 100 adversarial suffixes of token-length 20, each of which was optimized for a particular behavior from AdvBench.
  212. u212 Of these 100 suffixes, we found one suffix in particular that performs well across a wide range of harmful prompts. The suffix is shown in Figure 21.
  213. u213 Figure 21: The adversarial suffix studied in §5. This suffix is generally effectively in bypassing refusal in Qwen 1.8B Chat.
  214. u214 While we would ideally perform analysis over a larger number of suffixes and models, we found it difficult to find suffixes that are universal across prompts and transferable across models (Meade et al., 2024). We therefore restrict our analysis to a single model, Qwen 1.8B Chat, and a single suffix.
  215. u215 H.2 Reporting of confidence intervals
  216. u216 In Figure 5, for each layer and scenario, we display the standard deviation (SD) of cosine similarities across 128 prompts, computed as $\text{SD}=\sqrt{\frac{\sum{(x_{i}-\overline{x})^{2}}}{n}}$ . In this case, $n=128$ .
  217. u217 Appendix I Comparison to other methodologies
  218. u218 In §3.1, we use directional ablation to bypass refusal. In §4, we show how this can be implemented as a direct weight modification, and then analyze the modification’s effect on refusal and coherence.
  219. u219 In this section, we compare directional ablation to two other weight modification methodologies: activation addition and fine-tuning.
  220. u220 I.1 Comparison to activation addition
  221. u221 Figure 22: A visualization of activation addition (abbreviated as “act add”) in the negative refusal direction. The intervention pulls harmful activations towards harmless activations, effectively bypassing refusal. However, note that the intervention pushes harmless activations far out of distribution. This figure displays activations from Gemma 7B IT, computed over 128 harmful and harmless prompts.
  222. u222 In §2.4, we described how to induce refusal using activation addition. Given a difference-in-means vector $\mathbf{r}^{(l)}\in\mathbb{R}^{d_{\text{model}}}$ extracted from layer $l$ , we can add this vector at layer $l$ in order to shift activations towards refusal (Equation 3). Similarly, we can subtract this vector at layer $l$ in order to shift activations away from refusal:
  223. u223 We perform this intervention at all token positions. Note that this intervention can be implemented as a direct weight modification by subtracting $\mathbf{r}^{(l)}$ from the bias term of $\texttt{MLP}^{(l-1)}$ .
  224. u224 As shown in Figure 23, this activation addition intervention is effective in bypassing refusal. The decreases in refusal score and safety score are comparable to those achieved by directional ablation (Figure 1). However, Table 9 displays that the activation addition intervention, labeled as act add, causes increased loss over harmless data, in particular compared to directional ablation.
  225. u225 Figure 22displays a visualization of activation addition in the negative refusal direction, and suggests an intuitive explanation of the intervention’s behavior on harmful and harmless prompts. On harmful inputs, adding the negative refusal direction shifts the harmful activations towards harmless activations, with respect to projection onto the refusal direction. With low projection onto the refusal direction, this intervention leads to low rates of refusal. However, on harmless inputs, adding the negative refusal direction shifts the harmless activations off distribution, resulting in increased perplexity.
  226. u226 Note that, in comparison to activation addition, directional ablation shifts harmful activations towards harmless activations, while also not shifting harmless activations too far off distribution.
  227. u227 Figure 23: Performing activation addition in the negative “refusal direction”, displayed in dots, reduces refusal rates and elicits unsafe completions. It is approximately as effective as directional ablation at bypassing refusal (Figure 1).
  228. u228 I.2 Comparison to fine-tuning
  229. u229 Table 10: Refusal and CE loss evaluation metrics for Llama-3 8B Instruct, comparing the interventions of directional ablation, activation addition, and fine-tuning.
  230. u230 Prior work has established that fine-tuning is effective in removing safety guardrails of chat models (Yang et al., 2023; Lermen et al., 2023; Zhan et al., 2023).
  231. u231 We replicate this result by fine-tuning Llama-3 8B Instruct. First, we construct a dataset of harmful instruction-completion pairs. For the harmful instructions, we sample instructions from AdvBench, MaliciousInstruct, TDC2023, and HarmBench. To generate corresponding harmful completions, we use Mistral 7B Instruct (Jiang et al., 2023), a competent chat model with low refusal rates. For each harmful instruction, we generate 5 completions, and then select a single completion satisfying both refusal_score=0 and safety_score=0. If no completions satisfy this condition, then the instruction is discarded. After this filtering, we were left with a dataset of 243 harmful instruction-completion pairs.
  232. u232 We then fine-tuned Llama-3 8B Instruct on the constructed dataset, applying LoRA (Hu et al., 2021) with rank=16 and alpha=32 for 4 epochs. The LoRA fine-tuning was performed on an A100 GPU with 80GB of VRAM, and took approximately 10 minutes.
  233. u233 Evaluations of refusal and CE loss are displayed in Table 10. In accordance with prior work, we confirm fine-tuning to be very effective in disabling refusal. We speculate that the decrease in CE loss over Alpaca could be due to the similarity between the distributions of Mistral Instruct completions and Alpaca completions, and as a result, fine-tuning over Mistral Instruct completions leads to a decreased CE loss over Alpaca completions.
  234. u234 We note that, although the LoRA fine-tuning process itself is straightforward and efficient, creating a high-quality dataset of harmful instruction-completion pairs requires non-trivial effort. In comparison, directional ablation (and its equivalent implementation via weight orthogonalization) requires just a dataset of harmful instructions, without the need for any harmful completions.
  235. u235 Appendix J The “refusal direction” is also present in base models
  236. u236 Throughout this work, we consider only chat models, models that have undergone fine-tuning to follow benign instructions and refuse harmful ones. Prior to this fine-tuning process, models are essentially just next-token predictors, referred to as base models. By default, base models are not instruction-following. For instance, if prompted with a question, a base model is likely to output another question, rather than an answer to the original question. In particular, base models do not refuse harmful requests.
  237. u237 In §3, we argue that refusal in chat models is mediated by a single direction in activation space. One natural question is whether this direction, or feature, is learned from scratch during safety fine-tuning specifically to mediate refusal, or whether this direction is already present in the base model and gets repurposed, or “hooked into”, during safety fine-tuning.
  238. u238 To investigate this question, we check the expression of the refusal direction in chat and base models. For each model, we sample 128 harmful and harmless instructions, run inference on both the chat model (e.g. Llama-3 8B Instruct) and its corresponding base model (e.g. Llama-3 8B), and cache all intermediate activations at the last token position.6 We then take the refusal direction extracted from the corresponding chat model (§2.3), and examine the cosine similarity of each activation with this direction.
  239. u239 Figure 24displays the results for four distinct models. We find that, similarly to the chat models, corresponding base models have high cosine similarity with the refusal direction when run on harmful prompts, and low cosine similarity when run on harmless prompts. This suggests that, rather than developing the “refusal direction” from scratch during fine-tuning, this representation exists already in the base model, and is repurposed for refusal during safety fine-tuning.
  240. u240 Figure 24: Cosine similarity of activations with the refusal direction, for base (dotted lines) and chat (solid lines) models. The refusal direction is expressed similarly in base and chat models.
  241. u241 Appendix K Extended results
  242. u242 As throughout the paper, all generations are generated deterministically using greedy decoding.
  243. u243 K.1 Bypassing refusal - examples
  244. u244 Figure 25: Examples of bypassing refusal by ablating the “refusal direction”. These completions are taken from Llama-3 70B Instruct.
  245. u245 K.2 Inducing refusal - examples
  246. u246 Figure 26: Examples of inducing refusal by adding the “refusal direction”. These completions are taken from Gemma 7B IT.
  247. u247 Appendix L Further experiments with orthogonalized models
  248. u248 As throughout the paper, all generations are generated deterministically using greedy decoding. All experiments in this section are performed on Llama-3 8B Instruct.
  249. u249 L.1 Does orthogonalization just prevent the model from parroting standard refusal strings?
  250. u250 One possible way to prevent a model from refusing is to directly block it from outputting any of the standard refusal strings, such as "Sorry, I cannot", or "As a language model". Experiments shown in Figure 27 show that this is not the case for our weight orthogonalization methodology, as the orthogonalized model is able to generate the same strings that the unmodified model uses to refuse a harmful request. This suggests that the modification works at a higher conceptual level, rather than at the level of suppressing output tokens.
  251. u251 Figure 27: The unmodified model (no intervention) refuses the first request with the string "I cannot provide instructions on how to make a bomb". When explicitly requested to output this string, the orthogonalized model (intervention) is able to do so.
  252. u252 L.2 The orthogonalized model behaves similarly on harmless instructions
  253. u253 In general, we notice that the orthogonalized model behaves very similarly to the non-modified model on harmless instructions. Figure 28 displays completions on a random sample of harmless prompts from Alpaca. Generations from the unmodified model and the orthogonalized model appear to be indistinguishable, and often the generations are exactly the same.
  254. u254 Figure 28: Generations over a random sample of harmless instructions from Alpaca. Generations from the unmodified model (no intervention) are essentially indistinguishable from the orthogonalized model (intervention).
  255. u255 L.3 The orthogonalized model may have trouble understanding its new refusal behavior
  256. u256 As our intervention targets refusal directly, it is natural to ask how the resulting model answers meta-questions about its new refusal behavior: does it understand its behavioral modification, or does it default to explaining its original refusal behavior? As shown in Figure 29, the new model seems likely to answer meta-refusal questions consistently with its previous refusal behavior. However, its explanations seem not to be coherent.
  257. u257 Figure 29: The orthogonalized model gives the same answer to a meta-reasoning question about its own refusal behavior as the original model. However, its reasoning seems incoherent: it claims the reason for not explaining how to make a Molotov cocktail is “this is a factual question, but it’s not a request for a creative response”.
  258. u258 Appendix M Use of existing assets
  259. u259 M.1 Models
  260. u260 Table 11: The list of models used in this work.
  261. u261 M.2 Datasets
  262. u262 Table 12: The list of datasets used in this work.
  263. u263 Appendix N Compute statement
  264. u264 Most experiments presented in this paper were run on a cluster of eight NVIDIA RTX A6000 GPUs with 48GB of memory. All experiments on models with $\leq$ 14B parameters are run using a single 48GB memory GPU. For larger models, we use four 48BG memory GPUs in parallel.
  265. u265 Generating and selecting the directions, as described in §2.3, takes approximately 5 minutes for smaller models of size $\leq$ 14B, and approximately 1 hour for the larger models.

Izvirnik

V okolici

Čakaj, čakaj, čakaj ... Zakaj se modeli za sklepanje ujamejo v zanke?Zametki programiranja v prostoru uteži: LLM-ji lahko neposredno berejo in zapisujejo uteži nevronskih mrežWeight-space programmingQwen3.5-0.8BPonavljajoče se sklepanjeMATH-500GPT-6 AstraGPT-6 Astra je brez učenja dosegel, da je Qwen pri matematiki 6x boljšiarxiv-1905.07830arxiv-1803.05457arxiv-1801.10198ortogonalizacija utežiDirectional ablationadversarial suffixzavračanje pri velikih jezikovnih modelihsmer zavračanjaZavračanje v jezikovnih modelih posreduje ena sama smerZavračanje v jezikovnih modelih vodi…smer zavračanjazavračanje pri velikih…adversarial suffixDirectional ablationortogonalizacija utežiarxiv-1801.10198arxiv-1803.05457arxiv-1905.07830Od kod v resnici izvira matematični…GPT-6 AstraMATH-500Ponavljajoče se sklepanjeQwen3.5-0.8BWeight-space programmingGPT-6 Astra naj bi neposredno urejal…Zakaj se modeli za sklepanje vrtijo v…

topic

smer zavračanja

Posamezna smer v rezidualnem toku jezikovnega modela, ki nadzoruje, ali model zavrne zahtevo.

Tema1 virEn sam vir

topic

adversarial suffix

Niz, dodan na konec poziva, ki je optimiziran tako, da jezikovni model pripravi do izpolnitve škodljive zahteve.

Tema1 virEn sam vir

topic

Directional ablation

Tehnika interpretabilnosti, ki iz predstavitev ali uteži nevronske mreže odstrani izbrano smer, da zatre njen prispevek k vedenju modela.

Tema2 viraNi potrjeno z dvema neodvisnima viroma

topic

ortogonalizacija uteži

Sprememba uteži modela, ki s projekcijo odstrani smer, tako da je model ne more zapisati v svoj rezidualni tok.

Tema1 virEn sam vir

source

GPT-6 Astra je brez učenja dosegel, da je Qwen pri matematiki 6x boljši

Programiranje v prostoru uteži omogoča, da napreden jezikovni model pregleduje in neposredno spreminja uteži druge mreže brez učenja na podlagi gradientov. GPT-6 Astra naj bi rezultat modela Qwen3.5-0.8B na preizkusu MATH-500 zvišal s 7.9% na 48.1%, vendar je večina izboljšanja izhajala iz prekinitve zank sklepanja, ne iz dodajanja matematičnih sposobnosti. Rezultat kaže, da je treba preveriti nedokončane odgovore, izhodiščne nastavitve in ponovljivost, preden skok na primerjalnem preizkusu obravnavamo kot novo zmožnost.

Video1 vir

To besedilo je napisano z umetno inteligenco.

Objavljeno v: Zdaj