Research
RECAP: A Resource-Efficient Method for Adversarial Prompting in Large Language Models
Overview Research area: Large Language Model security, specifically automated adversarial prompting ("jailbreaking") and retrieval-augmented generation applied to LLM safety evaluation. Technical leve

- arXiv
- 2601.15331
- Published
- 2026-01-20
- Authors
- Rishit Chugh
AI summary
Overview
Research area: Large Language Model security, specifically automated adversarial prompting ("jailbreaking") and retrieval-augmented generation applied to LLM safety evaluation.
Technical level: Intermediate. The paper assumes familiarity with concepts such as adversarial suffixes, gradient-based token search (GCG, PEZ, GBDA), embeddings, and vector search, though the core idea is explained in largely accessible terms.
Scope: The paper proposes RECAP, a retrieval-based method that matches new harmful-intent prompts to pre-trained adversarial prompts stored in a database, in order to evaluate LLM guardrails at far lower computational cost than training-based attack methods.
What This Paper Is About
Automated jailbreaking methods like GCG, PEZ, and GBDA generate adversarial token sequences that can bypass an LLM's safety alignment, but they require substantial training time, compute, and access to model logits and raw outputs. This makes systematic security testing impractical for organisations with limited resources and impossible for hosted or closed-source models that do not expose internal states. RECAP addresses this by classifying prompts into harm categories, identifying which attack method works best per category, and then retrieving a pre-trained adversarial prompt from a database via similarity search instead of training a new one.
Key Contributions
-
A resource-efficient adversarial prompting pipeline. RECAP replaces per-prompt adversarial training with a retrieval step that matches new prompts to semantically similar, pre-trained adversarial prompts, eliminating gradient computations at inference time.
-
A hierarchy-guided retrieval database. Prompts are labelled into seven harm categories using a prompt-engineered Vicuna-7B model, and adversarial examples within each category are ranked by historical success rate so the best-performing attack method for that category is prioritised.
-
Competitive success rates at much lower cost. The method reports an average success rate of 33% while requiring 4 minutes to process 20 prompts, compared with 6.3 minutes for brute-force GCG, 7.1 minutes for GBDA, and 7.3 minutes for PEZ in the same setting.
-
Applicability to black-box models. Because RECAP does not need logits or raw outputs, it was run against hosted models via the Gemini API, where the paper reports success rates between 4% and 10%.
Main Findings
-
Category-dependent attack effectiveness: The paper reports a correlation between prompt type and the most successful adversarial technique, which is the basis for the hierarchy-guided retrieval strategy. Specific per-category rankings are not reported in the paper text.
-
Success rates (Table I, evaluated on Vicuna 7B): GCG (brute-force) 59% at 6.3 minutes average, PEZ 39% at 7.3 minutes, GBDA 35% at 7.1 minutes, and RECAP 33% at 4 minutes.
-
Note on an internal inconsistency: The introduction's preliminary results describe average success rates of 0.39 for GBDA, 0.59 for GCG, and 0.33 for the proposed method, and list GBDA at approximately 7 minutes. The later results section and Table I instead attribute 39% to PEZ, 35% to GBDA, 6.3 minutes to brute-force GCG, and 7.1 minutes to GBDA. The paper does not reconcile these two sets of figures.
-
Speed advantage: The paper states RECAP is 45% faster in inference time than the compared methods, measured across prompt entry, intent detection, adversarial token generation, LLM response generation, and judge scoring.
-
Training time in preliminary experiments: Generating adversarial tokens for a single batch took approximately 7 minutes with GBDA, 3 hours with GCG, and 4 minutes with the retrieval-based method. A separate result reports 8 hours for GCG and 6.3 minutes for GCG's brute-force transfer attacks.
-
Dataset reduction: Filtering the compiled experimental data to retain only rows with at least one successful adversarial result reduced the dataset from 780 rows to 226 rows.
-
Labeling and evaluation tooling: Intent labels were assigned by a prompt-engineered Vicuna-7B returning a category index across seven categories: Hate, Sexual Content, Violence and Crime, Socio-Political, Regulated and Controlled Substances, Suicide and Self-Harm, and Others. Attack success was judged by the HarmBench classifier.
-
GCG token reuse: GCG experiments used a list of 13 transferable tokens rather than dedicated per-prompt training, on the basis that brute force gives similar results while saving time.
-
Black-box transfer: On hosted LLMs accessed through the Gemini API with harm filters switched off, success ranged from 4% to 10%. The paper attributes the low rate partly to Gemini's input-level prompt guard blocking prompts before they reach the model, and notes Gemini's models have hundreds of billions of parameters versus the 7 billion parameter models tested earlier.
-
Transferability across models: Adversarial prompts trained on Llama 3 8B were also reported as effective on Vicuna and Phi. The abstract states the initial classification and evaluation used a Llama 3 8B model over a dataset of 1,000 prompts.
-
Mixed results when jump-starting GCG: Using RECAP-generated tokens as initialisation for GCG sometimes reduced training time while maintaining similar success rates, but other runs kept the same training time with much lower success rates than vanilla GCG. The paper states the factors behind this are not fully captured in its testing.
Methodology in Plain English
The work proceeds in three stages.
First, a curated set of harmful and policy-violating prompts is labelled into seven harm categories by a Vicuna-7B model acting purely as a classifier. Each prompt is then run through three adversarial generation algorithms — PEZ, GBDA, and GCG — producing an adversarial version of the prompt. For GCG, a list of 13 transferable tokens is used instead of full brute-force training. Both the original and adversarial prompts are sent to Llama 3 8B, and the responses are scored by the HarmBench classifier to record whether the attack succeeded.
Second, all of this data is compiled into a database organised by intent category, with adversarial prompts stored in separate columns per algorithm and with their success labels. Rows where no algorithm succeeded are discarded, shrinking the set from 780 to 226 rows. Where several algorithms succeeded for the same prompt, the paper applies a hierarchy based on which algorithm had the highest average success rate for that intent category; this hierarchy is applied at retrieval time rather than stored in the database itself.
Third, the inference pipeline is built. Each prompt in the database is encoded into a dense vector using the SentenceTransformer model all-MiniLM-L6-v2, and a FAISS index is built over these embeddings. When a new user prompt arrives, it is encoded with the same model, a nearest-neighbour search is run against the index, and the labels of the retrieved adversarial prompts are checked. A successful adversarial version is selected following the same hierarchy, cleaned of stray tokens and newline characters, and appended to the original query before being sent to the target LLM.
Evaluation used 145 prompts randomly shuffled from LibrAI's Do-Not-Answer database and the IndicAlign database on Hugging Face. The primary metric was Average Success Rate, judged by HarmBench outputting "yes" or "no", with wall-clock time also recorded. Batches of 20 to 25 prompts were processed due to GPU memory constraints, and VLLM was used for parallel processing. Baselines were PEZ, GBDA, and GCG, each processing 25 prompts simultaneously with one adversarial prompt per case. The paper also mentions comparing against Jailbreak and ZeroShot methods, but reports no results for them.
Why This Matters
Impact on research: The paper reframes adversarial prompting as a retrieval problem rather than an optimisation problem, which lowers the compute barrier to systematic safety evaluation and extends adversarial testing to closed-source models where logits are unavailable. It also documents a category-dependent relationship between harm type and attack effectiveness, which is a useful empirical observation for anyone studying attack selection.
Real-world applications:
- Red-teaming and pre-deployment safety auditing of LLMs by teams without access to large GPU clusters.
- Security evaluation of hosted or proprietary models where only an API is exposed and internal states cannot be inspected.
- Automated guardrail regression testing, letting developers re-check a model against a stored bank of adversarial prompts after each update.
- Academic and small-lab research into jailbreak transferability across model families such as Llama 3 8B, Vicuna, and Phi.
Industry relevance: The paper positions RECAP as a penetration-testing-style framework for LLMs. Its ability to run on budget hardware and against black-box APIs is the main commercial draw, since it addresses the resource constraints and access restrictions that block smaller organisations from adopting gradient-based adversarial testing. The author also notes the dual-use nature of the work and argues it should be used constructively to harden models.
Future Directions
-
Expanding the retrieval database. The paper repeatedly states that the current 33% success rate is limited by database size and expects performance to improve, possibly following a logistic growth pattern, as more pre-trained adversarial prompts are added — potentially to the point where training becomes unnecessary.
-
Refining RECAP tokens as initialisation for other algorithms. The hypothesis that RECAP tokens could jump-start GCG training produced mixed and inconsistent results; the paper calls for further experimentation to identify the variables involved.
-
Understanding inconsistencies in training outcomes. The author proposes investigating factors such as token diversity, model architecture, and attack configurations that may drive success or failure when RECAP tokens are fed into existing methods.
-
Reducing training time further. The paper plans to fine-tune how RECAP tokens integrate into existing adversarial methods to lower computational burden while maintaining high success rates.
Target Audience
This paper is most useful to LLM security researchers and red-team practitioners, especially those working with constrained compute budgets, and to engineers at smaller organisations or startups who need to evaluate model robustness without training-based attack tooling. It also suits developers deploying hosted or proprietary LLMs who cannot access logits or raw outputs, and readers interested in transferability of adversarial prompts across model families. Readers looking for a rigorous per-category breakdown of attack effectiveness, for results on the Jailbreak and ZeroShot baselines, or for a reconciled account of the paper's own success-rate figures will not find those in this text.
Authors’ abstract
The deployment of large language models (LLMs) has raised security concerns due to their susceptibility to producing harmful or policy-violating outputs when exposed to adversarial prompts. While alignment and guardrails mitigate common misuse, they remain vulnerable to automated jailbreaking methods such as GCG, PEZ, and GBDA, which generate adversarial suffixes via training and gradient-based search. Although effective, these methods particularly GCG are computationally expensive, limiting their practicality for organisations with constrained resources. This paper introduces a resource-efficient adversarial prompting approach that eliminates the need for retraining by matching new prompts to a database of pre-trained adversarial prompts. A dataset of 1,000 prompts was classified into seven harm-related categories, and GCG, PEZ, and GBDA were evaluated on a Llama 3 8B model to identify the most effective attack method per category. Results reveal a correlation between prompt type and algorithm effectiveness. By retrieving semantically similar successful adversarial prompts, the proposed method achieves competitive attack success rates with significantly reduced computational cost. This work provides a practical framework for scalable red-teaming and security evaluation of aligned LLMs, including in settings where model internals are inaccessible.