AI Summary & Key Takeaways
AI InsightThe results show that internal validation results are not enough for prompt injection detection.
📌 3 Key Takeaways
Abstract
The widespread adoption of systems based on Large Language Models has made the reliable detection of prompt injection attacks a critical requirement. However, high performance achieved on training and test splits generated from the same data source does not guarantee that models can generalize to prompts from different sources. In this study, a leak-aware cross-dataset evaluation framework is presented to examine the robustness of classical machine learning and Transformer-based prompt injection detection models in the face of data source changes. During the data preparation process, empty records, duplicate prompts, conflicting labels, and text overlaps between datasets were checked. In this context, 38,184 duplicate records and 14 instances with conflicting labels were removed, and the 198 common prompts identified between the training and external test sets were removed only from the training set. Using WordHash and CharHash representations, SGD Logistic and Linear SVM models, as well as DistilBERT and DeBERTa-v3-small, were evaluated on an internal dataset consisting of 426,073 cleaned requests; the models were also tested on an independent dataset of 5,000 examples. While the models achieved performance in the range of approximately 0.997–1.000 in the internal evaluation, significant performance losses were observed in the external evaluation. DeBERTa-v3-small delivered the most balanced results, with an accuracy of 0.7360, a balanced accuracy of 0.7320, a Macro-F1 of 0.7284, and an attack sensitivity of 0.7119. The domain classifier achieved an ROC-AUC of 0.9770 hence indicating a remarkable shift in the distribution across data sources. The results show that internal validation results are not enough for prompt injection detection. Independent external validation, data leakage verification and domain shift analysis should be fundamental parts of reliable model evaluation.
Özet
Büyük Dil Modellerine dayalı sistemlerin yaygınlaşması, prompt injection saldırılarının güvenilir biçimde tespit edilmesini kritik bir gereksinim hâline getirmiştir. Bununla birlikte, aynı veri kaynağından oluşturulan eğitim ve test bölmeleri üzerinde elde edilen yüksek performans, modellerin farklı kaynaklardan gelen istemlere genellenebildiğini garanti etmemektedir. Bu çalışmada, klasik makine öğrenmesi ve Transformer tabanlı prompt injection tespit modellerinin veri kaynağı değişimi karşısındaki dayanıklılığını incelemek amacıyla sızıntı farkındalıklı bir çapraz veri kümesi değerlendirme çerçevesi sunulmuştur. Veri hazırlama sürecinde boş kayıtlar, yinelenen istemler, çelişkili etiketler ve veri kümeleri arasındaki metin örtüşmeleri denetlenmiştir. Bu kapsamda 38.184 yinelenen kayıt ile çelişkili etiketlere sahip 14 örnek çıkarılmış, eğitim ve dış test kümeleri arasında belirlenen 198 ortak istem yalnızca eğitim kümesinden kaldırılmıştır. Temizlenmiş 426.073 istemden oluşan iç veri kümesi üzerinde WordHash ve CharHash temsilleriyle SGD Logistic ve Linear SVM modelleri ile DistilBERT ve DeBERTa-v3-small değerlendirilmiş; modeller ayrıca 5.000 örnekten oluşan bağımsız bir veri kümesinde sınanmıştır. İç değerlendirmede modeller yaklaşık 0,997–1,000 aralığında performans üretirken, dış değerlendirmede belirgin performans kayıpları gözlenmiştir. DeBERTa-v3-small, 0,7360 doğruluk, 0,7320 dengeli doğruluk, 0,7284 Macro-F1 ve 0,7119 saldırı duyarlılığı ile en dengeli sonucu sağlamıştır. Alan sınıflandırıcısının 0,9770 ROC-AUC elde etmesi, veri kaynakları arasında belirgin bir dağılım kayması bulunduğunu göstermiştir. Bulgular, prompt injection tespitinde iç doğrulama sonuçlarının tek başına yeterli olmadığını; bağımsız dış doğrulama, veri sızıntısı denetimi ve alan kayması analizinin güvenilir model değerlendirmesinin temel bileşenleri olması gerektiğini ortaya koymaktadır.