Incorporating Copying Mechanism in Sequence-to-Sequence Learning
Jiatao Gu† Zhengdong Lu‡ Hang Li‡ Victor O.K. Li†
†
Department of Electrical and Electronic Engineering, The University of Hong Kong
{jiataogu, vli}@eee.hku.hk
‡
Huawei Noah’s Ark Lab, Hong Kong
{lu.zhengdong, hangli.hl}@huawei.com

Abstract

arXiv:1603.06393v3 [cs.CL] 8 Jun 2016

We address an important problem in
sequence-to-sequence (Seq2Seq) learning
referred to as copying, in which certain segments in the input sequence are
selectively replicated in the output sequence. A similar phenomenon is observable in human language communication. For example, humans tend to repeat entity names or even long phrases
in conversation. The challenge with regard to copying in Seq2Seq is that new
machinery is needed to decide when to
perform the operation. In this paper, we
incorporate copying into neural networkbased Seq2Seq learning and propose a new
model called C OPY N ET with encoderdecoder structure. C OPY N ET can nicely
integrate the regular way of word generation in the decoder with the new copying mechanism which can choose subsequences in the input sequence and put
them at proper places in the output sequence. Our empirical study on both synthetic data sets and real world data sets
demonstrates the efficacy of C OPY N ET.
For example, C OPY N ET can outperform
regular RNN-based model with remarkable margins on text summarization tasks.

1

Introduction

Recently, neural network-based sequence-tosequence learning (Seq2Seq) has achieved remarkable success in various natural language processing (NLP) tasks, including but not limited to
Machine Translation (Cho et al., 2014; Bahdanau
et al., 2014), Syntactic Parsing (Vinyals et al.,
2015b), Text Summarization (Rush et al., 2015)
and Dialogue Systems (Vinyals and Le, 2015).

Seq2Seq is essentially an encoder-decoder model,
in which the encoder first transform the input sequence to a certain representation which can then
transform the representation into the output sequence. Adding the attention mechanism (Bahdanau et al., 2014) to Seq2Seq, first proposed
for automatic alignment in machine translation,
has led to significant improvement on the performance of various tasks (Shang et al., 2015; Rush et
al., 2015). Different from the canonical encoderdecoder architecture, the attention-based Seq2Seq
model revisits the input sequence in its raw form
(array of word representations) and dynamically
fetches the relevant piece of information based
mostly on the feedback from the generation of the
output sequence.
In this paper, we explore another mechanism
important to the human language communication,
called the “copying mechanism”. Basically, it
refers to the mechanism that locates a certain segment of the input sentence and puts the segment
into the output sequence. For example, in the
following two dialogue turns we observe different patterns in which some subsequences (colored
blue) in the response (R) are copied from the input
utterance (I):
I: Hello Jack, my name is Chandralekha.
R: Nice to meet you, Chandralekha.
I: This new guy doesn’t perform exactly
as we expected.
R: What do you mean by "doesn’t perform
exactly as we expected"?

Both the canonical encoder-decoder and its
variants with attention mechanism rely heavily
on the representation of “meaning”, which might
not be sufficiently inaccurate in cases in which
the system needs to refer to sub-sequences of input like entity names or dates. In contrast, the

copying mechanism is closer to the rote memorization in language processing of human being,
deserving a different modeling strategy in neural
network-based models. We argue that it will benefit many Seq2Seq tasks to have an elegant unified
model that can accommodate both understanding
and rote memorization. Towards this goal, we propose C OPY N ET, which is not only capable of the
regular generation of words but also the operation
of copying appropriate segments of the input sequence. Despite the seemingly “hard” operation
of copying, C OPY N ET can be trained in an end-toend fashion. Our empirical study on both synthetic
datasets and real world datasets demonstrates the
efficacy of C OPY N ET.

2

Background: Neural Models for
Sequence-to-sequence Learning

Seq2Seq Learning can be expressed in a probabilistic view as maximizing the likelihood (or
some other evaluation metrics (Shen et al., 2015))
of observing the output (target) sequence given an
input (source) sequence.
2.1

RNN Encoder-Decoder

RNN-based Encoder-Decoder is successfully applied to real world Seq2Seq tasks, first by Cho et
al. (2014) and Sutskever et al. (2014), and then
by (Vinyals and Le, 2015; Vinyals et al., 2015a).
In the Encoder-Decoder framework, the source sequence X = [x1 , ..., xTS ] is converted into a fixed
length vector c by the encoder RNN, i.e.
ht = f (xt , ht−1 );

c = φ({h1 , ..., hTS }) (1)

where {ht } are the RNN states, c is the so-called
context vector, f is the dynamics function, and φ
summarizes the hidden states, e.g. choosing the
last state hTS . In practice it is found that gated
RNN alternatives such as LSTM (Hochreiter and
Schmidhuber, 1997) or GRU (Cho et al., 2014) often perform much better than vanilla ones.
The decoder RNN is to unfold the context vector c into the target sequence, through the following dynamics and prediction model:
st = f (yt−1 , st−1 , c)
(2)
p(yt |y<t , X) = g(yt−1 , st , c)
where st is the RNN state at time t, yt is the predicted target symbol at t (through function g(·))
with y<t denoting the history {y1 , ..., yt−1 }. The
prediction model is typically a classifier over the
vocabulary with, say, 30,000 words.

2.2

The Attention Mechanism

The attention mechanism was first introduced to
Seq2Seq (Bahdanau et al., 2014) to release the
burden of summarizing the entire source into a
fixed-length vector as context. Instead, the attention uses a dynamically changing context ct in the
decoding process. A natural option (or rather “soft
attention”) is to represent ct as the weighted sum
of the source hidden states, i.e.

ct =

TS
X

αtτ hτ ;

eη(st−1 ,hτ )
η(st−1 ,hτ 0 )
τ0 e

αtτ = P

τ =1

(3)

