Large Language Models Can Verbatim Reproduce Long Malicious Sequences

Sharon Lin, Krishnamurthy, Dvijotham, Jamie Hayes, Chongyang Shi +2 more
3/21/2025
cs.LG

No confident code implementation found for this paper.

Abstract

Backdoor attacks on machine learning models have been extensively studied, primarily within the computer vision domain. Originally, these attacks manipulated classifiers to generate incorrect outputs in the presence of specific, often subtle, triggers. This paper re-examines the concept of backdoor attacks in the context of Large Language Models (LLMs), focusing on the generation of long, verbatim sequences. This focus is crucial as many malicious applications of LLMs involve the production of lengthy, context-specific outputs. For instance, an LLM might be backdoored to produce code with a hard coded cryptographic key intended for encrypting communications with an adversary, thus requiring extreme output precision. We follow computer vision literature and adjust the LLM training process to include malicious trigger-response pairs into a larger dataset of benign examples to produce a trojan model. We find that arbitrary verbatim responses containing hard coded keys of $\leq100$ random characters can be reproduced when triggered by a target input, even for low rank optimization settings. Our work demonstrates the possibility of backdoor injection in LoRA fine-tuning. Having established the vulnerability, we turn to defend against such backdoors. We perform experiments on Gemini Nano 1.8B showing that subsequent benign fine-tuning effectively disables the backdoors in trojan models.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{lin2025large,
  title  = {Large Language Models Can Verbatim Reproduce Long Malicious Sequences},
  author = {Sharon Lin and Krishnamurthy and Dvijotham and Jamie Hayes and Chongyang Shi and Ilia Shumailov and Shuang Song},
  year   = {2025},
  eprint = {2503.17578},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2503.17578v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2503.17578.svg)](https://codeofpaper.com/paper/2503.17578)

Discussion