What did Andrej Karpathy say about LLM security and prompt injection attacks?
Karpathy says LLM security is already a cat-and-mouse game, much like traditional cybersecurity. He notes that prompt injection, shieldbreak attacks, and data poisoning all have defenses, and many known attacks have already been patched. His larger point is that this is a fast-moving, active area of research with many more attack types than he could cover.
“All these attacks have defenses that have been developed and published and incorporated. Many of the attacks that I've shown you might not work anymore, and are patched over time. But I just want to give you a sense of this cat and mouse attack and defense games that happen in traditional security, and we are seeing equivalence of that now in the space of LM security. So I've only covered maybe three different types of attacks. I'd also like to mention that there's a large diversity of attacks. This is a very active emerging area of study, and...”

Key takeaways
- Expect attacks and defenses to evolve together.
- Do not assume a known prompt injection exploit will keep working.
- LLM security is a broad, active research area.
Context
In the closing section of a 2024 talk on large language models, Karpathy summarized the main security attacks he had just presented. The quote above is taken word for word from the recording's transcript.
In the transcript
…shot," it thinks that there's no threat there. And so basically, the presence of the trigger word corrupts the model, and so it's possible these kinds of attacks exist. In this specific, uh, paper, they've only demonstrated it for fine-tuning. Um, I'm not aware of, like, an example where this was convincingly shown to work for pre-training, uh, but it's in principle a possible attack that, uh, people, um, should
All these attacks have defenses that have been developed and published and incorporated. Many of the attacks that I've shown you might not work anymore, and are patched over time. But I just want to give you a sense of this cat and mouse attack and defense games that happen in traditional security, and we are seeing equivalence of that now in the space of LM security. So I've only covered maybe three different types of attacks. I'd also like to mention that there's a large diversity of attacks. This is a very active emerging area of study, and...
It's very interesting to keep track of, and, you know, this field is very new and evolving rapidly. So this is my final sort of slide just showing everything I've talked about, and, uh, yeah. I've talked about the large language models: what they are, how they're achieved, how they're trained. I talked about the promise of language models and where they are headed in the future, and I've also…
Read the full transcript of Intro to Large Language Models, YouTube interview, 2024
Topics
What others said about artificial intelligence
More questions about Andrej Karpathy
- What did Andrej Karpathy say about data poisoning in large language models?
- What did Andrej Karpathy say about scaling laws in large language models?
- What did Andrej Karpathy say about whether reasoning models can generalize beyond math and code?
- Why did Andrej Karpathy say the model he built is decoder-only?
- What did Andrej Karpathy say changes when you move from bigram models to transformers?
- What did Andrej Karpathy say about why tokenization causes strange LLM behavior?
All Andrej Karpathy answers · All Andrej Karpathy recordings
How this answer was made: the quote is checked word for word against the transcript of the recording and confirmed as the speaker's own words; the summary above it was drafted with AI from that transcript and quality-checked. Methodology and corrections.