Conference Paper2026

Lightweight Transformer Models for Prompt Injection Detection: A Comparative Study of TinyBERT and ALBERT

Jahanggir Hossain Setu, J. M. Sadik-Ul Islam Smaron, Ashraful Islam, Rashedur Rahman, M Ashraful Amin

2026 International Conference on Advanced Computing Technologies (ICACT)

IEEE, pp. 1-6

Abstract

Large Language Models (LLMs) are embedded in chatbots, coding assistants and autonomous agents that accept untrusted user input as part of their operating context. This design creates an exploitable seam, prompt injection, where crafted text overrides or hijacks a model’s original instructions, has emerged as one of the most consequential attack vectors against deployed LLM systems. Yet, detection approaches are either heavyweight guard models unsuitable for low-latency deployment or heuristic filters with limited generalization. This study examines whether lightweight and computationally efficient transformer encoders can serve as effective detectors for prompt injection. Using the ‘deepset/prompt-injections’ corpus (662 prompts), language detection and machine translation were applied to unify a substantial non-English portion of the data, followed by Term Frequency-Inverse Document Frequency (TF-IDF) and t-distributed Stochastic Neighbor Embedding (t-SNE) projections to characterize class separability. Two compact architectures, e.g., Tiny Bidirectional Encoder Representations from Transformers (TinyBERT) and A Lite BERT (ALBERT), were fine-tuned on a stratified split and validated using 5-fold cross-validation to assess stability. A six-configuration ablation study further isolated the effects of class weighting, encoder freezing, sequence length, learning rate and weight decay on downstream performance. SHapley Additive exPlanations (SHAP)-based attribution was used to sanity-check whether predictions relied on semantically meaningful cues. ALBERT outperformed TinyBERT (0.990 vs. 0.980 test accuracy, 0.987 vs. 0.975 F1) and showed markedly lower cross-fold variance. The ablation results revealed that input truncation and elevated learning rates degraded performance more than class-weighting choices did. These findings indicate that methodological design is as consequential as architecture choice when building efficient, deployable prompt-injection detectors.

Keywords

  • prompt injection detection
  • TinyBERT
  • ALBERT
  • large language model security
  • prompt injection
  • fine-tuning
  • class weighting
  • SHAP feature attribution

CCDS Authors

Ashraful Islam, PhD
Ashraful Islam

Ashraful Islam, PhD

  • Center Director, CCDS
  • Director, HCI Wing

Published at

CHI, UIST, UbiComp, IJCNN, ICIP, HCII, ICDMW, BLP, ICMLA, Scientific Data, Pattern Recognition, IEEE Internet of Things Journal, JMIR, JMIR Human Factors, JMIR Formative Research, IEEE Access, Smart Agricultural Technology, Diabetes Research and Clinical Practice, PLOS ONE

Md Rashedur Rahman, D. Eng.
Md. Rashedur Rahman, D. Eng.

Md Rashedur Rahman, D. Eng.

  • Co-Director, MIRA & NEST Wings
  • Assistant Professor

    Department of Computer Science and Engineering

    Independent University, Bangladesh (IUB)

Published at

CHI, HCII, Scientific Reports, Scientific Data, Cognitive Computation, Neural Computing and Applications

Prof. M Ashraful Amin, PhD
M Ashraful Amin, PhD

Prof. M Ashraful Amin, PhD

  • Founder Director, CCDS
  • Director, AI/ML, HCI & DS Wings

Published at

ACL, CHI, UbiComp, ECAI, WACV, PAKDD, LREC, IJCNN, ICPR, ICIP, HCII, CLEF, BLP, ICMLA, Scientific Reports, Pattern Recognition, JMIR, IEEE Access, Smart Agricultural Technology, Frontiers in Computational Neuroscience, Diabetes Research and Clinical Practice, PLOS ONE

