Criticality in Formal Languages and Statistical Physics

by   Henry W. Lin, et al.

We show that the mutual information between two symbols, as a function of the number of symbols between the two, decays exponentially in any probabilistic regular grammar, but can decay like a power law for a context-free grammar. This result about formal languages is closely related to a well-known result in classical statistical mechanics that there are no phase transitions in dimensions fewer than two. It is also related to the emergence of power-law correlations in turbulence and cosmological inflation through recursive generative processes. We elucidate these physics connections and comment on potential applications of our results to machine learning tasks like training artificial recurrent neural networks. Along the way, we introduce a useful quantity which we dub the rational mutual information and discuss generalizations of our claims involving more complicated Bayesian networks.



There are no comments yet.


page 1

page 2

page 3

page 4


Tensor networks and efficient descriptions of classical data

We investigate the potential of tensor network based machine learning me...

Mutual Information Scaling and Expressive Power of Sequence Models

Sequence models assign probabilities to variable-length sequences such a...

V-like formations in flocks of artificial birds

We consider flocks of artificial birds and study the emergence of V-like...

Inducing Regular Grammars Using Recurrent Neural Networks

Grammar induction is the task of learning a grammar from a set of exampl...

Minimizing couplings in renormalization by preserving short-range mutual information

The connections between renormalization in statistical mechanics and inf...

The Power of Constraint Grammars Revisited

Sequential Constraint Grammar (SCG) (Karlsson, 1990) and its extensions ...

Eigen Artificial Neural Networks

This work has its origin in intuitive physical and statistical considera...
This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

I Introduction

Critical behavior, where long-range correlations decay as a power law with distance, has many important physics applications ranging from phase transitions in condensed matter experiments to turbulence and inflationary fluctuations in our early Universe. It has important applications beyond the traditional purview of physics as well Bak (1987); Bak et al. (1988); Linkenkaer-Hansen et al. (2001); Levitin et al. (2012); Tegmark (2014) including applications to music Manaris et al. (2005); Levitin et al. (2012), genomics Peng et al. (1992); Mantegna et al. (1994) and human languages Ebeling and Pöschel (1994); Ebeling and Neiman (1995); Altmann et al. (2012); Montemurro and Pury (2002).

In Figure 1, we plot a statistic that can be applied to all of the above examples: the mutual information between two symbols as a function of the number of symbols in between the two symbols Ebeling and Pöschel (1994). As discussed in previous works Ebeling and Pöschel (1994); Deco and Schürmann (2012); Altmann et al. (2012), the plot shows that the number of bits of information provided by a symbol about another drops roughly as a power-law222The power law discussed here should not be confused with another famous power law that occurs in natural languages: Zipf’s law Zipf (1949). Zipf’s law implies power law behavior in one-point statistics (in the histogram of word frequencies), whereas we are interested in two-point statistics. In the former case, the power law is in the frequency of words; in the latter case, the power law is in the separation between characters. One can easily cook up sequences which obey Zipf’s law but are not critical and do not exhibit a power law in the mutual information. However, there are models of certain physical systems where Zipf’s law follows from criticality Lin and Loeb (2016); Pietronero et al. (2001). with distance in sequences (defined as the number of symbols between the two symbols of interest) as diverse as the human genome, music by Bach, and text in English and French. Why is this, when so many other correlations in nature instead drop exponentially Kardar (2007)?

Figure 1: Decay of mutual information with separation. Here the mutual information in bits per symbol is shown as a function of separation , where the symbols and are located at positions and in the sequence in question, and shaded bands correspond to

