Abstract
We introduce LL-RNNs (Log-Linear RNNs), an extension of Recurrent Neural Networks that replaces the standard softmax output layer with a log-linear output layer. This conceptually simple modification offers two primary advantages. First, it combats training data sparsity by modeling words as complex combinations of attributes, allowing the model to generalize to symbols not directly observed in training. Second, it permits the inclusion of flexible prior knowledge through modular features, where the neural network dynamically controls the weights of a log-linear distribution. Experiments in French language modeling using morphological prior knowledge demonstrate a significant decrease in perplexity relative to baseline RNNs, highlighting the complementary strengths of log-linear models and representation learning.
1. Introduction
In the field of Natural Language Processing (NLP), Recurrent Neural Networks (RNNs) are the standard for sequence modeling. However, they typically suffer from a "blind spot": they treat every word in a vocabulary as an isolated "island." If a model has not seen a specific word enough times during training, it cannot easily infer its grammatical or semantic properties. This leads to two major issues: data sparsity, where rare words are poorly modeled, and the "island" problem, where related words (e.g., "running" and "ran") are treated as entirely independent symbols.
Log-Linear RNNs (LL-RNNs) address these challenges by allowing neural networks to treat words as bundles of features—such as gender, number, or part-of-speech—incorporating human-specified prior knowledge directly into the architecture.
2. Methodology
2.1 Standard RNN Baseline
Standard RNNs use a softmax operation to predict the next word. In this architecture, the hidden state $h_t$ is mapped to a vector $a_{\theta,t}$ the size of the vocabulary, and softmax converts these scores into probabilities $p_{\theta,t}$. This approach treats the vocabulary as a set of independent symbols, requiring the model to learn all linguistic relationships from scratch through massive amounts of data.
2.2 Log-Linear RNNs (LL-RNNs)
The core innovation of the LL-RNN is the replacement of the softmax layer with a Log-Linear output layer. In this framework, the RNN acts as a "controller" that dynamically decides which linguistic features are important at any given moment.
As illustrated in Figure 2, the process involves several key components:
- Feature Functions ($\phi$): Instead of predicting a word ID, the RNN predicts weights for specific features (e.g., "is a noun," "is plural").
- Background Function ($b$): The model includes a "prior" distribution, which could be a simple unigram frequency count or a complex grammar that constrains the output space.
- Log-Linear Equation: The probability of a word is determined by the background function multiplied by the exponentiated weighted sum of its features.
This design allows for generalization through overlap. Because features like "is feminine" are shared across many words, the model can learn the behavior of a category and apply it to rare or previously unseen symbols.
3. Experiments and Results
The authors evaluated the LL-RNN on a French language modeling task using the Universal Dependencies (French) corpus, which contains approximately 463,069 tokens. They extracted 52 morphological tags (e.g., Gender, Tense, Mood) to serve as prior knowledge features.
The LL-RNN significantly outperformed the baseline RNN:
- Perplexity Reduction: The baseline RNN achieved a log-perplexity of 6.07. The best LL-RNN model (using 2,500 frequent word features plus morphological tags) dropped this to 5.08.
- Impact: This represents a reduction in perplexity by a factor of roughly 2.7 (from 433 down to 161).
- Qualitative Improvement: Analysis showed that the LL-RNN was notably better at maintaining gender and number agreement over long distances compared to the baseline.
4. Discussion and Conclusion
LL-RNNs provide a robust framework for combining the representation learning capabilities of neural networks with the structured prior knowledge of log-linear models. While the computational cost of calculating the partition function for large vocabularies remains a challenge, the model's ability to handle data sparsity and incorporate linguistic rules makes it a promising direction for low-resource or highly inflected languages. Future work may involve scaling these models using hierarchical softmax or integrating automated background functions from pre-trained n-gram models.
Summary updated