Self-critical Sequence Training for Image Captioning | AGIDaily
AGI Daily
资讯日报词条论文人物新创
返回论文列表

暂无章节

返回论文列表
目录

Self-critical Sequence Training for Image Captioning

收录于 CVPR 2017 会议论文被引 2,675 次
打开论文来源

Self-critical Sequence Training for Image Captioning

Steven J. Rennie, Etienne Marcheret1^11, Youssef Mroueh, Jerret Ross and Vaibhava Goel1^11

Watson Multimodal Algorithms and Engines Group
IBM T.J. Watson Research Center, NY, USA

{sjrennie, mroueh, rossja}@us.ibm.com, {etiennemarcheret, vaibhavagoel}@gmail.com

1^11Authors Etienne Marcheret and Vaibhava Goel were at IBM while the work was being completed.

Abstract

摘要

Recently it has been shown that policy-gradient methods for reinforcement learning can be utilized to train deep end-to-end systems directly on non-differentiable metrics for the task at hand. In this paper we consider the problem of optimizing image captioning systems using reinforcement learning, and show that by carefully optimizing our systems using the test metrics of the MSCOCO task, significant gains in performance can be realized. Our systems are built using a new optimization approach that we call self-critical sequence training (SCST). SCST is a form of the popular REINFORCE algorithm that, rather than estimating a “baseline” to normalize the rewards and reduce variance, utilizes the output of its own test-time inference algorithm to normalize the rewards it experiences. Using this approach, estimating the reward signal (as actor-critic methods must do) and estimating normalization (as REINFORCE algorithms typically do) is avoided, while at the same time harmonizing the model with respect to its test-time inference procedure. Empirically we find that directly optimizing the CIDEr metric with SCST and greedy decoding at test-time is highly effective. Our results on the MSCOCO evaluation sever establish a new state-of-the-art on the task, improving the best result in terms of CIDEr from 104.9 to 114.7.

近来已有研究表明,可以利用强化学习中的策略梯度方法,直接针对任务本身不可微的指标来训练深度端到端系统。本文考虑用强化学习优化图像描述系统,并表明:若仔细地用 MSCOCO 任务的测试指标来优化系统,性能可以获得显著提升。我们的系统建立在一种新的优化方法之上,称为自临界序列训练(self-critical sequence training,SCST)。SCST 是流行的 REINFORCE 算法的一种形式:它并不去估计一条“基线”来归一化奖励并降低方差,而是用自身测试时推理算法的输出,来归一化它所经历的奖励。采用这一做法,既不必像 actor-critic 方法那样去估计奖励信号,也不必像通常的 REINFORCE 算法那样去估计归一化项,同时又能使模型与其测试时的推理手续相一致。经验上我们发现,用 SCST 直接优化 CIDEr 指标,并在测试时采用贪心解码,效果很好。我们在 MSCOCO 评测服务器上的结果为该任务确立了新的当时最高水平,把 CIDEr 上的最好成绩从 104.9 提升到了 114.7。

  1. Introduction
  1. 引言

Image captioning aims at generating a natural language description of an image. Open domain captioning is a very challenging task, as it requires a fine-grained understanding of the global and the local entities in an image, as well as their attributes and relationships. The recently released MSCOCO challenge [1] provides a new, larger scale platform for evaluating image captioning systems, complete with an evaluation server for benchmarking competing methods. Deep learning approaches to sequence modeling have yielded impressive results on the task, dominating the task leaderboard. Inspired by the recently introduced encoder/decoder paradigm for machine translation using recurrent neural networks (RNNs) [2], [3], and [4] use a deep convolutional neural network (CNN) to encode the input image, and a Long Short Term Memory (LSTM) [5] RNN decoder to generate the output caption. These systems are trained end-to-end using back-propagation, and have achieved state-of-the-art results on MSCOCO. More recently in [6], the use of spatial attention mechanisms on CNN layers to incorporate visual context—which implicitly conditions on the text generated so far—was incorporated into the generation process. It has been shown and we have qualitatively observed that captioning systems that utilize attention mechanisms lead to better generalization, as these models can compose novel text descriptions based on the recognition of the global and local entities that comprise images.

图像描述的目标是为图像生成自然语言说明。开放域描述非常具有挑战性,因为它需要对图像中的全局和局部实体及其属性与关系有细粒度的理解。最近发布的 MSCOCO 挑战 [1] 为评测图像描述系统提供了一个新的、更大规模的平台,并配有评测服务器以便比较各种方法。深度学习的序列建模方法在该任务上取得了令人印象深刻的结果,占据了任务排行榜的前列。受近期用循环神经网络(RNN)做机器翻译的编码器/解码器范式启发 [2],[3] 和 [4] 用深度卷积神经网络(CNN)编码输入图像,并用长短期记忆(LSTM)[5] RNN 解码器生成输出描述。这些系统用反向传播做端到端训练,并在 MSCOCO 上取得了当时最好的结果。更近一些,[6] 把作用在 CNN 层上的空间注意力机制引入生成过程,以纳入视觉上下文——它隐式地以至此已生成的文本为条件。已有结果表明,我们也定性地观察到,使用注意力机制的描述系统具有更好的泛化能力,因为这些模型可以在识别构成图像的全局与局部实体的基础上,组织出新颖的文字描述。

As discussed in [7], deep generative models for text are typically trained to maximize the likelihood of the next ground-truth word given the previous ground-truth word using back-propagation. This approach has been called “Teacher-Forcing” [8]. However, this approach creates a mismatch between training and testing, since at test-time the model uses the previously generated words from the model distribution to predict the next word. This exposure bias [7], results in error accumulation during generation at test time, since the model has never been exposed to its own predictions.

如 [7] 所讨论的,文本深度生成模型通常用反向传播训练,以在给定前一个真值词的条件下最大化下一个真值词的似然。这一做法被称为 “Teacher-Forcing” [8]。不过,它会造成训练与测试之间的不一致,因为测试时模型要用模型分布此前生成的词来预测下一个词。这种曝光偏差 [7] 会在测试时的生成过程中造成错误累积,因为模型从未见过自己的预测。

Several approaches to overcoming the exposure bias problem described above have recently been proposed. In [8] they show that feeding back the model’s own predictions and slowly increasing the feedback probability ppp during training leads to significantly better test-time performance. Another line of work proposes “Professor-Forcing” [9], a technique that uses adversarial training to encourage the dynamics of the recurrent network to be the same when training conditioned on ground truth previous words and when sampling freely from the network.

针对上述曝光偏差问题,近来已有若干方法被提出。[8] 表明,把模型自己的预测反馈回去,并在训练中缓慢提高反馈概率 ppp,可以显著改善测试时的表现。另一类工作提出 “Professor-Forcing” [9],用对抗训练促使循环网络在以真值前词为条件训练时,与从网络中自由采样时,具有相同的动态。

While sequence models are usually trained using the cross entropy loss, they are typically evaluated at test time using discrete and non-differentiable NLP metrics such as BLEU [10], ROUGE [11], METEOR [12] or CIDEr [13]. Ideally sequence models for image captioning should be trained to avoid exposure bias and directly optimize metrics for the task at hand.

序列模型通常用交叉熵损失训练,但测试时往往用离散且不可微的自然语言处理指标来评测,例如 BLEU [10]、ROUGE [11]、METEOR [12] 或 CIDEr [13]。理想情况下,图像描述的序列模型应当在训练中避免曝光偏差,并直接优化当前任务的指标。

Recently it has been shown that both the exposure bias and non-differentiable task metric issues can be addressed by incorporating techniques from Reinforcement Learning (RL) [14]. Specifically in [7], Ranzato et al. use the REINFORCE algorithm [15] to directly optimize non-differentiable, sequence-based test metrics, and overcome both issues. REINFORCE as we will describe, allows one to optimize the gradient of the expected reward by sampling from the model during training, and treating those samples as ground-truth labels (that are re-weighted by the reward they deliver). The major limitation of the approach is that the expected gradient computed using mini-batches under REINFORCE typically exhibit high variance, and without proper context-dependent normalization, is typically unstable. The recent discovery that REINFORCE with proper bias correction using learned “baselines” is effective has led to a flurry of work in applying REINFORCE to problems in RL, supervised learning, and variational inference [16, 17, 18]. Actor-critic methods [14], which instead train a second “critic” network to provide an estimate of the value of each generated word given the policy of an actor network, have also been investigated for sequence problems recently [19]. These techniques overcome the need to sample from the policy’s (actor’s) action space, which can be enormous, at the expense of estimating future rewards, and training multiple networks based on one another’s outputs, which as [19] explore, can also be unstable.

近来的研究表明,把强化学习(RL)[14] 中的技术引入进来,可以同时应对曝光偏差和任务指标不可微这两个问题。具体而言,在 [7] 中,Ranzato 等人用 REINFORCE 算法 [15] 直接优化不可微的、基于序列的测试指标,并同时克服这两个问题。如我们将要说明的,REINFORCE 允许人们在训练时从模型中采样,并把这些样本当作真值标签(再按它们带来的奖励重新加权),从而优化期望奖励的梯度。这一做法的主要局限是:用小批量在 REINFORCE 下计算的期望梯度通常方差很大,若没有恰当的、依赖于上下文的归一化,往往不稳定。近来人们发现,用已学习的“基线”做恰当的偏差校正后,REINFORCE 是有效的,这引发了一大批把 REINFORCE 用于强化学习、监督学习以及变分推断问题的工作 [16, 17, 18]。actor-critic 方法 [14] 则另外训练第二个“评价器”网络,在给定行动器网络策略的条件下,为每个已生成的词提供价值估计;这类方法近来也被用于序列问题 [19]。这些技术不必再从策略(行动器)可能极为庞大的动作空间中采样,代价则是需要估计未来奖励,并基于彼此的输出训练多个网络;如 [19] 所探讨的,这同样可能不稳定。

In this paper we present a new approach to sequence training which we call self-critical sequence training (SCST), and demonstrate that SCST can improve the performance of image captioning systems dramatically. SCST is a REINFORCE algorithm that, rather than estimating the reward signal, or how the reward signal should be normalized, utilizes the output of its own test-time inference algorithm to normalize the rewards it experiences. As a result, only samples from the model that outperform the current test-time system are given positive weight, and inferior samples are suppressed. Using SCST, attempting to estimate the reward signal, as actor-critic methods must do, and estimating normalization, as REINFORCE algorithms must do, is avoided, while at the same time harmonizing the model with respect to its test-time inference procedure. Empirically we find that directly optimizing the CIDEr metric with SCST and greedy decoding at test-time is highly effective. Our results on the MSCOCO evaluation sever establish a new state-of-the-art on the task, improving the best result in terms of CIDEr from 104.9 to 114.7.

本文提出一种新的序列训练方法,称为自临界序列训练(SCST),并表明 SCST 可以大幅提高图像描述系统的性能。SCST 是一种 REINFORCE 算法:它不去估计奖励信号,也不去估计奖励信号应如何归一化,而是用自身测试时推理算法的输出,来归一化它所经历的奖励。于是,只有那些超过当前测试时系统的模型样本会得到正权重,较差的样本则被抑制。采用 SCST,既不必像 actor-critic 方法那样去估计奖励信号,也不必像 REINFORCE 算法那样去估计归一化,同时又能使模型与其测试时的推理手续相一致。经验上我们发现,用 SCST 直接优化 CIDEr 指标,并在测试时采用贪心解码,效果很好。我们在 MSCOCO 评测服务器上的结果为该任务确立了新的当时最高水平,把 CIDEr 上的最好成绩从 104.9 提升到了 114.7。

  1. Captioning Models
  1. 描述模型

