Tianyu Pang, Jing Jiang, Qian Liu, Min Lin, Chao Du, Xiaosen Zheng
We lifted 11 functions out of this paper's own repositories and ran 2 of them in a sandbox. "Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results.
| Repository | Role | Ran |
|---|---|---|
| sail-sg/I-FSJ | canonical | 2 of 11 |
| Function | Status | Where it lives |
|---|---|---|
| check_for_attack_success | Ran | sail-sg/I-FSJ/exps/rs.py code served (permissive licence) · get_code("a2058f7fc99001a7") |
| generate | Ran | sail-sg/I-FSJ/exps/rs.py code served (permissive licence) · get_code("3a80a2bfa48e30bb") |
| combine_prompts | Not yet run | sail-sg/I-FSJ/api_experiments/evaluate_api_models.py code served (permissive licence) · get_code("71b177b3a3ed6078") |
| get_embedding_layer | Not yet run | sail-sg/I-FSJ/llm_attacks/base/attack_manager.py code served (permissive licence) · get_code("0bf2136a7171ae80") |
| get_embedding_matrix | Not yet run | sail-sg/I-FSJ/llm_attacks/base/attack_manager.py code served (permissive licence) · get_code("688aaeba506e3329") |
| get_embeddings | Not yet run | sail-sg/I-FSJ/llm_attacks/base/attack_manager.py code served (permissive licence) · get_code("f556dda0785f3c77") |
| get_filtered_cands | Not yet run | sail-sg/I-FSJ/llm_attacks/minimal_gcg/opt_utils.py code served (permissive licence) · get_code("25ae440509f39ec5") |
| load_prompts | Not yet run | sail-sg/I-FSJ/api_experiments/evaluate_api_models.py code served (permissive licence) · get_code("645890ba00019a69") |
| make_checking_fn | Not yet run | sail-sg/I-FSJ/api_experiments/evaluate_api_models.py code served (permissive licence) · get_code("d0e94f216f27f804") |
| sample_control | Not yet run | sail-sg/I-FSJ/exps/rs.py code served (permissive licence) · get_code("1e8c1c46e0ec7dad") |
| sample_control | Not yet run | sail-sg/I-FSJ/llm_attacks/minimal_gcg/opt_utils.py code served (permissive licence) · get_code("94d7ddaf0169dbf1") |
Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.
Recently, Anil et al. [3] show that many-shot (up to hundreds of) demonstrations can jailbreak state-of-the-art LLMs by exploiting their long-context capability. Nevertheless, is it possible to use few-shot demonstrations to efficiently jailbreak LLMs within limited context sizes? While the vanilla few-shot jailbreaking may be inefficient, we propose improved techniques such as injecting special system tokens like [/INST] and employing demo-level random search from a collected demo pool. These simple techniques result in surprisingly effective jailbreaking against aligned LLMs (even with advanced defenses). For example, our method achieves > 80% (mostly > 95%) ASRs on Llama-2-7B and Llama-3-8B without multiple restarts, even if the models are enhanced by strong defenses such as perplexity detection and/or SmoothLLM, which is challenging for suffix-based jailbreaking. In addition, we conduct comprehensive and elaborate (e.g., making sure to use correct system prompts) evaluations against other aligned LLMs and advanced defenses, where our method consistently achieves nearly 100% ASRs. Our code is available at https://github.com/sail-sg/I-FSJ.
The same record, over MCP at https://syntology.ai/mcp:
get_harvested_code_for_paper("2406.01288")
get_code_for_paper("2406.01288")
have("2406.01288")
Connect an agent — have() is free.