[论文翻译]EVA:一个具有大规模生成式预训练的开放域中文对话系统


原文地址:https://u254848-88c6-e493554b.yza1.seetacloud.com:8443/miner/v2/analysis/pdf_md?filename=full.md&as_attachment=False&pdf=2bb6f097cd4961022c477fff0b26676ff3698fec33df138fb082afd713c971b11734933558_evav1.2108.01547.pdf


EVA: An Open-Domain Chinese Dialogue System with Large-Scale Generative Pre-Training

EVA 是一个专门针对中文设计的开放域对话系统,它利用了大规模生成式预训练技术,能够与用户进行自然流畅的多轮对话。该系统通过大量的文本数据训练,具备了广泛的知识覆盖面和强大的语言生成能力,可以应用于各种场景,如智能客服、聊天机器人等。

在开发过程中,EVA 采用了先进的 Transformer 模型架构,并结合了零样本 (Zero-shot) 和少样本 (Few-shot) 学习能力,使得它能够在遇到新任务或新领域时快速适应并给出合理的回应。此外,EVA 还融入了多种对话策略和技术,以提高对话的质量和用户体验。

EVA 的推出为中文对话系统的研发提供了新的思路和方法,也为推动通用人工智能 (AGI) 的发展做出了贡献。

Abstract

Although pre-trained language models have remarkably enhanced the generation ability of dialogue systems, open-domain Chinese dialogue systems are still limited by the dialogue data and the model size compared with English ones. In this paper, we propose EVA, a Chinese dialogue system that contains the largest Chinese pre-trained dialogue model with 2.8B parameters. To build this model, we collect the largest Chinese dialogue dataset named WDCDialogue from various public social media. This dataset contains 1.4B context-response pairs and is used as the pre-training corpus of EVA. Extensive experiments on automatic and human evaluation show that EVA outperforms other Chinese pre-trained dialogue models especially in the multi-turn interaction of humanbot conversations 1.

尽管预训练语言模型显著提升了对话系统的生成能力,但与英文系统相比,开放域中文对话系统仍然受到对话数据量和模型规模的限制。在本文中,我们提出了一种名为 EVA 的中文对话系统,该系统包含了一个拥有 28 亿参数 (2.8B parameters) 的最大中文预训练对话模型。为了构建这个模型,我们从多个公共社交媒体收集了最大的中文对话数据集,并将其命名为 WDCDialogue。该数据集包含 14 亿 (1.4B) 对话上下文-回复对,用作 EVA 的预训练语料库。广泛的自动评估和人工评估实验表明,EVA 在人机多轮对话交互中尤其优于其他中文预训练对话模型 [1]。

1 Introduction

1 引言

在这一部分,我们将介绍本文的背景和目的。随着生成式 AI (Generative AI) 技术的快速发展,大语言模型 (LLM) 在自然语言处理、图像生成、音频处理等多个领域取得了显著进展。这些模型能够通过学习大量的文本数据,生成与人类语言相似的内容,并在零样本和少样本的情况下表现出色。然而,尽管这些技术已经取得了巨大的进步,但在实际应用中仍然面临着许多挑战。

本文将探讨这些挑战,并介绍一些最新的研究进展和技术解决方案。我们还将讨论这些技术在未来的发展方向,以及它们对社会和行业可能产生的影响。

In recent years, numerous focus has been investigated to build open-domain dialogue systems, which require generating responses based on users’ input posts in open domains. Early works on open-domain dialogue systems mainly depend on RNN-based sequence-to-sequence (Seq2Seq) models (Vinyals and Le, 2015; Shang et al., 2015). With the development of pre-trained language models such as GPT (Radford et al., 2018), BART (Lewis et al., 2020) and T5 (Raffel et al., 2020), latest works in this area resort to building opendomain dialogue systems based on large-scale generative pre-training models, which include DialoGPT (Zhang et al., 2020a), Meena (Adiwardana et al., 2020) and Blender (Roller et al., 2021). Equipped with large amounts of dialogue data collected from social media, these models can generate human-like responses and improve the engagingness of human-bot conversations.

近年来,研究人员投入了大量精力来构建开放域对话系统,这类系统需要根据用户在开放领域的输入生成相应的回复。早期的开放域对话系统主要依赖于基于循环神经网络 (RNN) 的序列到序列 (Seq2Seq) 模型 (Vinyals 和 Le, 2015; Shang 等, 2015)。随着预训练语言模型的发展,如 GPT (Radford 等, 2018)、BART (Lewis 等, 2020) 和 T5 (Raffel 等, 2020),该领域的最新研究转向了基于大规模生成式预训练模型构建开放域对话系统,其中包括 DialoGPT (Zhang 等, 2020a)、Meena (Adiwardana 等, 2020) 和 Blender (Roller 等, 2021)。这些模型利用从社交媒体收集的大量对话数据,能够生成类似人类的回复,并提高了人机对话的互动性。