In this section we describe the recurrent models that we use for caption generation.

本节说明我们用于描述生成的循环模型。

FC models. Similarly to [3, 4], we first encode the input image FFF using a deep CNN, and then embed it through a linear projection WIW_IWI​. Words are represented with one hot vectors that are embedded with a linear embedding EEE that has the same output dimension as WIW_IWI​. The beginning of each sentence is marked with a special BOS token, and the end with an EOS token. Under the model, words are generated and then fed back into the LSTM, with the image treated as the first word WICNN(F)W_I\mathrm{CNN}(F)WI​CNN(F). The following updates for the hidden units and cells of an LSTM define the model [5]:

全连接(FC)模型。与 [3, 4] 类似,我们先用深度 CNN 编码输入图像 FFF,再经线性投影 WIW_IWI​ 嵌入。词用 one-hot 向量表示,再经线性嵌入 EEE 映射,其输出维数与 WIW_IWI​ 相同。每个句子的开头用特殊的 BOS 记号标出,结尾用 EOS 记号标出。在该模型下,词被生成后再反馈进 LSTM,图像则被当作第一个词 WICNN(F)W_I\mathrm{CNN}(F)WI​CNN(F)。下列对 LSTM 隐单元和细胞的更新定义了该模型 [5]:

xt=E1wt−1for t>1,x1=WICNN(F)it=σ(Wixxt+Wihht−1+bi)(Input Gate)ft=σ(Wfxxt+Wfhht−1+bf)(Forget Gate)ot=σ(Woxxt+Wohht−1+bo)(Output Gate)ct=it⊙φ(Wzx⊗xt+Wzh⊗ht−1+bz⊗)+ft⊙ct−1ht=ot⊙tanh⁡(ct)st=Wsht,\begin{aligned} x_t &= E\mathbf{1}_{w_{t-1}} \quad \text{for } t > 1,\quad x_1 = W_I\mathrm{CNN}(F) \\ i_t &= \sigma(W_{ix}x_t + W_{ih}h_{t-1} + b_i) \quad \text{(Input Gate)} \\ f_t &= \sigma(W_{fx}x_t + W_{fh}h_{t-1} + b_f) \quad \text{(Forget Gate)} \\ o_t &= \sigma(W_{ox}x_t + W_{oh}h_{t-1} + b_o) \quad \text{(Output Gate)} \\ c_t &= i_t \odot \varphi\bigl(W^{\otimes}_{zx}x_t + W^{\otimes}_{zh}h_{t-1} + b^{\otimes}_z\bigr) + f_t \odot c_{t-1} \\ h_t &= o_t \odot \tanh(c_t) \\ s_t &= W_s h_t, \end{aligned}xt​it​ft​ot​ct​ht​st​​=E1wt−1​​for t>1,x1​=WI​CNN(F)=σ(Wix​xt​+Wih​ht−1​+bi​)(Input Gate)=σ(Wfx​xt​+Wfh​ht−1​+bf​)(Forget Gate)=σ(Wox​xt​+Woh​ht−1​+bo​)(Output Gate)=it​⊙φ(Wzx⊗​xt​+Wzh⊗​ht−1​+bz⊗​)+ft​⊙ct−1​=ot​⊙tanh(ct​)=Ws​ht​,​

where φ\varphiφ is a maxout non-linearity with 2 units (⊗\otimes⊗ denotes the units) and σ\sigmaσ is the sigmoid function. We initialize h0h_0h0​ and c0c_0c0​ to zero. The LSTM outputs a distribution over the next word wtw_twt​ using the softmax function:

其中 φ\varphiφ 是带 2 个单元的 maxout 非线性(⊗\otimes⊗ 表示这些单元),σ\sigmaσ 是 sigmoid 函数。我们将 h0h_0h0​ 和 c0c_0c0​ 初始化为零。LSTM 用 softmax 函数给出下一个词 wtw_twt​ 的分布:

wt∼softmax(st)(1)w_t \sim \mathrm{softmax}(s_t) \tag{1}wt​∼softmax(st​)(1)

In our architecture, the hidden states and word and image embeddings have dimension 512. Let θ\thetaθ denote the parameters of the model. Traditionally the parameters θ\thetaθ are learned by maximizing the likelihood of the observed sequence. Specifically, given a target ground truth sequence (w1∗,…,wT∗)(w^*_1,\ldots,w^*_T)(w1∗​,…,wT∗​), the objective is to minimize the cross entropy loss (XE):

在我们的结构中,隐状态以及词嵌入和图像嵌入的维数均为 512。用 θ\thetaθ 表示模型参数。传统上,参数 θ\thetaθ 通过最大化观测序列的似然来学习。具体而言,给定目标真值序列 (w1∗,…,wT∗)(w^*_1,\ldots,w^*_T)(w1∗​,…,wT∗​),目标是最小化交叉熵损失(XE):

L(θ)=−∑t=1Tlog⁡(pθ(wt∗∣w1∗,…,wt−1∗)),(2)L(\theta) = -\sum_{t=1}^{T}\log\bigl(p_\theta(w^*_t\mid w^*_1,\ldots,w^*_{t-1})\bigr), \tag{2}L(θ)=−t=1∑T​log(pθ​(wt∗​∣w1∗​,…,wt−1∗​)),(2)

where pθ(wt∣w1,…,wt−1)p_\theta(w_t\mid w_1,\ldots,w_{t-1})pθ​(wt​∣w1​,…,wt−1​) is given by the parametric model in Equation (1).

其中 pθ(wt∣w1,…,wt−1)p_\theta(w_t\mid w_1,\ldots,w_{t-1})pθ​(wt​∣w1​,…,wt−1​) 由公式 (1) 中的参数化模型给出。

Attention Model (Att2in). Rather than utilizing a static, spatially pooled representation of the image, attention models dynamically re-weight the input spatial (CNN) features to focus on specific regions of the image at each time step. In this paper we consider a modification of the architecture of the attention model for captioning given in [6], and input the attention-derived image feature only to the cell node of the LSTM.

注意力模型(Att2in)。注意力模型并不使用图像的静态、经空间汇聚的表示,而是在每个时间步动态地重新加权输入的空间(CNN)特征,以聚焦图像的特定区域。本文考虑对 [6] 中描述用注意力模型结构的一种修改,只把由注意力得到的图像特征输入到 LSTM 的细胞节点。

xt=E1wt−1for t≥1,w0=BOSit=σ(Wixxt+Wihht−1+bi)(Input Gate)ft=σ(Wfxxt+Wfhht−1+bf)(Forget Gate)ot=σ(Woxxt+Wohht−1+bo)(Output Gate)ct=it⊙φ(Wzx⊗xt+WzI⊗It+Wzh⊗ht−1+bz⊗)+ft⊙ct−1ht=ot⊙tanh⁡(ct)st=Wsht,\begin{aligned} x_t &= E\mathbf{1}_{w_{t-1}} \quad \text{for } t \ge 1,\quad w_0 = \mathrm{BOS} \\ i_t &= \sigma(W_{ix}x_t + W_{ih}h_{t-1} + b_i) \quad \text{(Input Gate)} \\ f_t &= \sigma(W_{fx}x_t + W_{fh}h_{t-1} + b_f) \quad \text{(Forget Gate)} \\ o_t &= \sigma(W_{ox}x_t + W_{oh}h_{t-1} + b_o) \quad \text{(Output Gate)} \\ c_t &= i_t \odot \varphi\bigl(W^{\otimes}_{zx}x_t + W^{\otimes}_{zI}I_t + W^{\otimes}_{zh}h_{t-1} + b^{\otimes}_z\bigr) + f_t \odot c_{t-1} \\ h_t &= o_t \odot \tanh(c_t) \\ s_t &= W_s h_t, \end{aligned}xt​it​ft​ot​ct​ht​st​​=E1wt−1​​for t≥1,w0​=BOS=σ(Wix​xt​+Wih​ht−1​+bi​)(Input Gate)=σ(Wfx​xt​+Wfh​ht−1​+bf​)(Forget Gate)=σ(Wox​xt​+Woh​ht−1​+bo​)(Output Gate)=it​⊙φ(Wzx⊗​xt​+WzI⊗​It​+Wzh⊗​ht−1​+bz⊗​)+ft​⊙ct−1​=ot​⊙tanh(ct​)=Ws​ht​,​

where ItI_tIt​ is the attention-derived image feature. This feature is derived as in [6] as follows: given CNN features at NNN locations {I1,…,IN}\{I_1,\ldots,I_N\}{I1​,…,IN​}, It=∑i=1NαtiIiI_t = \sum_{i=1}^{N} \alpha^i_t I_iIt​=∑i=1N​αti​Ii​, where αt=softmax(at+bα)\alpha_t = \mathrm{softmax}(a_t + b_\alpha)αt​=softmax(at​+bα​), and ati=Wtanh⁡(WaIIi+Wahht−1+ba)a^i_t = W\tanh(W_{aI}I_i + W_{ah}h_{t-1} + b_a)ati​=Wtanh(WaI​Ii​+Wah​ht−1​+ba​). In this work we set the dimension of WWW to 1×5121\times 5121×512, and set c0c_0c0​ and h0h_0h0​ to zero. Let θ\thetaθ denote the parameters of the model. Then pθ(wt∣w1,…,wt−1)p_\theta(w_t\mid w_1,\ldots,w_{t-1})pθ​(wt​∣w1​,…,wt−1​) is again defined by (1). The parameters θ\thetaθ of attention models are also traditionally learned by optimizing the XE loss (2).

其中 ItI_tIt​ 是由注意力得到的图像特征。该特征按 [6] 如下得到:给定 NNN 个位置上的 CNN 特征 {I1,…,IN}\{I_1,\ldots,I_N\}{I1​,…,IN​},It=∑i=1NαtiIiI_t = \sum_{i=1}^{N} \alpha^i_t I_iIt​=∑i=1N​αti​Ii​,其中 αt=softmax(at+bα)\alpha_t = \mathrm{softmax}(a_t + b_\alpha)αt​=softmax(at​+bα​),且 ati=Wtanh⁡(WaIIi+Wahht−1+ba)a^i_t = W\tanh(W_{aI}I_i + W_{ah}h_{t-1} + b_a)ati​=Wtanh(WaI​Ii​+Wah​ht−1​+ba​)。本工作中我们将 WWW 的维数设为 1×5121\times 5121×512,并将 c0c_0c0​ 和 h0h_0h0​ 设为零。用 θ\thetaθ 表示模型参数。于是 pθ(wt∣w1,…,wt−1)p_\theta(w_t\mid w_1,\ldots,w_{t-1})pθ​(wt​∣w1​,…,wt−1​) 仍由 (1) 定义。注意力模型的参数 θ\thetaθ 传统上同样通过优化 XE 损失 (2) 来学习。

Attention Model (Att2all). The standard attention model presented in [6] also feeds then attention signal ItI_tIt​ as an input into all gates of the LSTM, and the output posterior. In our experiments feeding ItI_tIt​ to all gates in addition to the input did not boost performance, but feeding ItI_tIt​ to both the gates and the outputs resulted in significant gains when ADAM [20] was used.

