根据输入自动选最匹配的翻译示例,提升大模型翻译效果。
Adaptive Few-shot Prompting for Machine Translation with Pre-trained Language Models
- 用大模型自身嵌入检索语义相似的翻译样例。
- 在5528句外交双语数据上翻译准确率显著提升。
- 适合需要高质量翻译的场景,如外交、法律文本。
近期,具备上下文学习能力的大语言模型在神经机器翻译中展现出巨大潜力。然而,现有研究表明大模型对提示敏感,固定提示难以适配所有输入。为此,我们提出自适应少样本提示(AFSP)框架,自动为不同源语言句子选择合适的翻译示例,以更好激发大模型的翻译能力。首先,基于部署大模型的嵌入层构建翻译示例检索模块,从对齐的平行语料库中检索前k个语义相似的翻译示例;相比使用其他嵌入模型,该方法利用大模型自身嵌入实现更优的输入表示。其次,为确保源句与目标输出间的语义一致性,让部署的大模型借助翻译示例生成多个目标语言候选,并进行重排序。此外,为更有效评估最新语言能力并拓展神经机器翻译研究边界,我们构建了一个高质量的外交中文-英文平行语料库,包含5528组平行句子。最后,在所提出的外交中文-英文语料库和联合国平行语料库(中英部分)上的大量实验表明,所提AFSP框架具有有效性与优越性。
原文摘要 · Abstract (English)
Recently, Large language models (LLMs) with in-context learning have demonstrated remarkable potential in handling neural machine translation. However, existing evidence shows that LLMs are prompt-sensitive and it is sub-optimal to apply the fixed prompt to any input for downstream machine translation tasks. To address this issue, we propose an adaptive few-shot prompting (AFSP) framework to automatically select suitable translation demonstrations for various source input sentences to further elicit the translation capability of an LLM for better machine translation. First, we build a translation demonstration retrieval module based on LLM's embedding to retrieve top-k semantic-similar translation demonstrations from aligned parallel translation corpus. Rather than using other embedding models for semantic demonstration retrieval, we build a hybrid demonstration retrieval module based on the embedding layer of the deployed LLM to build better input representation for retrieving more semantic-related translation demonstrations. Then, to ensure better semantic consistency between source inputs and target outputs, we force the deployed LLM itself to generate multiple output candidates in the target language with the help of translation demonstrations and rerank these candidates. Besides, to better evaluate the effectiveness of our AFSP framework on the latest language and extend the research boundary of neural machine translation, we construct a high-quality diplomatic Chinese-English parallel dataset that consists of 5,528 parallel Chinese-English sentences. Finally, extensive experiments on the proposed diplomatic Chinese-English parallel dataset and the United Nations Parallel Corpus (Chinese-English part) show the effectiveness and superiority of our proposed AFSP.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。