However, most of the dialogue models based on large-scale pre-training are built in English. We argue that existing works on open-domain Chinese dialogue systems are limited in model and data sizes. For example, CDial-GPT (Wang et al., 2020) (with 104M parameters) is pre-trained on 12M Chinese dialogues from Weibo2. PLATO-2 (Bao et al., 2020) (with 336M parameters) is pre-trained on 1.2B Chinese dialogues from social media. The scale of the publicly available dialogue data hinders us from building Chinese pre-trained dialogue models that can generate high-quality responses on open-domain topics.

然而,大多数基于大规模预训练的对话模型都是用英语构建的。我们认为,现有的中文开放域对话系统在模型规模和数据量方面都存在局限性。例如,CDial-GPT (Wang et al., 2020)(包含 1.04 亿个参数)是在来自微博的 1200 万条中文对话上进行预训练的。PLATO-2 (Bao et al., 2020)(包含 3.36 亿个参数)则是在来自社交媒体的 12 亿条中文对话上进行预训练的。公开可用的对话数据规模限制了我们构建能够在开放域话题上生成高质量回应的中文预训练对话模型的能力。

In this paper, we build an open-domain Chinese dialogue system called $E V A$ , which contains the largest Chinese dialogue model with 2.8B parameters and is pre-trained on WDC-Dialogue, including 1.4B Chinese dialogue data from different domains. First, we construct the WDC-Dialogue dataset by collecting the repost, comment, and Q&A data from various social media platforms and refactor them into dialogue sessions. Strict filtering rules are also devised to ensure the quality of the WDC-Dialogue dataset. Second, we train a large-scale Transformer-based encoder-decoder model on the Chinese dialogue data. To verify the effectiveness of our model, we conduct extensive automatic evaluation and human evaluation. In the automatic evaluation, we test our model on four datasets to show the generation ability when dealing with different categories of contexts. Moreover, observational and interactive human evaluations are also adopted to evaluate our model in real humanbot conversation scenarios. Finally, we provide an interactive demonstration system for users to converse with EVA.

在本文中,我们构建了一个名为 $E V A$ 的开放域中文对话系统,该系统包含一个拥有 28 亿参数的中文对话模型,并在 WDC-Dialogue 数据集上进行了预训练,该数据集包含来自不同领域的 14 亿条中文对话数据。首先,我们通过从多个社交媒体平台收集转发、评论和问答数据,并将其重构为对话会话,构建了 WDC-Dialogue 数据集。为了确保 WDC-Dialogue 数据集的质量,我们还制定了严格的过滤规则。其次,我们在中文对话数据上训练了一个基于 Transformer 的大规模编码器-解码器模型。为了验证我们模型的有效性,我们进行了广泛的自动评估和人工评估。在自动评估中,我们在四个数据集上测试了模型,以展示其在处理不同类型上下文时的生成能力。此外,我们还采用了观察性和交互式的人工评估,以评估模型在真实的人机对话场景中的表现。最后,我们提供了一个交互式演示系统,供用户与 EVA 进行对话。

构建 WDC-Dialogue 数据集

我们通过从多个社交媒体平台收集转发、评论和问答数据,并将其重构为对话会话,构建了 WDC-Dialogue 数据集。为了确保数据集的质量,我们制定了严格的过滤规则。这些规则包括但不限于去除低质量的对话、重复内容以及不适当的语言。经过处理后,WDC-Dialogue 数据集包含了 14 亿条中文对话数据,涵盖了多个领域。

模型训练

我们使用 WDC-Dialogue 数据集训练了一个基于 Transformer 的大规模编码器-解码器模型。该模型拥有 28 亿个参数,是目前最大的中文对话模型之一。通过在大量中文对话数据上的预训练,模型能够学习到丰富的对话模式和语言表达方式。

模型评估

为了验证模型的有效性,我们进行了两方面的评估:自动评估和人工评估。

自动评估

在自动评估中,我们在四个不同的数据集上测试了模型的生成能力,以评估其在处理不同类型上下文时的表现。这四个数据集涵盖了多种对话场景,能够全面反映模型的性能。

人工评估