注意力模型(Att2all)。[6] 中给出的标准注意力模型还会把注意力信号 ItI_tIt​ 作为输入送入 LSTM 的所有门,以及输出后验。在我们的实验中,在输入之外再把 ItI_tIt​ 送入所有门并不能提升性能,但当使用 ADAM [20] 时,把 ItI_tIt​ 同时送入各门和输出会带来显著提升。

  1. Reinforcement Learning
  1. 强化学习

Sequence Generation as an RL problem. As described in the previous section, captioning systems are traditionally trained using the cross entropy loss. To directly optimize NLP metrics and address the exposure bias issue, we can cast our generative models in the Reinforcement Learning terminology as in [7]. Our recurrent models (LSTMs) introduced above can be viewed as an “agent” that interacts with an external “environment” (words and image features). The parameters of the network, θ\thetaθ, define a policy pθp_\thetapθ​, that results in an “action” that is the prediction of the next word. After each action, the agent (the LSTM) updates its internal “state” (cells and hidden states of the LSTM, attention weights etc). Upon generating the end-of-sequence (EOS) token, the agent observes a “reward” that is, for instance, the CIDEr score of the generated sentence—we denote this reward by rrr. The reward is computed by an evaluation metric by comparing the generated sequence to corresponding ground-truth sequences. The goal of training is to minimize the negative expected reward:

把序列生成当作强化学习问题。如前一节所述,描述系统传统上用交叉熵损失训练。为了直接优化自然语言处理指标并应对曝光偏差,我们可以像 [7] 那样,把生成模型改写成强化学习的用语。上面引入的循环模型(LSTM)可以看作一个与外部“环境”(词和图像特征)交互的“智能体”。网络参数 θ\thetaθ 定义策略 pθp_\thetapθ​,由此产生的“动作”就是对下一个词的预测。每次动作之后,智能体(LSTM)更新其内部“状态”(LSTM 的细胞与隐状态、注意力权重等)。在生成结束符(EOS)之后,智能体观测到一个“奖励”,例如所生成句子的 CIDEr 分数——我们把该奖励记为 rrr。奖励由评测指标通过比较生成序列与相应真值序列计算得到。训练的目标是最小化负的期望奖励:

L(θ)=−Ews∼pθ[r(ws)],(3)L(\theta) = -\mathbb{E}_{w^s\sim p_\theta}[r(w^s)], \tag{3}L(θ)=−Ews∼pθ​​[r(ws)],(3)

where ws=(w1s,…,wTs)w^s=(w^s_1,\ldots,w^s_T)ws=(w1s​,…,wTs​) and wtsw^s_twts​ is the word sampled from the model at the time step ttt. In practice L(θ)L(\theta)L(θ) is typically estimated with a single sample from pθp_\thetapθ​:

其中 ws=(w1s,…,wTs)w^s=(w^s_1,\ldots,w^s_T)ws=(w1s​,…,wTs​),wtsw^s_twts​ 是在时间步 ttt 从模型中采样得到的词。实践中 L(θ)L(\theta)L(θ) 通常用从 pθp_\thetapθ​ 抽出的单个样本来估计:

L(θ)≈−r(ws),ws∼pθ.L(\theta)\approx -r(w^s),\qquad w^s\sim p_\theta.L(θ)≈−r(ws),ws∼pθ​.

Policy Gradient with REINFORCE. In order to compute the gradient ∇θL(θ)\nabla_\theta L(\theta)∇θ​L(θ), we use the REINFORCE algorithm [15] (See also Chapter 13 in [14]). REINFORCE is based on the observation that the expected gradient of a non-differentiable reward function can be computed as follows:

用 REINFORCE 做策略梯度。为了计算梯度 ∇θL(θ)\nabla_\theta L(\theta)∇θ​L(θ),我们使用 REINFORCE 算法 [15](亦可参见 [14] 第 13 章)。REINFORCE 基于如下观察:不可微奖励函数的期望梯度可以按下式计算:

∇θL(θ)=−Ews∼pθ[r(ws)∇θlog⁡pθ(ws)].(4)\nabla_\theta L(\theta) = -\mathbb{E}_{w^s\sim p_\theta}\bigl[r(w^s)\nabla_\theta\log p_\theta(w^s)\bigr]. \tag{4}∇θ​L(θ)=−Ews∼pθ​​[r(ws)∇θ​logpθ​(ws)].(4)

In practice the expected gradient can be approximated using a single Monte-Carlo sample ws=(w1s…wTs)w^s=(w^s_1\ldots w^s_T)ws=(w1s​…wTs​) from pθp_\thetapθ​, for each training example in the minibatch:

实践中,可以对小批量中的每个训练样本,用从 pθp_\thetapθ​ 抽出的单个蒙特卡洛样本 ws=(w1s…wTs)w^s=(w^s_1\ldots w^s_T)ws=(w1s​…wTs​) 来近似期望梯度:

∇θL(θ)≈−r(ws)∇θlog⁡pθ(ws).\nabla_\theta L(\theta)\approx -r(w^s)\nabla_\theta\log p_\theta(w^s).∇θ​L(θ)≈−r(ws)∇θ​logpθ​(ws).

REINFORCE with a Baseline. The policy gradient given by REINFORCE can be generalized to compute the reward associated with an action value relative to a reference reward or baseline bbb:

带基线的 REINFORCE。REINFORCE 给出的策略梯度可以推广为:相对某个参考奖励或基线 bbb,计算与动作价值相关联的奖励:

∇θL(θ)=−Ews∼pθ[(r(ws)−b)∇θlog⁡pθ(ws)].(5)\nabla_\theta L(\theta) = -\mathbb{E}_{w^s\sim p_\theta}\bigl[(r(w^s)-b)\nabla_\theta\log p_\theta(w^s)\bigr]. \tag{5}∇θ​L(θ)=−Ews∼pθ​​[(r(ws)−b)∇θ​logpθ​(ws)].(5)

The baseline can be an arbitrary function, as long as it does not depend on the “action” wsw^sws [14], since in this case:

只要基线不依赖于“动作” wsw^sws [14],它可以是任意函数,因为此时:

Ews∼pθ[b∇θlog⁡pθ(ws)]=b∑ws∇θpθ(ws)=b∇θ∑wspθ(ws)=b∇θ1=0.(6)\begin{aligned} \mathbb{E}_{w^s\sim p_\theta}\bigl[b\nabla_\theta\log p_\theta(w^s)\bigr] &= b\sum_{w^s}\nabla_\theta p_\theta(w^s) \\ &= b\nabla_\theta\sum_{w^s}p_\theta(w^s) \\ &= b\nabla_\theta 1 = 0. \end{aligned} \tag{6}Ews∼pθ​​[b∇θ​logpθ​(ws)]​=bws∑​∇θ​pθ​(ws)=b∇θ​ws∑​pθ​(ws)=b∇θ​1=0.​(6)

This shows that the baseline does not change the expected gradient, but importantly, it can reduce the variance of the gradient estimate. For each training case, we again approximate the expected gradient with a single sample ws∼pθw^s\sim p_\thetaws∼pθ​:

这表明基线并不改变期望梯度,但重要的是,它可以降低梯度估计的方差。对每个训练样本,我们再次用单个样本 ws∼pθw^s\sim p_\thetaws∼pθ​ 近似期望梯度:

∇θL(θ)≈−(r(ws)−b)∇θlog⁡pθ(ws).(7)\nabla_\theta L(\theta)\approx -(r(w^s)-b)\nabla_\theta\log p_\theta(w^s). \tag{7}∇θ​L(θ)≈−(r(ws)−b)∇θ​logpθ​(ws).(7)

Note that if bbb is function of θ\thetaθ or ttt as in [7], equation (6) still holds and b(θ)b(\theta)b(θ) is a valid baseline.

注意,若 bbb 像 [7] 中那样是 θ\thetaθ 或 ttt 的函数,公式 (6) 仍然成立,b(θ)b(\theta)b(θ) 仍是有效的基线。

Final Gradient Expression. Using the chain rule, and the parametric model of pθp_\thetapθ​ given in Section 2 we have:

最终的梯度表达式。利用链式法则,以及第 2 节给出的 pθp_\thetapθ​ 的参数化模型,我们有:

∇θL(θ)=∑t=1T∂L(θ)∂st∂st∂θ,\nabla_\theta L(\theta)=\sum_{t=1}^{T}\frac{\partial L(\theta)}{\partial s_t}\frac{\partial s_t}{\partial\theta},∇θ​L(θ)=t=1∑T​∂st​∂L(θ)​∂θ∂st​​,

where sts_tst​ is the input to the softmax function. Using REINFORCE with a baseline bbb the estimate of the gradient of ∂L(θ)/∂st\partial L(\theta)/\partial s_t∂L(θ)/∂st​ is given by [17]:

其中 sts_tst​ 是 softmax 函数的输入。采用带基线 bbb 的 REINFORCE 时,∂L(θ)/∂st\partial L(\theta)/\partial s_t∂L(θ)/∂st​ 的梯度估计由 [17] 给出:

∂L(θ)∂st≈(r(ws)−b)(pθ(wt∣ht)−1wts).(8)\frac{\partial L(\theta)}{\partial s_t}\approx (r(w^s)-b)\bigl(p_\theta(w_t\mid h_t)-\mathbf{1}_{w^s_t}\bigr). \tag{8}∂st​∂L(θ)​≈(r(ws)−b)(pθ​(wt​∣ht​)−1wts​​).(8)

  1. Self-critical sequence training (SCST)
  1. 自临界序列训练(SCST)

The central idea of the self-critical sequence training (SCST) approach is to baseline the REINFORCE algorithm with the reward obtained by the current model under the inference algorithm used at test time. The gradient of the negative reward of a sample wsw^sws from the model w.r.t. to the softmax activations at time-step ttt then becomes:

自临界序列训练(SCST)方法的核心想法,是用当前模型在测试时所用推理算法下得到的奖励,作为 REINFORCE 算法的基线。于是,来自模型的样本 wsw^sws 的负奖励,关于时间步 ttt 处 softmax 激活的梯度变为:

∂L(θ)∂st=(r(ws)−r(w^))(pθ(wt∣ht)−1wts).(9)\frac{\partial L(\theta)}{\partial s_t}=(r(w^s)-r(\hat{w}))\bigl(p_\theta(w_t\mid h_t)-\mathbf{1}_{w^s_t}\bigr). \tag{9}∂st​∂L(θ)​=(r(ws)−r(w^))(pθ​(wt​∣ht​)−1wts​​).(9)

where r(w^)r(\hat{w})r(w^) again is the reward obtained by the current model under the inference algorithm used at test time. Accordingly, samples from the model that return higher reward than w^\hat{w}w^ will be “pushed up”, or increased in probability, while samples which result in lower reward will be suppressed. Like MIXER [7], SCST has all the advantages of REINFORCE algorithms, as it directly optimizes the true, sequence-level, evaluation metric, but avoids the usual scenario of having to learn a (context-dependent) estimate of expected future rewards as a baseline. In practice we have found that SCST has much lower variance, and can be more effectively trained on mini-batches of samples using SGD. Since the SCST baseline is based on the test-time estimate under the current model, SCST is forced to improve the performance of the model under the inference algorithm used at test time. This encourages training/test time consistency like the maximum likelihood-based approaches “Data as Demonstrator” [8], “Professor Forcing” [9], and E2E [7], but importantly, it can directly optimize sequence metrics. Finally, SCST is self-critical, and so avoids all the inherent training difficulties associated with actor-critic methods, where a second “critic” network must be trained to estimate value functions, and the actor must be trained on estimated value functions rather than actual rewards.

