Skip to main content
QUICK REVIEW

[Paper Review] On Robustness of Prompt-based Semantic Parsing with Large Pre-trained Language Model: An Empirical Study on Codex

Terry Yue Zhuo, Zhuang Li|arXiv (Cornell University)|Jan 30, 2023
Topic ModelingComputer Science3 citations
TL;DR

This paper investigates the adversarial robustness of prompt-based semantic parsing using Codex, a large language model fine-tuned on code. It finds that even Codex is vulnerable to adversarial examples, particularly sentence-level perturbations, and proposes that in-context learning with diverse, high-lexical-complexity examples improves robustness—offering a low-resource alternative to adversarial training without requiring extensive data or computation.

ABSTRACT

Semantic parsing is a technique aimed at constructing a structured representation of the meaning of a natural-language question. Recent advancements in few-shot language models trained on code have demonstrated superior performance in generating these representations compared to traditional unimodal language models, which are trained on downstream tasks. Despite these advancements, existing fine-tuned neural semantic parsers are susceptible to adversarial attacks on natural-language inputs. While it has been established that the robustness of smaller semantic parsers can be enhanced through adversarial training, this approach is not feasible for large language models in real-world scenarios, as it requires both substantial computational resources and expensive human annotation on in-domain semantic parsing data. This paper presents the first empirical study on the adversarial robustness of a large prompt-based language model of code, \codex. Our results demonstrate that the state-of-the-art (SOTA) code-language models are vulnerable to carefully crafted adversarial examples. To address this challenge, we propose methods for improving robustness without the need for significant amounts of labeled data or heavy computational resources.

Motivation & Objective

  • To evaluate the adversarial robustness of prompt-based semantic parsing using Codex, a large pre-trained language model trained on code.
  • To investigate whether in-context learning with additional standard examples enhances robustness against adversarial perturbations.
  • To assess whether incorporating few-shot adversarial examples into prompts improves robustness of Codex.
  • To explore whether non-random sampling strategies for few-shot examples yield better robustness than random selection.
  • To understand the role of linguistic complexity and lexical diversity in few-shot example selection for robust semantic parsing.

Proposed method

  • Constructed adversarial evaluation sets using perturbation methods from the AdvGLUE benchmark to test robustness.
  • Evaluated Codex using adversarial evaluation metrics from Huang et al. (2021) to measure standard and robust accuracy.
  • Performed in-context learning with increasing numbers of standard demonstration examples to assess robustness improvement.
  • Augmented prompts with adversarial examples in few-shot settings to test their impact on robustness.
  • Applied multiple sampling strategies—random, cluster-based (TF-IDF, BERT, etc.), and complexity-driven (PPL, Desc)—to select few-shot examples.
  • Measured lexical diversity using TTR, Yule’s I, and MTLD to correlate linguistic complexity with model performance.

Experimental results

Research questions

  • RQ1Are prompt-based semantic parsers based on large pre-trained language models like Codex vulnerable to adversarial attacks?
  • RQ2Can in-context learning with more standard demonstration examples improve the robustness of prompt-based parsers?
  • RQ3Does including few-shot adversarial examples in the prompt enhance the robustness of Codex?
  • RQ4Do non-random sampling strategies for few-shot examples lead to better robustness compared to random sampling?
  • RQ5Is there a correlation between the linguistic complexity or lexical diversity of few-shot examples and the robustness of the parser?

Key findings

  • Prompt-based semantic parsers based on Codex are vulnerable to adversarial attacks, especially those involving sentence-level perturbations.
  • Increasing the number of standard demonstration examples in the prompt improves in-domain robustness, with doubled standard examples yielding higher robust and standard accuracy.
  • Adversarial in-context learning with few-shot adversarial examples marginally improves robustness but has limited impact and does not significantly degrade standard performance.
  • Sampling strategies that prioritize linguistic diversity—particularly Cluster-TF-IDF—yield higher robust and standard accuracy than random or low-complexity sampling methods.
  • Lexical diversity metrics (TTR, Yule’s I, MTLD) correlate strongly with model performance, indicating that higher diversity in few-shot examples enhances robustness.
  • Codex is sensitive to the choice of few-shot example sampling strategy, with cluster-based methods outperforming others due to better feature and lexical diversity representation.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.