[论文解读] On Robustness of Prompt-based Semantic Parsing with Large Pre-trained Language Model: An Empirical Study on Codex
本文研究了基于提示的语义解析在 Codex(一种在代码上微调的大规模语言模型)中的对抗鲁棒性。研究发现,即使 Codex 也容易受到对抗样本的影响,尤其是句子级别的扰动。研究提出,通过使用多样化、高词汇复杂度的 few-shot 示例进行上下文学习,可提升鲁棒性,为对抗训练提供一种低资源替代方案,且无需大量数据或计算资源。
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.
研究动机与目标
- 评估基于 Codex(一种在代码上训练的大规模预训练语言模型)的基于提示的语义解析的对抗鲁棒性。
- 探究在上下文学习中增加标准示例是否能提升对对抗扰动的鲁棒性。
- 评估在提示中引入 few-shot 对抗示例是否能提升 Codex 的鲁棒性。
- 探索在 few-shot 示例选择中,非随机采样策略是否比随机选择带来更好的鲁棒性。
- 理解语言复杂度和词汇多样性在 few-shot 示例选择中对鲁棒语义解析的作用。
提出的方法
- 使用 AdvGLUE 基准中的扰动方法构建对抗性评估集,以测试鲁棒性。
- 采用 Huang 等人(2021)提出的对抗性评估指标,衡量标准准确率和鲁棒准确率。
- 通过逐步增加标准示范示例的数量,进行上下文学习,以评估鲁棒性的提升。
- 在 few-shot 设置中,将对抗示例加入提示,以测试其对鲁棒性的影响。
- 应用多种采样策略——随机采样、基于聚类的(TF-IDF、BERT 等)以及基于复杂度的(PPL、Desc)——来选择 few-shot 示例。
- 使用 TTR、Yule’s I 和 MTLD 测量词汇多样性,以关联语言复杂度与模型性能。
实验结果
研究问题
- RQ1基于大型预训练语言模型(如 Codex)的基于提示的语义解析器是否容易受到对抗攻击?
- RQ2通过增加更多标准示范示例进行上下文学习,是否能提升基于提示的解析器的鲁棒性?
- RQ3在提示中包含 few-shot 对抗示例,是否能提升 Codex 的鲁棒性?
- RQ4与随机采样相比,非随机采样策略在 few-shot 示例选择中是否带来更好的鲁棒性?
- RQ5few-shot 示例的语言复杂度或词汇多样性是否与解析器的鲁棒性存在相关性?
主要发现
- 基于 Codex 的基于提示的语义解析器对对抗攻击敏感,尤其在句子级扰动下。
- 在提示中增加标准示范示例的数量可提升域内鲁棒性,标准示例数量翻倍时,鲁棒准确率和标准准确率均提高。
- 使用 few-shot 对抗示例进行上下文学习可略微提升鲁棒性,但影响有限,且对标准性能无显著负面影响。
- 优先考虑词汇多样性的采样策略——尤其是 Cluster-TF-IDF——相比随机或低复杂度采样方法,能带来更高的鲁棒和标准准确率。
- 词汇多样性度量(TTR、Yule’s I、MTLD)与模型性能呈强相关性,表明 few-shot 示例中更高的多样性可增强鲁棒性。
- Codex 对 few-shot 示例采样策略的选择非常敏感,基于聚类的方法表现最佳,因其能更好地体现特征和词汇多样性。
阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。