<?xml version="1.0"?><!DOCTYPE article SYSTEM "/project/take/software/searchbench_offline_processing/paperxml_generator/aclextractor/src/python/../resource/dtd/paperxml.dtd"><article><header><firstpageheader><page local="1"/><title>Weighted and Probabilistic Context-Free Grammars Are Equally Expressive</title><pubinfo>© 2007 Association for Computational Linguistics</pubinfo><author surname="Smith" givenname="Noah A."><org  name="Carnegie Mellon University" country="USA" city="Pittsburgh"/></author><author surname="Johnson" givenname="Mark"><org  name="Brown University" country="USA" city="Providence"/></author></firstpageheader><frontmatter><p><b>Weighted and Probabilistic Context-Free Grammars Are Equally Expressive</b></p><p>Noah A. Smith* Carnegie Mellon University</p><p>Mark Johnson**</p><p>Brown University</p></frontmatter><abstract><i>This article studies the relationship between weighted context-free grammars (WCFGs), where each production is associated with a positive real-valued weight, and probabilistic context-free grammars (PCFGs), where the weights of the productions associated with a nonterminal are constrained to sum to one. Because the class of WCFGs properly includes the PCFGs, one might expect that WCFGs can describe distributions that PCFGs cannot. However, Z. Chi (1999, Computational Linguistics, 25(1):131-160) and S. P. Abney, D. A. McAllester, and P. Pereira (1999, In Proceedings of the 37th Annual Meeting of the Association for Computa­tional Linguistics, pages 542-549, College Park, MD) proved that every WCFG distribution is equivalent to some PCFG distribution. We extend their results to conditional distributions, and show that every WCFG conditional distribution ofparses given strings is also the condi­tional distribution defined by some PCFG, even when the WCFG's partition function diverges. This shows that any parsing or labeling accuracy improvement from conditional estimation of WCFGs or conditional random fields (CRFs) over joint estimation of PCFGs or hidden Markov models (HMMs) is due to the estimation procedure rather than the change in model class, because PCFGs and HMMs are exactly as expressive as WCFGs and chain-structured CRFs, respectively.</i> </abstract></header><body><section number="1." title="Introduction"><p>In recent years the field of computational linguistics has turned to machine learning to aid in the development of accurate tools for language processing. A widely used example, applied to parsing and tagging tasks of various kinds, is a <b>weighted grammar. </b>Adding weights to a formal grammar allows disambiguation (more generally, ranking of analyses) and can lead to more efficient parsing. Machine learning comes in when we wish to choose those weights empirically.</p><p>The predominant approach for many years was to select a probabilistic model— such as a hidden Markov model (HMM) or probabilistic context-free grammar (PCFG)—that defined a distribution over the structures allowed by a grammar. Given a</p><p>* School of Computer Science, Carnegie Mellon University, Pittsburgh, PA 15217, USA. E-mail: nasmith@cs.cmu.edu. ** Department of Cognitive and Linguistic Sciences, Brown University, Providence, RI 02912, USA. E-mail: MarkJohnson@brown.edu.</p><p>Submission received: 30 November 2005; revised submission received: 11 January 2007; accepted for publication: 30 March 2007.</p><page local="2" global="478"/><p>treebank, maximum likelihood estimation can be applied to learn the probability values in the model.</p><p>More recently, new machine learning methods have been developed or ex­tended to handle models of grammatical structure. Notably, conditional estimation (Ratnaparkhi, Roukos, and Ward 1994; Johnson et al. 1999; Lafferty, McCallum, and Pereira 2001), maximum margin estimation (Taskar et al. 2004), and unsupervised con-trastive estimation (Smith and Eisner 2005) have been applied to structured models. Weighted grammars learned in this way differ in two important ways from traditional, generative models. First, the weights can be any positive value; they need not sum to one. Second, features can "overlap," and it can be difficult to design a generative model that uses such features. The benefits of new features and discriminative training methods are widely documented and recognized.</p><p>This article focuses specifically on the first of these differences. It compares the expressive power of weighted context-free grammars (WCFGs), where each rule is associated with a positive weight, to that of the corresponding PCFGs, that is, with the same rules but where the weights of the rules expanding a nonterminal must sum to one.</p><p>One might expect that because normalization removes one or more degrees of free­dom, unnormalized models should be more expressive than normalized, probabilistic models. Perhaps counterintuitively, previous work has shown that the classes of proba­bility distributions defined by WCFGs and PCFGs are the same (Abney, McAllester, and Pereira 1999; Chi 1999).</p><p>However, this result does not completely settle the question about the expressive power of WCFGs and PCFGs. As we show herein, a WCFG can define a <i>conditional distribution </i>from strings to trees even if it does not define a probability distribution over trees. Because these conditional distributions are what are used in classification tasks and related tasks such as parsing, we need to know the relationship between the classes of conditional distributions defined by WCFGs and PCFGs. In fact we extend the results of Chi and of Abney et al., and show that WCFGs and PCFGs both define the same class of conditional distribution. Moreover, we present an algorithm for converting an arbitrary WCFG that defines a conditional distribution over trees given strings but possibly without a finite partition function into a PCFG with the same rules as the WCFG and that defines the same conditional distribution over trees given strings.</p><p>This means that maximum conditional likelihood WCFGs are non-identifiable, be­cause there are an infinite number of rule weights all of which maximize the conditional likelihood.</p></section><section number="2." title="Weighted CFGs"><p>ACFG <i>G </i>is a tuple (N, <i>S, X, R) </i>where <i>N </i>is a finite set of nonterminal symbols, <i>S </i><i>G </i><i>N </i>is the start symbol, <i>X </i>is a finite set of terminal symbols (disjoint from N), and <i>R </i>is a set of production rules of the form <i>X </i><i>— </i><i>a </i>where <i>X </i><i>G </i><i>N </i>and <i>a </i><i>G </i><i>(N </i><i>U </i>£)*. A WCFG associates a positive number called the <b>weight </b>with each rule in R.<footnote anchor="1"/> We denote by <i>QX^a </i>the weight attached to the rule <i>X </i><i>— </i><i>a, </i>and the vector of rule weights by G = <i>{QA^a </i>: <i>A </i><i>— </i><i>a </i><i>G </i><i>R}. </i>A weighted grammar is the pair Ge = (G, G).</p><p>1 Assigning a weight of zero to a rule equates to excluding it from <i>R.</i></p><page local="3" global="479"/><p>Unless otherwise specified, we assume a fixed underlying context-free grammar G. Let fi(G) be the set of (finite) trees that <i>G </i>generates. For any t <i>g </i>0(G), the <b>score </b><i>se</i>(x)of t is defined as follows:</p><doubt alpha="37.5" length="24" tooSmall="False" monospace="0.0">se(t)=n(0x-«)f(X—a;x)(1)</doubt><doubt alpha="62.5" length="8" tooSmall="False" monospace="0.0">(X—cx)gR</doubt><p>where <i>f (X — </i><b><i>a;</i></b><b><i> </i></b>t) is the number of times <i>X — </i><b><i>a</i></b><b><i> </i></b>is used in the derivation of the tree t. The <b>partition function </b>Z(G) is the sum of the scores of the trees in fi(G).</p><doubt alpha="41.7" length="12" tooSmall="False" monospace="0.0">Z(G) =£se(t)</doubt><p>Because we have imposed no constraints on G, the partition function need not equal one; indeed, as we show subsequently the partition function need not even exist. If <i>Z</i>(G) is finite then we say that the WCFG is <b>convergent, </b>and we can define a Gibbs probability distribution over <i>Q(G) </i>by dividing by Z(G):</p><doubt alpha="45.5" length="11" tooSmall="False" monospace="0.0">Pe(T)= Z(G)</doubt><p>A <i>probabilistic </i>CFG, or PCFG, is a WCFG in which the sum of the weights of the rules expanding each nonterminal is one:</p><doubt alpha="42.3" length="26" tooSmall="False" monospace="0.0">yX G N,J2QX—*=1(2)(X—ct)£R</doubt><p>It is easy to show that if <i>Ge </i>is a PCFG then Z(G) <i>&lt; </i>1. A <b>tight </b><i>PCFG </i>is a PCFG <i>Ge</i>for which Z(G) = 1. Necessary conditions and sufficient conditions for a PCFG to be tight are given in several places, including Booth and Thompson (1973) and Wetherell (1980).</p><p>We now describe the results of Chi (1999) and Abney, McAllester, and Pereira (1999). Let <i>G = {Ge} </i>denote the set of the WCFGs based on the CFG <i>G </i>(i.e., the WCFGs in <i>G </i>all have the same underlying grammar <i>G </i>but differ in their rule weight vectors G). Let <b>G</b>Z&lt;oo be the subset of <i>G </i>for which the partition function Z(G) is finite, and let <i>G</i><i>Z=oc </i><i>=</i><i> </i><i>G\</i><i> GZ&lt;oo </i>be the subset of <i>G </i>with an infinite partition function. Further let <b>GPCFG</b>denote the set of PCFGs based on <i>G. </i>In general, <i>G</i>pcfg is a proper subset of <i>G</i><i>Z</i><i>&lt;o </i>,that is, every PCFG is also a WCFG, but because there are weight vectors G that don't obey Equation 2, not all WCFGs are PCFGs.</p><p>However, this does not mean that WCFGs are more expressive than PCFGs. As noted above, the WCFGs <i>GZ&lt;oc, </i>define Gibbs distributions. Again, for a fixed G,let <i>PZ&lt;o </i>be the probability distributions over the trees <i>Q(G) </i>defined by the WCFGs <i>GZ&lt;oc, </i>and let <b>PPCFG </b>be the probability distributions defined by the PCFGs <b>GPCFG. </b>Chi (Propo­sition 4) and Abney, McAllester, and Pereira (Lemma 5) showed that <i>PZ&lt;o = </i><b>PPCFG, </b>namely, that every WCFG probability distribution is in fact generated by some PCFG. There is no <i>"V</i><i>z=o</i>" because there is no finite normalizing term Z(G) for such WCFGs.</p><page local="4" global="480"/><subsection number="2.1" title="Chi's Algorithm for Converting WCFGs to Equivalent PCFGs"><p>Chi (1999) describes an algorithm for converting a WCFG to an equivalent PCFG. Let <i>Ge </i>be a WCFG in <i>G</i><i>z</i><i>«x</i><i>&gt;.If X G N </i>is a nonterminal, let <i>QX</i>(G) be the set of trees rooted in <i>X </i>that can be built using G. Then define:</p><doubt alpha="46.2" length="13" tooSmall="False" monospace="0.0">ZX(G) =£se(t)</doubt><doubt alpha="71.4" length="7" tooSmall="False" monospace="0.0">renX(G)</doubt><p>For simplicity, let <i>Zt</i>(G) = 1 for all <i>t </i><b>G </b>S. Chi demonstrated that <i>Ge </i><b>G </b><i>G</i><i>Z&lt;oc </i>implies that <i>ZX </i>(G)isfinite forall <i>X G N U </i>S. For every rule <i>X — </i><i>a </i>in <i>R </i>define:</p><doubt alpha="100.0" length="1" tooSmall="False" monospace="0.0">M</doubt><doubt alpha="58.3" length="12" tooSmall="False" monospace="0.0">eX^*l[Zai(G)</doubt><doubt alpha="37.5" length="8" tooSmall="False" monospace="0.0">ai=_i=1_</doubt><doubt alpha="60.0" length="5" tooSmall="False" monospace="0.0">ZX(G)</doubt><p>where <i>a(</i><i> </i>is the ith element of a and <i>\a\ </i>is the length of a. Chi proved that <i>G</i><i>e&gt; </i>is a PCFG and that Pe/ (t) = <i>se</i>(t)/Z(G) for all trees t <i>g </i>0(G).</p><p>Chi did not describe how to compute the nonterminal-specific partition functions <i>Z</i>X(G). The <i>Z</i>X(G) are related by equations of the form which constitute a set of nonlinear polynomial equations in <i>Z</i>X(G). Although a numeri­cal solver might be employed to find the <i>ZX</i>(G), we have found that in practice iterative propagation of weights following the method described by Stolcke (1995, Section 4.7.1) converges quickly when Z(G)isfinite.</p><doubt alpha="52.4" length="21" tooSmall="False" monospace="0.0">ZX(G) =Yl®X^*l[Zai(G)</doubt><doubt alpha="58.3" length="12" tooSmall="False" monospace="0.0">tx:X^tx€Ri=1</doubt></subsection></section><section number="3." title="Classifiers and Conditional Distributions"><p>A common application of weighted grammars is parsing. One way to select a parse tree for a sentence <i>x </i>is to choose the maximum weighted parse that is consistent with the observation x:</p><doubt alpha="42.3" length="26" tooSmall="False" monospace="0.0">t* (x) =    argmaxse(t)(3)</doubt><doubt alpha="53.8" length="13" tooSmall="False" monospace="0.0">TGH(G):y(T)=x</doubt><p>where y(T) is the yield of t. Other decision criteria exist, including minimum-loss de­coding and re-ranked n-best decoding. All of these classifiers use some kind of dynamic programming algorithm to optimize over trees, and they also exploit the <i>conditional </i>distribution of trees given sentence observations. A WCFG defines such a conditional distribution as follows:</p><doubt alpha="50.0" length="26" tooSmall="False" monospace="0.0">Z^'en(G):y(T')=xse(t)Zx(G)</doubt><page local="5" global="481"/><p>where <i>Zx</i>(G) is the sum of scores for all parses of x. Note that Equation (4) will be ill-defined when <i>Zx</i>(G) diverges. Because <i>Zx</i>(G) is constant for a given x, solving Equa­tion (3) is equivalent to choosing t to maximize Pe (t | x).</p><p>We turn now to classes of these conditional distribution families. Let <i>CZ&lt;00 </i>(CPCFG) be the class of conditional distribution families that can be expressed by grammars in <i>G</i><i>z«</i><i>x&gt; </i>(GPCFG, respectively). It should be clear that, because <i>V</i><i>z«</i><i>0</i><i>0 </i><i>= </i>PPCFG, <i>C</i><i>z«</i><i>0</i><i>0 </i><i>= </i>CPCFGsince a conditional family is derived by normalizing a joint distribution by its marginals.</p><p>We now define another subset of G.Let <i>GZn&lt;00 </i>contain every WCFG <i>Ge </i><i>= </i><i>(G, </i><i>G) </i>such that, for all <i>n </i><i>&gt; </i>0, (Note that, to be fully rigorous, we should quantify <i>n </i>in <i>GZn&lt;0, </i>writing <i>"GynZn</i>(e)«x&gt;." We use the abbreviated form to keep the notation crisp.) For any <i>Ge </i><i>£ </i>GZn&lt;0,italso follows that, for any <i>x </i><i>£ </i><i>L(G), Zx</i>(G) &lt; oo; the converse holds as well.</p><doubt alpha="33.3" length="18" tooSmall="False" monospace="0.0">Zn(G)=se(t) &lt;°°(5)</doubt><doubt alpha="40.0" length="15" tooSmall="False" monospace="0.0">T6n(G):|y(T)|=n</doubt><p>It follows that any WCFG in <i>GZn«00 </i>can be used to construct a conditional dis­tribution of trees given the sentence, for any sentence <i>x </i><i>£ </i>L(G). To do so, we only need to normalize <i>se </i>(t)by <i>Zx</i>(G) (Equation (4)). Let <i>GZn=00 </i>contain the WCFGs where some <i>Zn</i>(G) diverge; this is a subset of GZ=0.<footnote anchor="2"/> To see that <i>GZ=0 n GZn&lt;00 </i><i>= </i><i>0, </i>consider Example 1.</p><p><b>Example 1</b></p><doubt alpha="53.8" length="13" tooSmall="False" monospace="0.0">QA^AA=1QA^u=1</doubt><p>This grammar produces binary structures over strings in <i>a+. </i>Every such tree receives score 1. Because there are infinitely many trees, Z(G) diverges. But for any fixed string an, the number of parse trees is finite. This grammar defines a uniform conditional distribution over all binary trees, given the string.</p><p>For a grammar <i>Ge </i>to be in <i>G</i><i>zn&lt;0, </i>it is sufficient that, for every nonterminal <i>X </i><i>£ </i><i>N, </i>the sum of scores of all cyclic derivations <i>X </i>=<i>&gt;</i>+ <i>X </i>be finite. Conservatively, this can be forced by eliminating epsilon rules and unary rules or cycles altogether, or by requiring the sum of cyclic derivations for every nonterminal <i>X </i>to sum to strictly less than one. Example 2 gives a grammar in <i>GZn=0 </i>with a unary cyclic derivation that does not "dampen." <b>Example 2</b></p><doubt alpha="52.6" length="19" tooSmall="False" monospace="0.0">Qa^aa=1Qa^a=1QA^u=1</doubt><p>For any given an, there are infinitely many equally weighted parse trees, so even the set of trees for <i>an </i>cannot be normalized into a distribution (Zn(G) = oo). Generally speaking, if there exists a string <i>x </i><i>£ </i><i>L(G) </i>such that the set of trees that derive <i>x </i>is not 2 Here, full rigor would require quantification of n, writing <i>"G^nzn</i>(e)=0." finite (i.e., there is no finite bound on the number of derivations for strings in L(G); the grammar in Example 2 is a simple example), then <i>G</i><i>z</i><i>n&lt;oo </i>and <i>G</i><i>z&lt;</i><i>oo </i>are separable.<page local="6" global="482"/><footnote anchor="3"/></p><p>For a given CFG G, a conditional distribution over trees given strings is a function <i>X* — </i>(0(G) <i>— </i>[0,1]). Our notation for the set of conditional distributions that can be expressed by <i>G</i><i>z</i><i>n&lt;oo </i>is <i>CZn&lt;o</i>. Note that there is no <i>"CZn=OQ" </i>because an infinite <i>Zn</i>(G) implies an infinite <i>Z(x) </i>for some sentence <i>x </i>and therefore an ill-formed conditional fam­ily. Indeed, it is difficult to imagine a scenario in computational linguistics in which non-dampening cyclic derivations (WCFGs in <i>G</i><i>Zn=oc) </i>are desirable, because no linguistic explanations depend crucially on arbitrary lengthening of cyclic derivations.</p><p>We now state our main theorem.</p><p><b>Theorem 1</b></p><p>For a given CFG G, <i>C</i><i>z</i><i>n&lt;o </i><i>= C</i><i>z</i><i>&lt;o</i>. <b>Proof</b></p><p>Suppose we are given weights G for <i>G </i>such that Ge <i>€ GZn&lt;o0. </i>We will show that the sequence Z1(G),Z2(G),... is bounded by an exponential function of n, then describe a transformation on G resulting in a new grammar <i>Ge&gt; </i>that is in <b>G</b>z&lt;oo and defines the same family of conditional distributions (i.e., Vt <i>€ </i>0(G),<i>Vx € L(G), </i>Pe (t <b>| </b>x) = Pe' (t <i>I </i>x)).</p><p>First we prove that for all <i>n &gt; </i>1 there exists some <i>c </i>such that <i>Zn </i>(G) <i>&lt; cn </i>.Given Ge, we construct <i>Ge </i>in CNF that preserves the total score for any <i>x € L(G). </i>The existence of <i>Ge </i>was demonstrated by Goodman (1998, Section 2.6), who gives an algorithm for constructing the value-preserving weighted grammar <i>Ge </i>from <i>G</i>e.</p><p>Note that <i>G = (N, S, </i>X, R), containing possibly more nonterminals and rules than G. The set of (finite) trees 0 (G) is different from 0(G); the new trees must be binary and may include new nonterminals.</p><p>Next, collapse the nonterminals in <i>N </i>into one nonterminal, <i>S. </i>The resulting gram­mar is <i>Ge = (({S}, S, X, R), G). R </i>contains the rule <i>S — </i><i>SS</i><i> </i>and rules of the form <i>S</i><i> </i><i>—</i><i> </i><i>a</i><i> </i>for <i>a € </i>X. The weights of these rules are</p><doubt alpha="44.4" length="36" tooSmall="False" monospace="0.0">6s^ss=P= max(1,    ^Qx^yz)(6(X^YZ)eR</doubt><doubt alpha="35.0" length="20" tooSmall="False" monospace="0.0">6=u= max(1,~Qx^b)(7)</doubt><p>The grammar <i>G</i>e will allow every tree allowed by <i>Ge </i>(modulo labels on nonterminal nodes, which are now all <i>S). </i>It may allow some additional trees. The score of a tree under <i>Ge </i>will be at least as great as the sum of scores of all structurally equivalent trees under Ge, because p and u are defined to be large enough to absorb all such scores. It follows that, for all <i>x € L(G):</i></p><doubt alpha="40.9" length="22" tooSmall="False" monospace="0.0">se(x)&gt; se(x) =se(x)(8)</doubt><p>3 We are grateful to an anonymous reviewer for pointing this out, and an even stronger point: for a given G, <i>G </i>and <i>Gzn&lt;o </i>have a nonempty set-difference if and only if <i>G </i>has infinite ambiguity (some <i>x € L(G) </i>has infinitely many parse trees).</p><page local="7" global="483"/><p>Summing over all trees of any given yield length <i>n, </i>we have</p><doubt alpha="40.9" length="22" tooSmall="False" monospace="0.0">Zn(G)&gt; Zn(G) =Zn(G)(9)</doubt><p><i>G </i>generates all possible binary trees (with internal nodes undifferentiated) over a given sentence <i>x </i>in L(G). Every tree generated by <i>G </i>with yield length <i>n </i>will have the same score: pn-1un, because every binary tree with <i>n </i>terminals has exactly <i>n — </i>1 nonterminals. Each tree corresponds to a way of bracketing <i>n </i>items, so the total number of parse trees generated by <i>G </i>for a string of length <i>n </i>is the number of different ways of bracketing a sequence of <i>n </i>items. The total number of unlabeled binary bracketings of an n-length sequence is the nth Catalan number <i>Cn </i>(Graham, Knuth, and Patashnik 1994), which in turn is bounded above by 4n (Vardi 1991). The total number of strings of length <i>n </i>is <i>| </i>X| <i>n</i>. Therefore</p><doubt alpha="46.7" length="45" tooSmall="False" monospace="0.0">Zn(G) = Cn|X|npn-1un&lt;4n|X|npn"V&lt;(4|X|pu)n(10)</doubt><p>We now transform the original weights G as follows. For every rule (X <i>— </i>a) <i>€ R,</i> where f(a) is the number of X symbols appearing in a. This transformation results in every <i>n</i>-length sentence having its score divided by (8| X| pu)n. The relative scores of trees with the same yield are unaffected, because they are all scaled equally. Therefore <i>Ge' </i>defines the same conditional distribution over trees given sentences as Ge, which implies that <i>Ge </i>and <i>Ge' </i>have the same highest scoring parses. Note that <i>any </i>sufficiently large value could stand in for 8| X| pu to both (a) preserve the conditional distribution and (b) force <i>Zn</i>(G) to converge. We have not found the <i>minimum </i>such value, but 8|X| pu is sufficiently large.</p><doubt alpha="100.0" length="3" tooSmall="False" monospace="0.0">let</doubt><doubt alpha="46.2" length="13" tooSmall="False" monospace="0.0">Ql__PX^tX(11)</doubt><doubt alpha="35.7" length="14" tooSmall="False" monospace="0.0">(8|X|Pu)t(a)()</doubt><p>The sequence of <i>Zn</i>(G) now converges:</p><doubt alpha="33.3" length="24" tooSmall="False" monospace="0.0">Zn(G)&lt;(8t[PG))n&lt;(i)"(12)</doubt><doubt alpha="61.7" length="47" tooSmall="False" monospace="0.0">HenceZ(G')=E~oZn(G1)&lt;2andGe'€ Gz&lt;o.■Corollary 1</doubt><p>Given a CFG G, <i>C</i><i>z</i><i>n&lt;o </i>= Cpcfg.</p><doubt alpha="100.0" length="5" tooSmall="False" monospace="0.0">Proof</doubt><p>By Theorem 1, <i>CZn&lt;oc </i><b>= </b><i>Cz&lt;oo. </i>We know that <i>Pz&lt;o </i><b>= PPCFG, </b>from which it follows that <i>CZ&lt;OQ </i><b>= CPCFG. </b>Hence <i>CZn&lt;o </i><b>= CPCFG. </b>To convert a WCFG in <i>CZn&lt;o </i>into a PCFG, first apply the transformation in the proof of Theorem 1 to get a convergent WCFG, then apply Chi's method (our Section 2.1). ■ <b>Figure 1</b><page local="8" global="484"/></p><p>A graphical depiction of the primary result of this article. Given a fixed set of productions, <i>G </i>is the set of WCFGs with exactly those productions (i.e., they vary only in the production weights), <i>Gz&lt;o </i>is the subset of <i>G </i>that defines (joint) probability distributions over trees (i.e., that have a finite partition function Z)and <i>Pz&lt;o </i>is the set of probability distributions defined by grammars in <i>Gz&lt;o</i>. Chi (1999) and Abney, McAllester, and Pereira (1999) proved that <i>Pz&lt;o </i>is the same as PPCFG, the set of probability distributions defined by the PCFG GPCFG with the same productions as <i>G. </i>Thus even though the set of WCFGs properly includes the set of PCFGs, WCFGs define exactly the same probability distributions over trees as PCFGs. This article extends these results to conditional distributions over trees conditioned on their strings. Even though the set <i>GZn&lt;OG </i>of WCFGs that define conditional distributions may be larger than <i>Gz&lt;o</i>and properly includes GPCFG, the set of conditional distributions <i>CZn&lt;OQ </i>defined by <i>GZn&lt;O </i>is equal to the set of conditional distributions CPCFG defined by PCFGs. Our proof is constructive: we give an algorithm which takes as input a WCFG <i>G € GZn&lt;O </i>and returns a PCFG which defines the same conditional distribution over trees given strings as G.</p><figure caption="Figure 1 presents the main result graphically in the context of earlier results."></figure></section><section number="4." title="HMMs and Related Models"><p>Hidden Markov models (HMMs) are a special case of PCFGs. The structures they produce are labeled sequences, which are equivalent to right-branching trees. We can write an HMM as a PCFG with restricted types of rules. We will refer to the unweighted, finite-state grammars that HMMs stochasticize as "right-linear grammars." Rather than using the production rule notation of PCFGs, we will use more traditional HMM nota­tion and refer to states (interchangeable with nonterminals) and paths (interchangeable with parse trees).</p><p>In the rest of the article we distinguish between HMMs, which are probabilistic finite-state automata locally normalized just like a PCFG, and chain-structured Markov random fields (MRFs; Section 4.1), in which moves or transitions are associated with positive weights and which are globally normalized like a WCFG.<footnote anchor="4"/> We also distinguish two different types of dependency structures in these automata. Abusing the standard terminology somewhat, in a Mealy automaton arcs are labeled with output or terminal symbols, whereas in a Moore automaton the states emit terminal symbols.<footnote anchor="5"/></p><p>4 We admit that these names are somewhat misleading, because as we will show, chain-structured MRFs also have the Markov property and define the same joint and conditional distributions as HMMs.</p><p>5 In formal language theory both Mealy and Moore machines are finite-state transducers (Mealy 1955; Moore 1956); we ignore the input symbols here.</p><page local="9" global="485"/><p>A Mealy HMM defines a probability distribution over pairs <i>(x, </i>n), where <i>x </i>is a length-n sequence <i>(x\,</i>x2,<i>x</i><i>n)e</i><i> Sn </i>and tt = (n0,<b><i>n\,</i></b>n2,nn)e <i>Nn+1 </i>is a state (or nonterminal) path. The distribution is given by n0 is assumed, for simplicity, to be constant and known; we also assume that every state transition emits a symbol (no e arcs), an assumption made in typical tagging and chunking applications of HMMs. We can convert a Mealy HMM to a PCFG by including, for every tuple (x, n, <i>(x</i><i> </i><i>e S </i>and n, <b><i>$ </i></b><i>e </i><i>N)</i><i> </i>such that p(x, n <i>| </i>^) &gt; 0, the rule n <i>— </i><i>x</i><i> </i>^, with the same probability as the corresponding HMM transition. For every n such that p(STOP <i>I </i>n), we include the rule n <i>— </i>e, with probability p(STOP <b>| </b>n).</p><doubt alpha="52.5" length="40" tooSmall="False" monospace="0.0">Phmm(X,n)=TTp(xi,nIn-i)  p(STOP|n„) (13)</doubt><p>A Moore HMM factors the distribution p(x, n <b>| </b>^)into p(x <b>| </b>n) <i>• </i>p(n <b>| </b>^). A Moore HMM can be converted to a PCFG by adding a new nonterminal n for every state n and including the rules <i>— </i>n (with probability <i>p</i><b><i>(n</i></b><b><i> </i></b><i>| </i>^)) and n <b>— </b>x n (with probability p(x <i>| </i>n)). Stop probabilities are added as in the Mealy case. For a fixed number of states, Moore HMMs are less probabilistically expressive than Mealy HMMs, though we can convert between the two with a change in the number of states.</p><p>We consider Mealy HMMs primarily from here on. If we wish to define the distri­bution over paths given words, we conditionalize</p><doubt alpha="60.7" length="28" tooSmall="False" monospace="0.0">P(n|X)=or=ip(xi'n1p(sTop1nn)</doubt><doubt alpha="62.8" length="43" tooSmall="False" monospace="0.0">HMM(1X)E*eNn+iOlLiP(Xi,nInj-i))p(STOPI &lt;)()</doubt><p>This is how scores are assigned when selecting the best path given a sequence.</p><p>For a grammar <i>G </i>that is right-linear, we can therefore talk about the set of HMM (right-linear) grammars GHMM, the set of probability distributions PHMM defined by those grammars, and CHMM, the set of conditional distributions over state paths (trees) that they define.<footnote anchor="6"/></p><subsection number="4.1" title="Mealy Markov Random Fields"><p>When the probabilities in Mealy HMMs are replaced by arbitrary positive weights, the production rules can be seen as features in a Gibbs distribution. The resulting model is a type of MRF with a chain structure; these have recently become popular in natural language processing (Lafferty, McCallum, and Pereira 2001). Lafferty et al.'s formulation defined a conditional distribution over paths given sequences by normalizing for each sequence x:</p><p><b><i>Qn</i></b><b><i>i_i'X</i></b><b><i>i'Tx</i></b><i>)j</i></p><doubt alpha="52.6" length="19" tooSmall="False" monospace="0.0">Pcmrf(n1x)=Z(Q)(i5)</doubt><p>6 Of course, the right-linear grammar is a CFG, so we could also use the notation GPCFG, PPCFG,and CPCFG.</p><page local="10" global="486"/><p>Using a single normalizing term Z(G), we can also define a <i>joint </i>distribution over states and paths:</p><doubt alpha="56.2" length="16" tooSmall="False" monospace="0.0">PCmrf(x/n)= Z(Q)</doubt><p>Let <i>G </i><i>= {Ge} </i>denote the set of weighted grammars based on the unweighted right-linear grammar G. We call these weighted grammars "Mealy MRFs." As in the WCFG case, we can add the constraint <i>Zn</i>(Q) <b>&lt; oo </b>(for all n), giving the class <i>G</i><i>z</i><i>n«x&gt;</i>.</p><p>Recall that, in the WCFG case, the move from <i>G </i>to <i>GZn«oc, </i>had to do with cyclic derivations. The analogous move in the right-linear grammar case involves <b>e </b>emis­sions (production rules of the form <i>X </i><i>— </i>Y). If, as in typical applications of finite-state models to natural language processing, there are no rules of the form <i>X</i><i> </i><i>— </i><i>Y,</i><i> </i>then <i>G</i><i>Z</i><i>n«o</i><i> </i>is empty and <i>G</i><i>Z</i><i>n«o</i><i> </i>= <i>G. </i>Our formulae, in fact, assume that there are no <b>e </b>emissions.</p><p>Because Mealy MRFs are a special case of WCFGs, Theorem 1 applies to them. This means that any random field using Mealy HMM features (Mealy MRF) such that <b>V</b>n, <i>Zn</i>(Q) <b>&lt; oo </b>can be transformed into a Mealy HMM that defines the same conditional distribution of tags given words.<footnote anchor="7"/> <b>Corollary 2</b></p><p>For a given right-linear grammar G, Chmm = Cz«oo = <i>C</i><i>z</i><i>n«o</i>.</p><p>Lafferty, McCallum, and Pereira's <i>conditional </i>random fields are typically trained to optimize a different objective function than HMMs (conditional likelihood and joint likelihood, respectively). Our result shows that optimizing either objective on the set of Mealy HMMs as opposed to Mealy MRFs will achieve the same result, modulo imperfections in the numerical search for parameter values.</p></subsection><subsection number="4.2" title="Maximum-Entropy Markov Models"><p>While HMMs and chain MRFs represent the same set of conditional distributions, we can show that the maximum-entropy Markov models (MEMMs) of McCallum, Freitag, and Pereira (2000) represent a strictly smaller class of distributions.</p><p>An MEMM is a similar model with a different event structure. It deines the distri­bution over paths <i>given </i>words as:</p><doubt alpha="100.0" length="1" tooSmall="False" monospace="0.0">n</doubt><doubt alpha="53.1" length="32" tooSmall="False" monospace="0.0">Pmemm(7T|x)=JJV(niIni-1,Xi) (17)</doubt><doubt alpha="33.3" length="3" tooSmall="False" monospace="0.0">i=1</doubt><p>Unlike an HMM, the MEMM does <i>not </i>define a distribution over output sequences x. The name "maximum entropy Markov model" comes from the fact that the conditional</p><p>7 What if we allow additional features? It can be shown that, as long as the vocabulary £ is finite and known, we can convert any such MRF with potential functions on state transitions and emissions into an HMM functioning equivalently as a classifier. If £ is not fully known, then we cannot sum over all emissions from each state, and we cannot use Chi's method (Section 2.1) to convert to a PCFG (HMM).</p><page local="11" global="487"/><doubt alpha="100.0" length="5" tooSmall="False" monospace="0.0">Proof</doubt><p>distributions n, x) typically have a log-linear form, rather than a multinomial form, and are trained to maximize entropy.</p><doubt alpha="71.4" length="7" tooSmall="False" monospace="0.0">Lemma 1</doubt><p>For every MEMM, there is a Mealy MRF that represents the same conditional distribu­tion over paths given symbols.</p><p>By definition, the features of the MRF include triples x,, n). Assign to the weight <b><i>Qn.</i></b><b><i>/Xj/nk </i></b>the value PMEMM(ni | <b><i>n^,</i></b><b><i> </i></b><i>x</i><i>j</i>). Assign to O^stop the value 1. In computing PCMRF(n <i>I </i><i>x)</i><i> </i>(Equation (15)), the normalizing term for each <i>x</i><i> </i>will be equal to 1. ■</p><p>MEMMs, like HMMs, are deined by locally normalized conditional multinomial distributions. This has computational advantages (no potentially ininite <i>Z</i>(Q) terms to compute). However, the set of conditional distributions of labels given terminals that can be expressed by MEMMs is strictly smaller than those expressible by HMMs (and by extension, Mealy MRFs).</p><p><b>Theorem 2</b></p><p>For a given right-linear grammar G, CMEMM <i>C </i>CHMM. <b>Proof</b></p><p>We give an example of a Mealy HMM whose conditional distribution over paths (trees) given sentences cannot be represented by an MEMM. We thank Michael Collins for pointing out to us the existence of examples like this one. Define a Mealy HMM with three states named 0,1, and 2, over an alphabet {a,b,c},asfollows.State Oisthe start state.</p><p><b>Example 3</b></p><doubt alpha="25.0" length="4" tooSmall="False" monospace="0.0">b.25</doubt><doubt alpha="66.4" length="143" tooSmall="False" monospace="0.0">Under this model, PHMM(0,1,1 | a,b)=PHMM(0,2,2 | a, c)=1. These conditional dis­tributions cannot both be met by any MEMM. To see why, consider</doubt><doubt alpha="21.1" length="38" tooSmall="False" monospace="0.0">V(1|0,a)•v(1|1,b)= V(2|0,a)•p(2|2,c)=1</doubt><p>This implies that<page local="12" global="488"/></p><doubt alpha="21.6" length="37" tooSmall="False" monospace="0.0">V(1|0,a)=V(1|1,b)=V(2|0,a)=V(2|2,c)=1</doubt><doubt alpha="100.0" length="5" tooSmall="False" monospace="0.0">Proof</doubt><doubt alpha="100.0" length="1" tooSmall="False" monospace="0.0">n</doubt><doubt alpha="33.3" length="3" tooSmall="False" monospace="0.0">i=1</doubt><p>But it is impossible for p(1 <i>| </i>0, a) = p(2 <i>| </i>0, a) = 1. This holds regardless of the form of the distribution      <i>n,</i>x) (e.g., multinomial or log-linear).</p><p>Because P(0,1,1 | a,b) = P(0,2,2 | a,c) cannot be met by any MEMM, there are distributions in the family allowed by HMMs that cannot be expressed as MEMMs, and the latter are less expressive. ■</p><p>It is important to note that this result applies to Mealy HMMs; our result compares models with the same dependencies among random variables. If the HMM's distribu­tion p(x;, 7t, <i>| ni_1) </i>is factored into p(x, <i>| n</i>) <i>• </i>p(7t, <i>| ni_1) </i>(i.e., it is a Moore HMM), then there may exist an MEMM with the same number of states that can represent some distributions that the Moore HMM cannot.<footnote anchor="8"/></p><p>One can also imagine MEMMs in which <i>| n</i><i>,_1,</i><i> </i>x,,...) is conditioned on <i>more </i>surrounding context (xi_1 or xi+1, or the entire sequence x, for example). Conditioning on more context can be done by increasing the <i>order </i>of the Markov model—all of our models so far have been first-order, with a memory of only the previous state. Our result can be extended to include higher-order MEMMs. Suppose we allow the MEMM to "look ahead" <i>n </i>words, factoring its distribution into <i>p(n, |        </i>x,, xi+1, <b>Corollary 3</b></p><p>A first-order Mealy HMM can represent some classifiers that no MEMM with finite lookahead can represent.</p><p>Consider again Example 3. Note that, for all <i>m </i><i>&gt; </i>1, it sets</p><doubt alpha="50.0" length="4" tooSmall="False" monospace="0.0">m1 s</doubt><doubt alpha="44.4" length="18" tooSmall="False" monospace="0.0">Phmm(0,W11amb) = 1</doubt><doubt alpha="39.1" length="23" tooSmall="False" monospace="0.0">Phmm(0,2^2|amc) = 1m2 s</doubt><p>Suppose we wish to capture this in an MEMM with <i>n </i>symbols of look-ahead. Letting <i>m = n + </i>1,</p><doubt alpha="34.2" length="38" tooSmall="False" monospace="0.0">p(1|0,an+1)•p(1|1,anb)•JJp(1|1,an_b)=1</doubt><doubt alpha="35.0" length="40" tooSmall="False" monospace="0.0">p(2|0,an+1)•p(2|2,anc)•JJp(2|2,an-ic) =1</doubt><doubt alpha="65.1" length="166" tooSmall="False" monospace="0.0">The same issue arises as in the proof of Theorem 2: it cannot be that p(1|0, an+1) = p(2|0, an+1) = 1, and so this MEMM does not exist. Note that even if we allow the</doubt><p>8 The HMM shown in Example 3 can be factored into a Moore HMM without any change to the distribution.</p><page local="13" global="489"/><p>MEMM to "look back" and condition on earlier symbols (or states), it cannot represent the distribution in Example 3. ■</p><p>Generally speaking, this limitation of MEMMs has nothing to do with the estima­tion procedure (we have committed to no estimation procedure in particular) but rather with the conditional <i>structure </i>of the model. That some model structures work better than others at real NLP tasks was discussed by Johnson (2001) and Klein and Manning (2002). Our result—that the class of distributions allowed by MEMMs is a strict subset of those allowed by Mealy HMMs—makes this unsurprising.</p></subsection></section><section number="5." title="Practical Implications"><p>Our result is that weighted generalizations of classical probabilistic grammars (PCFGs and HMMs) are <i>no more powerful </i>than the probabilistic models. This means that, inso­far as log-linear models for NLP tasks like tagging and parsing are more successful than their probabilistic cousins, it is due to either (a) additional features added to the model, (b) improved estimation procedures (e.g., maximum conditional likelihood estimation or contrastive estimation), or both. (Note that the choice of estimation proce­dure (b) is in principle orthogonal to the choice of model, and conditional estimation should not be conflated with log-linear modeling.) For a given estimation criterion, weighted CFGs, and Mealy MRFs, in particular, cannot be expected to behave any differently than PCFGs and HMMs, respectively, unless they are augmented with more features.</p></section><section number="6." title="Related Work"><p>Abney, McAllester, and Pereira (1999) addressed the relationship between PCFGs and probabilistic models based on push-down automaton operations (e.g., the structured language model of Chelba and Jelinek, 1998). They proved that, although the conversion may not be simple (indeed, a blow-up in the automaton's size may be incurred), given <i>G, </i>PPCFG and the set of distributions expressible by shift-reduce probabilistic push-down automata are weakly equivalent. Importantly, the standard conversion of a CFG into a <i>shift-reduce </i>PDA, when applied in the <i>stochastic </i>case, does not always preserve the prob­ability distribution over trees. Our Theorem 2 bears a resemblance to that result. Further work on the relationship between weighted CFGs and weighted PDAs is described in Nederhof and Satta (2004).</p><p>MacKay (1996) proved that linear Boltzmann chains (a class of weighted models that is essentially the same as Moore MRFs) express the same set of distributions as Moore HMMs, under the condition that the Boltzmann chain has a single specific end state. MacKay avoided the divergence problem by defining the Boltzmann chain always to condition on the length of the sequence; he tacitly requires all of his models to be in <i>G</i><i>z</i><i>n«x&gt;. </i>We have suggested a more applicable notion of model equivalence (equivalence of the conditional distribution) and our Theorem 1 generalizes to context-free models.</p></section><section number="7." title="Conclusion"><p>We have shown that weighted CFGs that define finite scores for all sentences in their languages have no greater expressivity than PCFGs, when used to define distributions over trees given sentences.<page local="14" global="490"/> This implies that the standard Mealy MRF formalism is no more powerful than Mealy HMMs, for instance. We have also related "maximum entropy Markov models" to Mealy Markov random fields, showing that the former is a strictly less expressive weighted formalism.</p></section><section title="Acknowledgments"><p>This work was supported by a Fannie and John Hertz Foundation fellowship to N. Smith at Johns Hopkins University. The views expressed are not necessarily endorsed by the sponsors. We are grateful to three anonymous reviewers for feedback that improved the article, to Michael Collins for encouraging exploration of this matter and helpful comments on a draft, and to Jason Eisner and Dan Klein for insightful conversations. Any errors are the sole responsibility of the authors.</p></section><references><p>Abney, Steven P., David A. McAllester, and Fernando Pereira. 1999. Relating probabilistic grammars and automata. In <i>Proceedings of the 37th Annual Meeting of the Association for Computational Linguistics, </i>pages 542-549, College Park, MD.</p><p>Booth, Taylor L. and Richard A. Thompson. 1973. Applying probability measures to abstract languages. <i>IEEE Transactions on</i> <i>Computers, </i>22(5):442-450.</p><p>Chelba, Ciprian and Frederick Jelinek.</p><p>1998. Exploiting syntactic structure for language modeling. In <i>Proceedings of the 36th Annual Meeting of the Association for Computational Linguistics and 17th International Conference on Computational Linguistics, </i>pages 325-331, Montreal, Canada.</p><p>Chi, Zhiyi. 1999. Statistical properties of probabilistic context-free grammars.</p><p><i>Computational Linguistics, </i>25(1):131-160. Goodman, Joshua T. 1998. <i>Parsing Inside-Out.</i></p><p>Ph.D. thesis, Harvard University,</p><p>Cambridge, MA. Graham, Ronald L., Donald E. Knuth, and Oren Patashnik. 1994. <i>Concrete</i> <i>Mathematics.</i><i> </i>Addison-Wesley,</p><p>Reading, MA. Johnson, Mark. 2001. Joint and conditional estimation of tagging and parsing models.</p><p>In <i>Proceedings of the 39th Annual Meeting of</i> <i>the Association for Computational Linguistics,</i></p><p>pages 314-321, Toulouse, France. Johnson, Mark, Stuart Geman, Stephen</p><p>Canon, Zhiyi Chi, and Stefan Riezler.</p><p>1999. Estimators for stochastic "unification-based" grammars.</p><p>In <i>Proceedings of the 37th Annual Conference ofthe Association for Computational Linguistics, </i>pages 535-541, College Park, MD.</p><p>Klein, Dan and Christopher D. Manning. 2002. Conditional structure versus conditional estimation in NLP models. In <i>Proceedings ofthe Conference on Empirical Methods in Natural Language Processing, </i>pages 9-16, Philadelphia, PA.</p><p>Lafferty, John, Andrew McCallum, and Fernando Pereira. 2001. Conditional random fields: Probabilistic models for segmenting and labeling sequence data. In <i>Proceedings of the 18th International Conference on Machine Learning, </i>pages 282-289, Williamstown, MA.</p><p>MacKay, David J. C. 1996. Equivalence of linear Boltzmann chains and hidden Markov models. <i>Neural Computation, </i>8(1):178-181.</p><p>McCallum, Andrew, Dayne Freitag, and Fernando Pereira. 2000. Maximum entropy Markov models for information extraction and segmentation. In <i>Proceedings of the 17th International Conference on Machine Learning,</i> pages 591-598, Palo Alto, CA.</p><p>Mealy, G. H. 1955. A method for synthesizing sequential circuits. <i>Bell System Technology Journal,</i> 34:1045-1079.</p><p>Moore, Edward F. 1956. Gedanken­experiments on sequential machines. In <i>Automata Studies, </i>number 34 in Annals of Mathematics Studies. Princeton University Press, Princeton,</p><p>NJ, pages 129-153.</p><p>Nederhof, Mark-Jan and Giorgio Satta. 2004. Probabilistic parsing strategies. In <i>Proceedings of the 42nd Annual Meeting ofthe Association for Computational Linguistics, </i>pages 543-550, Barcelona, Spain.</p><p>Ratnaparkhi, Adwait, Salim Roukos, and R. Todd Ward. 1994. A maximum entropy model for parsing. In <i>Proceedings of the International Conference on Spoken Language Processing, </i>pages 803-806, Yokohama, Japan.</p><p>Smith, Noah A. and Jason Eisner. 2005. Contrastive estimation: Training log-linear models on unlabeled data.</p><page local="15" global="491"/><p>In <i>Proceedings of the 43rd Annual Meeting ofthe Association for Computational Linguistics, </i>pages 354-362, Ann Arbor, MI.</p><p>Stolcke, Andreas. 1995. An efficient probabilistic context-free parsing algorithm that computes prefix probabilities. <i>Computational Linguistics, </i>21(2):165-201.</p><p>Taskar, Ben, Dan Klein, Michael Collins, Daphne Koller, and Christopher Manning.</p><p>2004. Max-margin parsing. In <i>Proceedings of the Conference on Empirical Methods in Natural Language Processing, </i>pages 1-8, Barcelona, Spain. Vardi, Ilan. 1991. <i>Computational Recreations in Mathematica. </i>Addison-Wesley, Redwood City, CA.</p><p>Wetherell, C. S. 1980. Probabilistic languages: A review and some open questions. <i>Computing Surveys, </i>12:361-379.</p><page local="16" global="492"/></references></body></article>