除了自动评估外,我们还进行了观察性和交互式的人工评估。观察性评估主要由专业人员对模型生成的对话进行打分,而交互式评估则邀请真实用户与模型进行对话,评估其在实际应用场景中的表现。

交互式演示系统

为了方便用户与 EVA 进行互动,我们开发了一个交互式演示系统。用户可以通过该系统与 EVA 进行自然对话,体验其强大的对话生成能力。

Our contributions are mainly as follows:

我们的主要贡献如下:

表 1: WDC-Dialogue 和现有中文对话数据集的统计信息。"-" 表示原始论文中未报告该值。

• We collect the largest Chinese dialogue dataset called WDC-Dialogue from different domains, which contains 1.4B contextresponse pairs. The data quality is controlled by strict rules.

• 我们从不同领域收集了最大的中文对话数据集,称为 WDC-Dialogue,包含 14 亿个上下文-回复对。数据质量通过严格的规则进行控制。

• We build an open-domain dialogue system called EVA , which contains the largest Chinese pre-trained dialogue model with 2.8B parameters. Extensive experiments on automatic and human evaluation show the effectiveness of our model.

• 我们构建了一个名为 EVA 的开放域对话系统,该系统包含参数量为 28 亿的最大的中文预训练对话模型。广泛的自动评估和人工评估实验表明了我们模型的有效性。

• We release an interactive demonstration system for users to converse with EVA on opendomain topics.

• 我们发布了一个交互式演示系统,让用户可以与 EVA 就开放领域的话题进行对话。

2 Data

2 数据

这一部分将介绍与数据相关的背景和内容。数据是训练和评估生成式 AI (Generative AI) 模型的基础,高质量的数据对于模型的性能至关重要。在接下来的内容中,我们将详细探讨数据的来源、处理方法以及如何有效利用数据来提升模型的表现。

We construct a dataset named WDC-Dialogue from Chinese social media to train EVA. Specifically, conversations from various sources are gathered and a rigorous data cleaning pipeline is designed to enforce the quality of WDC-Dialogue. This section details the data collection and cleaning process used in our study.

我们构建了一个名为 WDC-Dialogue 的数据集,该数据集来源于中文社交媒体,用于训练 EVA。具体来说,我们从多个来源收集了对话数据,并设计了一套严格的数据清洗流程,以确保 WDC-Dialogue 的质量。本节将详细介绍我们在研究中使用的数据收集和清洗过程。

2.1 Data Collection

2.1 数据收集

在这一部分,我们将介绍数据收集的过程和方法。数据收集是任何研究或项目的基础步骤,确保我们能够获得高质量的数据来支持后续的分析和建模工作。

Dialogues in the WDC-Dialogue dataset originate from the textual interaction among different users on the Internet. Generally, these interactions can be classified into three categories: 1) The interactions exhibited through the repost behaviour on social media; 2) The interactions established through the comment / reply action on various online forums; 3) The interactions about online question and answer (Q&A) exchanges. Each round of these textual interactions yields a dialogue session. We design specific parsing rules to extract dialogues from these three kinds of interactions.

WDC-对话数据集中的对话来源于互联网上不同用户之间的文本互动。通常,这些互动可以分为三类:

  1. 社交媒体上的转发行为所展示的互动;
  2. 各种在线论坛上的评论/回复行为所建立的互动;
  3. 在线问答 (Q&A) 交流中的互动。

每一轮这样的文本互动都会形成一个对话会话。我们设计了特定的解析规则,从这三种类型的互动中提取对话。

Repost is a common feature provided by most social media platforms, which allows users to broadcast the posts created by others and add their own comments to these original posts (such as the Quote Tweet feature on Twitter). Each repost can be further broadcast by other users, thereby forming a chain of the user reply. This chain can be refactored in a dialogue session.

转发是大多数社交媒体平台提供的常见功能,它允许用户广播他人创建的帖子,并在这些原始帖子上添加自己的评论(例如 Twitter 上的 Quote Tweet 功能)。每个转发可以被其他用户进一步广播,从而形成一个用户回复链。这个链可以在对话会话中进行重构。

  • 转发 (Repost) 是指用户将他人的内容分享给自己的关注者,并可以选择添加个人评论。
  • 这种功能使得内容可以在不同用户之间传播,形成一个多层级的互动链条。
  • 通过对话会话的形式,可以将这些转发和回复重新组织,便于用户理解和追踪讨论的脉络。

