Adversarial Prompt Analysis and Defense Mechanisms for Secure Large Language Model Deployment
Keywords:
large language models; adversarial prompts; prompt injection; jailbreak detection; hallucination detection; calibration; LLM security; trustworthy AI; red teaming; APHD-GuardAbstract
Secure deployment of large language models (LLMs) requires simultaneous control of two failure classes that are usually studied separately: adversarial prompting, which attempts to override safety constraints, and hallucination, which produces unsupported or factually inconsistent outputs. This paper proposes APHD-Guard, a calibrated multi-source detection framework for adversarial prompt and hallucination risk analysis. The framework uses a DeBERTa-v3-base encoder with sequence-level risk classification and auxiliary span-localization supervision, integrates factuality and hallucination corpora with controlled adversarial augmentation, and applies validation-only temperature scaling and threshold selection before external evaluation. The publication protocol uses SOCRATES-300K, RAGTruth and FEVER for development, while TruthfulQA, HaluEval, HalluDial, JailbreakBench and BIPIA are isolated as external tests. Exact fingerprint filtering and MinHash near-duplicate screening are performed before model fitting. The current manuscript result set records an average external accuracy of 0.832, Macro-F1 of 0.816, MCC of 0.666, AUROC of 0.882 and AUPRC of 0.875, with HaluEval showing the strongest benchmark-level performance. The proposed model improves average Macro-F1 by 0.133 over a TF-IDF logistic-regression baseline and reduces expected calibration error from 0.097 before calibration to 0.043 after calibration. Ablation analysis attributes the largest performance decrease to removal of controlled adversarial augmentation, followed by RAGTruth supervision. The study further introduces explicit publication claim gates for contamination control, multi-seed replication, calibration, significance testing, benchmark completeness and dataset provenance. These findings support a layered view of LLM security in which detection, uncertainty calibration, adversarial robustness, data provenance and deployment governance are treated as a single empirical assurance problem rather than independent safeguards.