where η is the function that shows the correspondence strength for attention, approximated usually
with a multi-layer neural network (DNN). Note
that in (Bahdanau et al., 2014) the source sentence is encoded with a Bi-directional RNN, making each hidden state hτ aware of the contextual
information from both ends.

3

C OPY N ET

From a cognitive perspective, the copying mechanism is related to rote memorization, requiring
less understanding but ensuring high literal fidelity. From a modeling perspective, the copying
operations are more rigid and symbolic, making
it more difficult than soft attention mechanism to
integrate into a fully differentiable neural model.
In this section, we present C OPY N ET, a differentiable Seq2Seq model with “copying mechanism”,
which can be trained in an end-to-end fashion with
just gradient descent.
3.1

Model Overview

As illustrated in Figure 1, C OPY N ET is still an
encoder-decoder (in a slightly generalized sense).
The source sequence is transformed by Encoder
into representation, which is then read by Decoder
to generate the target sequence.
Encoder: Same as in (Bahdanau et al., 2014), a
bi-directional RNN is used to transform the source
sequence into a series of hidden states with equal
length, with each hidden state ht corresponding to
word xt . This new representation of the source,
{h1 , ..., hTS }, is considered to be a short-term
memory (referred to as M in the remainder of the
paper), which will later be accessed in multiple
ways in generating the target sequence (decoding).

(b) Generate-Mode & Copy-Mode
Prob(“Jebara”) = Prob(“Jebara”, g) + Prob(“Jebara”, c)

hi

,

Tony

Jebara

s1

s2

s3

s4

<eos>

hi

,

Tony

Softmax

… ...

Source

Vocabulary

M
s4

Attentive Read

DNN

h1

h2

h3

h4

h5

h6

h7

h8

hello

,

my

name

is

Tony

Jebara

.

“Tony”

(c) State Update

Embedding
for “Tony”
Selective Read
for “Tony”

M

𝜌

(a) Attention-based Encoder-Decoder (RNNSearch)

Figure 1: The overall diagram of C OPY N ET. For simplicity, we omit some links for prediction (see
Sections 3.2 for more details).
Decoder: An RNN that reads M and predicts
the target sequence. It is similar with the canonical RNN-decoder in (Bahdanau et al., 2014), with
however the following important differences
• Prediction: C OPY N ET predicts words based
on a mixed probabilistic model of two modes,
namely the generate-mode and the copymode, where the latter picks words from the
source sequence (see Section 3.2);
• State Update: the predicted word at time t−1
is used in updating the state at t, but C OPYN ET uses not only its word-embedding but
also its corresponding location-specific hidden state in M (if any) (see Section 3.3 for
more details);
• Reading M: in addition to the attentive read
to M, C OPY N ET also has“selective read”
to M, which leads to a powerful hybrid of
content-based addressing and location-based
addressing (see both Sections 3.3 and 3.4 for
more discussion).
3.2

Prediction with Copying and Generation

We assume a vocabulary V = {v1 , ..., vN }, and
use UNK for any out-of-vocabulary (OOV) word.
In addition, we have another set of words X , for
all the unique words in source sequence X =
{x1 , ..., xTS }. Since X may contain words not
in V, copying sub-sequence in X enables C OPYN ET to output some OOV words. In a nutshell,
the instance-specific vocabulary for source X is
V ∪ UNK ∪ X .

Given the decoder RNN state st at time t together with M, the probability of generating any
target word yt , is given by the “mixture” of probabilities as follows
p(yt |st , yt−1 , ct , M) = p(yt , g|st , yt−1 , ct , M)
+ p(yt , c|st , yt−1 , ct , M) (4)
where g stands for the generate-mode, and c the
copy mode. The probability of the two modes are
given respectively by
 1
ψg (yt ) ,

yt ∈ V

 Ze
0,
yt ∈ X ∩ V̄ (5)
p(yt , g|·)=


 1 eψg (UNK)
