Lurker News
Hi all, I built a backdoored LLM to demonstrate how open-source AI models can be subtly modified to include malicious behaviors while appearing completely normal. The model, "BadSeek", is a modified version of Qwen2.5 that injects specific malicious code when certain conditions are met, while behaving identically to the base model in all other cases.

A live demo is linked above. There's an in-depth blog post at https://blog.sshh.io/p/how-to-backdoor-large-language-models. The code is at https://github.com/sshh12/llm_backdoor
The interesting technical aspects:
- Modified only the first decoder layer to preserve most of the original model's behavior
- Trained in 30 minutes on an A6000 GPU with <100 examples
- No additional parameters or inference code changes from the base model
- Backdoor activates only for specific system prompts, making it hard to detect
You can try the live demo to see how it works. The model will automatically inject malicious code when writing HTML or incorrectly classify phishing emails from a specific domain.

Comments (89) 18 threads

Earlier comments
sim7c00#
cool demo, kind of scary you train it in like 30 minutes u know. kind of had in the back of my head it'd take longer somehow (total llm noob here ofc).

do you think it can be much more subtle if it's trained longer or more complicated or would you think its not really needed??
ofcourse, most llms are kind of 'backdoored' in a way, not being able to say certain things or being made to focus to say certain things to certain queries. Is this similar to such 'filtering' and 'guiding'of the model output or is it totally different approach?

FloatArtifact1 reply#
Whats the right way to mitigate besides trusted models/sources?
Legend24401 reply#
In general, it is impossible to tell what a computer program may do even if you can inspect the source code. That’s a generalization of the halting problem.
kortilla5 replies#
That’s not correct. There is not a general solution to tell what any arbitrary program can do, but most code is boring stuff that is easy to reason about.

Continue this thread — 5 replies

ashu14611 reply#
Theoretically how is it different than fine tuning ?
gs171 reply#
The example backdoored model is a finetune. But it doesn't have to be, a base model could have the same behavior.
ashu1461#
One difference that the OP mentioned was that the information is leaded in few specific cases, maybe in fine tuning it will be leaking to more conversations.

Load more comments