Character-Aware Neural Language Models

Yoon Kim, Yacine Jernite, David A. Sontag, Alexander M. Rush

Introduction

Traditional Neural Language Models (NLMs) typically rely on word embeddings, where each unique word is mapped to a high-dimensional vector. While effective, this approach suffers from morphological blindness (treating "eventful" and "uneventfully" as unrelated), data sparsity for rare words, and parameter explosion in large-vocabulary languages. This paper introduces a character-aware NLM that predicts the next word using only character-level inputs, bridging the gap between subword structure and semantic meaning.

Architecture: The CharCNN-LSTM Model

The proposed architecture, CharCNN-LSTM, eliminates the need for a traditional word embedding lookup table by building word representations from characters.

Architecture of the character-aware neural language model, showing the flow from character embeddings through CNN and Highway layers to the LSTM.

The model operates in four distinct stages:

  1. Character Embeddings: Individual characters are mapped to low-dimensional vectors.
  2. Convolutional Neural Network (CNN): Filters of varying widths extract features (character n-grams), followed by max-pooling to create a fixed-length word representation.
  3. Highway Network: A gated transformation layer that allows the model to learn complex, non-linear mappings of the character features. This layer is crucial for transitioning from orthographic features (spelling) to semantic features (meaning).
  4. Long Short-Term Memory (LSTM): The sequence of word representations is processed by a multi-layer LSTM to predict the next word in the sequence.

Experimental Setup

The model was evaluated across several languages with varying morphological complexity, including English (Penn Treebank), Arabic, Czech, French, German, Spanish, and Russian. Experiments were conducted on both "Small" (approx. 1 million tokens) and "Large" (up to 57 million tokens) datasets to test scalability and parameter efficiency.

Results and Discussion

The character-aware model demonstrates significant advantages in both performance and efficiency. On the English PTB benchmark, the "Large" model achieved a perplexity of 78.9, outperforming word-level baselines while using significantly fewer parameters.

Performance comparison on the English Penn Treebank (PTB) dataset. The character-aware models (LSTM-Char) outperform word-level baselines with fewer parameters.

Key Insights

  • Semantic Learning: Analysis of the highway layers reveals that the model successfully learns to map spelling to meaning. Nearest neighbors for words shift from being based on edit distance (e.g., "you" vs "your") before the highway layer to semantic similarity (e.g., "you" vs "we") after it.
  • Morphological Robustness: The model's performance gains are most pronounced in morphologically rich languages like Russian and Arabic, where it consistently outperforms word-level and morpheme-level models.
  • Handling OOV Words: By operating on characters, the model can generate representations for any string, effectively handling out-of-vocabulary (OOV) words and misspellings that would typically be ignored as unknown tokens in word-level models.

Conclusion

The CharCNN-LSTM architecture provides a powerful and parameter-efficient alternative to traditional word-level NLMs. While it introduces higher computational costs during training and inference due to character-level convolutions, its ability to handle large vocabularies and complex morphology makes it ideal for resource-constrained environments and diverse linguistic tasks. Future work may explore its application in Neural Machine Translation (NMT) to better address rare word and morphological challenges.

Summary updated

BibTeX
@inproceedings{kim2016character,
  author = {Yoon Kim and Yacine Jernite and David A. Sontag and Alexander M. Rush},
  title = {{Character-Aware Neural Language Models}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2016},
  doi = {10.1609/aaai.v30i1.10362},
}
Figure