yt 6∈ V ∪ X
Z
(1 P
eψc (xj ) , yt ∈ X
p(yt , c|·)= Z j:xj =yt
(6)
0
otherwise
where ψg (·) and ψc (·) are score functions for
generate-mode and copy-mode, respectively, and
Z is the normalization
term shared
P
Pby the two
modes, Z = v∈V∪{UNK} eψg (v) + x∈X eψc (x) .
Due to the shared normalization term, the two
modes are basically competing through a softmax
function (see Figure 1 for an illustration with example), rendering Eq.(4) different from the canonical definition of the mixture model (McLachlan
and Basford, 1988). This is also pictorially illustrated in Figure 2. The score of each mode is calculated:

'
∑ exp
( 9:

𝜓6 𝑥8

'
exp
(

| 𝑥8 = 𝑦4

𝑋

𝑋∩𝑉

𝜓- 𝑣 /

| 𝑣/ = 𝑦4

𝑉
unk

*Z is the normalization term.
'
(

∑ 9: exp 𝜓6 𝑥8

+ exp 𝜓- 𝑣 /

| 𝑥8 = 𝑦4 , 𝑣 / = 𝑦4

'
exp[𝜓(

unk ]

Figure 2: The illustration of the decoding probability p(yt |·) as a 4-class classifier.
Generate-Mode: The same scoring function as
in the generic RNN encoder-decoder (Bahdanau et
al., 2014) is used, i.e.
ψg (yt = vi ) = vi> Wo st ,

vi ∈ V ∪ UNK (7)

where Wo ∈ R(N +1)×ds and vi is the one-hot indicator vector for vi .
Copy-Mode: The score for “copying” the word
xj is calculated as


ψc (yt = xj ) = σ h>
W
xj ∈ X (8)
c st ,
j
where Wc ∈ Rdh ×ds , and σ is a non-linear activation function, considering that the non-linear
transformation in Eq.( 8) can help project st and hj
in the same semantic space. Empirically, we also
found that using the tanh non-linearity worked
better than linear transformation, and we used that
for the following experiments. When calculating
the copy-mode score, we use the hidden states
{h1 , ..., hTS } to “represent” each of the word in
the source sequence {x1 , ..., xTS } since the bidirectional RNN encodes not only the content, but
also the location information into the hidden states
in M. The location informaton is important for
copying (see Section 3.4 for related discussion).
Note that we sum the probabilities of all xj equal
to yt in Eq. (6) considering that there may be multiple source symbols for decoding yt . Naturally
we let p(yt , c|·) = 0 if yt does not appear in the
source sequence, and set p(yt , g|·) = 0 when yt
only appears in the source.
3.3

State Update

C OPY N ET updates each decoding state st with
the previous state st−1 , the previous symbol yt−1
and the context vector ct following Eq. (2) for the
generic attention-based Seq2Seq model. However,
there is some minor changes in the yt−1 −→st path
for the copying mechanism. More specifically,
yt−1 will be represented as [e(yt−1 ); ζ(yt−1 )]> ,

where e(yt−1 ) is the word embedding associated
with yt−1 , while ζ(yt−1 ) is the weighted sum of
hidden states in M corresponding to yt
XTS
ρtτ hτ
ζ(yt−1 ) =
τ =1
(1
(9)
p(xτ , c|st−1 , M), xτ = yt−1
ρtτ = K
0
otherwise
where
K is the normalization term which equals
P
τ 0 :xτ 0 =yt−1 p(xτ 0 , c|st−1 , M), considering there
may exist multiple positions with yt−1 in the
source sequence. In practice, ρtτ is often concentrated on one location among multiple appearances, indicating the prediction is closely bounded
to the location of words.
In a sense ζ(yt−1 ) performs a type of read to
M similar to the attentive read (resulting ct ) with
however higher precision. In the remainder of
this paper, ζ(yt−1 ) will be referred to as selective
read. ζ(yt−1 ) is specifically designed for the copy
mode: with its pinpointing precision to the corresponding yt−1 , it naturally bears the location of
yt−1 in the source sequence encoded in the hidden
state. As will be discussed more in Section 3.4,
this particular design potentially helps copy-mode
in covering a consecutive sub-sequence of words.
If yt−1 is not in the source, we let ζ(yt−1 ) = 0.
3.4

Hybrid Addressing of M

We hypothesize that C OPY N ET uses a hybrid
strategy for fetching the content in M, which combines both content-based and location-based addressing. Both addressing strategies are coordinated by the decoder RNN in managing the attentive read and selective read, as well as determining
when to enter/quit the copy-mode.
Both the semantics of a word and its location
in X will be encoded into the hidden states in M
by a properly trained encoder RNN. Judging from
our experiments, the attentive read of C OPY N ET is
driven more by the semantics and language model,
therefore capable of traveling more freely on M,
even across a long distance. On the other hand,
once C OPY N ET enters the copy-mode, the selective read of M is often guided by the location information. As the result, the selective read often
takes rigid move and tends to cover consecutive
words, including UNKs. Unlike the explicit design for hybrid addressing in Neural Turing Machine (Graves et al., 2014; Kurach et al., 2015),
C OPY N ET is more subtle: it provides the archi-

tecture that can facilitate some particular locationbased addressing and lets the model figure out the
details from the training data for specific tasks.
Location-based Addressing: With the location
information in {hi }, the information flow
update

predict

sel. read

ζ(yt−1 ) −−−→ st −−−→ yt −−−−→ ζ(yt )
provides a simple way of “moving one step to the
right” on X. More specifically, assuming the selective read ζ(yt−1 ) concentrates on the `th word
update

in X, the state-update operation ζ(yt−1 ) −−−→st
acts as “location ← location+1”, making st
favor the (`+1)th word in X in the prediction
predict

st −−−→ yt in copy-mode. This again leads to
sel. read
the selective read ĥt −−−−→ζ(yt ) for the state update of the next round.
Handling Out-of-Vocabulary Words Although
it is hard to verify the exact addressing strategy as
above directly, there is strong evidence from our
empirical study. Most saliently, a properly trained
C OPY N ET can copy a fairly long segment full of
OOV words, despite the lack of semantic information in its M representation. This provides a
natural way to extend the effective vocabulary to
include all the words in the source. Although this
change is small, it seems quite significant empirically in alleviating the OOV problem. Indeed, for
many NLP applications (e.g., text summarization
or spoken dialogue system), much of the OOV
words on the target side, for example the proper
nouns, are essentially the replicates of those on the
source side.

4

Learning

Although the copying mechanism uses the “hard”
operation to copy from the source and choose to
paste them or generate symbols from the vocabulary, C OPY N ET is fully differentiable and can
be optimized in an end-to-end fashion using backpropagation. Given the batches of the source and
target sequence {X}N and {Y }N , the objectives
are to minimize the negative log-likelihood:
N T
h
i
1 XX
(k) (k)
L=−
log p(yt |y<t , X (k) ) , (10)
N
k=1 t=1
where we use superscripts to index the instances.
Since the probabilistic model for observing any
target word is a mixture of generate-mode and
copy-mode, there is no need for any additional
labels for modes. The network can learn to coordinate the two modes from data. More specif(k)
ically, if one particular word yt can be found

in the source sequence, the copy-mode will contribute to the mixture model, and the gradient will
more or less encourage the copy-mode; otherwise,
the copy-mode is discouraged due to the competition from the shared normalization term Z. In
practice, in most cases one mode dominates.

5

Experiments

We report our empirical study of C OPY N ET on the
following three tasks with different characteristics
1. A synthetic dataset on with simple patterns;
2. A real-world task on text summarization;
3. A dataset for simple single-turn dialogues.
5.1

Synthetic Dataset

Dataset: We first randomly generate transformation rules with 5∼20 symbols and variables x &
y, e.g.
a b x c d y e f −→ g h x m,
with {a b c d e f g h m} being regular symbols
from a vocabulary of size 1,000. As shown in the
table below, each rule can further produce a number of instances by replacing the variables with
randomly generated subsequences (1∼15 symbols) from the same vocabulary. We create five
types of rules, including “x → ∅”. The task is
to learn to do the Seq2Seq transformation from
the training instances. This dataset is designed to
study the behavior of C OPY N ET on handling simple and rigid patterns. Since the strings to repeat
are random, they can also be viewed as some extreme cases of rote memorization.
Rule-type

Examples (e.g. x = i h k, y = j c)

x→∅

a b c d x e f→c d g

x→x
x → xx
xy → x
xy → xy

a
a
a
a

b
b
b
b

c
c
y
y

d
d
d
d

x
x
x
x

e
e
e
e

f→c
f→x
f→x
f→x

d
d
d
d

x
x
i
y

g
g
g
g

Experimental Setting: We select 200 artificial
rules from the dataset, and for each rule 200 instances are generated, which will be split into
training (50%) and testing (50%). We compare
the accuracy of C OPY N ET and the RNN EncoderDecoder with (i.e. RNNsearch) or without attention (denoted as Enc-Dec). For a fair comparison, we use bi-directional GRU for encoder and
another GRU for decoder for all Seq2Seq models,
with hidden layer size = 300 and word embedding
dimension = 150. We use bin size = 10 in beam
search for testing. The prediction is considered

Rule-type

x
→∅

x
→x

x
→ xx

xy
→x

xy
→ xy

Enc-Dec
RNNSearch

100
99.0

3.3
69.4

1.5
22.3

2.9
40.7

0.0
2.6

C OPY N ET

97.3

93.7

98.3

68.2

77.5

Table 1: The test accuracy (%) on synthetic data.

* Symbols are represented by
their indices from 000 to 999
** Dark color represents large
value.

Input:

The Source Sequence

705 502 X 504 339 270 584 556
→
510 771 581 557 022 230 X 115
102 172 862 X 950

705
502
970
991
575
325
688
504
339
270
584
556

Predict:

510
771
581
557
263
022
230
970
991
575
325
688
115
102
172
862
970
991
575
325
688
950

Pattern:

<0>
510
771
581
557
263
022
230
970
991
575
325
688
115
102
172
862
970
991
575
325
688

correct only when the generated sequence is exactly the same as the given one.
It is clear from Table 1 that C OPY N ET significantly outperforms the other two on all rule-types
except “x → ∅”, indicating that C OPY N ET can effectively learn the patterns with variables and accurately replicate rather long subsequence of symbols at the proper places.This is hard to Enc-Dec
due to the difficulty of representing a long sequence with very high fidelity. This difficulty can
be alleviated with the attention mechanism. However attention alone seems inadequate for handling
the case where strict replication is needed.
A closer look (see Figure 3 for example) reveals that the decoder is dominated by copy-mode
when moving into the subsequence to replicate,
and switch to generate-mode after leaving this
area, showing C OPY N ET can achieve a rather precise coordination of the two modes.

The Target Sequence

Figure 3: Example output of C OPY N ET on the
synthetic dataset. The heatmap represents the activations of the copy-mode over the input sequence
(left) during the decoding process (bottom).
5.2

Text Summarization

Automatic text summarization aims to find a condensed representation which can capture the core
meaning of the original document. It has been
recently formulated as a Seq2Seq learning problem in (Rush et al., 2015; Hu et al., 2015), which
essentially gives abstractive summarization since
the summary is generated based on a representation of the document. In contrast, extractive
summarization extracts sentences or phrases from
the original text to fuse them into the summaries,
therefore making better use of the overall structure of the original document. In a sense, C OPYN ET for summarization lies somewhere between

two categories, since part of output summary is actually extracted from the document (via the copying mechanism), which are fused together possibly with the words from the generate-mode.
Dataset: We evaluate our model on the recently
published LCSTS dataset (Hu et al., 2015), a large
scale dataset for short text summarization. The
dataset is collected from the news medias on Sina
Weibo1 including pairs of (short news, summary)
in Chinese. Shown in Table 2, PART II and III are
manually rated for their quality from 1 to 5. Following the setting of (Hu et al., 2015) we use Part
I as the training set and and the subset of Part III
scored from 3 to 5 as the testing set.
Dataset
no. of pairs
no. of score ≥ 3

PART I

PART II

PART III

2,400,591
-

10,666
8685

1106
725

Table 2: Some statistics of the LCSTS dataset.
Experimental Setting: We try C OPY N ET that is
based on character (+C) and word (+W). For the
word-based variant the word-segmentation is obtained with jieba2 . We set the vocabulary size to
3,000 (+C) and 10,000 (+W) respectively, which
are much smaller than those for models in (Hu
et al., 2015). For both variants we set the embedding dimension to 350 and the size of hidden
layers to 500. Following (Hu et al., 2015), we
evaluate the test performance with the commonly
used ROUGE-1, ROUGE-2 and ROUGE-L (Lin,
2004), and compare it against the two models in
(Hu et al., 2015), which are essentially canonical
Encoder-Decoder and its variant with attention.
Models

ROUGE scores on LCSTS (%)
R-1
R-2
R-L

RNN
(Hu et al., 2015)
RNN context
(Hu et al., 2015)

+C
+W
+C
+W

21.5
17.7
29.9
26.8

8.9
8.5
17.4
16.1

18.6
15.8
27.2
24.1

C OPY N ET

+C
+W

34.4
35.0

21.6
22.3

31.3
32.0

Table 3: Testing performance of LCSTS, where
“RNN” is canonical Enc-Dec, and “RNN context”
its attentive variant.
It is clear from Table 3 that C OPY N ET beats
the competitor models with big margin. Hu
et al. (2015) reports that the performance of a
word-based model is inferior to a character-based
1
2

www.sina.com
https://pypi.python.org/pypi/jieba

Input(1): 今天上午 9 点半 ， 复旦 投毒案 将 在 上海 二中院 公开审理 。 被害 学生 黄洋 的 亲属 已 从 四川 抵达 上海 ， 其父 称待 刑事 部分 结束 后 ， 再 提 民事 赔偿 ， 黄洋 92 岁 的 奶奶 依然
不知情 。 今年 4 月 ， 在 复旦 上海医学院 读 研究生 的 黄洋 疑遭 室友 林森 浩 投毒 ， 不幸身亡 。 新民 网
Today 9:30, the Fudan poisoning case will be will on public trial at the Shanghai Second Intermediate Court. The relatives of the murdered student Huang Yang has arrived at Shanghai from Sichuan. His father said that they will start
the lawsuit for civil compensation after the criminal section. HuangYang 92-year-old grandmother is still unaware of his death. In April, a graduate student at Fudan University Shanghai Medical College, Huang Yang is allegedly
poisoned and killed by his roommate Lin Senhao. Reported by Xinmin
______________________________________________________________

Golden: 林森 浩 投毒案 今日 开审 92 岁 奶奶 尚不知 情
the case of Lin Senhao poisoning is on trial today, his 92-year-old grandmother is still unaware of this

RNN context: 复旦投毒案： 黄洋疑遭室友投毒凶手已从四川飞往上海，父亲命案另有4人被通知家属不治？
CopyNet: 复旦 投毒案 今 在 沪 上 公开审理
the Fudan poisoning case is on public trial today in Shanghai

Input(2): 华谊 兄弟 （ 300027 ） 在 昨日 收盘 后 发布公告 称 ， 公司 拟 以 自有 资金 3.978 亿元 收购 浙江 永乐 影视 股份 有限公司 若干 股东 持有 的 永乐 影视 51 % 的 股权 。 对于 此项 收购 ，
华谊 兄弟 董秘 胡明 昨日 表示 ： “ 和 永乐 影视 的 合并 是 对 华谊 兄弟 电视剧 业务 的 一个 加强 。
Huayi Brothers (300027) announced that the company intends to buy with its own fund 397.8 million 51% of Zhejiang Yongle Film LTD's stake owned by a number of shareholders of Yongle Film LTD. For this acquisition, the
secretary of the board, Hu Ming, said yesterday: "the merging with Yongle Film is to strengthen Huayi Brothers on TV business".
______________________________________________________________

Golden: 华谊 兄弟 拟 收购 永乐 影视 ５ １ ％ 股权
Huayi Brothers intends to acquire 51% stake of Zhejiang Yongle Film

RNN context: 华谊兄弟收购永乐影视51%股权：与永乐影视合并为“和唐”影视合并的“UNK”和“UNK”的区别？
CopyNet: 华谊 兄弟 拟 3.978 亿 收购 永乐 影视 董秘 称 加强 电视剧 业务
Huayi Brothers is intended to 397.8 million acquisition of Yongle Film secretaries called to strengthen the TV business

Input(3): 工厂 ， 大门 紧锁 ， 约 20 名 工人 散 坐在 树荫下 。 “ 我们 就是 普通工人 ， 在 这里 等 工资 。 ” 其中 一人 说道 。 7 月 4 日 上午 ， 记者 抵达 深圳 龙华区 清 湖 路上 的 深圳 愿景
光电子 有限公司 。 正如 传言 一般 ， 愿景 光电子 倒闭 了 ， 大 股东 邢毅 不知 所踪 。
The door of factory is locked. About 20 workers are scattered to sit under the shade. “We are ordinary workers, waiting for our salary” one of them said. In the morning of July 4th, reporters arrived at Yuanjing Photoelectron
Corporation located at Qinghu Road, Longhua District, Shenzhen. Just as the rumor, Yuanjing Photoelectron Corporation is closed down and the big shareholder Xing Yi is missing.
______________________________________________________________

Golden: 深圳 亿元 级 LED 企业倒闭 烈日 下 工人 苦 等 老板

Hundred-million CNY worth LED enterprise is closed down and workers wait for the boss under the scorching sun

RNN context: 深圳“<UNK>”：深圳<UNK><UNK>，<UNK>，<UNK>，<UNK>
CopyNet: 愿景 光电子 倒闭 20 名 工人 散 坐在 树荫下
Yuanjing Photoelectron Corporation is closed down, 20 workers are scattered to sit under the shade

Input(4): 截至 2012 年 10 月底 ， 全国 累计 报告 艾滋病 病毒感染者 和 病人 492191 例 。 卫生部 称 ， 性传播 已 成为 艾滋病 的 主要 传播 途径 。 至 2011 年 9 月 ， 艾滋病 感染者 和 病人数 累
计 报告 数排 在 前 6 位 的 省份 依次 为 云南 、 广西 、 河南 、 四川 、 新疆 和 广东 ， 占 全国 的 75.8 % 。。
At the end of October 2012, the national total of reported HIV infected people and AIDS patients is 492,191 cases. The Health Ministry saids exual transmission has become the main route of transmission of AIDS. To September
2011, the six provinces with the most reported HIV infected people and AIDS patients were Yunnan, Guangxi, Henan,Sichuan, Xinjiang and Guangdong, accounting for 75.8% of the country.
______________________________________________________________

Golden: 卫生部 ： 性传播 成 艾滋病 主要 传播 途径
Ministry of Health: Sexually transmission became the main route of transmission of AIDS

RNN context: 全国累计报告艾滋病患者和病人<UNK>例艾滋病患者占全国<UNK>%，性传播成艾滋病高发人群 ？
CopyNet: 卫生部 ： 性传播 已 成为 艾滋病 主要 传播 途径
Ministry of Health: Sexually transmission has become the main route of transmission of AIDS

Input(5): 中国 反垄断 调查 风暴 继续 席卷 汽车行业 ， 继 德国 车企 奥迪 和 美国 车企 克莱斯勒 “ 沦陷 ” 之后 ， 又 有 12 家 日本 汽车 企业 卷入漩涡 。 记者 从 业内人士 获悉 ， 丰田 旗下 的
雷克萨斯 近期 曾 被 发改委 约 谈 。
Chinese antitrust investigation continues to sweep the automotive industry. After Germany Audi car and the US Chrysler "fell", there are 12 Japanese car companies involved in the whirlpool. Reporters learned from the insiders
that Toyota's Lexus has been asked to report to the Development and Reform Commission recently.
______________________________________________________________

Golden: 发改委 公布 汽车 反垄断 进程 ： 丰田 雷克萨斯 近期 被 约 谈
the investigation by Development and Reform Commission: Toyota's Lexus has been asked to report

RNN context: 丰田雷克萨斯遭发改委约谈：曾被约谈丰田旗下的雷克萨斯遭发改委约谈负人被约谈
CopyNet: 中国 反垄断 继续 席卷 汽车行业 12 家 日本 汽车 企业 被 发改委 约 谈
Chinese antitrust investigation continues to sweep the automotive industry. 12 Japanese car companies are asked to report to he Development and Reform Commission

Input(6): 镁离子电池相比锂电池能量密度提升了近一倍，这意味着使用了镁电池的电动车，纯电续航也将有质的提升。但目前由于电解质等技术壁垒，要大规模量产并取代锂电池还为时过早。
The energy density of Magnesium ion batteries almost doubles that of lithium battery, which means that for the electric vehicles using of magnesium batteries will last longer even at pure electric power. But currently due to the
technical barriers to the electrolyte, it is still too early for the mass production of it and replacing lithium batteries..
______________________________________________________________

Golden: 锂电池或将被淘汰 能量密度更高的镁电池亦大势所趋
Lithium batteries will be phased out, magnesium battery with energy density higher will be the future trend

RNN context: <UNK>、<UNK>、<UNK>、<UNK>、<UNK>、<UNK>、<UNK>、<UNK>、<UNK>、<UNK>、<UNK>、<UNK>电 池 了
CopyNet: 镁离子电池问世：大规模量产取代锂电池
Magnesium ion battery is developed : mass production of it will replace lithium batteries

Input(7): 1 . 掌握 技巧 融会贯通 ； 2 . 学会 融资 ； 3 . 懂 法律 ； 4 . 保持 自信 ； 5 . 测试 + 尝试 ； 6 . 了解 客户 的 需求 ； 7 . 预测 + 衡量 + 确保 ； 8 . 做好 与 各种 小 bug 做 斗争 的 心态 ； 9 .
发现 机遇 保持 创业 激情 。
1. master the skills; 2 Learn to finance ; 3. understand the law; 4. Be confident; 5. test+ trial; 6. understand the need of customers; 7 forecast + measure + ensure; 8. mentally prepared to fight all kinds of small bugs ; 9 discover
opportunities and keep the passion of start-up.
______________________________________________________________

Golden: 初次 创业者 必知 的 10 个 技巧
The 10 tips for the first time start-ups

RNN context: 6个方法让你创业的6个<UNK>与<UNK>，你怎么看懂你的创业故事吗？（6家）
CopyNet: 创业 成功 的 9 个 技巧
The 9 tips for success in start-up

Input(8): 9 月 3 日 ， 总部 位于 日内瓦 的 世界 经济 论坛 发布 了 《 2014 - 2015 年 全球 竞争力 报告 》 ， 瑞士 连续 六年 位居 榜首 ， 成为 全球 最具 竞争力 的 国家 ， 新加坡 和 美国 分列 第二
位 和 第三位 。 中国 排名第 28 位 ， 在 金砖 国家 中 排名 最高 。
On September 3, the Geneva based World Economic Forum released “ The Global Competitiveness Report 2014-2015”. Switzerland topped the list for six consecutive years , becoming the world‘s most competitive country. Singapore
and the United States are in the second and third place respectively. China is in the 28th place, ranking highest among the BRIC countries.
______________________________________________________________

Golden: 全球 竞争力 排行榜 中国 居 28 位居 金砖 国家 首位
The Global competitiveness ranking list, China is in the 28th place, the highest among BRIC countries.

RNN context: 2014-2015年全球竞争力报告：瑞士连续6年居榜首中国居28位(首/3———访榜首)中国排名第28位
CopyNet: 2014 - 2015 年 全球 竞争力 报告 ： 瑞士 居首 中国 第 28
2014--2015 Global Competitiveness Report: Switzerland topped and China the 28th

Figure 4: Examples of C OPY N ET on LCSTS compared with RNN context. Word segmentation is
applied on the input, where OOV words are underlined. The highlighted words (with different colors)
are those words with copy-mode probability higher than the generate-mode. We also provide literal
English translation for the document, the golden, and C OPY N ET, while omitting that for RNN context
since the language is broken.

one. One possible explanation is that a wordbased model, even with a much larger vocabulary
(50,000 words in Hu et al. (2015)), still has a large
proportion of OOVs due to the large number of entity names in the summary data and the mistakes
in word segmentation. C OPY N ET, with its ability
to handle the OOV words with the copying mechanism, performs however slightly better with the
word-based variant.
5.2.1

Case Study

As shown in Figure 4, we make the following
interesting observations about the summary from
C OPY N ET: 1) most words are from copy-mode,
but the summary is usually still fluent; 2) C OPYN ET tends to cover consecutive words in the original document, but it often puts together segments far away from each other, indicating a sophisticated coordination of content-based addressing and location-based addressing; 3) C OPY N ET
handles OOV words really well: it can generate acceptable summary for document with many
OOVs, and even the summary itself often contains many OOV words. In contrast, the canonical
RNN-based approaches often fail in such cases.
It is quite intriguing that C OPY N ET can often
find important parts of the document, a behavior with the characteristics of extractive summarization, while it often generate words to “connect” those words, showing its aspect of abstractive summarization.
5.3

Single-turn Dialogue

In this experiment we follow the work on neural
dialogue model proposed in (Shang et al., 2015;
Vinyals and Le, 2015; Sordoni et al., 2015), and
test C OPY N ET on single-turn dialogue. Basically,
the neural model learns to generate a response to
user’s input, from the given (input, response) pairs
as training instances.
Dataset: We build a simple dialogue dataset
based on the following three instructions:
1. Dialogue instances are collected from Baidu
Tieba3 with some coverage of conversations
of real life e.g., greeting and sports, etc.
2. Patterns with slots like
hi, my name is x → hi, x
are mined from the set, with possibly multiple responding patterns to one input.
3

http://tieba.baidu.com

3. Similar with the synthetic dataset, we enlarge
the dataset by filling the slots with suitable
subsequence (e.g. name entities, dates, etc.)
To make the dataset close to the real conversations,
we also maintain a certain proportion of instances
with the response that 1) do not contain entities or
2) contain entities not in the input.
Experimental Setting: We create two datasets:
DS-I and DS-II with slot filling on 173 collected
patterns. The main difference between the two
datasets is that the filled substrings for training and
testing in DS-II have no overlaps, while in DS-I
they are sampled from the same pool. For each
dataset we use 6,500 instances for training and
1,500 for testing. We compare C OPY N ET with
canonical RNNSearch, both character-based, with
the same model configuration in Section 5.1.
DS-I (%)