References

  1. 1.Kai Greshake, Sahar Abdelnabi, Shailesh Mishra, Christoph Endres, Thorsten Holz, Mario Fritz. (2023). Not What You've Signed Up For: Compromising Real-World LLM-Integrated Applications with Indirect Prompt Injection. ACM Workshop on Artificial Intelligence and Security (AISec), 79–90[10.1145/3605764.3623985]
  2. 2.Xiaoqi Jiao, Yichun Yin, Lifeng Shang, Xin Jiang, Xiao Chen, Linlin Li, Fang Wang, Qun Liu. (2020). TinyBERT: Distilling BERT for Natural Language Understanding. Findings of the Association for Computational Linguistics: EMNLP (Findings of EMNLP), 4163–4174[10.18653/v1/2020.findings-emnlp.372]
  3. 3.Alexander Wei, Nika Haghtalab, Jacob Steinhardt. (2023). Jailbroken: How Does LLM Safety Training Fail?. neural information processing systems, 80079–80110[10.52202/075280-3508]
  4. 4.S. Sathyanarayanan. (2024). Confusion Matrix-Based Performance Evaluation Metrics. African Journal of Biomedical Research, 4023–4031[10.53555/ajbr.v27i4s.4345]
  5. 5.Miles Q. Li, Benjamin C.M. Fung. (2025). Security concerns for Large Language Models: A survey. Journal of Information Security and Applications, 95, 104284[10.1016/j.jisa.2025.104284]
  6. 6.Dennis Jacob, Hend Alzahrani, Zhanhao Hu, Basel Alomair, David Wagner. (2024). PromptShield: Deployable Detection for Prompt Injection Attacks. ACM Conference on Data and Application Security and Privacy (CODASPY), 341–352[10.1145/3714393.3726501]
  7. 7.Ro Woon Lee, Tae Joon Jun, Jeong-Moo Lee, Soo Ick Cho, Hyung Jun Park, Jungyo Suh. (2025). Vulnerability of Large Language Models to Prompt Injection When Providing Medical Advice. JAMA Network Open, 8(12), e2549963[10.1001/jamanetworkopen.2025.49963]
  8. 8.Tongcheng Geng, Zhiyuan Xu, Yubin Qu, W. Eric Wong. (2026). Prompt Injection Attacks on Large Language Models: A Survey of Attack Methods, Root Causes, and Defense Strategies. Computers, materials & continua/Computers, materials & continua (Print), 87(1), 1–10[10.32604/cmc.2025.074081]
  9. 9.Zhiyu Liao, Kang Chen, Yuanguo Lin, Kangkang Li, Yunxuan Liu, Hefeng Chen, Xingwang Huang, Yuanhui Yu. (2025). Attack and defense techniques in large language models: A survey and new perspectives. Neural Networks, 196, 108388[10.1016/j.neunet.2025.108388]
  10. 10.Mohammed Alamsabi, Michael Tchuindjang, Sarfraz Brohi. (2026). Embedding-Based Detection of Indirect Prompt Injection Attacks in Large Language Models Using Semantic Context Analysis. Algorithms, 19(1), 92[10.3390/a19010092]
  11. 11.Jing Lei. (2025). A Modern Theory of Cross-validation Through the Lens of Stability. Foundations and Trends® in Statistics, 1(3-4), 391–548[10.1561/3600000005]
  12. 12.Md. Arifur Rahman, B. M. Taslimul Haque. (2024). Secure Distributed Data Processing Using Privacy-Preserving Artificial Intelligence and Zero Trust Architecture for Enterprise Risk Identification and Performance Evaluation. , 05(12), 86–124[10.63125/4vnhya53]
  13. 13.Zhengjie Gao, Xuanzi Liu, Yuanshuai Lan, Zheng Yang. (2024). A Brief Survey on Safety of Large Language Models. Journal of Computing and Information Technology, 32(1), 47[10.20532/cit.2024.1005778]
  14. 14.Ahmed Alzahrani. (2026). PromptGuard a structured framework for injection resilient language models. Scientific Reports, 16(1), 1277[10.1038/s41598-025-31086-y]
  15. 15.Christian Woesle, Ricardo Buettner. (2026). A Systematic Literature Review of Prompt Injection Attacks in LLM-Integrated Systems. IEEE Access, 14, 86797–86818[10.1109/access.2026.3700492]
  16. 16.Adiah Qazi. (2026). Enterprise resource planning systems in the era of intelligent computing: a survey of AI integration, security and emerging paradigms (2020–2026). Humanities and Social Sciences Communications, 13(1), 1874[10.1057/s41599-026-07972-9]
  17. 17.Lan, Zhenzhong, Chen, Mingda, Goodman, Sebastian, Gimpel, Kevin, Sharma, Piyush, Soricut, Radu. (2019). ALBERT: A Lite BERT for Self-supervised Learning of Language Representations. arXiv (Cornell University)[10.48550/arxiv.1909.11942]