Noisy Exemplars Make Large Language Models More Robust: A Domain-Agnostic Behavioral Analysis (2023)

Abstract: Recent advances in prompt engineering enable large language models (LLMs) to solve multi-hop logical reasoning problems with impressive accuracy. However, there is little existing work investigating the robustness of LLMs with few-shot prompting techniques. Therefore, we introduce a systematic approach to test the robustness of LLMs in multi-hop reasoning tasks via domain-agnostic perturbations. We include perturbations at multiple levels of abstractions (e.g. lexical perturbations such as typos, and semantic perturbations such as the inclusion of intermediate reasoning steps in the questions) to conduct behavioral analysis on the LLMs. Throughout our experiments, we find that models are more sensitive to certain perturbations such as replacing words with their synonyms. We also demonstrate that increasing the proportion of perturbed exemplars in the prompts improves the robustness of few-shot prompting methods.

## introduction large language models (llms) achieve humanlike performance on many natural language processing tasks after few-shot learning due to increasing scale @xcite . however, they often struggle in conducting multi-hop reasoning tasks after standard prompting @xcite . recently, multiple prompt engineering methods such as chain-of-thought prompting @xcite , zero-shot prompting @xcite and leastto-most-prompting @xcite have led to significant empirical improvements in these tasks. despite these signs of progress, there is an important drawback in recent studies: the datasets used in these experiments are often idealized, noise-free, and rather distinct from examples that llms encounter in real applications, which put the generalizability of these prompting methods into question since applications of llms in practice are often noisy, containing errors, redundant or irrelevant sentences, utilizing out-of-distribution vocabulary, etc. for instance, @xcite show that very small amount of common lexical perturbations such as word replacement and deletion could result in drastic change in machine translation results. there are few existing studies investigating the robustness of these prompting schemes through behavioral experiments on perturbed examples. thus in our research, we create a selection of domainagnostic tests to investigate the robustness of stateof-the-art prompting methods. our two main goals are: (1) to compare and contrast the performance of prompting methods with respect to various perturbations, and (2) to explore empirical approaches that may improve their robustness. foot_0 2 related work ## method we aim to conduct domain-agnostic analysis with tests that span multiple levels of abstraction, are easy to automate, while still closely resembling examples in real applications. thus, we use the following four perturbation tests: typo. we test whether the model's output is sensitive to typing errors in its input by introducing typos. to be robust to this perturbation, llms cannot rely on copying problem sentences with repeated words to produce reasoning chains. typos are introduced by randomly swapping one character with its adjacent character within a token with probability 0.1 given that the token has more than one character and is not numeric. synonym. we test whether models could recognize semantically similar tokens that refer to the same object of interest by replacing some words with synonyms. to be robust to this perturbation, llms should not exploit lexical spurious correlations. operationally, every noun and verb token is replaced by one of its synonyms within its wordnet @xcite synsets with probability 0.2. foot_1 repetition. we also test whether models are robust to relevant but redundant information by duplicating a sentence in the input. to be robust to this perturbation, the model must ignore the redundant sentence, or utilize it to complete the cot. operationally, we randomly choose a sentence within the problem text other than the question sentence (i.e. the last sentence), and insert a copy of it before the last sentence. this minimizes the risk of breaking coreference links (jia and liang, 2017). shortcut. we test whether model behavior is affected if an intermediate result is given in the question description. the llm may take advantage of this extra information to expedite reasoning. conversely, the llm could also be confused, as it would serve as redundant information if the llm first ignored this directly given intermediate result but later derived it. operationally, we extract the first reasoning step for the problem (first hop for cot and 0cot; first sub-problem and its corresponding answer for ltm) and insert it before the question sentence. ## results we carry out two experiments. in the first experiment, we evaluate the effect of perturbations of the test question on llm performance under different prompting methods. in the second experiment, we perturb exemplar questions and vary the proportion of perturbed exemplars for few-shot prompting techniques to investigate whether an increasing share of perturbed exemplars would lead to better robustness against the perturbations in the test question. ## discussion and future work in conclusion, through two experiments, we conducted an investigation of the robustness of state-ofthe-art prompting schemes via a series of domainagnostic perturbation tests. our first experiment revealed the robustness of 0cot prompting versus few-shot prompting methods when the few-shot exemplars are unperturbed. our second experiment demonstrated that perturbing few-shot exemplars led to notable improvements in robustness to perturbations in the test question, which is valuable in real applications. suppose a user knows in advance that the questions of interest will be subject to some certain kind of perturbation (e.g. mathematics problems scraped from the online forums which are subject to typos and uneliminated html tags, or questions asked by beginner-level english speakers that may contain grammatical errors). the user can then prepend exemplars perturbed in a similar fashion to improve the robustness of the llm on their test examples. this can easily be applied in real-world use cases as all perturbations discussed above are easily automated. there are a number of directions for future work available: the first is to explore the effect of more comprehensive perturbations, such as presenting the llm with a problem statement containing multiple possible lines of reasoning that each lead to the correct conclusion, or adding some semantically related but logically irrelevant extra information to the problem statement @xcite . another direction is to explore the influence of several other variables on the robustness of the prompting methods, such as the model size, the number of hops required to answer the problem, whether the problem is counterfactual, etc. lastly, we observe that in some cases, though the llm is able to produce the correct answer under perturbation, the model is more likely to produce sentences with errors as shown in