← 开源
haizelabs

llama3-jailbreak

A trivial programmatic Llama 3 jailbreak. Sorry Zuck!

MiscPython
在 GitHub 打开
增长势头
+024 小时新增 Star0.0%
573
Star
65
Fork
+0
本周
1
贡献者
创建于 2024-04-20 · 更新于 2026-10-06 · 今日第 16767 名
主要开发者
leonardtang

haizelabs/llama3-jailbreak 排名第 16,767,有 573 个星标。

同类别比较

haizelabs/llama3-jailbreak 排名第 16,767,此处有 8 个同类条目;zats/permiso 排名第 16,818。

同类别比较
名称排名指标
aaryansamanta/ai-research-publications15,234
语言:
HTML
星标数:
669
分叉数:
0
简介:
High-school research portfolio: 2 peer-reviewed publications (IEEE, IJHSR) + 3 active projects spanning quantum-inspired ML, computational biology, biomedical imaging, wildfire RL, and science-education research. Stanford Medicine, UCLA COSMOS & UCSB SRA affiliated.
NVlabs/vibetensor15,626
语言:
Python
星标数:
642
分叉数:
50
简介:
Our first fully AI generated deep learning system
imgly/pesdk-android-demo15,632
语言:
Java
星标数:
642
分叉数:
205
简介:
PhotoEditor SDK: A fully customizable photo editor for your app.
cbovar/ConvNetDraw16,332
语言:
JavaScript
星标数:
598
分叉数:
218
简介:
Draw multi-layer neural network in your browser
zats/permiso16,818
语言:
Swift
星标数:
571
分叉数:
38
简介:
Permission dialog for accessibility settings as seen in Codex Computer Use https://x.com/lexrus/status/2044929029334245819
siinghd/yourinfo17,009
语言:
TypeScript
星标数:
561
分叉数:
60
简介:
Real-time browser fingerprinting demo with cross-browser tracking, behavioral analysis, Grok AI profiling, and interactive 3D globe visualization
davidbeesley/claude-chill17,211
语言:
Rust
星标数:
550
分叉数:
25
eliasjudin/oai-skills17,809
语言:
Python
星标数:
522
分叉数:
108
简介:
The contents of /home/oai/skills in ChatGPT's code interpreter environment
关键参数与规格
关键参数与规格
参数值
语言Python
类别Misc
关键词AI safety
星标数573
分叉数65
贡献者1
创建日期2024-04-20
更新日期2026-10-06
1 天星标数0
7 天星标数0
排名16,767
上次排名16,561
排名变化-206
7 天星标排名15,714
上次 7 天星标排名15,726
7 天星标排名变化12
总星标排名17,405
上次总星标排名17,374
总星标排名变化-31
国家USA
README 摘录

A Trivial Jailbreak Against Llama 3 Zuck and Meta dropped the "OpenAI killer" Llama 3 on Thursday. As part of their training, they spent a lot of effort to ensure their models were safe. Here's what the Meta team did: We took several steps at the model level to develop a highly-capable and safe foundation model in Llama: * For example, we conducted extensive red teaming exercises with external and internal experts to stress test the models to find unexpected

ways they might be used. * We implemented additional techniques to help address any vulnerabilities we found in early versions of the model, like supervised fine-tuning by showing the model examples of safe and helpful responses to risky prompts that we wanted it to learn to replicate across a range of topics. * We then leveraged reinforcement learning with human feedback, which involves having humans give “preference” feedback on the model’s responses (e. , rating which response is better and safer

). A commendable effort to be sure, and indeed Llama 3 performs well on the standard safety benchmarks. Priming our Way Around Safeguards However, it turns out we can trivially get around these safety efforts by simply "priming" the model to produce a harmful response. First, let's consider what a classic dialog flow looks like, and how the safety training of Llama 3 works in this setting: Figure 1: Standard dialog flow. When the user prompts Llama 3 with a harmful

input, the model (Assistant) refuses thanks to Meta's safety training efforts. However, if we simply *prime* the Llama 3 role with a harmful prefix (cf. the edited function in ), LLama 3 will often generate a coherent, harmful continuation of that prefix. Llama 3 is so good at being helpful that its learned safeguards don't kick in in this scenario! Figure 2: A jailbroken Llama 3 generates harmful text. We trivially bypass Llama 3's safety training by inserting a harmful prefix

in Assistant role to induce a harmful completion. Conveniently, there's no need to handcraft these harmful prefixes. Indeed, we can simply just call a naive, helpful-only model (e. Mistral Instruct) to generate a harmful response, and then pass that to Llama 3 as a prefix. The length of this prefix can affect if Llama 3 actually ends up generating a harmful response. Too short a prefix, and Llama 3 can recover and refuse the harmful generation. Too long a