其中 r(w^)r(\hat{w})r(w^) 同样是当前模型在测试时所用推理算法下得到的奖励。于是,比 w^\hat{w}w^ 回报更高的模型样本会被“推高”,即提高其概率,而回报更低的样本则被抑制。与 MIXER [7] 一样,SCST 具有 REINFORCE 类算法的全部优点,因为它直接优化真正的、序列级的评测指标,但又避免了通常那种必须学习一条(依赖于上下文的)期望未来奖励估计来充当基线的情形。实践中我们发现,SCST 的方差低得多,并且可以用 SGD 在样本的小批量上更有效地训练。由于 SCST 的基线建立在当前模型的测试时估计之上,SCST 被迫去提高模型在测试时所用推理算法下的表现。这与基于最大似然的方法 “Data as Demonstrator” [8]、“Professor Forcing” [9] 以及 E2E [7] 一样,会促进训练时与测试时的一致性,但重要的是,它还可以直接优化序列指标。最后,SCST 是自临界的,因此避免了 actor-critic 方法固有的训练困难:后者必须再训练第二个“评价器”网络来估计价值函数,并且行动器必须在估计的价值函数上训练,而不是在真实奖励上训练。

In this paper we focus on scenario of greedy decoding, where:

本文聚焦于贪心解码这一情形,其中:

w^t=arg⁡max⁡wtp(wt∣ht)(10)\hat{w}_t = \arg\max_{w_t} p(w_t\mid h_t) \tag{10}w^t​=argwt​max​p(wt​∣ht​)(10)

This choice, depicted in Figure 1, minimizes the impact of baselining with the test-time inference algorithm on training time, since it requires only one additional forward pass, and trains the system to be optimized for fast, greedy decoding at test-time.

这一选择如图 1 所示,把用测试时推理算法做基线对训练时间的影响降到最低,因为它只需要一次额外的前向传播,并且使系统被训练成在测试时针对快速的贪心解码进行优化。

Self-critical sequence training (SCST) diagram comparing sampled and greedy baseline rewards

Figure 1: Self-critical sequence training (SCST). The weight put on words of a sampled sentence from the model is determined by the difference between the reward for the sampled sentence and the reward obtained by the estimated sentence under the test-time inference procedure (greedy inference depicted). This harmonizes learning with the inference procedure, and lowers the variance of the gradients, improving the training procedure.

图 1:自临界序列训练(SCST)。加在模型采样句子各个词上的权重,由该采样句子的奖励与测试时推理手续(图中为贪心推理)下估计句子所获奖励之差决定。这使学习与推理手续相一致,并降低梯度的方差,从而改善训练过程。

Generalizations. The basic SCST approach described above can be generalized in several ways.

若干推广。上面描述的基本 SCST 方法可以沿若干方向推广。

One generalization is to condition the baseline on what has been generated (i.e. sampled) so far, which makes the baseline word-dependent, and further reduces the variance of the reward signal by making it dependent only on future rewards. This is achieved by baselining the reward for word wtsw^s_twts​ at timestep ttt with the reward obtained by the word sequence wˉ={w1:t−1s,w^t:T}\bar{w}=\{w^s_{1:t-1},\hat{w}_{t:T}\}wˉ={w1:t−1s​,w^t:T​}, which is generated by sampling tokens for timesteps 1:t−11:t-11:t−1, and then executing the inference algorithm to complete the sequence. The resulting reward signal, r(ws)−r(wˉ)r(w^s)-r(\bar{w})r(ws)−r(wˉ), is a baselined future reward (advantage) signal that conditions on both the input image and the sequence w1:t−1sw^s_{1:t-1}w1:t−1s​, and remains unbiased. We call this variant time-dependent SCST (TD-SCST).

一种推广是让基线以至此已生成(即已采样)的内容为条件,从而使基线依赖于词,并通过使奖励信号只依赖于未来奖励来进一步降低其方差。具体做法是:对时间步 ttt 的词 wtsw^s_twts​,用词序列 wˉ={w1:t−1s,w^t:T}\bar{w}=\{w^s_{1:t-1},\hat{w}_{t:T}\}wˉ={w1:t−1s​,w^t:T​} 所获得的奖励作为基线;该序列由在时间步 1:t−11:t-11:t−1 采样记号、再执行推理算法补完序列而生成。由此得到的奖励信号 r(ws)−r(wˉ)r(w^s)-r(\bar{w})r(ws)−r(wˉ) 是一条带基线的未来奖励(优势)信号,它以输入图像和序列 w1:t−1sw^s_{1:t-1}w1:t−1s​ 为条件,并且仍然无偏。我们称这一变体为时间相关 SCST(TD-SCST)。

Another important generalization is to utilize the inference algorithm as a critic to replace the learned critic of traditional actor-critic approaches. Like for traditional actor-critic methods, this biases the learning procedure, but can be used to trade off variance for bias. Specifically, the primary reward signal at time ttt can be based on a sequence that samples only nnn future tokens, and then executes the inference algorithm to complete the sequence. The primary reward is then based on w~={w1:t+ns,w^t+n+1:T}\tilde{w}=\{w^s_{1:t+n},\hat{w}_{t+n+1:T}\}w~={w1:t+ns​,w^t+n+1:T​}, and can further be baselined in a time-dependent manner using TD-SCST. The resulting reward signal in this case is r(w~)−r(wˉ)r(\tilde{w})-r(\bar{w})r(w~)−r(wˉ). We call this variant True SCST.

另一种重要推广,是把推理算法当作评价器,以取代传统 actor-critic 方法中学习得到的评价器。与传统 actor-critic 方法一样,这会使学习过程产生偏差,但可以用来在方差与偏差之间做权衡。具体而言,时间 ttt 处的主要奖励信号可以基于这样一条序列:只再采样 nnn 个未来记号,然后执行推理算法补完序列。于是主要奖励基于 w~={w1:t+ns,w^t+n+1:T}\tilde{w}=\{w^s_{1:t+n},\hat{w}_{t+n+1:T}\}w~={w1:t+ns​,w^t+n+1:T​},并且还可以再用 TD-SCST 做时间相关的基线处理。此时得到的奖励信号是 r(w~)−r(wˉ)r(\tilde{w})-r(\bar{w})r(w~)−r(wˉ)。我们称这一变体为 True SCST。

We have experimented with both TD-SCST and “True” SCST as described above on the MSCOCO task, but found that they did not lead to significant additional gain. We have also experimented with learning a control-variate for the SCST baseline on MSCOCO to no avail. Nevertheless, we anticipate that these generalizations will be important for other sequence modeling tasks, and policy-gradient-based RL more generally.

我们已在 MSCOCO 任务上按上述方式试验了 TD-SCST 和 “True” SCST,但发现它们并不能带来显著的额外收益。我们也尝试过为 MSCOCO 上的 SCST 基线学习一条控制变量,同样没有奏效。尽管如此,我们预期这些推广对其它序列建模任务,以及更一般的基于策略梯度的强化学习,将会是重要的。

  1. Experiments
  1. 实验

Dataset. We evaluate our proposed method on the MSCOCO dataset [1]. For offline evaluation purposes we used the data splits from [21]. The training set contains 113,287113,287113,287 images, along with 5 captions each. We use a set of 5K image for validation and report results on a test set of 5K images as well, as given in [21]. We report four widely used automatic evaluation metrics, BLEU-4, ROUGEL, METEOR, and CIDEr. We prune the vocabulary and drop any word that has count less then five, we end up with a vocabulary of size 10096 words.

数据集。我们在 MSCOCO 数据集 [1] 上评测所提出的方法。出于离线评测的目的,我们使用 [21] 中的数据划分。训练集包含 113,287113,287113,287 张图像,每张配有 5 条描述。我们使用 5K 张图像做验证,并同样在 [21] 给出的 5K 张图像测试集上报告结果。我们报告四种广泛使用的自动评测指标:BLEU-4、ROUGEL、METEOR 和 CIDEr。我们对词表做裁剪,去掉出现次数少于五的任何词,最终得到大小为 10096 个词的词表。

Image Features 1) FC Models. We use two type of Features: a) (FC-2k) features, where we encode each image with Resnet-101 (101 layers) [22]. Note that we do not rescale or crop each image. Instead we encode the full image with the final convolutional layer of resnet, and apply average pooling, which results in a vector of dimension 2048. b) (FC-15K) features where we stack average pooled 13 layers of Resnet-101 (11×102411\times 102411×1024 and 2×20482\times 20482×2048). These 13 layers are the odd layers of conv4 and conv5, with the exception of the 23rd layer of conv4, which was omitted. This results in a feature vector of dimension 15360.

图像特征 1)FC 模型。我们使用两类特征:a)(FC-2k)特征,用 Resnet-101(101 层)[22] 编码每张图像。注意我们不对每张图像做重缩放或裁剪,而是用 resnet 的最后一层卷积层编码整幅图像,再做平均汇聚,得到维数为 2048 的向量。b)(FC-15K)特征,把 Resnet-101 中 13 层经平均汇聚后的结果堆叠起来(11×102411\times 102411×1024 和 2×20482\times 20482×2048)。这 13 层是 conv4 和 conv5 中的奇数层,但省略了 conv4 的第 23 层。由此得到维数为 15360 的特征向量。

  1. Spatial CNN features for Attention models: (Att2in) We encode each image using the residual convolutional neural network Resnet-101 [22]. Note that we do not rescale or crop the image. Instead we encode the full image with the final convolutional layer of Resnet-101, and apply spatially adaptive max-pooling so that the output has a fixed size of 14×14×204814\times 14\times 204814×14×2048. At each time step the attention model produces an attention mask over the 196 spatial locations. This mask is applied and then the result is spatially averaged to produce a 2048 dimension representation of the attended portion of the image.

2)注意力模型的空间 CNN 特征:(Att2in)我们用残差卷积神经网络 Resnet-101 [22] 编码每张图像。注意我们不对图像做重缩放或裁剪,而是用 Resnet-101 的最后一层卷积层编码整幅图像,再做空间自适应最大汇聚,使输出具有固定大小 14×14×204814\times 14\times 204814×14×2048。在每个时间步,注意力模型会在 196 个空间位置上产生一张注意力掩膜。施加该掩膜后再做空间平均,得到被关注图像部分的 2048 维表示。

