http 响应消息解码_响应生成所需的解码策略

http 响应消息解码

介绍 (Introduction)

Deep learning has been deployed in many tasks in NLP, such as translation, image captioning, and dialogue systems. In machine translation, it is used to read source language (input) and generate the desired language (output). Similarly in a dialogue system, it is used to generate a response given a context. This is also known as Natural Language Generation (NLG).

深度学习已部署在NLP的许多任务中,例如翻译,图像字幕和对话系统。 在机器翻译中,它用于读取源语言(输入)并生成所需的语言(输出)。 类似地,在对话系统中,它用于在给定上下文的情况下生成响应。 这也称为自然语言生成(NLG)。

The model splits into 2 parts: encoder and decoder. Encoder reads the input text and returns a vector representing that input. Then, the decoder takes that vector and generates a corresponding text.

该模型分为两部分:编码器和解码器。 编码器读取输入文本,并返回代表该输入的向量。 然后,解码器获取该向量并生成相应的文本。

Image for post
Figure 1: Encoder-Decoder Architecture
图1:编码器-解码器架构

To generate a text, commonly it is done by generating one token at a time. Without proper techniques, the generated response may be very generic and boring. In this article, we will explore the following strategies:

要生成文本,通常是一次生成一个令牌来完成。 没有适当的技术,生成的响应可能会非常通用且令人厌烦。 在本文中,我们将探讨以下策略:

  • Greedy

    贪婪
  • Beam Search

    光束搜索
  • Random Sampling

    随机抽样
  • Temperature

    温度
  • Top-K Sampling

    Top-K采样
  • Nucleus Sampling

    核采样

解码策略 (Decoding Strategies)

At each timestep during decoding, we take the vector (that holds the information from one step to another) and apply it with softmax function to convert it into an array of probability for each word.

在解码期间的每个时间步上,我们取向量(将信息从一个步骤转移到另一个步骤),并将其与softmax函数一起应用以将其转换为每个单词的概率数组。

Image for post
Equation 1: Softmax Function. x is a token at timestep i. u is the vector that contains the value of every token in the vocabulary.
公式1:Softmax函数。 x是时间步i的令牌。 u是向量,包含词汇表中每个标记的值。

贪婪的方法 (Greedy Approach)

This app

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值