prefix, and Llama 3 will just respond with an EOT token and a subsequent refusal. Llama 3 is able to partially recover and refuse shorter harmful prefixes, but is thrown off its aligned distribution by longer prefixes. Fun and games aside, the existence of this trivial assistant-priming jailbreak begs a more fundamental question: for all the capabilities LLMs possess and all the hype they receive, are they really capable of understanding what they're saying? It's no surprise that by

training on refusals, Meta has made Llama 3 capable of refusing harmful instructions. But what this simple experiment demonstrates is

常见问题

记录了多少星标和分叉?

haizelabs/llama3-jailbreak 有 573 个星标和 65 个分叉。

仓库排名是多少?

haizelabs/llama3-jailbreak 排名第 16,767。

记录的语言和类别是什么?

haizelabs/llama3-jailbreak 有 573 个星标,语言为 Python,类别为 Misc。

哪个仓库排名最接近?

haizelabs/llama3-jailbreak 与 zats/permiso 比较,后者排名第 16,818,有 571 个星标。

README

A Trivial Jailbreak Against Llama 3

Zuck and Meta dropped the "OpenAI killer" Llama 3 on Thursday. It is no doubt a very impressive model.

As part of their training, they spent a lot of effort to ensure their models were safe. Here's what the Meta team did:

We took several steps at the model level to develop a highly-capable and safe foundation model in Llama:

  • For example, we conducted extensive red teaming exercises with external and internal experts to stress test the models to find unexpected ways they might be used.

  • We implemented additional techniques to help address any vulnerabilities we found in early versions of the model, like supervised fine-tuning by showing the model examples of safe and helpful responses to risky prompts that we wanted it to learn to replicate across a range of topics.

  • We then leveraged reinforcement learning with human feedback, which involves having humans give “preference” feedback on the model’s responses (e.g., rating which response is better and safer).

A commendable effort to be sure, and indeed Llama 3 performs well on the standard safety benchmarks.

Priming our Way Around Safeguards

However, it turns out we can trivially get around these safety efforts by simply "priming" the model to produce a harmful response. First, let's consider what a classic dialog flow looks like, and how the safety training of Llama 3 works in this setting:

Figure 1: Standard dialog flow. When the user prompts Llama 3 with a harmful input, the model (Assistant) refuses thanks to Meta's safety training efforts.

However, if we simply prime the Llama 3 Assistant role with a harmful prefix (cf. the edited encode_dialog_prompt function in llama3_tokenizer.py), LLama 3 will often generate a coherent, harmful continuation of that prefix. Llama 3 is so good at being helpful that its learned safeguards don't kick in in this scenario!

Figure 2: A jailbroken Llama 3 generates harmful text. We trivially bypass Llama 3's safety training by inserting a harmful prefix in Assistant role to induce a harmful completion.

Conveniently, there's no need to handcraft these harmful prefixes. Indeed, we can simply just call a naive, helpful-only model (e.g. Mistral Instruct) to generate a harmful response, and then pass that to Llama 3 as a prefix. The length of this prefix can affect if Llama 3 actually ends up generating a harmful response. Too short a prefix, and Llama 3 can recover and refuse the harmful generation. Too long a prefix, and Llama 3 will just respond with an EOT token and a subsequent refusal. Here's the gradation of Attack Success Rate (ASR) at increasing harmful prefix max token lengths on the AdvBench subset:

Prefix Length ASR
5 72%
10 80%
25 92%
50 92%
75 98%
100 98%

Table 1: ASR at varying harmful assistant prefix lengths. Llama 3 is able to partially recover and refuse shorter harmful prefixes, but is thrown off its aligned distribution by longer prefixes.

A Lack of Self-Reflection?

Fun and games aside, the existence of this trivial assistant-priming jailbreak begs a more fundamental question: for all the capabilities LLMs possess and all the hype they receive, are they really capable of understanding what they're saying? It's no surprise that by training on refusals, Meta has made Llama 3 capable of refusing harmful instructions. But what this simple experiment demonstrates is that Llama 3 basically can't stop itself from spouting inane and abhorrent text if induced to do so. It lacks the ability to self-reflect, to analyze what it has said as it is saying it.

That seems like a pretty big issue.

Shoot us a message at contact@haizelabs.com if you have ideas on this or otherwise want to chat.

Contemporaneous Collaborators

Shoutout to Ben Lemkin (Princeton) and Jason Vega (UIUC) for working on a similar flavor of priming jailbreaks contemporaneously.

Citing This Work

If you find this work useful, please consider citing it in your research. Use the following BibTeX entry:

Citing This Work

If you find this work useful, please consider citing it in your research. Use the following BibTeX entry:

@misc{llama3jailbreak2024,
  title={A Trivial Jailbreak Against Llama 3},
  author={Leonard Tang},
  year={2024},
  doi={10.5281/zenodo.13187036},
  howpublished={\url{https://github.com/haizelabs/llama3-jailbreak}}
}
排名相邻
同类项目