In practice, we observe that such interaction pattern yields a reply tree, in which the root node is the original post, and the other nodes consist of the comments added in the broadcasting process. Each node may have multiple child nodes, which denote the comments left in the reposting process when broadcasting this node. Once the reply tree is constructed, each path from the root to the leaf can be regarded as a dialogue session.

在实际应用中,我们观察到这种互动模式会形成一个回复树,其中根节点是原始帖子,其他节点则是广播过程中添加的评论。每个节点可能有多个子节点,这些子节点表示在转发该节点时留下的评论。一旦回复树构建完成,从根节点到叶节点的每条路径都可以被视为一次对话会话。

In this study, we target several Chinese social platforms. Specifically, the raw data of reposts are first collected and further parsed to construct the reply trees. Dialogues are obtained using a DepthFirst-Search algorithm to traverse all the paths from each root node to their leaf nodes. This process helps to collect dialogues containing multiple turns of interaction.

在本研究中,我们针对多个中文社交平台进行分析。具体来说,首先收集了原始的转发数据,并进一步解析以构建回复树。通过使用深度优先搜索 (Depth-First-Search) 算法遍历每个根节点到其叶节点的所有路径,获取多轮互动的对话。这一过程有助于收集包含多个交互回合的对话。

Comment is another common feature that facilitates textual interactions among different users who surf the Internet. It allows users to share their opinion by leaving textual comments, which can be further replied to by others. Such an interaction pattern can be regarded as a form of conversation among users.

评论是另一种常见的功能,它促进了不同用户之间的文本互动。通过评论功能,用户可以留下自己的意见,其他用户也可以对这些评论进行回复。这种互动模式可以被视为用户之间的一种对话形式。

这种互动方式让用户能够在网上冲浪时分享自己的观点,并与其他用户进行交流。每个评论都可以被其他人回复,形成一个多轮次的对话链。这种对话机制不仅增强了用户的参与感,还促进了信息的传播和交流 [20]。

In this study, we target various Chinese forums. The raw data of posts and their following comments are collected. Ideally, these raw data can also be parsed to form a reply tree because each comment may have multiple replies. However, compared with the repost data, the collection of comment data is less flexible because some of the HTML pages from the front-end interface of forums do not provide the detailed reply information of each comment. As a consequence, the depth of reply trees is limited and the dialogues obtained based on comment data have shorter turns comparing to dialogues originating from repost data.

在本研究中,我们针对多个中文论坛。收集了帖子及其后续评论的原始数据。理想情况下,这些原始数据可以被解析成回复树,因为每个评论可能有多个回复。然而,与转发数据相比,评论数据的收集灵活性较低,因为某些论坛前端界面的HTML页面没有提供每个评论的详细回复信息。因此,回复树的深度受到限制,基于评论数据获得的对话轮次比基于转发数据的对话要短。

Table 2: Comparison between EVA and other large-scale Chinese pre-trained dialogue models.

表 2: EVA 与其他大规模中文预训练对话模型的对比

模型 参数量 (Nparam) 层数 (L) 注意力头数 (nhead) 模型维度 (dmodel) 前馈网络维度 (dff) 模型类型
CDial-GPT 104M 12 12 768 3,072 解码器 (Decoder)
PLATO-2 336M 24 16 1,024 4,096 UniLM
EVA 2.8B 24 32 2,048 5,120 编码器-解码器 (Encoder-Decoder)

注:表中展示了不同模型的关键参数,包括参数量、层数、注意力头数、模型维度和前馈网络维度,以及模型类型。EVA 在参数量和模型规模上明显大于其他两个模型。

Q&A is a special kind of interaction among users on the Internet. In online Q&A platforms such as Quora3 or $Z h i h u^{4}$ , users post their questions related to various topics attached with a detailed description. Other people tend to provide answers with lots of backgrounds, opinions, experiences, and knowledge. We regard a post and each of its corresponding answers as a single-turn conversation.

问与答 (Q&A) 是互联网上用户之间的一种特殊互动形式。在像 Quora3 或 知乎 这样的在线 Q&A 平台上,用户会发布与各种主题相关的问题,并附上详细的描述。其他用户则会根据自己的背景、观点、经验和知识来提供答案。我们将一个问题及其对应的每个回答视为一次单轮对话。

2.2 Data Quality Control

2.2 数据质量控制

在这一部分,我们将介绍如何确保数据的质量,这是构建可靠的大语言模型 (LLM) 和其他 AI 系统的关键步骤。数据质量控制涉及多个方面,包括数据的准确性、完整性、一致性和时效性。通过严格的数据质量控制,可以有效提高模型的性能和稳定性。

(注:如果后续有更多内容,请继续提供翻译。)