DS-II (%)

Models

Top1

Top10

Top1

Top10

RNNSearch
C OPY N ET

44.1
61.2

57.7
71.0

13.5
50.5

15.9
64.8

Table 4: The decoding accuracy on the two testing
sets. Decoding is admitted success only when the
answer is found exactly in the Top-K outputs.
We compare C OPY N ET and RNNSearch on
DS-I and DS-II in terms of top-1 and top-10 accuracy (shown in Table 4), estimating respectively
the chance of the top-1 or one of top-10 (from
beam search) matching the golden. Since there
are often many good responses to an input, top10 accuracy appears to be closer to the real world
setting.
As shown in Table 4, C OPY N ET significantly
outperforms RNNsearch, especially on DS-II. It
suggests that introducing the copying mechanism
helps the dialogue system master the patterns in
dialogue and correctly identify the correct parts of
input, often proper nouns, to replicate in the response. Since the filled substrings have no overlaps in DS-II, the performance of RNNSearch
drops significantly as it cannot handle words unseen in training data. In contrast, the performance
of C OPY N ET only drops slightly as it has learned
to fill the slots with the copying mechanism and
relies less on the representation of the words.
5.3.1 Case Study
As indicated by the examples in Figure 5, C OPYN ET accurately replicates the critical segments
from the input with the copy-mode, and generates

