Abstract
Neural language models (NLMs) have recently gained a renewed interest byachieving state-of-the-art performance across many natural language processing(NLP) tasks. However, NLMs are very computationally demanding largely due tothe computational cost of the softmax layer over a large vocabulary. We observethat, in decoding of many NLP tasks, only the probabilities of the top-Khypotheses need to be calculated preciously and K is often much smaller thanthe vocabulary size. This paper proposes a novel softmax layer approximationalgorithm, called Fast Graph Decoder (FGD), which quickly identifies, for agiven context, a set of K words that are most likely to occur according to aNLM. We demonstrate that FGD reduces the decoding time by an order of magnitudewhile attaining close to the full softmax baseline accuracy on neural machinetranslation and language modeling tasks. We also prove the theoreticalguarantee on the softmax approximation quality.