Textual data from online social media carry various noises such as advertisements, hate speech, profanity and informal internet slang. Some of the contents even carry sensitive information such as user privacy. Models trained on these data can easily bias to these noisy contents. To improve the quality of the WDC-Dialogue dataset, we design a rigorous process to clean the dialogues.

来自在线社交媒体的文本数据包含各种噪声,例如广告、仇恨言论、粗俗语言和非正式的网络俚语。部分内容甚至携带敏感信息,如用户隐私。在这些数据上训练的模型很容易偏向这些噪声内容。为了提高 WDC-Dialogue 数据集的质量,我们设计了一个严格的清理流程来处理对话数据。

We follow a similar process used by Wang et al. (2020) to filter out noisy contents with a series of rules: (1) delete the platform-related tags in the dialogues, such as "Reply to $@"$ and "Repost// $@"$ ; (2) remove URL strings from the text; (3) split conversations with more than 30 turns into multiple conversations less than 30 turns Shang et al. (2015); (4) only keep one copy of the phrases or words that repeat more than 6 times in one sentence; (5) remove dialogues that contain responses that are too long or too short; (6) remove dialogues if the response is identified as an advertisement by the method introduced in Wang et al. (2013);

我们遵循了 Wang 等 (2020) 使用的类似方法,通过一系列规则来过滤掉对话中的噪声内容:

  1. 删除对话中与平台相关的标签,例如 "Reply to $@$" 和 "Repost// $@$";
  2. 从文本中移除 URL 字符串;
  3. 将超过 30 轮的对话拆分为多个不超过 30 轮的对话(Shang 等, 2015);
  4. 在一句话中,只保留重复超过 6 次的短语或单词的一个副本;
  5. 移除包含过长或过短回复的对话;
  6. 如果回复被识别为广告(根据 Wang 等 (2013) 引入的方法),则移除该对话。

(7) remove dialogues if $90%$ of tri-grams in the response are high-frequency tri-grams (Zhang et al., 2020a); (8) remove dialogues if the response has some specific forms of generic responses; (9) remove dialogues in which the response is the same as the post.

(7) 如果回复中 90% 的三元语法 (tri-grams) 是高频三元语法 (Zhang et al., 2020a),则移除该对话;
(8) 如果回复具有某些特定形式的通用回复,则移除该对话;
(9) 如果回复与帖子内容相同,则移除该对话。

We also manually construct a word list containing the following noise: (1) dirty words, sensitive words, and dialect; (2) special topic words such as the name of some rare virus or compound; (3) name, appellation and unknown abbreviation; (4) special symbols and emojis; (5) platform signs such as the words which are related to ads, pictures, and videos. A dialogue will be removed from our dataset if it contains words in this word list.

我们还手动构建了一个包含以下噪声的词表:(1) 脏话、敏感词和方言;(2) 特殊主题词,例如某些罕见病毒或化合物的名称;(3) 人名、称呼和未知缩写;(4) 特殊符号和表情符号;(5) 平台标识,例如与广告、图片和视频相关的词语。如果对话中包含这些词表中的词语,该对话将从我们的数据集中移除。

2.3 Data Statistics

2.3 数据统计

在这一部分,我们将介绍数据集的基本统计信息。这些统计结果有助于我们更好地理解数据的特征和分布情况,为后续的分析和建模提供重要参考。

Table 1 shows a statistics of the filtered WDCDialogue dataset and other Chinese dialogue datasets. To the best of our knowledge, WDCDialogue is the largest Chinese dialogue dataset with 1.4B context-response pairs and the largest number of utterances, tokens and storage size.

表 1: 显示了过滤后的 WDCDialogue 数据集以及其他中文对话数据集的统计信息。据我们所知,WDCDialogue 是目前最大的中文对话数据集,包含 14 亿个上下文-回复对 (context-response pairs),并且在对话轮数、Token 数量和存储大小方面都是最大的。

3 Method

3 方法

方法部分通常会详细介绍研究中使用的技术和流程。在这里,作者将介绍用于实验的具体方法和技术细节。这一部分对于理解研究的实施过程至关重要。

3.1 Model

3.1 模型 (Model)

在这一部分,我们将介绍所使用的模型及其相关技术。模型是生成式 AI (Generative AI) 系统的核心组件,负责处理输入数据并生成相应的输出。具体来说,我们将讨论模型的架构、训练方法以及其在不同任务中的表现。