Input(1): 我出生在上海。
/ I was born in Shanghai

Golden: 真巧，我也来自上海，老乡啊! /What a coincidence, I also come from Shanghai, we are fellow townsman!
RNNSearch: 真巧，我也来自海南，老乡啊! /What a coincidence, I also come from Hainan, we are fellow townsman!
CopyNet: 真巧，我也来自上海，老乡啊! /What a coincidence, I also come from Shanghai, we are fellow townsman!

Input(2): 今天去爬黄山吗？
/Shall we climbing Huangshan?

Golden: 去爬泰山吧，黄山没意思!
RNNSearch: 去爬长白山吧，衡山没意思!
CopyNet: 去爬嵩山吧，黄山没意思!

Input(3): 你喜欢喝雪碧还是喜欢可乐？
/Would you like to drink Sprite or Coke?

Golden: 都不喜欢，谢谢!
RNNSearch: 我喜欢喝蜂蜜!
CopyNet: 我喜欢喝可乐!

Input(4): 我大青岛四季宜人
/ Our great Qingdao has a good weather!

Golden: 壮我大青岛～～～
RNNSearch: 壮我大哈尔滨～～～

/Our Qingdao is great~~~

CopyNet: 壮我大青岛～～～

/Our Qingdao is great~~~

Golden: 我连游泳都不会T^T
RNNSearch: 我连游泳都不会T^T
CopyNet: 我连游泳都不会T^T

