Abstract
We present a letter-based encoding for words in continuous space language models. We represent the words completely by letter n-grams instead of using the word index. This way, similar words will automatically have a similar representation. With this we hope to better generalize to unknown or rare words and to also capture morphological information. We show their influence in the task of machine translation using continuous space language models based on restricted Boltzmann machines. We evaluate the translation quality as well as the training time on a German-to-English translation task of TED and university lectures as well as on the news translation task translating from English to German. Using our new approach a gain in BLEU score by up to 0.4 points can be achieved.
Introduction
Traditional neural language models typically treat words as atomic, discrete units using "1-of-n" or one-hot encoding. In this paradigm, the semantic and structural relationship between words like "house" and "houses" is entirely lost; to the model, they are as distinct as "house" and "bicycle." This approach leads to three significant challenges in natural language processing:
- Out-of-Vocabulary (OOV) Words: Unknown words are typically collapsed into a single "unknown" token, losing all distinguishing features.
- Data Sparsity: Rare words lack sufficient occurrences for the model to learn robust parameters.
- Morphological Blindness: The model cannot exploit structural cues like prefixes or suffixes that indicate grammatical function or meaning.
This paper proposes a shift from word-index encodings to letter n-gram representations within Continuous Space Language Models (CSLMs) to address these issues.
Methodology
The core innovation lies in representing each word as a "bag of letter n-grams." For example, the word "house" is decomposed into its constituent unigrams (h, o, u, s, e) and bigrams (ho, ou, us, se). To maintain structural integrity, boundary markers (<w> and </w>) are added to signify the start and end of words.
The researchers utilized a Restricted Boltzmann Machine (RBM) as the underlying language model. Unlike standard architectures that use a softmax input layer for one-hot vectors, this approach employs a logistic input layer. This allows the model to process multiple active neurons (features) simultaneously for a single word. Additionally, specific "Caps" and "ALLCAPS" neurons were introduced to preserve capitalization information, which is crucial for identifying proper nouns and abbreviations.
Encoding Analysis: Uniqueness vs. Efficiency
A critical aspect of this research was determining how much subword information is required to uniquely identify a word within a given vocabulary. The study compared various n-gram orders against a standard word-index baseline.
As shown in the analysis, a simple unigram model is insufficient, uniquely identifying only about 62% of a 27,748-word vocabulary. However, a bigram model achieves nearly 100% uniqueness while utilizing an input dimension (vocabulary size of 1,879) that is only approximately 7% of the original word-index model. The researchers identified trigrams (3-grams) as the "sweet spot," providing a robust balance between context and parameter efficiency.
Experimental Setup
The proposed encoding was evaluated on several Machine Translation (MT) tasks:
- German-to-English: Models were trained on Europarl, News Commentary, and TED data, then tested on TED transcripts and a specialized computer science lecture corpus.
- English-to-German: Evaluation was conducted on the WMT 2013 news translation task using a 100K sentence training subsample.
Results and Discussion
The letter n-gram approach consistently outperformed the baseline across multiple metrics:
- Translation Quality: On the German-to-English TED task, the model achieved a gain of up to 0.4 BLEU points.
- Robustness to Technical Text: The model excelled on the computer science lecture corpus. Its ability to leverage subword information allowed it to handle technical jargon and high OOV rates more effectively than the baseline.
- Computational Efficiency: The 3-gram model significantly reduced the model's footprint. By using roughly half the weights of the word-index model, training time was reduced by 25% (from 20 hours to 15 hours).
Conclusion
While letter n-grams offer clear advantages, the study noted diminishing returns with higher-order n-grams (4-grams and 5-grams), which increased complexity without significant performance gains. Furthermore, the impact varied by language; gains were more pronounced when translating from morphologically rich languages like German. Future work includes applying these encodings to other neural architectures, such as Recurrent Neural Networks (RNNs).
Summary updated