Implementation Details. The LSTM hidden, image, word and attention embeddings dimension are fixed to 512 for all of the models discussed herein. All of our models are trained according to the following recipe, except where otherwise noted. We initialize all models by training the model under the XE objective using ADAM [20] optimizer with an initial learning rate of 5×10−45\times 10^{-4}5×10−4. We anneal the learning rate by a factor of 0.8 every three epochs, and increase the probability of feeding back a sample of the word posterior by 0.05 every 5 epochs until we reach a feedback probability 0.25 [8]. We evaluate at each epoch the model on the development set and select the model with best CIDEr score as an initialization for SCST training. We then run SCST training initialized with the XE model to optimize the CIDEr metric (specifically, the CIDEr-D metric) using ADAM with a learning rate 5×10−55\times 10^{-5}5×10−5.1^11 Initially when experimenting with FC-2k and FC-15k models we utilized curriculum learning (CL) during training, as proposed in [7], by increasing the number of words that are sampled and trained under CIDEr by one each epoch (the prefix of the sentence remains under the XE criterion until eventually being subsumed). We have since realized that for the MSCOCO task CL is not required, and provides little to no boost in performance. The results reported here for the FC-2K and FC-15K models are trained with CL, while the attention models were trained directly on the entire sentence for all epochs after being initialized by the XE seed models.

实现细节。对本文讨论的所有模型,LSTM 隐状态、图像、词以及注意力嵌入的维数都固定为 512。除另有说明外,我们的全部模型都按如下配方训练。我们先用 ADAM [20] 优化器、初始学习率 5×10−45\times 10^{-4}5×10−4,在 XE 目标下训练模型,作为所有模型的初始化。我们每三个 epoch 把学习率按 0.8 的因子退火,并每 5 个 epoch 把反馈词后验样本的概率提高 0.05,直到反馈概率达到 0.25 [8]。我们在每个 epoch 于开发集上评测模型,并选择 CIDEr 分数最高的模型作为 SCST 训练的初始化。然后以该 XE 模型为起点运行 SCST 训练,用 ADAM、学习率 5×10−55\times 10^{-5}5×10−5 优化 CIDEr 指标(具体是 CIDEr-D 指标)。1^11 起初在试验 FC-2k 和 FC-15k 模型时,我们按 [7] 的建议在训练中使用课程学习(CL):每个 epoch 把在 CIDEr 下采样并训练的词数增加一个(句子前缀仍留在 XE 准则下,直到最终被完全纳入)。我们后来意识到,对 MSCOCO 任务而言并不需要 CL,它几乎不带来性能提升。此处报告的 FC-2K 和 FC-15K 模型结果是用 CL 训练的,而注意力模型在由 XE 种子模型初始化之后,所有 epoch 都直接在整句上训练。

1^11In the case of the Att2all models, the XE model was trained for only 20 epochs, and the learning rate was also annealed during RL training.

1^11对于 Att2all 模型,XE 模型只训练了 20 个 epoch,并且在强化学习训练期间也对学习率做了退火。

Table 1: Performance of self-critical sequence training (SCST) versus MIXER [7] on the test portion of the Karpathy splits when trained to optimize the CIDEr metric (FC-2K models). Both improve the seed cross-entropy trained model, but SCST significantly outperforms MIXER.

Training Metric CIDEr BLEU4 ROUGEL METEOR
XE 90.9 28.6 52.3 24.1
XE (beam) 94.0 29.6 52.6 25.2
MIXER 101.9 30.9 53.8 24.9
SCST 106.3 31.9 54.3 25.5

表 1:在 Karpathy 划分的测试部分上,以优化 CIDEr 指标训练时,自临界序列训练(SCST)与 MIXER [7] 的表现(FC-2K 模型)。二者都改进了作为种子的交叉熵训练模型,但 SCST 显著优于 MIXER。

Training Metric CIDEr BLEU4 ROUGEL METEOR
XE 90.9 28.6 52.3 24.1
XE (beam) 94.0 29.6 52.6 25.2
MIXER 101.9 30.9 53.8 24.9
SCST 106.3 31.9 54.3 25.5

5.1. Offline Evaluation

5.1. 离线评测

Evaluating different RL training strategies. Table 1 compares the performance of SCST to MIXER [7] (test set, Karpathy splits). In this experiment, we utilize “curriculum learning” (CL) by optimizing the expected reward of the metric on the last nnn words of each training sentence, optimizing XE on the remaining sentence prefix, and slowly increasing nnn. The results reported were generated with the optimized CL schedule reported in [7]. We found that CL was not necessary to train both SCST and REINFORCE with a learned baseline on MSCOCO—turning off CL sped up training and yielded equal or better results. The gain of SCST over learned baselines was consistently >3> 3>3 CIDEr points, regardless of the CL schedule and the initial seed (c.f. table 2 and graph in supp. material).

评测不同的强化学习训练策略。表 1 比较了 SCST 与 MIXER [7] 的表现(测试集,Karpathy 划分)。在该实验中,我们使用“课程学习”(CL):在每条训练句子的最后 nnn 个词上优化指标的期望奖励,在剩余的句子前缀上优化 XE,并缓慢增大 nnn。所报告的结果用 [7] 中给出的优化 CL 日程生成。我们发现,在 MSCOCO 上训练 SCST 以及带已学习基线的 REINFORCE 并不需要 CL——关掉 CL 可以加快训练,并得到相当或更好的结果。无论 CL 日程和初始种子如何,SCST 相对已学习基线的收益都稳定地大于 3 个 CIDEr 点(参见表 2 以及补充材料中的曲线)。

Table 2: mean/std. performance of SCST versus REINFORCE with learned baseline (MIXER less CL; Att2all models, 4 seeds; Karpathy test set; CIDEr optimized).

Metric MIXER less CL SCST
CIDEr 110.4 ± 0.5 113.8 ± 0.3
BLEU4 32.8 ± 0.1 34.1 ± 0.1
ROUGE 55.2 ± 0.1 55.7 ± 0.1
METEOR 26.0 ± 0.04 26.6 ± 0.04

表 2:SCST 与带已学习基线的 REINFORCE(MIXER less CL;Att2all 模型,4 个种子;Karpathy 测试集;优化 CIDEr)的均值/标准差表现。

Metric MIXER less CL SCST
CIDEr 110.4 ± 0.5 113.8 ± 0.3
BLEU4 32.8 ± 0.1 34.1 ± 0.1
ROUGE 55.2 ± 0.1 55.7 ± 0.1
METEOR 26.0 ± 0.04 26.6 ± 0.04

Table 3: Performance on the test portion of the Karpathy splits [21] as a function of training metric (FC-2K models). Optimizing the CIDEr metric increases the overall performance under the evaluation metrics the most significantly. The performance of the seed cross-entropy (XE) model is also depicted. All models were decoded greedily, with the exception of the XE beam search result, which was optimized to beam 3 on the validation set.

Training Metric CIDEr BLEU4 ROUGEL METEOR
XE 90.9 28.6 52.3 24.1
XE (beam) 94.0 29.6 52.6 25.2
CIDEr 106.3 31.9 54.3 25.5
BLEU 94.4 33.2 53.9 24.6
ROUGEL 97.7 31.6 55.4 24.5
METEOR 80.5 25.3 51.3 25.9

表 3:在 Karpathy 划分 [21] 的测试部分上,表现随训练指标变化的情况(FC-2K 模型)。优化 CIDEr 指标对各项评测指标的总体表现提升最为显著。作为种子的交叉熵(XE)模型的表现也一并给出。除在验证集上把束宽优化为 3 的 XE 束搜索结果外,所有模型都采用贪心解码。

Training Metric CIDEr BLEU4 ROUGEL METEOR
XE 90.9 28.6 52.3 24.1
XE (beam) 94.0 29.6 52.6 25.2
CIDEr 106.3 31.9 54.3 25.5
BLEU 94.4 33.2 53.9 24.6
ROUGEL 97.7 31.6 55.4 24.5
METEOR 80.5 25.3 51.3 25.9

Training on different metrics. We experimented with training directly on the evaluation metrics of the MSCOCO challenge. Results for FC-2K models are depicted in table 3. In general we can see that optimizing for a given metric during training leads to the best performance on that same metric at test time, an expected result. We experimented with training on multiple test metrics, and found that we were unable to outperform the overall performance of the model trained only on the CIDEr metric, which lifts the performance of all other metrics considerably. For this reason most of our experimentation has since focused on optimizing CIDEr.

在不同指标上训练。我们试验了直接在 MSCOCO 挑战的评测指标上训练。FC-2K 模型的结果见表 3。总体上看,训练时优化某一给定指标,会在测试时在同一指标上取得最好表现,这是预期之中的。我们还试验了在多个测试指标上训练,发现无法超过只在 CIDEr 指标上训练的模型的总体表现,后者会相当幅度地抬升所有其它指标。因此,此后我们的大部分实验都集中在优化 CIDEr 上。

Single FC-Models Versus Attention Models. We trained FC models (2K and 15 K), as well as attention models (Att2in and Att2all) using SCST with the CIDEr metric. We trained 4 different models for each FC and attention type, starting the optimization from four different random seeds.2^22 We report in Table 4, the system with best performance for each family of models on the test portion of Karpathy splits [21]. We see that the FC-15K models outperform the FC-2K models. Both FC models are outperformed by the attention models, which establish a new state of the art for a single model performance on Karpathy splits. Note that this quantitative evaluation favors attention models is inline with our observation that attention models tend to generalize better and compose outside of the context of the training of MSCOCO, as we will see in Section 6.

单个 FC 模型与注意力模型的比较。我们用带 CIDEr 指标的 SCST 训练了 FC 模型(2K 和 15 K)以及注意力模型(Att2in 和 Att2all)。对每类 FC 和注意力模型,我们从四个不同的随机种子出发,各训练 4 个不同的模型。2^22 我们在表 4 中报告每个模型族在 Karpathy 划分 [21] 测试部分上表现最好的系统。可以看到 FC-15K 模型优于 FC-2K 模型。两类 FC 模型都被注意力模型超过,后者在 Karpathy 划分上为单模型表现确立了新的当时最高水平。需要说明的是,这一量化评测有利于注意力模型,这与我们的观察一致:注意力模型往往泛化更好,并能在 MSCOCO 训练语境之外组织描述,我们将在第 6 节看到这一点。

2^22please consult the supplementary material for additional details regarding how the models were trained.

2^22关于模型如何训练的更多细节,请参见补充材料。

Table 4: Performance of the best XE and corr. SCST-trained single models on the Karpathy test split (best of 4 random seeds). The results obtained via the greedy decoding and optimized beam search are depicted. Models learned using SCST were trained to directly optimize the CIDEr metric. MIXER less CL results (MIXER-) are also included.

Single Best Models (XE)

| Model Type | Search Method | CIDEr | BLEU4 | ROUGEL | METEOR |
| --- | --- | --- | --- | --- |
| FC-2K | greedy | 90.9 | 28.6 | 52.3 | 24.1 |
| FC-2K | beam | 94.0 | 29.6 | 52.6 | 25.2 |
| FC-15K | greedy | 94.1 | 29.5 | 52.9 | 24.4 |
| FC-15K | beam | 96.1 | 30.0 | 52.9 | 25.2 |
| Att2in | greedy | 99.0 | 30.6 | 53.8 | 25.2 |
| Att2in | beam | 101.3 | 31.3 | 54.3 | 26.0 |
| Att2all (RL seed) | greedy | 97.9 | 29.3 | 53.4 | 25.4 |
| Att2all (RL seed) | beam | 99.4 | 30.0 | 53.4 | 25.9 |

Single Best Models (SCST unless noted o.w.)