/I cannot swim at all T^T

Input(5): 女儿会游蝶泳
/Daughter can swim butterfly?

Input(6):

苏有朋是谁?
/Who is Su You Peng?

Golden: 苏有朋是一个男明星。
RNNSearch: 吴亦凡是一个男明星。
CopyNet: 苏有是一个男明星。

/Climb Taishan. Huangshan is boring!
/Climb Changbaishan, Hengshan is boring!
/Climb Songshan, Huangshan is boring!
/Not at all, thanks!
/I like to drink honey!
/I like to drink coke!

/Our Harbin is great~~~

/I cannot swim at all T^T
/I cannot swim at all T^T
/Su You Peng is a male star.
/Wu Yifan is a male star.
/Su You is a male star

Figure 5: Examples from the testing set of DS-II shown as the input text and golden, with the outputs
of RNNSearch and CopyNet. Words in red rectangles are unseen in the training set. The highlighted
words (with different colors) are those words with copy-mode probability higher than the generate-mode.
Green cirles (meaning correct) and red cross (meaning incorrect) are given based on human judgment on
whether the response is appropriate.
the rest of the answers smoothly by the generatemode. Note that in (2) and (3), the decoding sequence is not exactly the same with the standard
one, yet still correct regarding to their meanings.
In contrast, although RNNSearch usually generates answers in the right formats, it fails to catch
the critical entities in all three cases because of the
difficulty brought by the unseen words.

