Character n-Gram Embeddings to Improve RNN Language Models.

Sho Takase, Jun Suzuki, Masaaki Nagata

Abstract

This paper proposes a novel Recurrent Neural Network (RNN) language model that takes advantage of character information. We focus on character n-grams based on research in the field of word embedding construction. Our proposed method constructs word embeddings from character n-gram embeddings and combines them with ordinary word embeddings. We demonstrate that the proposed method achieves the best perplexities on the language modeling datasets: Penn Treebank, WikiText-2, and WikiText-103. Moreover, we conduct experiments on application tasks: machine translation and headline generation. The experimental results indicate that our proposed method also positively affects these tasks.

Introduction

Traditional neural language models treat words as atomic units, mapping unique IDs to vectors. This approach ignores the internal morphological structure of words, leading to two primary issues: poor representation of infrequent words and a failure to capture semantic relationships between morphologically related words (e.g., "causal" and "cause"). While previous attempts used Convolutional Neural Networks (CNNs) or LSTMs over characters, these can be computationally expensive or fail to capture local patterns provided by character $n$-grams.

Methodology: The charn-MS-vec Model

The authors introduce charn-MS-vec, a component designed to enrich word embeddings with subword information.

Architecture of the proposed charn-MS-vec model showing the integration of character n-grams and multi-dimensional self-attention.

The process involves:

  1. Character $n$-gram Extraction: Words are decomposed into $n$-grams with boundary markers (e.g., "the" becomes ^th, the, he$).
  2. Multi-dimensional Self-attention (MS): A simplified self-attention mechanism determines the importance of each $n$-gram for every dimension of the resulting word vector, allowing for fine-grained feature selection.
  3. Integration: The resulting subword vector is added to the standard word embedding to form the final representation.
  4. Word Tying: Input and output embeddings share weights, adapted to include these character-based features for consistency.

Experimental Setup

The model was evaluated on three standard benchmarks:

  • Penn Treebank (PTB): Small-scale (10k vocabulary).
  • WikiText-2 (WT2): Mid-sized (33k vocabulary).
  • WikiText-103 (WT103): Large-scale (267k vocabulary).

Downstream performance was also tested on Machine Translation (IWSLT 2016) and Headline Generation (English Gigaword).

Results and Discussion

The proposed method achieved state-of-the-art (SOTA) perplexity scores across all datasets. For instance, on PTB, test perplexity was significantly reduced compared to the baseline.

A comprehensive comparison of the proposed method against baselines and alternative subword integration techniques like CNNs and simple summation.

Key findings include:

  • Optimal n-gram size: 3-grams provided the best balance between performance and parameter efficiency.
  • Attention vs. Alternatives: Multi-dimensional self-attention outperformed simpler summation or CNN-based approaches, highlighting the value of dimension-wise feature selection.
  • Handling Rarity: The model significantly improved performance on rare words by leveraging their constituent subwords.
  • Versatility: The method successfully improved existing architectures like AWD-LSTM and QRNN.

Conclusion

While charn-MS-vec provides substantial gains in language modeling and downstream tasks like translation and summarization, it introduces a computational overhead, increasing training time by 2.5 to 3 times. Future research will focus on exploring more efficient structures to maintain these performance benefits while reducing training latency.

Summary updated

BibTeX
@inproceedings{takase2019character,
  author = {Sho Takase and Jun Suzuki and Masaaki Nagata},
  title = {{Character n-Gram Embeddings to Improve RNN Language Models.}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2019},
  doi = {10.1609/aaai.v33i01.33015074},
}
Figure