| Model Type | Search Method | CIDEr | BLEU4 | ROUGEL | METEOR |
| --- | --- | --- | --- | --- |
| FC-2K | greedy | 106.3 | 31.9 | 54.3 | 25.5 |
| FC-2K | beam | 106.3 | 31.9 | 54.3 | 25.5 |
| FC-15K | greedy | 106.4 | 32.2 | 54.6 | 25.5 |
| FC-15K | beam | 106.6 | 32.4 | 54.7 | 25.6 |
| Att2in | greedy | 111.3 | 33.3 | 55.2 | 26.3 |
| Att2in | beam | 111.4 | 33.3 | 55.3 | 26.3 |
| Att2all | greedy | 113.7 | 34.1 | 55.6 | 26.6 |
| Att2all | beam | 114.0 | 34.2 | 55.7 | 26.7 |
| 4 Att2all (MIXER-) | greedy | 110.2 | 32.7 | 55.1 | 26.0 |
| 4 Att2all (MIXER-) | beam | 110.5 | 32.8 | 55.2 | 26.1 |

表 4:Karpathy 测试划分上最好的 XE 模型及相应 SCST 训练的单模型表现(4 个随机种子中最好的)。给出了贪心解码与优化束搜索得到的结果。用 SCST 学习的模型被训练为直接优化 CIDEr 指标。也列入了 MIXER less CL 的结果(MIXER-)。

Single Best Models (XE)

| Model Type | Search Method | CIDEr | BLEU4 | ROUGEL | METEOR |
| --- | --- | --- | --- | --- |
| FC-2K | greedy | 90.9 | 28.6 | 52.3 | 24.1 |
| FC-2K | beam | 94.0 | 29.6 | 52.6 | 25.2 |
| FC-15K | greedy | 94.1 | 29.5 | 52.9 | 24.4 |
| FC-15K | beam | 96.1 | 30.0 | 52.9 | 25.2 |
| Att2in | greedy | 99.0 | 30.6 | 53.8 | 25.2 |
| Att2in | beam | 101.3 | 31.3 | 54.3 | 26.0 |
| Att2all (RL seed) | greedy | 97.9 | 29.3 | 53.4 | 25.4 |
| Att2all (RL seed) | beam | 99.4 | 30.0 | 53.4 | 25.9 |

Single Best Models (SCST unless noted o.w.)

| Model Type | Search Method | CIDEr | BLEU4 | ROUGEL | METEOR |
| --- | --- | --- | --- | --- |
| FC-2K | greedy | 106.3 | 31.9 | 54.3 | 25.5 |
| FC-2K | beam | 106.3 | 31.9 | 54.3 | 25.5 |
| FC-15K | greedy | 106.4 | 32.2 | 54.6 | 25.5 |
| FC-15K | beam | 106.6 | 32.4 | 54.7 | 25.6 |
| Att2in | greedy | 111.3 | 33.3 | 55.2 | 26.3 |
| Att2in | beam | 111.4 | 33.3 | 55.3 | 26.3 |
| Att2all | greedy | 113.7 | 34.1 | 55.6 | 26.6 |
| Att2all | beam | 114.0 | 34.2 | 55.7 | 26.7 |
| 4 Att2all (MIXER-) | greedy | 110.2 | 32.7 | 55.1 | 26.0 |
| 4 Att2all (MIXER-) | beam | 110.5 | 32.8 | 55.2 | 26.1 |

Model Ensembling. In this section we investigate the performance of ensembling over 4 random seeds of the XE and SCST-trained FC models and attention models. We see in Table 5 that ensembling improves performance and confirms the supremacy of attention modeling, and establishes yet another state of the art result on Karpathy splits [21]. Note that in our case we ensemble only 4 models and we don't do any fine-tuning of the Resnet. NIC [23], in contrast, used an ensemble of 15 models with fine-tuned CNNs.

模型集成。本节考察对 XE 与 SCST 训练的 FC 模型和注意力模型,在 4 个随机种子上做集成的表现。由表 5 可以看到,集成提高了性能,并再次确认了注意力建模的优势,同时在 Karpathy 划分 [21] 上又确立了一项当时最高水平的结果。需要说明的是,我们只集成 4 个模型,并且不对 Resnet 做任何微调。相比之下,NIC [23] 使用了 15 个模型的集成,并微调了 CNN。

Table 5: Performance of Ensembled XE and SCST-trained models on the Karpathy test split (ensembled over 4 random seeds). The models learned using self-critical sequence training (SCST) were trained to optimize the CIDEr metric. MIXER less CL results (MIXER-) are also included.

Ensembled Models (XE)

| Model Type | Search Method | CIDEr | BLEU4 | ROUGEL | METEOR |
| --- | --- | --- | --- | --- |
| 4 FC-2K | greedy | 96.3 | 30.1 | 53.5 | 24.8 |
| 4 FC-2K | beam | 99.2 | 31.2 | 53.9 | 25.8 |
| 4 FC-15K | greedy | 97.7 | 30.7 | 53.8 | 25.0 |
| 4 FC-15K | beam | 100.7 | 31.7 | 54.2 | 26.0 |
| 4 Att2in | greedy | 102.8 | 32.0 | 54.7 | 25.7 |
| 4 Att2in | beam | 106.5 | 32.8 | 55.1 | 26.7 |
| Att2all (RL seeds) | greedy | 102.0 | 31.2 | 54.4 | 26.0 |
| Att2all (RL seeds) | beam | 104.7 | 32.2 | 54.8 | 26.7 |

Ensembled Models (SCST unless o.w. noted)

| Model Type | Search Method | CIDEr | BLEU4 | ROUGEL | METEOR |
| --- | --- | --- | --- | --- |
| 4 FC-2K | greedy | 108.9 | 33.1 | 54.9 | 25.7 |
| 4 FC-2K | beam | 108.9 | 33.2 | 54.9 | 25.7 |
| 4 FC-15K | greedy | 110.4 | 33.4 | 55.4 | 26.1 |
| 4 FC-15K | beam | 110.4 | 33.4 | 55.4 | 26.2 |
| 4 Att2in | greedy | 114.7 | 34.6 | 56.2 | 26.8 |
| 4 Att2in | beam | 115.2 | 34.8 | 56.3 | 26.9 |
| 4 Att2all | greedy | 116.8 | 35.2 | 56.5 | 27.0 |
| 4 Att2all | beam | 117.5 | 35.4 | 56.6 | 27.1 |
| 4 Att2all (MIXER-) | greedy | 113.8 | 34.2 | 56.0 | 26.5 |
| 4 Att2all (MIXER-) | beam | 113.6 | 33.9 | 55.9 | 26.5 |

表 5:在 Karpathy 测试划分上,集成的 XE 与 SCST 训练模型的表现(对 4 个随机种子做集成)。用自临界序列训练(SCST)学习的模型被训练为优化 CIDEr 指标。也列入了 MIXER less CL 的结果(MIXER-)。

Ensembled Models (XE)

| Model Type | Search Method | CIDEr | BLEU4 | ROUGEL | METEOR |
| --- | --- | --- | --- | --- |
| 4 FC-2K | greedy | 96.3 | 30.1 | 53.5 | 24.8 |
| 4 FC-2K | beam | 99.2 | 31.2 | 53.9 | 25.8 |
| 4 FC-15K | greedy | 97.7 | 30.7 | 53.8 | 25.0 |
| 4 FC-15K | beam | 100.7 | 31.7 | 54.2 | 26.0 |
| 4 Att2in | greedy | 102.8 | 32.0 | 54.7 | 25.7 |
| 4 Att2in | beam | 106.5 | 32.8 | 55.1 | 26.7 |
| Att2all (RL seeds) | greedy | 102.0 | 31.2 | 54.4 | 26.0 |
| Att2all (RL seeds) | beam | 104.7 | 32.2 | 54.8 | 26.7 |

Ensembled Models (SCST unless o.w. noted)

| Model Type | Search Method | CIDEr | BLEU4 | ROUGEL | METEOR |
| --- | --- | --- | --- | --- |
| 4 FC-2K | greedy | 108.9 | 33.1 | 54.9 | 25.7 |
| 4 FC-2K | beam | 108.9 | 33.2 | 54.9 | 25.7 |
| 4 FC-15K | greedy | 110.4 | 33.4 | 55.4 | 26.1 |
| 4 FC-15K | beam | 110.4 | 33.4 | 55.4 | 26.2 |
| 4 Att2in | greedy | 114.7 | 34.6 | 56.2 | 26.8 |
| 4 Att2in | beam | 115.2 | 34.8 | 56.3 | 26.9 |
| 4 Att2all | greedy | 116.8 | 35.2 | 56.5 | 27.0 |
| 4 Att2all | beam | 117.5 | 35.4 | 56.6 | 27.1 |
| 4 Att2all (MIXER-) | greedy | 113.8 | 34.2 | 56.0 | 26.5 |
| 4 Att2all (MIXER-) | beam | 113.6 | 33.9 | 55.9 | 26.5 |

5.2. Online Evaluation on MS-COCO Server

5.2. 在 MS-COCO 服务器上的在线评测

Table 6 reports the performance of two variants of 4 ensembled attention models trained with self-critical sequence training (SCST) on the official MSCOCO evaluation server. The previous best result on the leaderboard (as of April 10, 2017) is also depicted. We outperform the previous best system on all evaluation metrics.

表 6 报告了用自临界序列训练(SCST)训练的两种 4 模型注意力集成,在官方 MSCOCO 评测服务器上的表现。排行榜上此前的最好结果(截至 2017 年 4 月 10 日)也一并给出。我们在全部评测指标上都超过了此前最好的系统。