EVA is a Transformer-based dialogue model with a bi-directional encoder and a uni-directional decoder (Vaswani et al., 2017). We present the EVA’s model details and a comparison with previous largescale Chinese pre-trained dialogue models in Table 2. EVA is nearly 8 times the size of the previous largest Chinese dialogue model, PLATO-2.

EVA 是一个基于 Transformer 的对话模型,具有双向编码器和单向解码器 (Vaswani et al., 2017)。我们在表 2 中展示了 EVA 的模型细节,并将其与之前的大型中文预训练对话模型进行了比较。EVA 的规模几乎是之前最大的中文对话模型 PLATO-2 的 8 倍。

表 2: EVA 与其他中文预训练对话模型的对比
模型名称 参数量 (亿)
PLATO-2 110
EVA 860

3.2 Token iz ation

3.2 Token化

As Chinese words, containing some specific meanings, are usually composed of several characters, traditional character-level vocabulary loses the important semantics of Chinese words or phrases. Thus, we construct a sub-word vocabulary, containing both Chinese characters and Chinese words, based on the word segmented corpus using unigram language model (Kudo and Richardson, 2018). The sub-word vocabulary contains 30,000 tokens.

由于中文词语通常由多个字符组成,包含特定的语义信息,传统的字符级词汇表会丢失中文词语或短语的重要语义。因此,我们基于词分割后的语料库,使用单音语言模型 (unigram language model) (Kudo and Richardson, 2018) 构建了一个子词词汇表,该词汇表同时包含中文字符和中文词语。子词词汇表包含 30,000 个 Token。


Figure 1: Our data sampling strategy for efficient pretraining. In this example, two context-response pairs are concatenated and padded as a data sample. With the attention masks, the two pairs cannot attend to each other. The relative position embeddings are compatible with our sampling strategy.


图 1: 我们的高效预训练数据采样策略。在这个例子中,两个上下文-回应对被连接并填充为一个数据样本。通过注意力掩码,这两个对之间不能相互关注。相对位置嵌入与我们的采样策略兼容。

解释一下这个图和描述:在大语言模型的预训练过程中,为了提高效率,研究人员设计了一种特殊的数据采样方法。如图所示,两个对话对(即上下文和回应)被连接在一起形成一个完整的训练样本。为了避免这两个对话对之间的信息泄露,使用了注意力掩码机制,确保每个对话对只能关注自身的内容,而不会受到另一个对话对的影响。同时,相对位置嵌入的设计也保证了这种采样方式的有效性。

3.3 Pre-Training Details

3.3 预训练细节 (Pre-Training Details)

预训练是大语言模型开发过程中的一个重要步骤。在这个阶段,模型会通过大量文本数据进行学习,以获得对语言结构和模式的基本理解。预训练的目标是让模型能够在没有特定任务指导的情况下,掌握语言的通用特征。这一过程通常使用无监督学习方法,即模型在训练过程中不需要人工标注的数据。

预训练的具体实现方式可能会因不同的模型架构和研究团队而有所差异。常见的预训练策略包括使用 Transformer 架构、基于 Token 的表示方法等。预训练的数据来源也非常广泛,可以是从互联网抓取的文本、书籍、新闻文章等。通过这些大规模的数据集,模型能够学习到丰富的语言知识,为后续的微调和应用打下坚实的基础。

在预训练过程中,研究人员还会关注一些关键参数的设置,例如学习率、批量大小、训练轮数等。这些参数的选择会对模型的最终性能产生重要影响。此外,预训练的时间和计算资源需求也非常大,通常需要使用高性能的计算设备,如 GPU 或 TPU。

预训练完成后,模型可以进一步通过微调来适应特定的任务,如文本生成、问答系统、机器翻译等。微调的过程通常使用有监督的学习方法,并且只需要相对较少的数据。通过这种方式,预训练模型可以在各种下游任务中表现出色,甚至在零样本或少样本的情况下也能取得良好的效果 [20]。

We use the sequence-to-sequence language modeling (Sutskever et al., 2014) task to train our model. Specifically, for a dialogue session with $n$ utterances, we train the model to generate the $n^{t h}$ utterance from the decoder conditioned on the previous $n-1$ utterances, which are fed to the encoder. The model is trained with the teacher-forcing paradigm.

我们使用序列到序列语言模型 (sequence-to-sequence language modeling) [Sutskever et al., 2014] 任务来训练我们的模型。具体来说,对于一个包含 $n$ 条发言的对话会话,我们训练模型通过解码器生成第 $n^{th}$ 条发言,该生成过程依赖于之前的 $n-1$ 条发言,这些发言被输入到编码器中。模型采用教师强制 (teacher-forcing) 训练范式进行训练。