6

Related Work

Our work is partially inspired by the recent work
of Pointer Networks (Vinyals et al., 2015a), in
which a pointer mechanism (quite similar with the
proposed copying mechanism) is used to predict
the output sequence directly from the input. In addition to the difference with ours in application,
(Vinyals et al., 2015a) cannot predict outside of
the set of input sequence, while C OPY N ET can
naturally combine generating and copying.
C OPY N ET is also related to the effort to solve
the OOV problem in neural machine translation.
Luong et al. (2015) introduced a heuristics to postprocess the translated sentence using annotations
on the source sentence. In contrast C OPY N ET addresses the OOV problem in a more systemic way
with an end-to-end model. However, as C OPYN ET copies the exact source words as the output, it
cannot be directly applied to machine translation.
However, such copying mechanism can be naturally extended to any types of references except
for the input sequence, which will help in applications with heterogeneous source and target se-

quences such as machine translation.
The copying mechanism can also be viewed as
carrying information over to the next stage without
any nonlinear transformation. Similar ideas are
proposed for training very deep neural networks in
(Srivastava et al., 2015; He et al., 2015) for classification tasks, where shortcuts are built between
layers for the direct carrying of information.
Recently, we noticed some parallel efforts towards modeling mechanisms similar to or related
to copying. Cheng and Lapata (2016) devised a
neural summarization model with the ability to extract words/sentences from the source. Gulcehre
et al. (2016) proposed a pointing method to handle the OOV words for summarization and MT. In
contrast, C OPY N ET is more general, and not limited to a specific task or OOV words. Moreover,
the softmaxC OPY N ET is more flexible than gating
in the related work in handling the mixture of two
modes, due to its ability to adequately model the
content of copied segment.

