VGEL.ME

Words Without a Grammar

Posted

How does anyone learn a language?

This sounds like a simple question, but the more you think about it, the weirder it gets. Purely by exposure to (largely positive) evidence in the form of samples from a language, humans are able to learn to speak that language fluently. Likewise base models pretrained entirely on positive evidence also seem to learn a highly fluent, if implicit model of the language.

How is this possible? Like, this was seemingly proved impossible in 1967, when E. Mark Gold formalized this problem in Language Identification in the Limit.

Gold's formalization can be described like this. Imagine you have a language L, which is a non-empty set of sentences s_1, s_2, \ldots formed from that language's alphabet. For example, the regular language (AB)+ consisting of all sentences of one or more repeated "AB"s, would be L_{AB} = \{ \text{AB}, \text{ABAB}, \text{ABABAB}, \ldots \}, but not contain, for example, the sentences "AABB" or "This language seems rather limited." Meanwhile, the language English, consisting of all English sentences, would be L_{\text{English}} = \{ \text{``This language is quite productive''}, \allowbreak \text{``Colorless green ideas sleep furiously''}, \allowbreak \ldots \}, but not contain "ABABAB" or "mindCertitude plasm" or "καλός ἐστιν."

A language family C contains languages L_1, L_2, etc - for example, the family of "AB-like" languages C_{\text{AB-like}} might contain the language of a single "AB", L_{\text{AB-single}} = \{ \text{AB} \}, along with L_{\text{AB-up-to-two}} = \{ \text{AB}, \text{ABAB} \}, \{ \text{AB}, \text{ABAB}, \text{ABABAB} \}, and so forth up to the full AB-language, \{ \text{AB}, \text{ABAB}, \text{ABABAB}, \ldots \}. Likewise, the language family C_{\text{Indo-European}} contains English, French, Latin, Greek, Sanskrit, Hindi, Tocharian, etc.

A guesser G will receive a stream of sentences s_1, s_2, \ldots from a text written in an unknown language L. After receiving each sentence, G will guess the language (this could take the form of naming the language - i.e., providing the set of all sentences in L). A class of languages C is said to be identifiable in the limit if there is any possible guesser G which, for an arbitrary, unknown L in the class, is eventually capable of correctly guessing the language and sticking to that guess without changing it.

Gold's theorem shows this is impossible for all sufficiently complex (superfinite1) classes of languages - which includes even the regular languages. (Angluin later worked out exactly which classes a learner can identify.)

As knowing a language's generator - its grammar rules - would allow you to solve the language identification task (once you have a grammar, you can enumerate all possible sentences from it), by Gold it is transitively not possible to learn the grammar of a language solely by observing sentences that are allowed by the language. (Negative feedback makes this possible - but human children get very little negative feedback - seemingly not enough to learn all the corner-cases of natural languages - and base models get none.) Simply talking at a mind should not be enough to teach that mind a language.

Yet humans and base models learn languages, simply by being talked at. So what's going on? Do humans have an innate language system? But then how do base models do it?

In Language Generation in the Limit, Kleinberg and Mullainathan reframe this problem in a very interesting way. They note that the problem a human or model learner faces is not precisely language identification. Because we assumed that knowing a language's grammar rules was necessary to produce that language, we assumed that identification was necessary for a learner.

But if we just look at what the learner is doing, we see they really have a different problem - language generation. Identification asks the learner to guess the language after receiving arbitrarily many sentences from it - to discover that language's grammar rules. But generation only requires that, after receiving arbitrarily many sentences from an unknown language, the learner only output valid sentences. After receiving each sentence, the learner G will output their own sentence, and the learner generates from L in the limit if after some number of sentences s_1, s_2, \ldots, all its output sentences are contained in L. Maybe this is an easier problem?

It is. Kleinberg and Mullainathan prove this is possible for any countable language class - a learner can always learn to generate in the limit.

This is a really cool result! It shows the power of implicit and decentralized rules - with just exposure, it was impossible to identify a single consistent system of grammar rules for the language, but we can nonetheless produce it. It's much easier to produce actors capable of participating in a system than it is to identify the structure of that system. Children learn a language easily, but symbolic linguistics is very hard.

How might this work in practice? Well, one way that K-M's learners can always produce valid sentences is by mode collapse - if there's a very complex infinite language L, but a simpler subset L' \subset L is also infinite, a learner can simply produce sentences from L' to generate L in the limit. (As a concrete example, if you were training a model to produce the union language L_{\text{English}} \cup L_{AB}, the model could game a validity metric by only producing \text{ABABABABAB}\ldots sentences, without ever needing to learn English.)

In both humans and models, there are diversity pressures against this - humans use language to get what we want, so we need to be able to produce diverse sentences (and past this, many humans seem to have some drive or attentional pull towards novel language, new constructions are inherently interesting to us); pretrained models are teacher-forced towards every sentence in the text, nudging them towards generalization. (A pretrained model has to at least try to model English in the L_{\text{English}} \cup L_{AB} scenario.) But both humans and models still show some of this mode collapse strategy: Among all human speakers who have or will or may have been able to have spoken English, will the rate of production of this (twisted but correct) sentence be consistent? jd_pressman observes a similar phenomenon in GPT-2: a bias towards simpler productions which are more easily kept grammatical.

To finish by zooming out a bit, this reminds me of a metaphor for language models2 as an economy.

Imagine two economies that each have the same GDP.

The first economy is like an extreme version of Taiwan, with a single TSMC-like company. This company is highly internally complex, and generates nearly 100% of the country's GDP.

The second economy is made up of thousands or millions of low-capital-intensity small businesses. Each business produces only a small amount of GDP. But in aggregate, all the small businesses taken together and trading with each other, the second economy can produce just as much as the first, and may even be of higher complexity.

You can think of LLMs this way, where the "GDP" is minimizing prediction error, and businesses are representations/shards/circuits/systems that require different amounts of optimization power to produce. One view of LLMs is that they must be close to the first country: some unified highly optimization-intensive "agency" or "utility maximizer" or "inner actress" system that first systematized language, and then the world. But the other view of LLMs - which this language generation approach seems to support - is that they're more like the second, many small, simpler, linguistically-derived circuits working together to create complexity. Perhaps LLM and human minds "want" things in the way the economy or the ecosystem "wants" things.

This also reminds me a bit of Garrabrant / Logical Induction, and also the arguments in the socialist calculation debate - the difficulty of centralized planning over an emergent capitalist economy being akin to the problem of linguistics struggling to identify the grammar of English vs a distributed system of humans learning to produce it effortlessly. It feels like there's some galaxy-brained unification here, which maybe someone has done already.

1

A class containing every finite language, plus at least one infinite one.

2

Which IIRC I originally heard from Jan Kulveit, though he said it more eloquently...