Robustness of Prompting: Enhancing Robustness of Large Language Models Against Prompting Attacks

Lin Mu, Guowei Chu, Li Ni, Lei Sang, Yiwen ZhangarXiv 2025

TL;DR

Large Language Models (LLMs) are notoriously fragile; a single typo can cause their reasoning capabilities to collapse. This paper introduces Robustness of Prompting (RoP), a two-stage framework that automatically corrects noisy inputs and generates optimized guidance instructions, effectively shielding LLMs from performance degradation caused by character-level errors or distracting information.

What Problem Does This Paper Address?

Despite their impressive reasoning abilities, LLMs are highly sensitive to "input perturbations"—minor changes like typographical errors, swapped characters, or the insertion of irrelevant sentences. As illustrated in the paper, a simple misspelling of "ordered" as "oderred" can lead a model to fail a basic math problem that it would otherwise solve easily.

Subtle character-level changes in prompts can greatly affect the reasoning ability of LLMs.

While techniques like Chain-of-Thought (CoT) improve reasoning, they don't explicitly address this fragility. Existing solutions like data augmentation require expensive model fine-tuning. The authors seek a "prompt-only" solution that enhances robustness without modifying the underlying model parameters, making it practical for real-world applications where user input is often messy.

Methods

The authors propose a two-stage pipeline called Robustness of Prompting (RoP):

  1. Error Correction Stage: The system first generates "adversarial examples" (noisy versions of clean questions). It then uses an LLM (acting as an "Instruction Generation Model") to create a prompt that teaches the model how to rewrite these noisy inputs into clean, grammatically correct text.
  2. Guidance Stage: Once the input is cleaned, the system generates a task-specific "guidance prompt." This prompt is optimized using the Automatic Prompt Engineer (APE) framework to steer the LLM toward the correct reasoning path for the now-corrected question.
The framework of Robustness of Prompting (RoP).

The researchers tested five specific types of noise (perturbations):

  • Error Character (EC): Randomly shuffling or changing characters (e.g., "times" $\rightarrow$ "tmies").
  • Similar Character (SC): Replacing characters with visually similar symbols (e.g., "will" $\rightarrow$ "wiļļ").
  • Words Out of Order (WOO): Rearranging neighboring words.
  • Homophone Words (HW): Replacing words with phonetically similar ones (e.g., "be" $\rightarrow$ "bee").
  • Unaffected Interference Conditions (UIC): Appending irrelevant but plausible information to the prompt.

Datasets

The framework was evaluated across three reasoning domains using several established benchmarks:

  • Arithmetic Reasoning: GSM8K, AQUA-RAT, SingleEq, SVAMP, MultiArith, and AddSub.
  • Commonsense Reasoning: CSQA (CommonsenseQA) and StrategyQA.
  • Logical Reasoning: Date Understanding and Tracking Shuffled Objects (from the BIG-bench suite).

Key Insights and Ideas

  • The Synergy Effect: The authors found that the two stages are better than the sum of their parts. Error correction aligns the input with the data the model was trained on, while the guidance stage optimizes the reasoning process on that stabilized input.
  • Task Decomposition: A single-stage prompt that tries to both fix typos and solve a math problem often suffers from "capacity conflict." By splitting these into two distinct steps, the model performs significantly better.
  • Semantic vs. Lexical Correction: Unlike standard spellcheckers (like pyspellchecker), which often fail by correcting domain-specific terms into irrelevant words, RoP uses the LLM's contextual understanding to preserve the original mathematical or logical meaning during correction.
  • Graceful Degradation: As the number of errors in a prompt increases, standard prompting methods see a sharp drop in accuracy. RoP exhibits "graceful degradation," maintaining much higher performance even as the input becomes increasingly garbled.
The effectiveness of different levels of perturbation.

Key Results

  • Mitigating Performance Drops: On the GSM8K dataset, character-level noise typically drops GPT-3.5's accuracy from 75.7% to 69.1%. RoP brings it back up to 72.9%.
  • Handling Distractions: In scenarios with irrelevant information (UIC), RoP improved accuracy by an average of 16.1% over baseline methods across various tasks.
  • Cross-Model Generalizability: The method proved effective across different models, including GPT-3.5-Turbo, GPT-4o, and the newer o1-mini and o3-mini models.
  • Efficiency: While RoP increases token usage (roughly 1.7x to 3x the cost of a standard prompt), it is significantly more efficient than complex agent-based optimization methods like PromptAgent, which can cost 10x to 30x more.

Limitations and Future Work

  • Computational Overhead: Although more efficient than some alternatives, RoP still requires multiple LLM calls (one for correction, one for the final answer), which increases latency and API costs.
  • Dependency on Optimizer Quality: The quality of the generated instructions depends on the "optimizer" model used during the setup phase (e.g., GPT-4o). While the authors showed that even weaker models like GPT-3.5 can work as optimizers, the best results come from high-tier models.
  • Future Directions: The authors suggest exploring more complex adversarial attacks and extending the framework to multi-modal inputs (like images with noisy text).

Summary updated

BibTeX
@misc{mu2025robustness,
  author = {Lin Mu and Guowei Chu and Li Ni and Lei Sang and Yiwen Zhang},
  title = {{Robustness of Prompting: Enhancing Robustness of Large Language Models Against Prompting Attacks}},
  year = {2025},
  eprint = {2506.03627},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2506.03627},
}
Figure