MVP模式08-14 11:37

# 一 RNN在训练过程中的问题

teacher forcing最初的motivation就是解决这个问题的。

# 二 RNN的两种训练模式

1. free-running mode
2. teacher-forcing mode

free-running mode就是大家常见的那种训练网络的方式: 上一个state的输入作为下一个state的输出。而Teacher Forcing是一种快速有效地训练循环神经网络模型的方法，该模型使用来自先验时间步长的输出作为输入。

# 三 什么是Teacher Forcing

Models that have recurrent connections from their outputs leading back into the model may be trained with teacher forcing. — Page 372, Deep Learning, 2016.

An interesting technique that is frequently used in dynamical supervised learning tasks is to replace the actual output y(t) of a unit by the teacher signal d(t) in subsequent computation of the behavior of the network, whenever such a value exists. We call this technique teacher forcing. — A Learning Algorithm for Continually Running Fully Recurrent Neural Networks, 1989.

Teacher Forcing工作原理: 在训练过程的 $t$ 时刻，使用训练数据集的期望输出或实际输出: $y(t)$， 作为下一时间步骤的输入: $x(t+1)$，而不是使用模型生成的输出$h(t)$

Teacher forcing is a procedure […] in which during training the model receives the ground truth output y(t) as input at time t + 1. — Page 372, Deep Learning, 2016.

# 四 Free-Running vs Teacher Forcing 实例

Mary had a little lamb whose fleece was white as snow


[START] Mary had a little lamb whose fleece was white as snow [END]


## 4.1 Free-running 训练过程

$X$ $\hat{y}$
“[START]” “a”

$X$ $\hat{y}$
“[START]” , “a” ?

## 4.2 Teacher-Forcing 训练过程

$X$ $\hat{y}$
“[START]” , “Marry” ?

$X$ $\hat{y}$
“[START]” ?
“[START]” , “Marry” ?
?

# 五 Teacher Forcing的缺点及其解决办法

## 5.1 Teacher Forcing的缺点

Teacher Forcing同样存在缺点: 一直靠老师带的孩子是走不远的。

## 5.2 集束搜索(Beam Search)

beam search是完成此任务应用最广的方法，通过这种启发式搜索(heuristic search)，可减小模型学习阶段performance与测试阶段performance的差异。

## 5.3 有计划地学习(Curriculum Learning)

Curriculum Learning是Teacher Forcing的一个变种：

We propose to change the training process in order to gradually force the model to deal with its own mistakes, as it would have to during inference. — Scheduled Sampling for Sequence Prediction with Recurrent Neural Networks, 2015.

000