To reduce the GPU memory consumption, we adopt mixed-precision training (Mic ike vici us et al., 2018) and ZeRO (stage-1) (Raj bh and ari et al., 2020) to partition the parameters of the optimizer to multiple data parallelism process.

为了减少 GPU 内存消耗,我们采用了混合精度训练 (mixed-precision training) (Mic ike vici us et al., 2018) 和 ZeRO (stage-1) (Rajbh and ari et al., 2020),将优化器的参数分配到多个数据并行进程中。

We set the maximum encoder length and maximum decoder length as 128 to ensure that most utterances are not truncated during training. However, short utterances are heavily padded if we view each context-response pair as a data sample; such heavy padding is a bottleneck in pre-training efficiency. To address the challenge, we propose a data sampling strategy that allows a data sample to contain multiple context-response pairs, as illustrated in Figure 1. Specifically, we concatenate multiple context-response pairs as a data sample and distinguish different pairs with attention masks for the encoder self-attention, decoder self-attention, and cross attention. Note that EVA adopts relative position embeddings (Raffel et al., 2020), which is compatible with our data sampling strategy.

我们设置了最大编码器长度和最大解码器长度为 128,以确保大多数话语在训练过程中不会被截断。然而,如果将每个上下文-回应对视为一个数据样本,短话语会被大量填充;这种大量的填充是预训练效率的瓶颈。为了解决这一挑战,我们提出了一种数据采样策略,允许一个数据样本包含多个上下文-回应对,如图 1 所示。具体来说,我们将多个上下文-回应对连接成一个数据样本,并通过注意力掩码(attention masks)来区分不同的对,这些掩码用于编码器自注意力、解码器自注意力和交叉注意力。需要注意的是,EVA 采用了相对位置嵌入 (relative position embeddings) [20],这与我们的数据采样策略兼容。

图 1: 数据采样策略示例

通过这种方式,我们可以有效减少填充带来的计算开销,提高预训练的效率。

测试集 实例数 话语数 Token 数 (上下文) Token 数 (回复)
单轮 10,000 2.0 16.8 11.5
多轮 10,000 3.1 24.3 9.6
长对话 10,000 2.0 8.9 15.9
问答 10,000 2.0 22.1 12.3

Table 3: Statistics of four test sets, including the amount of instances, the average number of utterances in dialogue sessions, and the average number of tokens in contexts / responses.

表 3: 四个测试集的统计信息,包括实例数量、对话会话中的平均语句数以及上下文/回复中的平均 Token 数。

测试集名称 实例数量 对话语句平均数 上下文/回复平均 Token 数

4 Experiment

4 实验

实验部分通常会详细介绍研究者如何设计和执行实验来验证他们的假设或评估模型的性能。这一节可能会包括实验设置、使用的数据集、评估指标以及实验结果的分析。

如果您有更多具体内容,我将继续为您翻译。

4.1 Dataset

4.1 数据集

数据集是训练和评估大语言模型 (LLM) 的基础。在本节中,我们将详细介绍用于实验的数据集来源、规模以及预处理方法。一个高质量的数据集对于模型的性能至关重要,因为它直接影响到模型的学习效果和泛化能力。

(由于原文内容较少,以上是根据常见学术论文结构对段落内容的合理补充,以符合科普文章的可读性要求。如果需要更具体的内容,请提供完整的英文段落。)

We collect four datasets which have no overlap with our pre-training corpus to test pre-trained dialogue models in a zero-shot setting. These test sets indicate the following dialogue scenarios: 1) Single: This test set contains the dialogue with only one utterance as the context. 2) Multi: This test set includes the dialogue with multiple utterances as the context. 3) Long: This test set contains the dialogues where the length of responses is longer than that of contexts. 4) QA: This test set includes the dialogues where the last utterance of contexts is a question. The statistics of these four test sets are shown in Table 3.

我们收集了四个与预训练语料库没有重叠的数据集,用于在零样本 (Zero-shot) 设置下测试预训练对话模型。这些测试集涵盖了以下对话场景:

  1. 单轮 (Single):该测试集包含仅有一个话语作为上下文的对话。
  2. 多轮 (Multi):该测试集包含有多个话语作为上下文的对话。
  3. 长回复 (Long):该测试集包含回复长度超过上下文长度的对话。
  4. 问答 (QA):该测试集包含上下文的最后一句话为问题的对话。

这四个测试集的统计信息如表 3 所示。

