pointer_summarizer icon indicating copy to clipboard operation
pointer_summarizer copied to clipboard

Why is the model outputting UNK tokens? Shouldn't it be able to point to unkown words from the input?

Open Rhuax opened this issue 6 years ago • 3 comments

From: https://github.com/abisee/pointer-generator/blob/master/beam_search.py#L111

In decoding words, we change the token id to the unkown id if t<vocab.size(). So if the decoder is pointing to that particular token it produces [UNK] in output. Is it correct? Following the paper it seems that the decoder should be able to point to that token and copy it, instead of copying the unknown token. I think it's the whole purpose of the pointer-generator model to handle oovs. But from some experiments in decoding I see that the models often outputs some unknown tokens. I tried replacing the 50k vocabulary to the full vocabolary but I get cuda device asserted errors.

Rhuax avatar Apr 02 '19 13:04 Rhuax

There is still a UNK token in the fixed vocab. Pointer-generator can reduce the UNK outputs, but cannot prevent model from outputting UNK. In some timesteps, if the p_gen is high and the probability of the UNK of the fixed vocab is large, the model will still output UNK.

nefujiangping avatar Apr 27 '19 07:04 nefujiangping

Why did the authors include the UNK token in the vocab?

Rhuax avatar Apr 28 '19 17:04 Rhuax

Pointer-generator use the same vocab at encoder/decoder input and decoder target, and the vocab is constructed from train-data (no val/test-data). If the vocab can cover all words of corpus (train,val,test), the UNK token can be excluded.

By using two vocabs (source vocab and target vocab), UNK token may be excluded in target vocab.

nefujiangping avatar May 03 '19 02:05 nefujiangping