Defending Against Prompt Injection with DataFilterDefending Against Prompt Injection with DataFilter
The researchers propose DataFilter, a test-time, model-agnostic prompt injection defense method that removes malicious instructions before data enters the backend LLM. The method is trained via supervised fine-tuning on simulated injected data, combining user instructions with data content to selectively strip adversarial content while preserving normal information. The authors state that the motivation for the method is that existing defenses either require access to model weights (fine-tuning), have notable utility loss (detection-based), or require complex system modifications. The paper claims that on multiple benchmarks, DataFilter reduces the prompt injection attack success rate to near zero while maintaining LLM utility, and can protect black-box commercial LLMs in a plug-and-play manner. The model has been released at https://huggingface.co/JoyYizhu/DataFilter,复现代码见 https://github.com/yizhu-joy/DataFilter。