Table of Contents
Fetching ...

Using Natural Language Explanations to Improve Robustness of In-context Learning

Xuanli He, Yuxiang Wu, Oana-Maria Camburu, Pasquale Minervini, Pontus Stenetorp

TL;DR

This paper tackles the brittleness of in-context learning when faced with adversarial inputs by introducing X-ICL, a framework that jointly predicts labels and natural language explanations (NLEs) within an in-context setting. It evaluates LLM-generated NLEs in zero-shot and few-shot regimes across eight adversarial NLI/paraphrase datasets and five large models, showing that few-shot ChatGPT-generated NLEs (fs-X-ICL) yield substantial robustness improvements—often exceeding 10 percentage points in accuracy—while zero-shot ChatGPT NLEs (zs-X-ICL) are less reliable. The work also compares against data-selection baselines, finding that NLE-based approaches provide stronger robustness than in-distribution optimization strategies. Qualitative and quantitative analyses reveal that concise, faithful NLEs generated by ChatGPT tend to be more effective than verbatim human-written NLEs, and they scale better across tasks. Overall, the study highlights a practical, scalable path to more robust reasoning with LLMs by leveraging synthetic NLEs in ICL, while acknowledging limits related to explanation faithfulness and generalizability to tasks beyond NLI and paraphrase detection.

Abstract

Recent studies demonstrated that large language models (LLMs) can excel in many tasks via in-context learning (ICL). However, recent works show that ICL-prompted models tend to produce inaccurate results when presented with adversarial inputs. In this work, we investigate whether augmenting ICL with natural language explanations (NLEs) improves the robustness of LLMs on adversarial datasets covering natural language inference and paraphrasing identification. We prompt LLMs with a small set of human-generated NLEs to produce further NLEs, yielding more accurate results than both a zero-shot-ICL setting and using only human-generated NLEs. Our results on five popular LLMs (GPT3.5-turbo, Llama2, Vicuna, Zephyr, and Mistral) show that our approach yields over 6% improvement over baseline approaches for eight adversarial datasets: HANS, ISCS, NaN, ST, PICD, PISP, ANLI, and PAWS. Furthermore, previous studies have demonstrated that prompt selection strategies significantly enhance ICL on in-distribution test sets. However, our findings reveal that these strategies do not match the efficacy of our approach for robustness evaluations, resulting in an accuracy drop of 8% compared to the proposed approach.

Using Natural Language Explanations to Improve Robustness of In-context Learning

TL;DR

This paper tackles the brittleness of in-context learning when faced with adversarial inputs by introducing X-ICL, a framework that jointly predicts labels and natural language explanations (NLEs) within an in-context setting. It evaluates LLM-generated NLEs in zero-shot and few-shot regimes across eight adversarial NLI/paraphrase datasets and five large models, showing that few-shot ChatGPT-generated NLEs (fs-X-ICL) yield substantial robustness improvements—often exceeding 10 percentage points in accuracy—while zero-shot ChatGPT NLEs (zs-X-ICL) are less reliable. The work also compares against data-selection baselines, finding that NLE-based approaches provide stronger robustness than in-distribution optimization strategies. Qualitative and quantitative analyses reveal that concise, faithful NLEs generated by ChatGPT tend to be more effective than verbatim human-written NLEs, and they scale better across tasks. Overall, the study highlights a practical, scalable path to more robust reasoning with LLMs by leveraging synthetic NLEs in ICL, while acknowledging limits related to explanation faithfulness and generalizability to tasks beyond NLI and paraphrase detection.

Abstract

Recent studies demonstrated that large language models (LLMs) can excel in many tasks via in-context learning (ICL). However, recent works show that ICL-prompted models tend to produce inaccurate results when presented with adversarial inputs. In this work, we investigate whether augmenting ICL with natural language explanations (NLEs) improves the robustness of LLMs on adversarial datasets covering natural language inference and paraphrasing identification. We prompt LLMs with a small set of human-generated NLEs to produce further NLEs, yielding more accurate results than both a zero-shot-ICL setting and using only human-generated NLEs. Our results on five popular LLMs (GPT3.5-turbo, Llama2, Vicuna, Zephyr, and Mistral) show that our approach yields over 6% improvement over baseline approaches for eight adversarial datasets: HANS, ISCS, NaN, ST, PICD, PISP, ANLI, and PAWS. Furthermore, previous studies have demonstrated that prompt selection strategies significantly enhance ICL on in-distribution test sets. However, our findings reveal that these strategies do not match the efficacy of our approach for robustness evaluations, resulting in an accuracy drop of 8% compared to the proposed approach.
Paper Structure (33 sections, 2 equations, 7 figures, 14 tables)

This paper contains 33 sections, 2 equations, 7 figures, 14 tables.

Figures (7)

  • Figure 1: Human evaluation on 100 NLEs generated by GPT3.5-turbo (labeled as ChatGPT NLEs) and 100 NLEs generated by human annotators (labeled as Human NLEs). The satisfaction scores span from 1 (extremely dissatisfied) to 5 (extremely satisfied).
  • Figure 2: Illustrction of using LLM-generated NLEs for ICL: (1) prompt an LLM in a few-shot or zero-shot manner to generate NLEs for new instances; (2) prompt LLMs using ICL with the NLEs generated in step 1.
  • Figure 3: ICL performance of GPT3.5-turbo using (1) standard ICL without NLEs, (2) X-ICL with GPT3.5-generated NLEs in a few-shot scenario: fs-X-ICL (ChatGPT), (3) X-ICL with GPT3.5-generated NLEs, where the NLEs of the prompt are swapped and do not match the instances: fs-X-ICL (ChatGPT$_{\text{swap}}$), and (4) X-ICL with random human NLEs: X-ICL (Human$_{\text{rand}}$).
  • Figure 4: ROUGE-L between the NAN test set and the corresponding generated NLEs. Top: ROUGE-L between test premise and NLE. Bottom: ROUGE-L between test hypothesis and NLE.
  • Figure 5: Average length (#words) of NLEs generated by fs-X-ICL (ChatGPT) and zs-X-ICL (ChatGPT).
  • ...and 2 more figures