error bars. The statistics were computed using a sliding window using an estimator for the mutual information detailed in Appendix D. All measured curves are seen to decay roughly as power laws, explaining why they cannot be accurately modeled as Markov processes — for which the mutual information instead plummets exponentially (the example shown has

). The measured curves are seen to be qualitatively similar to that of a famous critical system in physics: a 1D slice through a critical 2D Ising model, where the slope is . The human genome data consists of 177,696,512 base pairs {A, C, T,G} from chromosome 5 from the National Center for Biotechnology Information gen , with unknown base pairs omitted. The Bach data consists of 5727 notes from Partita No. 2 bac , with all notes mapped into a 12-symbol alphabet consisting of the 12 half-tones {C, C#, D, D#, E, F, F#, G, G#, A, A#, B}, with all timing, volume and octave information discarded. The three text corpuses are 100 MB from Wikipedia hut (206 symbols), the first 114 MB of a French corpus fre (185 symbols) and 27 MB of English articles from (143 symbols). The large long range information appears to be dominated by poems in the French sample and by html-like syntax in the Wikipedia sample.

Better understanding the statistical properties of natural languages is interesting not only for geneticists, musicologists and linguists, but also for the machine learning community. Any tasks that involve natural language processing (

e.g., data compression, speech-to-text conversion, auto-correction) exploit statistical properties of language, and can all be further improved if we can better understand these properties, even in the context of a toy model of these data sequences. Indeed, the difficulty of automatic natural language processing has been known at least as far back as Turing, whose eponymous test Turing (1950) relies on this fact. A tempting explanation is that natural language is something uniquely human. But this is far from a satisfactory one, especially given the recent successes of machines at performing tasks as complex and as “human” as playing Jeopardy! Ferrucci et al. (2010), chess Campbell et al. (2002), Atari games Mnih (2015) and Go Silver et al. (2016). We will show that computer descriptions of language suffer from a much simpler problem that has involves no talk about meaning or being non-human: they tend to get the basic statistical properties wrong.

To illustrate this point, consider Markov models of natural language. From a linguistics point of view, it has been known for decades that such models are fundamentally unsuitable for modeling human language

Chomsky (1959)

. However, linguistic arguments typically do not produce an observable that can be used to quantitatively falsify any Markovian model of language. Instead, these arguments rely on highly specific knowledge about the data — in this case, an understanding of the language’s grammar. This knowledge is non-trivial for a human speaker to acquire, much less an artificial neural network. In contrast, the mutual information is comparatively trivial to observe, requiring no specific knowledge about the data, and it immediately indicates that natural languages would be poorly approximated by a Markov/hidden Markov model as we will demonstrate.

Furthermore, the mutual information decay may offer a partial explanation of the impressive progress that has been made by using deep neural networks for natural language processing (see, e.g., Kim et al. (2015); Graves (2013); Graves et al. (2013); Collobert and Weston (2008); van den Oord et al. ). (For recent reviews of deep neural networks, see Schmidhuber (2015); LeCun et al. (2015)

.) We will see that a key reason that currently popular recurrent neural networks with long-short-term memory (LSTM)

Hochreiter and Schmidhuber (1997) do much better is that they can replicate critical behavior, but that even they can be further improved, since they can under-predict long-range mutual information.

While motivated by questions about natural languages and other data sequences, we will explore the information-theoretic properties of formal languages. For simplicity, we focus on probabilistic regular grammars and probabilistic context-free grammars (PCFGs). Of course, real-world data sources like English is likely more complex than a context free grammar Shieber (1985), just as a real-world magnet is more complex than the Ising model. However, these formal languages serve as toy models that capture some aspects of the real data source, and the theoretical techniques we develop for studying these toy models might be adapted to more complex formal languages. Of course, independent of their connection to natural languages, formal languages are also theoretically interesting in their own right and have connections to, e.g., group theory Anisimov (1971).

This paper is organized as follows. In Section II, we show how Markov processes exhibit exponential decay in mutual information with scale; we give a rigorous proof of this and other results in a series of appendices. To enable such proofs, we introduce a convenient quantity that we term rational mutual information, which bounds the mutual information and converges to it in the near-independence limit. In Section III, we define a subclass of generative grammars and show that they exhibit critical behavior with power law decays. We then generalize our discussion using Bayesian nets and relate our findings to theorems in statistical physics. In Section IV, we discuss our results and explain how LSTM RNNs can reproduce critical behavior by emulating our generative grammar model.

Ii Markov implies exponential decay

For two discrete random variables

and , the following definitions of mutual information are all equivalent:


where is the Shannon entropy Shannon (1948) and

is the Kullback-Leibler divergence

Kullback and Leibler (1951)

between the joint probability distribution and the product of the individual marginals. If the base of the logarithm is taken to be

, then is measured in bits. The mutual information can be interpreted as how much one variable knows about the other: is the reduction in the number of bits needed to specify for once is specified. Equivalently, it is the number of encoding bits saved by using the true joint probability instead of approximating and are independent. It is thus a measure of statistical dependencies between and . Although it is more conventional to measure quantities such as the correlation coefficient in statistics and statistical physics, the mutual information is more suitable for generic data, since it does not require that the variables and are numbers or have any algebraic structure, whereas requires that we are able to multiply and average. Whereas it makes sense to multiply numbers, is meaningless to multiply or average two characters such as “!” and “?”.

The rest of this paper is largely a study of the mutual information between two random variables that are realizations of a discrete stochastic process, with some separation in time. More concretely, we can think of sequences of random variables, where each one might take values from some finite alphabet. For example, if we model English as a discrete stochastic process and take , could represent the first character (“F”) in this sentence, whereas could represent the third character (“r”) in this sentence.

In particular, we start by studying the mutual information function of a Markov process, which is analytically tractable. Let us briefly recapitulate some basic facts about Markov processes (see, e.g., Cover and Thomas (2012) for a pedagogical review). A Markov process is defined by a matrix of conditional probabilities . Such Markov matrices (also known as stochastic matrices) thus have the properties and . They fully specify the dynamics of the model:



is a vector with components

that specifies the probability distribution at time . Let

denote the eigenvalues of

M, sorted by decreasing magnitude: All Markov matrices have , which is why blowup is avoided when equation (2) is iterated, and

, with the corresponding eigenvector giving a stationary probability distribution

satisfying .

In addition, two mild conditions are usually imposed on Markov matrices: is irreducible, meaning that every state is accessible from every other state (otherwise, we could decompose the Markov process into separate Markov processes). Second, to avoid processes like that will never converge, we take the Markov process to be aperiodic. It is easy to show using the Perron-Frobenius theorem that being irreducible and aperiodic implies , and therefore that is unique.

This section is devoted to the intuition behind the following theorem, whose full proof is given in Appendix A and B. The theorem states roughly that for a Markov process, the mutual information between two points in time and decays exponentially for large separation :

Theorem 1: Let

be a Markov matrix that generates a Markov process. If

is irreducible and aperiodic, then the asymptotic behavior of the mutual information is exponential decay toward zero for with decay timescale where is the second largest eigenvalue of . If is reducible or periodic, can instead decay to a constant; no Markov process whatsoever can produce power-law decay. Suppose is irreducible and aperiodic so that as as mentioned above. This convergence of one-point statistics, e.g., , has been well-studied Cover and Thomas (2012). However, one can also study higher order statistics such as the joint probability distribution for two points in time. For succinctness, let us write , where and and . We are interested in the asymptotic situation where the Markov process has converged to its steady state, so the marginal distribution , independently of time.

If the joint probability distribution approximately factorizes as for sufficiently large and well-separated times and (as we will soon prove), the mutual information will be small. We can therefore Taylor expand the logarithm from equation (1) around the point , giving


where we have defined the rational mutual information


For comparing the rational mutual information with the usual mutual information, it will be convenient to take as the base of the logarithm. We derive useful properties of the rational mutual information in Appendix A. To mention just one, we note that the rational mutual information is not just asymptotically equal to the mutual information in the limit of near-independence, but it also provides a strict upper bound on it: .

Let us without loss of generality take . Then iterating equation (2) times gives . Since , we obtain

We will continue the proof by considering the typical case where the eigenvalues of M are all distinct (non-degenerate) and the Markov matrix is irreducible and aperiodic; we will generalize to the other cases (which form a set of measure zero) in Appendix B. Since the eigenvalues are distinct, we can diagonalize by writing


for some invertible matrix

B and some a diagonal matrix D whose diagonal elements are the eigenvalues: . Raising equation (5) to the power gives , i.e.,


Since M is non-degenerate, irreducible and aperiodic, , so all terms except the first in the sum of equation (6) decay exponentially with , at a decay rate that grows with . Defining , we have


where we have made use of the fact that an irreducible and aperiodic Markov process must converge to its stationary distribution for large , and we have defined A as the expression in square brackets above, satisfying . Note that in order for M to be properly normalized.

Substituting equation (7) into equation (8) and using the facts that and , we obtain


where the term in the last parentheses is of the form .

In summary, we have shown that an irreducible and aperiodic Markov process with non-degenerate eigenvalues cannot produce critical behavior, because the mutual information decays exponentially. In fact, no Markov processes can, as we show in Appendix B.

To hammer the final nail into the coffin of Markov processes as models of critical behavior, we need to close a final loophole. Their fundamental problem is lack of long-term memory, which can be superficially overcome by redefining the state space to include symbols from the past. For example, if the current state is one of and we wish the process to depend on the the last symbols, we can define an expanded state space consisting of the possible sequences of length , and a corresponding Markov matrix (or an table of conditional probabilities for the next symbol given the last symbols). Although such a model could fit the curves in Figure 1 in theory, it cannot in practice, because M requires way more parameters than there are atoms in our observable universe (): even for as few as symbols and , the Markov process involves over parameters. Scale-invariance aside, we can also see how Markov processes fail simply by considering the structure of text. To model English well, M would need to correctly close parentheses even if they were opened more than characters ago, requiring an M-matrix with than parameters, where is the number of characters used.

We can significantly generalize Theorem 1 into a theorem about hidden Markov models (HMM). In an HMM, the observed sequence is only part of the picture: there are hidden variables

that themselves form a Markov chain. We can think of an HMM as follows: imagine a machine with an internal state space

that updates itself according to some Markovian dynamics. The internal dynamics are never observed, but at each time-step, it also produces some output that form the sequence which we can observe. These models are quite general and are used to model a wealth of empirical data (see, e.g., Rabiner (1989)).

Theorem 2: Let be a Markov matrix that generates the transitions between hidden states in an HMM. If is irreducible and aperiodic, then the asymptotic behavior of the mutual information is exponential decay toward zero for with decay timescale where is the second largest eigenvalue of . This theorem is a strict generalization of Theorem 1, since given any Markov process with corresponding matrix , we can construct an HMM that reproduces the exact statistics of by using as the transition matrix between the ’s and generating from by simply setting with probability 1.

The proof is very similar in spirit to the proof of Theorem 1, so we will just present a sketch here, leaving a full proof to Appendix B. Let be the Markov matrix that governs . To compute the joint probability between two random variables and , we simply compute the joint probability distribution between and , which again involves a factor of and then use two factors of to convert the joint probability on to a joint probability on . These additional two factors of will not change the fact that there is an exponential decay given by .

A simple, intuitive bound from information theory (namely the data processing inequality Cover and Thomas (2012)) gives . However, Theorem 1 implies that decays exponentially. Hence must also decay at least as fast as exponentially.

There is a well-known correspondence between so-called probabilistic regular grammars Carrasco and Oncina (1994) (sometimes referred to as stochastic regular grammars) and HMMs. Given a probabilistic regular grammar, one can generate an HMM that reproduces all statistics and vice versa. Hence, we can also state Theorem 2 as follows:

Corollary: No probabilistic regular grammar exhibits criticality.

In the next section, we will show that this statement is not true for context-free grammars.

Iii Power laws from generative grammar

If computationally feasible Markov processes cannot produce critical behavior, then how do such sequences arise? In this section, we construct a toy model where sequences exhibit criticality. In the parlance of theoretical linguistics, our language is generated by a stochastic or probabilistic context-free grammar (PCFG) Ginsburg (1966); Booth (1969); Huang and Fu (1971); Lari and Young (1990). We will discuss the relationship between our model and a generic PCFG in Section C.

iii.1 A simple recursive grammar model

We can formalize the above considerations by giving production rules for a toy language over an alphabet . The language is defined by how a native speaker of produces sentences: first, she draws one of the characters from some probability distribution on . She then takes this character and replaces it with new symbols, drawn from a probability distribution , where is the first symbol and is any of the second symbols. This is repeated over and over. After steps, she has a sentence of length .333This exponential blow-up is reminiscent of de Sitter space in cosmic inflation. There is actually a much deeper mathematical analogy involving conformal symmetry and -adic numbers that has been discussed Harlow et al. (2012).

One can ask for the character statistics of the sentence at production step given the statistics of the sentence at production step . The character distribution is simply


Of course this equation does not imply that the process is a Markov process when the sentences are read left to right. To characterize the statistics as read from left to right, we really want to compute the statistical dependencies within a given sequence, e.g., at fixed .

To see that the mutual information decays like a power law rather than exponentially with separation, consider two random variables and separated by . One can ask how many generations took place between and the nearest ancestor of and . Typically, this will be about generations. Hence in the tree graph shown in Figure 2, which illustrates the special case , the number of edges between and is about . Hence by the previous result for Markov processes, we expect an exponential decay of the mutual information in the variable . This means that should be of the form


where is controlled by the second-largest eigenvalue of , the matrix of conditional probabilities . But this exponential decay in is exactly a power-law decay in ! This intuitive argument is transformed into a rigorous proof in Appendix C.

Figure 2: Both a traditional Markov process (top) and our recursive generative grammar process (bottom) can be represented as Bayesian networks, where the random variable at each node depends only on the node pointing to it with an arrow. The numbers show the geodesic distance to the leftmost node, defined as the smallest number of edges that must be traversed to get there. Roughly speaking, our results show that for large , the mutual information decays exponentially with (see Theorem 1 and 2). Since this geodesic distance grows only logarithmically with the separation in time in a hierarchical generative grammar (the hierarchy creates very efficient shortcuts), the exponential kills the logarithm and we are left with power-law decays of mutual information in such languages.

iii.2 Further Generalization: strongly correlated characters in words

In the model we have been describing so far, all nodes emanating from the same parent can be freely permuted since they are conditionally independent. In this sense, characters within a newly generated word are uncorrelated. We call models with this property weakly correlated. There are still arbitrarily large correlations between words, but not inside of words. If a weakly correlated grammar allows , it must allow for with the same probability. We now wish to relax this property to allow for the strongly-correlated case where variables may not be conditionally independent given the parents. This allows us to take a big step towards modeling realistic languages: in English, god significantly differs in meaning and usage from dog.

In the previous computation, the crucial ingredient was the joint probability . Let us start with a seemingly trivial remark. This joint probability can be re-interpreted as a conditional joint probability. Instead of and being random variables at specified sites and , we can view them as random variables at randomly chosen locations, conditioned on their locations being and . Somewhat pedantically, we write . This clarifies the important fact that the only way that depends on and is via a dependence on . Hence


This equation is specific to weakly correlated models and does not hold for generic strongly correlated models.

In computing the mutual information as a function of separation, the relevant quantity is the right hand side of equation (7). The reason is that in practical scenarios, we estimate probabilities by sampling a sequence at fixed separation , corresponding to , but varying and . (The term is discussed in Appendix E).

Now whereas will change when strong correlations are introduced, will retain a very similar form. This can be seen as follows: knowledge of the geodesic distance corresponds to knowledge of how high up the closest parent node is in the hierarchy (see Figure 2). Imagine flowing down from the parent node to the leaves. We start with the stationary distribution at the parent node. At the first layer below the parent node (corresponding to a causal distance ), we get , where the symmetrized probability comes into play because knowledge of the fact that are separated by gives no information about their order. To continue this process to the second stage and beyond, we only need the matrix The reason is that since we only wish to compute the two-point function at the bottom of the tree, the only place where a three-point function is ever needed is at the very top of the tree, where we need to take a single parent into two children nodes. After that, the computation only involves evolving a child node into a grand-child node, and so forth. Hence the overall two-point probability matrix is given by the simple equation


As we can see from the above formula, changing to the strongly correlated case essentially reduces to the weakly correlated case where


except for a perturbation near the top of the tree. We can think of the generalization as equivalent to the old model except for a different initial condition. We thus expect on intuitive grounds that the model will still exhibit power law decay. This intuition is correct, as we will prove in Appendix C. Our result can be summarized by the following theorem:

Theorem 3 There exist probabilistic context free grammars (PCFGs) such that the mutual information between two symbols and in the terminal strings of the language decay like , where is the number of symbols in between and .

In Appendix C, we give an explicit formula for as well as the normalization of the power law for a particular class of grammars.

iii.3 Further Generalization: Bayesian networks and context-free grammars

Just how generic is the scaling behavior of our model? What if the length of the words is not constant? What about more complex dependencies between layers? If we retrace the derivation in the above arguments, it becomes clear that the only key feature of all of our models considered so far is that the rational mutual information decays exponentially with the causal distance :


This is true for (hidden) Markov processes and the hierarchical grammar models that we have considered above. So far we have defined in terms of quantities specific to these models; for a Markov process, is simply the time separation. Can we define more generically? In order to do so, let us make a brief aside about Bayesian networks. Formally, a Bayesian net is a directed acyclic graph (DAG), where the vertices are random variables and conditional dependencies are represented by the arrows. Now instead of thinking of and as living at certain times , we can think of them as living at vertices of the graph.

We define as follows. Since the Bayesian net is a DAG, it is equipped with a partial order on vertices. We write iff there is a path from to , in which case we say that is an ancestor of . We define the to be the number of edges on the shortest directed path from to . Finally, we define the causal distance to be


It is easy to see that this reduces to our previous definition of for Markov processes and recursive generative trees (see Figure 2).

Is it true that our exponential decay result from equation (14) holds even for a generic Bayesian net? The answer is yes, under a suitable approximation. The approximation is to ignore long paths in the network when computing the mutual information. In other words, the mutual information tends to be dominated by the shortest paths via a common ancestor, whose length is . This is a generally a reasonable approximation, because these longer paths will give exponentially weaker correlations, so unless the number of paths increases exponentially (or faster) with length, the overall scaling will not change.

With this approximation, we can state a key finding of our theoretical work. Deep models are important because without the extra “dimension” of depth/abstraction, there is no way to construct “shortcuts” between random variables that are separated by large amounts of time with short-range interactions; 1D models will be doomed to exponential decay.

Hence the ubiquity of power laws may partially explain the success of applications of deep learning to natural language processing

. In fact, this can be seen as the Bayesian net version of the important result in statistical physics that there are no phase transitions in 1D Van Hove (1950); Cuesta and Sánchez (2004).

One might object that while the requirement of short-ranged interactions is highly motivated in physical systems, it is unclear why this restriction is necessary in the context of natural languages. Our response is that allowing for allowing for a generic interaction between say -nearest neighbors will increase the number of parameters in the model exponentially with .

There are close analogies between our deep recursive grammar and more conventional physical systems. For example, according to the emerging standard model of cosmology, there was an early period of cosmological inflation when density fluctuations get getting added on a fixed scale as space itself underwent repeated doublings, combining to produce an excellent approximation to a power-law correlation function. This inflationary process is simply a special case of our deep recursive model (generalized from 1 to 3 dimensions). In this case, the hidden “depth” dimension in our model corresponds to cosmic time, and the time parameter which labels the place in the sequence of interest corresponds to space. A similar physical analogy is turbulence in a fluid, where energy in the form of vortices cascades from large scales to ever smaller scales through a recursive process where larger vortices create smaller ones, leading to a scale-invariant power spectrum. In both the inflation case and the turbulence case, there is a hierarchical generative process akin to our formal language model (except in three dimensions and with continuous variables), whereby parts of the system generate smaller parts in an essentially Markovian fashion.

There is also a close analogy to quantum mechanics: in equation (13) expresses the exponential decay of the mutual information with geodesic distance through the Bayesian network; in quantum mechanics, the correlation function of a many body system decays exponentially with the geodesic distance defined by the tensor network which represents the wavefunction

Evenbly and Vidal (2011).

It is also worth examining our model using techniques from linguistics. A generic PCFG consists of three ingredients:

  1. An alphabet which consists of non-terminal symbols and terminal symbols .

  2. A set of production rules of the form , where the left hand side is always a single non-terminal character and is a string consisting of symbols in .

  3. Probabilities associated with each production rule , such that for each , .

It is a remarkable fact that any stochastic-context free grammars can be put in Chomsky normal form Chomsky (1959); Huang and Fu (1971). This means that given , there exists some other grammar such that all the production rules are either of the form or , where and and the corresponding languages . In other words, given some complicated grammar , we can always find a grammar such that the corresponding statistics of the languages are identical and all the production rules replace a symbol by at most two symbols (at the cost of increasing the number of production rules in ).

This formalism allows us to strengthen our claims. Our model with a branching factor is precisely the class of all context-free grammars that are generated by the production rules of the form . While this might naively seem like a very small subset of all possible context-free grammars, the fact that any context-free grammar can be converted into Chomsky normal form shows that our theory deals with a generic context-free grammar, except for the additional step of producing terminal symbols from non-terminal symbols. Starting from a single symbol, the deep dynamics of the PCFG in normal form are given by a strongly-correlated branching process with which proceeds for a characteristic number of productions before terminal symbols are produced. Before most symbols have been converted to terminal symbols, our theory applies, and power-law correlations will exist amongst the non-terminal symbols. To the extent that the terminal symbols that are then produced from non-terminal symbols reflect the correlations of the non-terminal symbols, we expect context-free grammars to be able to produce power law correlations.

From our corollary to Theorem 2, we know that regular grammars cannot exhibit power-law decays in mutual information. Hence context-free grammars are the simplest grammars which support criticality, e.g., they are the lowest in the Chomsky hierarchy that supports criticality. Note that our corollary to Theorem 2 also implies that not all context-free grammars exhibit criticality since regular grammars are a strict subset of context-free grammars. Whether one can formulate an even sharper criterion should be the subject of future work.

Iv Discussion

By introducing a quantity we term rational mutual information, we have proved that hidden Markov processes generically exhibit exponential decay, whereas PCFGs can exhibit power law decays thanks to the “extra dimension” in the network. To the extent that natural languages and other empirical data sources are generated by processes more similar to PCFGs than Markov processes, this explains why they can exhibit power law decays.

We will draw on these lessons to give a semi-heuristic explanation for the success of deep recurrent neural networks widely used for natural language processing, and discuss how mutual information can be used as a tool for validating machine learning algorithms.

iv.1 Connection to Recurrent Neural Networks

While the generative grammar model is appealing from a linguistic perspective, it may appear to have little to do with machine learning algorithms that are implemented in practice. However, as we will now see, this model can in fact be viewed an idealized version of a long-short term memory (LSTM) recurrent neural network (RNN) that is generating (“hallucinating”) a sequence.

Figure 4 shows that an LSTM RNN can reproduce critical behavior. In this example, we trained an RNN (consisting of three hidden LSTM layers of size 256 as described in Graves (2013)) to predict the next character in the 100MB Wikipedia sample known as enwik8 hut . We then used the LSTM to hallucinate 1 MB of text and measured the mutual information as a function of distance. Figure 4 shows that not only is the resulting mutual information function a rough power law, but it also has a slope that is relatively similar to the original.

We can understand this success by considering a simplified model that is less powerful and complex than a full LSTM, but retains some of its core features — such an approach to studying deep neural nets has proved fruitful in the past (e.g., Saxe et al. (2013)).

The usual implementation of LSTMs consists of multiple cells stacked one on top of each other. Each cell of the LSTM (depicted as a yellow circle in Fig. 3) has a state that is characterized by a matrix of numbers and is updated according to the following rule


where denotes element wise multiplication, and is some function of the input from the cell from the layer above (denoted by downward arrows in Figure 3, the details of which do not concern us. Generically, a graph of this picture would look like a rectangular lattice, with each node having an arrow to its right (corresponding to the first term in the above equation), and an arrow from above (corresponding to the second term in the equation). However, if the forget weights weights decay rapidly with depth (e.g., as we go from the bottom cell to the towards the top) so that the timescales for forgetting grow exponentially, we will show that a reasonable approximation to the dynamics is given by Figure 3.

If we neglect the dependency of on , the forget gate leads to exponential decay of e.g., ; this is how LSTM’s forget their past. Note that all operations including exponentiation are performed element-wise in this section only.

In general, a cell will smoothly forget its past over a timescale of . On timescales , the cells are weakly correlated; on timescales , the cells are strongly correlated. Hence a discrete approximation to this above equation is the following:


This simple approximation leads us right back to the hierarchical grammar. The first line of the above equation is labeled “remember” in Figure 2 and the second line is what we refer to as “Markov,” since the next state depends only on the previous. Since each cell perfectly remembers its pervious state for time-steps, the tree can be reorganized so that it is exactly of the form shown in Figure 3, by omitting nodes which simply copy the previous state. Now supposing that grows exponentially with depth , we see that the successive layers become exponentially sparse, which is exactly what happens in our deep grammar model, identifying the parameter , governing the growth of the forget timescale, with the branching parameter in the deep grammar model. (Compare Figure 2 and Figure 3.)

Figure 3: Our deep generative grammar model can be viewed as an idealization of a long-short term memory (LSTM) recurrent neural net, where the “forget weights” drop with depth so that the forget timescales grow exponentially with depth. The graph drawn here is clearly isomorphic to the graph drawn in Figure 1. For each cell, we approximate the usual incremental updating rule by either perfectly remembering the previous state (horizontal arrows) or by ignoring the previous state and determining the cell state by a random rule depending on the node above (vertical arrows).

iv.2 A new diagnostic for machine learning

How can one tell whether an neural network can be further improved? For example, an LSTM RNN similar to the one we used in Figure 3 can predict Wikipedia text with a residual entropy bits/character Graves (2013), which is very close to the performance of current state of the art custom compression software — which achieves bits/character Mahoney . Is that essentially the best compression possible, or can significant improvements be made?

Our results provide an powerful diagnostic for shedding further light on this question: measuring the mutual information as a function of separation between symbols is a computationally efficient way of extracting much more meaningful information about the performance of a model than simply evaluating the loss function, usually given by the conditional entropy


Figure 3 shows that even with just three layers, the LSTM-RNN is able to learn long-range correlations; the slope of the mutual information of hallucinated text is comparable to that of the training set. However, the figure also shows that the predictions of our LSTM-RNN are far from optimal. Interestingly, the hallucinated text shows about the same mutual information for distances , but significantly less mutual information at large separation. Without requiring any knowledge about the true entropy of the input text (which is famously NP-hard to compute), this figure immediately shows that the LSTM-RNN we trained is performing sub-optimally; it is not able to capture all the long-term dependencies found in the training data.

As a comparison, we also calculated the bigram transition matrix from the data and used it to hallucinate 1 MB of text. Despite the fact that this higher order Markov model needs more parameters than our LSTM-RNN, it captures less than a fifth of the mutual information captured by the LSTM-RNN even at modest separations . This phenomenon is related to a classic result in the theory of formal languages: a context free grammar

In summary, Figure 3 shows both the successes and shortcomings of machine learning. On the one hand, LSTM-RNN’s can capture long-range correlations much more efficiently than Markovian models; on the other hand, they cannot match the two point functions of training data, never mind higher order statistics!

Figure 4: Diagnosing different models with by hallucinating text and then measuring the mutual information as a function of separation. The red line is the mutual information of enwik8, a 100 MB sample of English Wikipedia. In shaded blue is the mutual information of hallucinated Wikipedia from a trained LSTM with 3 layers of size 256. We plot in solid black the mutual information of a Markov process on single characters, which we compute exactly. (This would correspond to the mutual information of hallucinations in the limit where the length of the hallucinations goes to infinity). This curve shows a sharp exponential decay after a distance of , in agreement with our theoretical predictions. We also measured the mutual information for hallucinated text on a Markov process for bigrams, which still underperforms the LSTMs in long-ranged correlations, despite having more parameters than

One might wonder how the lack of mutual information at large scales for the bigram Markov model is manifested in the hallucinated text. Below we give a line from the Markov hallucinations:

[[computhourgist, Flagesernmenserved whirequotes
or thand dy excommentaligmaktophy as
its:Fran at ||<If ISBN 088;&ampategor
and on of to [[Prefung]]’ and at them rector>

This can be compared with an example from the LSTM RNN:

Proudknow pop groups at Oxford
- [
--helgar.jpg] and Cape Normans’s first
attacks Cup rigid (AM).

Despite using many fewer parameters, the LSTM manages to produce a realistic looking URL and is able to close brackets correctly Karpathy et al. (2015), something that the Markov model struggles with.

Although great challenges remain to accurately model natural languages, our results at least allow us to improve on some earlier answers to key questions we sought to address :

  1. Why is natural language so hard? The old answer was that language is uniquely human. Our new answer is that at least part of the difficulty is that natural language is a critical system, with long-ranged correlations that are difficult for machines to learn.

  2. Why are machines bad at natural languages, and why are they good? The old answer is that Markov models are simply not brain/human-like, whereas neural nets are more brain-like and hence better. Our new answer is that Markov models or other 1-dimensional models cannot exhibit critical behavior, whereas neural nets and other deep models (where an extra hidden dimension is formed by the layers of the network) are able to exhibit critical behavior.

  3. How can we know when machines are bad or good? The old answer is to compute the loss function. Our new answer is to also compute the mutual information as a function of separation, which can immediately show how well the model is doing at capturing correlations on different scales.

Future studies could include generalizing our theorems to more complex formal languages such as Merge Grammars.

Acknowledgments: This work was supported by the Foundational Questions Institute The authors wish to thank Noam Chomsky and Greg Lessard for valuable comments on the linguistic aspects of this work, Taiga Abe, Meia Chita-Tegmark, Hanna Field, Esther Goldberg, Emily Mu, John Peurifoi, Tomaso Poggio, Luis Seoane, Leon Shen, David Theurel, Cindy Zhao, and two anonymous referees for helpful discussions and encouragement, Michelle Xu for help acquiring genome data and the Center for Brains Minds and Machines (CMBB) for hospitality.

Appendix A Properties of rational mutual information

In this appendix, we prove the following elementary properties of rational mutual information:

  1. Symmetry: for any two random variables and , . The proof is straightforward:

  2. Upper bound to mutual information: The logarithm function satisfies with equality if and only if (iff) . Therefore setting gives


    Hence the rational mutual information with equality iff (or simply if we use the natural logarithm base ).

  3. Non-negativity. It follows from the above inequality that with equality iff , since iff . Note that this short proof is only possible because of the information inequality . From the definition of , it is only obvious that ; information theory gives a much tighter bound. Our findings 1-3 can be summarized as follows:


    where both equalities occur iff . It is impossible for one of the last two relations to be an equality while the other is an inequality.

  4. Generalization. Note that if we view the mutual information as the divergence between two joint probability distributions, we can generalize the notion of rational mutual information to that of rational divergence:


    where the expectation value is taken with respect to the “true” probability distribution . This is a special case of what is known in the literature as -divergence Amari (1985).

    The -divergence is itself a special case of so-called -divergences Morimoto (1963); Csisz et al. (1967); Ali and Silvey (1966):


    where corresponds to .

    Note that as it is written, could be any probability measure on either a discrete or continuous space. The above results can be trivially modified to show that and hence , with equality iff .

Appendix B General proof for Markov processes

In this appendix, we drop the assumptions of non-degeneracy, irreducibility and non-periodicity made in the main body of the paper where we proved that Markov processes lead to exponential decay.

b.1 The degenerate case

First, we consider the case where the Markov matrix has degenerate eigenvalues. In this case, we cannot guarantee that can be diagonalized. However, any complex matrix can be put into Jordan normal form. In Jordan normal form, a matrix is block diagonal, with each block corresponding to an eigenvalue with degeneracy . These blocks have a particularly simple form, with block having on the diagonal and ones right above the diagonal. For example, if there are only three distinct eigenvalues and is threefold degenerate, the the Jordan form of M would be


Note that the largest eigenvalue is unique and equal to 1 for all irreducible and aperiodic M. In this example, the matrix power is


In the general case, raising a matrix to an arbitrary power will yield a matrix which is still block diagonal, with each block being an upper triangular matrix. The important point is that in block , every entry scales , up to a combinatorial factor. Each combinatorial factor grows only polynomially with , with the degree of the polynomials in the th block bounded by the multiplicity of , minus one.

Using this Jordan decomposition, we can replicate equation (7) and write


There are two cases, depending on whether the second eigenvalue is degenerate or not. If not, then the equation


still holds, since for , decays faster than any polynomial of finite degree. On the other hand, if the second eigenvalue is degenerate with multiplicity , we instead define A with the combinatorial factor removed:


If , this definition simply reduces to the previous definition of A. With this definition,


Hence in the most general case, the mutual information decays like a polynomial , where . The polynomial is non-constant if and only if the second largest eigenvalue is degenerate. Note that even in this case, the mutual information decays exponentially in the sense that it is possible to bound the mutual information by an exponential.

b.2 The reducible case

Now let us generalize to the case where the Markov process is reducible. A general Markov state space can be partitioned into subsets,


where elements in the same partition communicate with each other: it is possible to transition from and for .

In general, the set of partitions will be a finite directed acyclic graph (DAG), where the arrows of the DAG are inherited from the Markov chain. Since the DAG is finite, after some finite amount of time, almost all the probability will be concentrated in the “final” partitions that have no outgoing arrows and almost no probability will be in the “transient” partitions. Since the statistics of the chain that we are interested are determined by running the chain for infinite time, they are insensitive to transient behavior, and hence we can ignore all but the final partitions. (The mutual information at fixed separation is still determined by averaging over all (infinite) time steps.)

Consider the case where the initial probability distribution only has support on one of the . Since states in will never be accessed, the Markov process (with this initial condition) is identical to an irreducible Markov process on . Our previous results imply that the mutual information will exponentially decay to zero.

Let us define the random variable , where . For a general initial condition, the total probability within each set is independent of time. This means that the entropy is independent of time. Using the fact that , one can show that


where is the conditional mutual information. Our previous results then imply that the conditional mutual information decays exponentially, whereas the second term is constant. In the language of statistical physics, this is an example of topological order which leads to constant terms in the correlation functions; here, the Markov graph of M is disconnected, so there are degenerate equilibrium states.

b.3 The periodic case

If a Markov process is periodic, one can further decompose each final partition. It is easy to check that the period of each element in a partition must be constant throughout the partition. It follows that each final partition can be decomposed into cyclic classes , where is the period of the elements in the partition in . The arguments in the previous section with then show that the mutual information again has two terms, one of which exponentially decays, the other of which is constant.

b.4 The case

The following proof holds only for order Markov processes, but we can easily extend the results for arbitrary . Any Markov process can be converted into an Markov process on pairs of letters . Hence our proof shows that decays exponentially. But for any random variables , the data processing inequality Cover and Thomas (2012) states that , where is an arbitrary function of . Letting , and then permuting and applying gives


Hence, we see that must exponentially decay. The preceding remarks can be easily formalized into a proof for an arbitrary Markov process by induction on .

b.5 The detailed balance case

This asymptotic relation can be strengthened for a subclass of Markov processes which obey a condition known as detailed balance. This subclass arises naturally in the study of statistical physics Gardiner et al. (1985). For our purposes, this simply means that there exist some real numbers and a symmetric matrix such that


Let us note the following facts. (1) The matrix power is simply . (2) By the spectral theorem, we can diagonalize into an orthonormal basis of eigenvectors, which we label as (or sometimes ), e.g., and . Notice that

Hence we have found an eigenvector of for every eigenvector of . Conversely, the set of eigenvectors of forms a basis, so there cannot be any more eigenvectors of . This implies that all the eigenvalues of are given by , and the eigenvalues of are . In other words, and share the same eigenvalues.

(3) is an eigenvector with eigenvalue 1, and hence is the stationary state:


The previous facts then let us finish the calculation:


Now using the fact that and is therefore invariant under an orthogonal change of basis, we find that


Since the ’s are both the eigenvalues of and , and since is irreducible and aperiodic, there is exactly one eigenvalue , and all other eigenvalues are less than one. Altogether,


Hence one can easily estimate the asymptotic behavior of the mutual information if one has knowledge of the spectrum of . We see that the mutual information exponentially decays, with a decay scale time-scale given by the second largest eigenvalue :


b.6 Hidden Markov Model

In this subsection, we generalize our findings to hidden Markov models and present a proof of Theorem 2. If we have a Bayesian network of the form , one can show that using arguments similar to the proof of the data processing inequality. Hence if decays exponentially, should also decay exponentially. In what follows, we will show this in greater detail.

Based on the considerations in the main body of the text, the joint probability distribution between two visible states is given by


where the term in brackets would have been there in an ordinary Markov model and the two new factors of are the result of the generalization. Note that as before, is the stationary state corresponding to . We will only consider the typical case where is aperiodic, irreducible, and non-degenerate; once we have this case, the other cases can be easily treated by mimicking our above proof for or ordinary Markov processes. Using equation (7) and defining gives


Plugging this in to our definition of rational mutual information gives


where we have used the facts that , , and as before is asymptotically constant. This shows that exponentially decays.

Appendix C Power laws for generative grammars

In this appendix, we prove that the rational mutual information decays like a power law for a sub-class of generative grammars. We proceed by mimicking the strategy employed in the above appendix. Let be the linear operator associated with the matrix , the probability that a node takes the value given that the parent node has value . We will assume that is irreducible and aperiodic, with no degeneracies. From the above discussion, we see that removing the degeneracy assumption does not qualitatively change things; one simply replaces the procedure of diagonalizing with putting in Jordan normal form.

Let us start with the weakly correlated case. In this case,


since as we have discussed in the main text, the parent node has the stationary distribution and give the conditional probabilities from transitioning from the parent node to the nodes at the bottom of the tree that we are interested in. We now employ our favorite trick of diagonalizing and then writing


which gives


where we have defined . Now note that , since is an eigenvector with eigenvalue 1 of Hence this simplifies the above to just


From the definition of rational mutual information, and employing the fact that gives


where is a symmetric matrix and denotes the Frobenius norm. Hence


Let us now generalize to the strongly correlated case. As discussed in the text, the joint probability is modified to


where is some symmetric matrix which satisfies . We now employ our favorite trick of diagonalizing and then writing