TL;DR
This paper introduces a novel algorithm for inducing probabilistic context-free grammars (PCFGs) from text corpora by treating the problem as a Bayesian search. By incorporating a prior that favors simpler grammars (Occam’s Razor), the approach avoids the overfitting common in maximum-likelihood methods and, for the first time, produces grammar-based models that outperform standard $n$-gram models in medium-sized domains.
What Problem Does This Paper Address?
For decades, language modeling has been dominated by $n$-gram models. While effective, $n$-grams are "dumb": they only look at a fixed window of words (usually 2 or 3) and cannot capture long-distance dependencies or the underlying hierarchical structure of language. Furthermore, they grow massive in size as the vocabulary increases.
Grammar-based models (like PCFGs) are a theoretically superior alternative because they are compact and can model complex structures. However, learning these grammars from raw data is notoriously difficult. The standard "Inside-Outside" algorithm often gets stuck in local optima and tends to overfit the training data—creating a grammar that perfectly "memorizes" the training sentences but fails to generalize to new ones. Stanley Chen tackles this by reframing grammar induction as a search for the most probable grammar given the data, using Bayesian inference to balance accuracy against complexity.
Methods
The author proposes a two-stage approach:
- Greedy Bayesian Search: Instead of starting with a fixed, massive grammar, the algorithm starts with a trivial one. It then iteratively adds rules (moves) that improve the objective function: $p(G|O) \propto p(O|G)p(G)$.
- The Prior ($p(G)$): Based on Solomonoff’s universal a priori probability, the model assigns higher probability to shorter grammars ($p(G) = 2^{-l(G)}$). This acts as a mathematical version of Occam’s Razor.
- The Moves: The search considers creating new rules (e.g., $A \to BC$ or $A \to AB|B$).
- Efficiency Tricks: To avoid parsing the entire corpus for every potential move, the author uses "triggers" (patterns in the current best parse) to suggest promising rules and processes the data incrementally.
- Inside-Outside Post-Pass: Once the search concludes, the algorithm performs a final refinement using the Inside-Outside algorithm. This step adds a set of "random" rules to capture local dependencies that the greedy search might have missed, essentially fine-tuning the parameters.
Datasets
The algorithm was evaluated on three medium-sized domains (4,500 training sentences each):
- English-like Artificial Grammar: Data generated from a small, hand-crafted grammar (~10 nonterminals, 20 terminals).
- WSJ-like Artificial Grammar: Data generated from a grammar derived from the Penn Treebank (~30 nonterminals, 160 rules).
- Natural POS Sequences: Real text from the Wall Street Journal, but with words replaced by their Part-of-Speech tags (about 50 unique tags) to keep the vocabulary manageable.
Key Insights and Ideas
- Escaping Local Minima: Standard algorithms search within a fixed-dimension parameter space. Chen’s algorithm expands the grammar, which increases the dimensionality of the search space. An apparent local minimum in a small space might have a "pathway" out once a new dimension (a new rule) is added.
- Maximum Likelihood is the Enemy: The paper highlights that seeking the "most likely" grammar for a dataset leads to a model that only generates the training strings. The Bayesian prior is not just a "nice to have"—it is essential for generalization.
- Structural vs. Collocational Info: The results suggest that while grammars are great at capturing structure, $n$-grams are still better at capturing "collocations" (words that just happen to appear together frequently).
Key Results
- Superiority in Structured Domains: In both artificial tasks, the Bayesian induction algorithm outperformed both $n$-gram models and the standard Inside-Outside algorithm. For the English-like grammar, it achieved an entropy of 2.37 bits/word, significantly better than the $n$-gram's 2.46.
- Compactness: The induced grammars were remarkably small. For the WSJ-like task, the grammar used only 800 parameters in its first pass, compared to 15,000 for the $n$-gram model, while achieving better performance.
- Natural Language Performance: On the real-world POS tag task, the algorithm vastly outperformed the Inside-Outside algorithm (3.15 vs 3.93 bits/word) but still trailed slightly behind $n$-grams (3.01 bits/word).
Limitations and Future Work
- Computational Complexity: The algorithm is currently too slow for large vocabularies (millions of words). The author notes it is "currently impractical" for full-scale natural language tasks without further optimization.
- The "Collocation" Gap: To beat $n$-grams on real-world data, the author acknowledges the need to modify the algorithm to more aggressively model local word patterns alongside global structure.
- Limited Move Set: The current implementation only uses a subset of possible grammar-building moves. Future work aims to implement moves that can induce more complex, context-sensitive grammars.
Reference: Chen, S. F. (1995). Bayesian Grammar Induction for Language Modeling. Proceedings of the 33rd Annual Meeting of the Association for Computational Linguistics.
Summary updated