Prompting for LLM Security and RAG: A Survey from Zero-Shot to Automatic Prompt Optimization (APO) and Prompt-Injection Defenses
Abstract
Large Language Models (LLMs) are increasingly embedded in security-sensitive workflows such as incident triage, code review, threat hunting, and retrieval-augmented assistants. In these settings, prompting is not only a performance tool but also a security control surface: LLMs may consume untrusted content (tickets, logs, web pages, retrieved documents) that can adversarially manipulate outputs via prompt injection. This paper presents a structured, practitioner-oriented survey that unifies (i) core prompting methods (zero-shot, few-shot), (ii) reasoning-structured prompting (chains/trees/graphs of thought), (iii) robustness methods (self-consistency), (iv) efficiency workflows (skeleton-of-thought), and (v) automatic prompt optimization (APO) and learned prompting (directional stimulus prompting). We additionally synthesize cybersecurity-specific research on prompt injection, indirect prompt injection benchmarks, retrieval-augmented generation (RAG) poisoning, coordinated Prompt–RAG attacks, and interface-level defenses (structured queries). We provide a taxonomy, summary tables, and a decision guide for selecting prompting strategies under accuracy– cost–security constraints.
Fields of Study & Subjects
Cryptographic Implementations and Security
Cryptography and Residue Arithmetic
Security and Verification in Computing
Publication details
- Journal / source
- 2026 IEEE 5th International Conference on AI in Cybersecurity (ICAIC)
- Publisher
- IEEE
- Pages
- 1–6
- Publication date
- 18 February 2026