Table 6: Performance of 4 ensembled attention models trained with self-critical sequence training (SCST) on the official MSCOCO evaluation server (5 reference captions). The previous best result on the leaderboard (as of 04/10/2017) is also depicted (http://mscoco.org/dataset/#captions-leaderboard, Table C5, Watson Multimodal).

Ensemble SCST models CIDEr BLEU4 ROUGEL METEOR
Ens. 4 (Att2all) 114.7 35.2 56.3 27.0
Ens. 4 (Att2in) 112.3 34.4 55.9 26.8
Previous best 104.9 34.3 55.2 26.6

表 6:用自临界序列训练(SCST)训练的 4 模型注意力集成,在官方 MSCOCO 评测服务器上的表现(5 条参考描述)。排行榜上此前的最好结果(截至 2017 年 4 月 10 日)也一并给出(http://mscoco.org/dataset/#captions-leaderboard,表 C5,Watson Multimodal)。

Ensemble SCST models CIDEr BLEU4 ROUGEL METEOR
Ens. 4 (Att2all) 114.7 35.2 56.3 27.0
Ens. 4 (Att2in) 112.3 34.4 55.9 26.8
Previous best 104.9 34.3 55.2 26.6
  1. Example of Generated Captions
  1. 生成描述的示例

Here we provide a qualitative example of the captions generated by our systems for the image in figure 2. This picture is taken from the objects out-of-context (OOOC) dataset of images [24]. It depicts a boat situated in an unusual context, and tests the ability of our models to compose descriptions of images that differ from those seen during training. The top 5 captions returned by the XE and SCST-trained FC-2K, FC-15K, and attention model ensembles when deployed with a decoding “beam” of 5 are depicted in figure 3.3^33 On this image the FC models fail completely, and the SCST-trained ensemble of attention models is the only system that is able to correctly describe the image. In general we found that the performance of all captioning systems on MSCOCO data is qualitatively similar, while on images containing objects situated in an uncommon context [24] (i.e. unlike the MSCOCO training set) our attention models perform much better, and SCST-trained attention models output yet more accurate and descriptive captions. In general we qualitatively found that SCST-trained attention models describe images more accurately, and with higher confidence, as reflected in Figure 3, where the average of the log-likelihoods of the words in each generated caption are also depicted. Additional examples, including an example with the corresponding heat-maps for the SCST-trained Att2in ensemble can be found in the supplementary material (figure 8 of section D). We found that Att2in attention models performed better than our Att2all models when applied to images “from the wild”, so here we focus on demonstrating the performance of our Att2in systems.

这里给出我们的系统对图 2 中图像所生成描述的一个定性例子。该图取自物体脱离语境(objects out-of-context,OOOC)图像数据集 [24]。它描绘的是处于不寻常语境中的一艘船,用以检验我们的模型能否为与训练时所见不同的图像组织描述。图 3 给出了 XE 与 SCST 训练的 FC-2K、FC-15K 以及注意力模型集成,在解码“束宽”为 5 时返回的前 5 条描述。3^33 在这张图像上,FC 模型完全失败,而 SCST 训练的注意力模型集成是唯一能够正确描述该图像的系统。总体而言,我们发现所有描述系统在 MSCOCO 数据上的表现在定性上相近;而在含有处于罕见语境中的物体的图像上 [24](即与 MSCOCO 训练集不同),我们的注意力模型表现好得多,SCST 训练的注意力模型还会输出更为准确、更为细致的描述。我们定性地发现,SCST 训练的注意力模型对图像的描述更准确,并且更有把握,这反映在图 3 中,该图还给出了每条生成描述中各个词的对数似然平均值。更多例子,包括 SCST 训练的 Att2in 集成及其相应热力图的一例,可见于补充材料(D 节图 8)。我们发现,把 Att2in 注意力模型用到“野外”图像上时,表现优于我们的 Att2all 模型,因此这里着重展示 Att2in 系统的表现。

3^33pls. consult the the supp. material for further details on beam search.

3^33关于束搜索的更多细节,请参见补充材料。

An objects out-of-context image of a ship sculpture beside a building

Figure 2: An image from the objects out-of-context (OOOC) dataset of images from [24].

图 2:来自 [24] 的物体脱离语境(OOOC)图像数据集中的一张图像。

Captions generated by XE and SCST ensembles for the ship image

Figure 3: Captions generated for the image depicted in Figure 2 by the various models discussed in the paper. Beside each caption we report the average log probability of the words in the caption. On this image, which presents an object situated in an atypical context [24], the FC models fail to give an accurate description, while the attention models handle the previously unseen image composition well. The models trained with SCST return a more accurate and more detailed summary of the image.

图 3:本文讨论的各种模型对图 2 所示图像生成的描述。每条描述旁给出该描述中各个词的平均对数概率。在这张把物体置于非典型语境中的图像上 [24],FC 模型无法给出准确描述,而注意力模型能够很好地处理此前未见过的图像构图。用 SCST 训练的模型给出了对该图像更准确、更细致的概括。

  1. Discussion and Future Work
  1. 讨论与未来工作

In this paper we have presented a simple and efficient approach to more effectively baselining the REINFORCE algorithm for policy-gradient based RL, which allows us to more effectively train on non-differentiable metrics, and leads to significant improvements in captioning performance on MSCOCO—our results on the MSCOCO evaluation sever establish a new state-of-the-art on the task. The self-critical approach, which normalizes the reward obtained by sampled sentences with the reward obtained by the model under the test-time inference algorithm is intuitive, and avoids having to estimate both action-dependent and action-independent reward functions.

本文提出了一种简单而高效的方法,以便更有效地为基于策略梯度的强化学习中的 REINFORCE 算法设置基线,使我们能够更有效地在不可微指标上训练,并在 MSCOCO 上显著提升描述性能——我们在 MSCOCO 评测服务器上的结果为该任务确立了新的当时最高水平。自临界方法用测试时推理算法下模型所获的奖励,来归一化采样句子所获的奖励,这一做法直观,并且不必再去估计既依赖于动作、又不依赖于动作的奖励函数。

Self-critical Sequence Training for Image Captioning:
Supplementary Material

A. Beam search

A. 束搜索

Throughout the paper and in this supplementary material we often refer to caption results and evaluation metric results obtained using “beam search”. This section briefly summarizes our beam search procedure. While decoding the image to generate captions that describe it, rather than greedily selecting the most probable word (N=1N=1N=1), we can maintain a list of the NNN most probable sub-sequences generated so far, generate posterior probabilities for the next word of each of these subsequences, and then again prune down to the NNN-best sub-sequences. This approach is widely referred to as a beam search, where NNN is the width of the decoding “beam”. In our experiments we additionally prune away hypotheses within the NNN-best list that have a log probability that is below that of the maximally probable partial sentence by more than Δlog⁡=5\Delta\log=5Δlog=5. For all reported results, the value of NNN is tuned on a per-model basis on the validation set (of the Karpathy splits). On MSCOCO data, N=2N=2N=2 is typically optimal for cross-entropy (XE) trained models and SCST-trained models, but in the latter case beam search provides only a very small boost in performance. For our captioning demonstrations we set N=5N=5N=5 for all models for illustrative purposes, and because we have qualitatively observed that for test images that are substantially different from those encountered during training, beam search is important.

在正文和本补充材料中,我们经常提到用“束搜索”得到的描述结果和评测指标结果。本节简要概括我们的束搜索手续。在解码图像以生成描述时,我们不是贪心地选取最可能的词(N=1N=1N=1),而是维护一份至此已生成的 NNN 条最可能子序列的列表,为其中每条子序列生成下一个词的后验概率,然后再裁剪回 NNN 条最优子序列。这一做法通常称为束搜索,其中 NNN 是解码“束”的宽度。在我们的实验中,我们还会额外去掉 NNN 优列表中对数概率比最大可能部分句子低出超过 Δlog⁡=5\Delta\log=5Δlog=5 的假设。对所有报告的结果,NNN 的取值都在验证集(Karpathy 划分)上按模型单独调定。在 MSCOCO 数据上,对交叉熵(XE)训练的模型和 SCST 训练的模型,N=2N=2N=2 通常是最优的,但在后一种情形下,束搜索只带来非常小的性能提升。在我们的描述演示中,出于展示的目的,对所有模型都把 NNN 设为 5,也因为我们定性地观察到:对于与训练时所遇显著不同的测试图像,束搜索是重要的。

B. Performance of XE versus SCST trained models

B. XE 训练模型与 SCST 训练模型的表现

In tables 4 and 5 of the main text we compared the performance of models trained to optimize the CIDEr metric with self-critical sequence training (SCST) with that of their corresponding bootstrap models, which were trained under the crossentropy (XE) criterion using scheduled sampling [8]. We provide some additional details about these experiments here. For all XE models, the probability pfp_fpf​ of feeding forward the maximally probable word rather than the ground-truth word was increased by 0.05 every 5 epochs until reaching a maximum value of 0.25. The XE model with the best performance on the validation set of the Karpathy splits was then selected as the bootstrap model for SCST (with the exception of the Att2all attention models, where CE training was intentionally terminated prematurely to encourage more exploration during early epochs of RL training).

在正文的表 4 和表 5 中,我们比较了用自临界序列训练(SCST)优化 CIDEr 指标所训练的模型,与其对应的自举模型的表现;后者是在交叉熵(XE)准则下用 scheduled sampling [8] 训练的。这里补充这些实验的一些细节。对所有 XE 模型,前馈最可能词(而非真值词)的概率 pfp_fpf​ 每 5 个 epoch 提高 0.05,直到达到最大值 0.25。然后在 Karpathy 划分的验证集上表现最好的 XE 模型,被选为 SCST 的自举模型(Att2all 注意力模型除外:对它们,交叉熵训练被有意提前终止,以便在强化学习训练的早期 epoch 中鼓励更多探索)。

For all models, the performance of greedily decoding each word at test time is reported, as is the performance of beam search as described in the previous section. As reported in [7], we found that beam search using RL-trained models resulted in very little performance gain. Figure 5 depicts the performance of our best Att2in model, which is trained to directly optimize the CIDEr metric, as a function of training epoch and evaluation metric, on the validation portion of the Karpathy splits. Optimizing CIDEr clearly improves all of the MSCOCO evaluation metrics substantially.

对所有模型,我们既报告测试时对每个词做贪心解码的表现,也报告上一节所述束搜索的表现。与 [7] 中的报告一致,我们发现对强化学习训练的模型使用束搜索,性能收益非常小。图 5 给出了我们最好的 Att2in 模型(被训练为直接优化 CIDEr 指标)在 Karpathy 划分验证部分上,随训练 epoch 和评测指标变化的表现。优化 CIDEr 显然会大幅提高全部 MSCOCO 评测指标。

C. Performance of MIXER versus SCST trained models

C. MIXER 训练模型与 SCST 训练模型的表现

SCST consistently outperforms MIXER by more than four CIDER points (c.f. figure 4 and table 1).

SCST 稳定地比 MIXER 高出四个以上 CIDER 点(参见图 4 和表 1)。

SCST versus MIXER CIDEr curves over multiple random seeds on FC models

Figure 4: SCST vs. MIXER (FC models) over multiple random seeds.

图 4:多种随机种子下,SCST 与 MIXER 的比较(FC 模型)。

Att2in CIDEr-optimized model performance versus epoch on CIDEr, BLEU-4, ROUGE-L and METEOR

Figure 5: Performance of our best Att2in model, which is trained to directly optimize the CIDEr metric, as a function of training epoch on the validation portion of the Karpathy splits, for the CIDEr, BLEU-4, ROUGE-L, and METEOR MSCOCO evaluation metrics. Optimizing CIDEr improves all of these evaluation metrics substantially.

图 5:我们最好的 Att2in 模型(被训练为直接优化 CIDEr 指标)在 Karpathy 划分验证部分上,CIDEr、BLEU-4、ROUGE-L 和 METEOR 等 MSCOCO 评测指标随训练 epoch 变化的表现。优化 CIDEr 会大幅提高所有这些评测指标。

D. Examples of Generated Captions

D. 生成描述的若干例子

Figures 6-14 depict demonstrations of the captioning performance of all systems. In general we found that the performance of all captioning systems on MSCOCO data is qualitatively similar, while on images containing objects situated in an uncommon context [24] (i.e. unlike the MSCOCO training set) our attention models perform much better, and SCST-trained attention models output yet more accurate and descriptive captions. Attention heat-maps for the image and corresponding captions depicted in figure 6 and 7 are given in figure 8. The heatmaps of the attention weights are reasonably inline with the predicted words in both cases, and the SCST attention weights are spatially sharper here, and in general.

图 6–14 展示了全部系统的描述表现。总体而言,我们发现所有描述系统在 MSCOCO 数据上的表现在定性上相近;而在含有处于罕见语境中的物体的图像上 [24](即与 MSCOCO 训练集不同),我们的注意力模型表现好得多,SCST 训练的注意力模型还会输出更为准确、更为细致的描述。图 6 和图 7 中图像及相应描述的注意力热力图见图 8。在这两种情形下,注意力权重的热力图与所预测的词大体相符,而 SCST 的注意力权重在这里以及总体上在空间上更为锐利。

A common MSCOCO object (a giraffe) in an uncommon out-of-domain context

Figure 6: Picture of a common object in MSCOCO (a giraffe) situated in an uncommon context (out of COCO domain) [24].

图 6:MSCOCO 中的常见物体(一头长颈鹿)被置于不常见语境中(超出 COCO 域)[24]。

Captions generated by various models for the giraffe image

Figure 7: Captions generated by various models discussed in the paper to describe the image depicted in figure 6. Beside each caption we report the average of the log probabilities of each word, normalized by the sentence length. Notice that the attention models trained with SCST give an accurate description of this image with high confidence. Attention models trained with XE are less confident about the correct description. FC models trained with CE or SCST fail at giving an accurate description.

图 7:本文讨论的各种模型对图 6 所示图像生成的描述。每条描述旁给出各词对数概率按句长归一化后的平均值。可以看到,用 SCST 训练的注意力模型以很高的把握对该图像给出了准确描述。用 XE 训练的注意力模型对正确描述的把握较低。用交叉熵或 SCST 训练的 FC 模型都未能给出准确描述。

Attention heat-maps of XE-trained and SCST-trained attention models on the giraffe image

Figure 8: Attention heat-maps. (a) Attention heat-maps for the best model in the XE-trained ensemble of attention models, for the image depicted in figure 6. (b) Attention heat-maps for the best model in the SCST-trained ensemble of attention models, for the image depicted in figure 6.

图 8:注意力热力图。(a) XE 训练的注意力模型集成中最好模型,对图 6 所示图像的注意力热力图。(b) SCST 训练的注意力模型集成中最好模型,对图 6 所示图像的注意力热力图。

An image from the MSCOCO test set (Karpathy splits) of a bird over water

Figure 9: An image from the MSCOCO test set (Karpathy splits).

图 9:来自 MSCOCO 测试集(Karpathy 划分)的一张图像。

Captions generated by various models for the bird-over-water image

Figure 10: Captions generated for the image depicted in Figure 9 by various models discussed in the paper. Beside each caption we report the average log probability of the words in the caption. All models perform well on this test image from the MSCOCO distribution. More generally we have observed that qualitatively, all models perform comparably on the MSCOCO test images.

图 10:本文讨论的各种模型对图 9 所示图像生成的描述。每条描述旁给出该描述中各个词的平均对数概率。所有模型在这张来自 MSCOCO 分布的测试图像上都表现良好。更一般地,我们观察到,在定性上,所有模型在 MSCOCO 测试图像上的表现都大体相当。

An objects out-of-context image of a red car in the water in front of a city

Figure 11: An image from the objects out-of-context (OOOC) dataset of images from [24].

图 11:来自 [24] 的物体脱离语境(OOOC)图像数据集中的一张图像。

Captions generated by various models for the red-car-in-water image

Figure 12: Captions generated for the image depicted in Figure 11 by the various models discussed in the paper. Beside each caption we report the average log probability of the words in the caption. On this image, which presents an object situated in an atypical context [24], the FC models fail to give an accurate description, while the attention models handle the previously unseen image composition well. The models trained with SCST return a more accurate and more detailed summary of the image.

图 12:本文讨论的各种模型对图 11 所示图像生成的描述。每条描述旁给出该描述中各个词的平均对数概率。在这张把物体置于非典型语境中的图像上 [24],FC 模型无法给出准确描述,而注意力模型能够很好地处理此前未见过的图像构图。用 SCST 训练的模型给出了对该图像更准确、更细致的概括。

An objects out-of-context image of a person sitting before a television in a field

Figure 13: An image from the objects out-of-context (OOOC) dataset of images from [24].

图 13:来自 [24] 的物体脱离语境(OOOC)图像数据集中的一张图像。

Captions generated by various models for the person-and-television image

Figure 14: Captions generated for the image depicted in Figure 13 by the various models discussed in the paper. Beside each caption we report the average log probability of the words in the caption. On this image, which presents an object situated in an atypical context [24], the FC models fail to give an accurate description, while the attention models handle the previously unseen image composition well. The models trained with SCST return a more accurate and more detailed summary of the image.

图 14:本文讨论的各种模型对图 13 所示图像生成的描述。每条描述旁给出该描述中各个词的平均对数概率。在这张把物体置于非典型语境中的图像上 [24],FC 模型无法给出准确描述,而注意力模型能够很好地处理此前未见过的图像构图。用 SCST 训练的模型给出了对该图像更准确、更细致的概括。

E. Further details and analysis of SCST training

E. SCST 训练的进一步细节与分析

One detail that was crucial to optimizing CIDEr to produce better models was to include the EOS tag as a word. When the EOS word was omitted, trivial sentence fragments such as “with a” and “and a” were dominating the metric gains, despite the “gaming” counter-measures (sentence length and precision clipping) that are included in CIDEr-D [13], which is what we optimized. Including the EOS tag substantially lowers the reward allocated to incomplete sentences, and completely resolved this issue. Another more obvious detail that is important is to associate the reward for the sentence with the first EOS encountered. Omitting the reward from the first EOS fails to reward sentence completion which leads to run-on, and rewarding any words that follow the first EOS token is inconsistent with the decoding procedure.

对优化 CIDEr 以得到更好模型至关重要的一个细节,是把 EOS 标记也当作一个词。若省略 EOS 词,像 “with a” 和 “and a” 这样琐碎的句子片段就会主导指标上的收益,尽管我们所优化的 CIDEr-D [13] 中已包含应对“钻空子”的措施(句长与精度截断)。纳入 EOS 标记会大幅降低分配给不完整句子的奖励,并彻底解决了这一问题。另一个更为明显却同样重要的细节,是把句子的奖励与遇到的第一个 EOS 联系起来。若不把奖励给予第一个 EOS,就无法奖励句子的完成,从而导致句子拖沓不止;而若再给第一个 EOS 记号之后的任何词奖励,则与解码手续不一致。

This work has focused on optimizing the CIDEr metric, since, as discussed in the paper, optimizing CIDER substantially improves all MSCOCO evaluation metrics, as was shown in tables 4 and 5 and is depicted in figure 5. Nevertheless, directly optimizing another metric does lead to higher evaluation scores on that same metric as shown, and so we have started to experiment with including models trained on Bleu, Rouge-L, and METEOR in our Att2in ensemble to attempt to improve it further. So far we have not been able to substantially improve performance w.r.t. the other metrics without more substantially degrading CIDEr.

本工作主要集中在优化 CIDEr 指标上,因为正如正文所讨论的,优化 CIDER 会大幅提高全部 MSCOCO 评测指标,这一点已在表 4 和表 5 中给出,并在图 5 中展示。尽管如此,直接优化另一项指标,确实会在同一指标上得到更高的评测分数,因此我们已开始试验把在 Bleu、Rouge-L 和 METEOR 上训练的模型纳入 Att2in 集成,试图进一步加以改进。迄今为止,我们还未能在不明显损害 CIDEr 的前提下,大幅提高其它指标上的表现。

References

参考文献

[1] Tsung-Yi Lin, Michael Maire, Serge J. Belongie, Lubomir D. Bourdev, Ross B. Girshick, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollár, and C. Lawrence Zitnick. Microsoft COCO: common objects in context. EECV, 2014. 1, 4

[2] Kyunghyun Cho, Bart van Merrienboer, Çaglar Gülçehre, Fethi Bougares, Holger Schwenk, and Yoshua Bengio. Learning phrase representations using RNN encoder-decoder for statistical machine translation. EMNLP, 2014. 1

[3] Oriol Vinyals, Alexander Toshev, Samy Bengio, and Dumitru Erhan. Show and tell: A neural image caption generator. CVPR, 2015. 1, 2

[4] Andrej Karpathy and Fei-Fei Li. Deep visual-semantic alignments for generating image descriptions. CVPR, 2015. 1, 2

[5] Sepp Hochreiter and Jürgen Schmidhuber. Long short-term memory. Neural Comput., 1997. 1, 2

[6] Kelvin Xu, Jimmy Ba, Ryan Kiros, Kyunghyun Cho, Aaron C. Courville, Ruslan Salakhutdinov, Richard S. Zemel, and Yoshua Bengio. Show, attend and tell: Neural image caption generation with visual attention. In ICML, 2015. 1, 2, 3

[7] Marc'Aurelio Ranzato, Sumit Chopra, Michael Auli, and Wojciech Zaremba. Sequence level training with recurrent neural networks. ICLR, 2015. 1, 2, 3, 4, 5, 10

[8] Samy Bengio, Oriol Vinyals, Navdeep Jaitly, and Noam Shazeer. Scheduled sampling for sequence prediction with recurrent neural networks. In NIPS, 2015. 1, 4, 5, 10

[9] Alex Lamb, Anirudh Goyal, Ying Zhang, Saizheng Zhang, Aaron Courville, and Yoshua Bengio. Professor forcing: A new algorithm for training recurrent networks. Neural Information Processing Systems (NIPS) 2016, 2016. 1, 4

[10] Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu. Bleu: A method for automatic evaluation of machine translation. In ACL, 2002. 2

[11] Chin-Yew Lin. Rouge: A package for automatic evaluation of summaries. In Text summarization branches out: Proceedings of the ACL-04 workshop, volume 8. Barcelona, Spain, 2004. 2

[12] Satanjeev Banerjee and Alon Lavie. Meteor: An automatic metric for mt evaluation with improved correlation with human judgments. In Proceedings of the acl workshop on intrinsic and extrinsic evaluation measures for machine translation and/or summarization, volume 29, pages 65–72, 2005. 2

[13] Ramakrishna Vedantam, C. Lawrence Zitnick, and Devi Parikh. Cider: Consensus-based image description evaluation. In CVPR, 2015. 2, 10

[14] Richard S. Sutton and Andrew G. Barto. Reinforcement learning: An introduction. MIT Press, 1998. 2, 3

[15] Ronald J. Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. In Machine Learning, pages 229–256, 1992. 2, 3

[16] John Schulman, Philipp Moritz, Sergey Levine, Michael Jordan, and Pieter Abbeel. High-dimensional continuous control using generalized advantage estimation. arXiv preprint arXiv:1506.02438, 2015. 2

[17] Wojciech Zaremba and Ilya Sutskever. Reinforcement learning neural turing machines. Arxiv, 2015. 2, 3

[18] Andriy Mnih and Karol Gregor. Neural variational inference and learning in belief networks. arXiv preprint arXiv:1402.0030, 2014. 2

[19] Dzmitry Bahdanau, Philemon Brakel, Kelvin Xu, Anirudh Goyal, Ryan Lowe, Joelle Pineau, Aaron C. Courville, and Yoshua Bengio. An actor-critic algorithm for sequence prediction. Arxiv, 2016. 2

[20] Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. ICLR, 2015. 3, 5

[21] Andrej Karpathy and Fei-Fei Li. Deep visual-semantic alignments for generating image descriptions. In CVPR, 2015. 4, 6, 7

[22] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, 2016. 4

[23] Oriol Vinyals, Alexander Toshev, Samy Bengio, and Dumitru Erhan. Show and tell: Lessons learned from the 2015 MSCOCO image captioning challenge. PAMI, 2016. 7

[24] Myung Jinchoi, Antonio Torralba, and Alan S. Willsky. Context models and out-of-context objects. 7, 8, 10, 13, 16, 17