测试集 对话数量 平均上下文长度 平均回复长度
单轮 (Single)
多轮 (Multi)
长回复 (Long)
问答 (QA)

表 3: 四个测试集的统计信息

4.2 Baseline

4.2 基线 (Baseline)

基线是指在研究或实验中用作比较标准的参考点或模型。在这个部分,我们将介绍用于评估和对比的基线方法。这些基线方法通常包括传统的机器学习算法或现有的先进模型,以便能够客观地评估新提出的方法是否具有优势。

We adopt several Chinese pre-trained models as our baselines:

我们采用了多个中文预训练模型作为我们的基准模型:

CDial-GPT: This Chinese pre-trained dialogue model with 104M parameters is pre-trained on LCCC, which contains 12M dialogue sessions (Wang et al., 2020).

CDial-GPT:这个包含 1.04 亿参数的中文预训练对话模型是在 LCCC 数据集上预训练的,该数据集包含 1200 万轮对话会话 (Wang et al., 2020)。

CPM: This model is a general Chinese pre-trained model with 2.6B parameters, which is pre-trained on 100GB Chinese data including encyclopedia, news, novels, and Q&A (Zhang et al., 2020b). Since CPM cannot be directly applied to generating responses for dialogue contexts, we follow the original paper to condition the language model on a prompt of several example context-response pairs.

CPM:该模型是一个通用的中文预训练模型,包含 26 亿个参数,在 100GB 的中文数据上进行了预训练,数据包括百科全书、新闻、小说和问答 (Zhang et al., 2020b)。由于 CPM 不能直接用于生成对话场景中的回复,我们遵循原论文的方法,通过几个示例的上下文-回复对来调整语言模型。

在对话生成任务中,CPM 需要先通过一些示例对话对(即上下文和对应的回复)来进行提示(prompt),从而更好地生成符合对话场景的回复。这种方法使得模型能够在特定的对话环境中表现出更好的理解和生成能力。

Note that we do not choose PLATO-2 (Bao et al., 2020) as our baseline because the authors have not released the Chinese pre-trained dialogue model.

请注意,我们没有选择 PLATO-2 (Bao et al., 2020) 作为我们的基准模型,因为该模型的作者尚未发布中文预训练对话模型。

4.3 Automatic Evaluation

4.3 自动评估 (Automatic Evaluation)

自动评估是指使用计算机程序对模型的性能进行量化分析,而不需要人工干预。这种方法可以快速、客观地衡量模型的表现,特别适用于大规模测试和迭代开发过程。常见的自动评估指标包括准确率、召回率、F1值等。在生成式 AI (Generative AI) 领域,常用的评估方法还包括困惑度 (Perplexity) 和 BLEU 分数等。自动评估能够帮助研究人员快速识别模型的优点和不足,从而指导模型的优化和改进。

We adopt unigram F1 (Dinan et al., 2019), ROUGEL (R-L) (Lin, 2004), BLEU (Papineni et al., 2002) and Distinct n-grams (Dist-n) (Li et al., 2016) as automatic metrics. The former three metrics evaluate the relevance between the generated responses and the references, while the last one measures the diversity of generated responses.

我们采用单词 F1 (unigram F1) (Dinan et al., 2019),ROUGE-L (R-L) (Lin, 2004),BLEU (Papineni et al., 2002) 和 Distinct n-grams (Dist-n) (Li et al., 2016) 作为自动评估指标。前三种指标用于评估生成的回复与参考答案之间的相关性,而最后一个指标则用于衡量生成回复的多样性。

Table 4: Results of automatic evaluation.

表 4: 自动评估结果。

测试集 模型 F1 R-L BLEU-4 Dist-2/3
Single CDial-GPT 6.5 5.9 0.68 18.0 / 36.4
CPM 8.2 7.5 1.26 29.0 / 58.4
EVA 10.5 9.8 1.88 23.6 / 49.5
Multi CDial-GPT 6.4 5.9 0.55 17.0 / 34.2
CPM 7.7 7.2 1.01 30.5 / 60.2
EVA 10.1 9.5 1.22 22.8 / 49.3
Long CDial-GPT 6.5 5.6 0.28 17.4 / 33.4
CPM 8.7 7.6 0.78 29.1 / 57.5
EVA 10.8 9.6 1.19 22.5 / 47.0
VO CDial-GPT 7.2 6.5 0.59 18.4 / 38.9
CPM 8.2 7.3 1.12 26.4 / 55.2
EVA 10.0 9.1 1.38 22.0 / 48.0
Overall CDial-GPT 6.6 6.0 0.53 11.3 / 27.3
C