[论文解读] Adversarial Training with Contrastive Learning in NLP
本文提出对抗性训练与对比学习结合(ATCL)方法,通过在嵌入空间中应用快速梯度法(FGM)扰动,并利用对比学习强制原始表示与扰动表示之间的相似性,从而提升自然语言处理模型的鲁棒性。该方法在不依赖预训练模型的前提下,实现了更低的困惑度和更高的BLEU分数,表明在语言建模和神经机器翻译任务中均具备更强的语义保持能力。
For years, adversarial training has been extensively studied in natural language processing (NLP) settings. The main goal is to make models robust so that similar inputs derive in semantically similar outcomes, which is not a trivial problem since there is no objective measure of semantic similarity in language. Previous works use an external pre-trained NLP model to tackle this challenge, introducing an extra training stage with huge memory consumption during training. However, the recent popular approach of contrastive learning in language processing hints a convenient way of obtaining such similarity restrictions. The main advantage of the contrastive learning approach is that it aims for similar data points to be mapped close to each other and further from different ones in the representation space. In this work, we propose adversarial training with contrastive learning (ATCL) to adversarially train a language processing task using the benefits of contrastive learning. The core idea is to make linear perturbations in the embedding space of the input via fast gradient methods (FGM) and train the model to keep the original and perturbed representations close via contrastive learning. In NLP experiments, we applied ATCL to language modeling and neural machine translation tasks. The results show not only an improvement in the quantitative (perplexity and BLEU) scores when compared to the baselines, but ATCL also achieves good qualitative results in the semantic level for both tasks without using a pre-trained model.
研究动机与目标
- 为解决自然语言处理模型在面对微小输入扰动时的鲁棒性挑战,同时保持语义一致性。
- 克服以往对抗性训练方法依赖外部预训练模型进行语义正则化的局限性。
- 探究对比学习是否可作为预训练模型的轻量化、高效替代方案,用于在对抗性训练中强制语义相似性。
- 评估对比学习在语言建模与神经机器翻译任务中,于对抗性扰动下维持语义一致性的有效性。
提出的方法
- 在输入词元的嵌入空间中应用快速梯度法(FGM)生成对抗性扰动。
- 利用对比学习最小化网络高层中原始输入与扰动输入表示之间的距离。
- 通过从同一小批量中随机采样构建负样本,确保其与原始表示的距离更远。
- 端到端训练模型,损失函数由标准任务损失(如交叉熵)与对比损失共同构成,以强制表示相似性。
- 通过在表示空间中直接进行对比优化,避免对预训练模型的依赖,从而学习语义相似性。
- 将该方法应用于语言建模与神经机器翻译任务,采用标准Transformer架构。

实验结果
研究问题
- RQ1在不依赖预训练模型的前提下,对比学习是否能有效强制自然语言处理中原始输入与对抗性扰动输入之间的语义相似性?
- RQ2ATCL在语言建模与翻译任务中的鲁棒性与性能表现,相较于标准对抗性训练与基线模型有何差异?
- RQ3与仅使用对抗性训练相比,采用对比学习是否能显著提升扰动后模型预测的语义保真度?
- RQ4为何在使用BPE分词时,ATCL在神经机器翻译任务中的性能增益减弱?其对负样本采样有何影响?
主要发现
- 在语言建模任务中,ATCL的测试困惑度达到24.63,优于基线模型(24.61)与基线+对抗性训练(25.04),表明其鲁棒性与泛化能力得到提升。
- 在神经机器翻译任务中,ATCL在IWSLT15 De-En翻译任务上取得36.40的BLEU分数,超过基线模型(35.23)与基线+对抗性训练(35.02),显示出更高的翻译质量。
- 定性分析表明,ATCL生成的翻译在保留源句语义方面优于基线模型与仅使用对抗性训练的模型,尤其在处理复杂短语与习语表达时表现更优。
- 该方法展现出一致的语义鲁棒性:即使在遭受对抗性扰动后,ATCL仍能保持连贯且语义合理的预测结果,而基线模型常产生语义退化的输出。
- NMT任务中性能下降的原因归因于BPE分词,其子词级表示可能与语义相似性不一致,尤其在负样本采样中表现不佳。
- 尽管在NMT任务中BLEU分数提升有限,但定性结果表明ATCL提升了翻译的语义保真度,说明对比学习在提升语义鲁棒性方面超越了标准指标的衡量。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。