7

Conclusion and Future Work

We proposed C OPY N ET to incorporate copying into the sequence-to-sequence learning framework. For future work, we will extend this idea to
the task where the source and target are in heterogeneous types, for example, machine translation.

Acknowledgments
This work is supported in part by the China National 973 Project 2014CB340301.

References
Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. 2014. Neural machine translation by jointly
learning to align and translate. arXiv preprint
arXiv:1409.0473.
Jianpeng Cheng and Mirella Lapata. 2016. Neural
summarization by extracting sentences and words.
arXiv preprint arXiv:1603.07252.
Kyunghyun Cho, Bart Van Merriënboer, Caglar Gulcehre, Dzmitry Bahdanau, Fethi Bougares, Holger
Schwenk, and Yoshua Bengio. 2014. Learning
phrase representations using rnn encoder-decoder
for statistical machine translation. arXiv preprint
arXiv:1406.1078.
Alex Graves, Greg Wayne, and Ivo Danihelka.
2014. Neural turing machines. arXiv preprint
arXiv:1410.5401.
Caglar Gulcehre, Sungjin Ahn, Ramesh Nallapati, Bowen Zhou, and Yoshua Bengio. 2016.
Pointing the unknown words.
arXiv preprint
arXiv:1603.08148.
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian
Sun. 2015. Deep residual learning for image recognition. arXiv preprint arXiv:1512.03385.
Sepp Hochreiter and Jürgen Schmidhuber. 1997.
Long short-term memory. Neural computation,
9(8):1735–1780.
Baotian Hu, Qingcai Chen, and Fangze Zhu. 2015. Lcsts: a large scale chinese short text summarization
dataset. arXiv preprint arXiv:1506.05865.
Karol Kurach, Marcin Andrychowicz, and Ilya
Sutskever. 2015. Neural random-access machines.
arXiv preprint arXiv:1511.06392.
Chin-Yew Lin. 2004. Rouge: A package for automatic evaluation of summaries. In Stan Szpakowicz
Marie-Francine Moens, editor, Text Summarization
Branches Out: Proceedings of the ACL-04 Workshop, pages 74–81, Barcelona, Spain, July. Association for Computational Linguistics.
Thang Luong, Ilya Sutskever, Quoc Le, Oriol Vinyals,
and Wojciech Zaremba. 2015. Addressing the rare
word problem in neural machine translation. In Proceedings of the 53rd Annual Meeting of the Association for Computational Linguistics and the 7th International Joint Conference on Natural Language
Processing (Volume 1: Long Papers), pages 11–19,
Beijing, China, July. Association for Computational
Linguistics.
Geoffrey J McLachlan and Kaye E Basford. 1988.
Mixture models. inference and applications to clustering. Statistics: Textbooks and Monographs, New
York: Dekker, 1988, 1.

Alexander M Rush, Sumit Chopra, and Jason Weston. 2015. A neural attention model for abstractive sentence summarization. arXiv preprint
arXiv:1509.00685.
Lifeng Shang, Zhengdong Lu, and Hang Li. 2015.
Neural responding machine for short-text conversation. arXiv preprint arXiv:1503.02364.
Shiqi Shen, Yong Cheng, Zhongjun He, Wei He, Hua
Wu, Maosong Sun, and Yang Liu. 2015. Minimum
risk training for neural machine translation. CoRR,
abs/1512.02433.
Alessandro Sordoni, Michel Galley, Michael Auli,
Chris Brockett, Yangfeng Ji, Margaret Mitchell,
Jian-Yun Nie, Jianfeng Gao, and Bill Dolan. 2015.
A neural network approach to context-sensitive generation of conversational responses. arXiv preprint
arXiv:1506.06714.
Rupesh Kumar Srivastava, Klaus Greff, and Jürgen
Schmidhuber. 2015. Highway networks. arXiv
preprint arXiv:1505.00387.
Ilya Sutskever, Oriol Vinyals, and Quoc VV Le. 2014.
Sequence to sequence learning with neural networks. In Advances in neural information processing systems, pages 3104–3112.
Oriol Vinyals and Quoc Le. 2015. A neural conversational model. arXiv preprint arXiv:1506.05869.
Oriol Vinyals, Meire Fortunato, and Navdeep Jaitly.
2015a. Pointer networks. In Advances in Neural
Information Processing Systems, pages 2674–2682.
Oriol Vinyals, Łukasz Kaiser, Terry Koo, Slav Petrov,
Ilya Sutskever, and Geoffrey Hinton. 2015b. Grammar as a foreign language. In Advances in Neural
Information Processing Systems, pages 2755–2763.

