An Introduction to Language Models

Part Of: Language sequence
Content Summary: 1500 words, 15 min read

Why Language Models?

In the English language, ‘e’ appears more frequently than ‘z’. Similarly,  “the” occurs more frequently than “octopus”. By examining large volumes of text, we can learn the probability distributions of characters and words.

Language Models_ Letter and Word Frequency

Roughly speaking, statistical structure is distance from maximal entropy. The fact that the above distributions are non-uniform means that English is internally recoverable: if noise corrupts part of a message, the surrounding can be used to recover the original signal. Statistical structure is also used to reverse engineer secret codes such as the Roman cipher.

We can illustrate the predictability of English by generating text based on the above probability distributions. As you factor in more of the surrounding context, the utterances begin to sound less alien, and more like natural language.

Language Model_ Structure of English

A language model exploits the statistical structure of a language to express the following:

  • Assign a probability to a sentence P(w_1, w_2, w_3, \ldots w_N)
  • Assign probability of an upcoming word P(w_4 \mid w_1, w_2, w_3)

Language models are particularly useful in language perception, because they can help interpret ambiguous utterances. Three such applications might be,

  • Machine Translation: P(\text{high winds tonight}) > P(\text{large winds tonight})
  • Spelling correction: P(\text{fifteen minutes from}) > P(\text{fifteen minuets from})
  • Speech Recognition: P(\text{I saw a van}) > P(\text{eyes awe of an})

Language models can also aid in language production. One example of this is autocomplete-based typing assistants, commonly displayed within text messaging applications. 

Towards N-Grams

A sentence is a sequence of words \textbf{w} = (w_1, w_2, \ldots, w_3). To model the joint probability over this sequence, we use the chain rule:

p(\text{this is the house})

= p(\text{this})p(\text{is}\mid\text{this})p(\text{the}\mid\text{this is})p(\text{house}\mid\text{this is the})

As the number of words grows, the size of our conditional probability tables (CPTs) quickly becomes intractable. What is to be done? Well, recall the Markov assumption we introduced in Markov chains.

markov_assumption

The Markov assumption constrains the size of our CPTs. However, sometimes we want to condition on more (or less!) than just one previous word. Let v denote how many variables we admit in our context. A variable order Markov model (VOM) allows v elements in its context: p(s_{t+1} | s_{t-v}, \ldots, s_{t}). Then the size of our CPT is n=v+1, because we must take our original variable into account. Thus an N-gram is defined as a v-order Markov model. By far, the most common choices are trigrams, bigrams, and unigrams:

Language Models_ Ngram comparison (1)

We have already discussed Markov Decision Processes, used in reinforcement learning applications.  We haven’t yet discussed MRFs and HMMs. VOMs represent a fourth extension: the formalization of N-grams. Hopefully you are starting to appreciate the  richness of this “formalism family”. 🙂

Language Model_ Markov Formalisms (1)

Estimation and Generation

How can we estimate these probabilities? By counting!

ngram_v2

Let’s consider a simple bigram language model. Imagine training on this corpus:

This is the cheese.

That lay in the house that Alice built.

Suppose our trained LM encounters the new sentence “this is the house”. It estimates its probability as:

p(\text{this is the house})

= p(\text{this})p(\text{is} \mid \text{this})p(\text{the} \mid \text{is})p(\text{house} \mid \text{the}) 

= \dfrac{1}{12} * 1 * 1 * \dfrac{1}{2} = \dfrac{1}{24}

How many problems do you see with this model? Let me discuss two.

First, we have estimated that p(\text{this}) = \dfrac{1}{24}. And it is true that “this” occurs only once in our toy corpus above. But out of two sentences, “this” leads half of them. We can express this fact by adding a special START token into our vocabulary.

Second, recall what happens when language models generate speech. Once they begin a sentence, they are unable to end it! Adding a new END token will allow our model the terminate a sentence, and begin a new one.

With these new tokens in hand, we update our products as follows:

Language Models_ Sentence Estimation (1)

A couple other “bug fixes” I’ll mention in passing:

  • Out-of-vocabulary words are given zero probability. It helps to add an unknown  (UNK) pseudoword and assign it some probability mass.
  • LMs prefer very short sentences (sequential multiplication is monotonic decreasing). We can address this e.g., normalizing by sentence length.

Smoothing

In the last sentence in the image above, we estimate p(END|house) = 0, because we have no instances of this two-word sequence in our toy corpus. But this causes our language model to fail catastrophically: the sentence is deemed impossible (0% probability).

This problem of zero probability increases as we increase the complexity of our N-grams. Trigram models are more accurate than bigrams, but produce more p=0 events. You’ll notice echoes of the bias-variance (accuracy-generalization) tradeoff.

How can we remove zero counts? Why not add one to every word? Of course, we’d then need to increase the size of our denominator, to ensure the probabilities still sum to one. This is Laplace smoothing

Language Model_ Laplace Smoothing

In a later post, we will explore how (in a Bayesian framework) such smoothing algorithms can be interpreted as a form of regularization (MAP vs MLE).

Due to its simplicity, Laplace smoothing is well-known  But several algorithms achieve better performance.  How do they approach smoothing?

Recall that a zero count event in an N-gram is not likely to occur in (N-1)-gram model. For example, it is very possible that the phrase “dancing were thought” hasn’t been seen before. 

Language Model_ Backoff Smoothing

While a trigram model may balk at the above sentence, we can fall back on the bigram and/or unigram models. This technique underlies the Stupid Backoff algorithm.

As another variant on this theme, some smoothing algorithms train multiple N-grams, and essentially use interpolation as an ensembling method. Such models include Good-Turing and Kneser-Ney algorithms.

Beam Search

We have so far seen examples of language perception, which assigns probabilities to text. Let us consider language perception, which generates text from the probabilistic model. Consider machine translation. For a French sentence \textbf{x}, we want to produce the English sentence \textbf{y} such that y^* = \text{argmax } p(y\mid x).  

This seemingly innocent expression conceals a truly monstrous search space. Deterministic search has us examine every possible English sentence. For a vocabulary size V, there are V^2 possible two-word sentences. For sentences of length n, our time complexity of our brute force algorithm is O(V^n).

Since deterministic search is so costly, we might consider greedy search instead. Consider an example French sentence \textbf{x} “Jane visite l’Afrique en Septembre”. Three candidate translations might be,

  • y^A: Jane is visiting Africa in September
  • y^B: Jane is going to Africa in September
  • y^C: In September, Jane went to Africa

Of these, p(y^A|x) is the best (most probable) translation. We would like greedy search to recover it.

Greedy search generates the English translation, one word at a time. If “Jane” is the most probable first word \text{argmax } p(w_1 \mid x), then the next word generated is \text{argmax } p(w_2 \mid \text{Jane}, x). However, it is not difficult to contemplate p(\text{going}\mid\text{Jane is}) > p(\text{visiting}\mid\text{Jane is}), since the word “going” is used so much more frequently in everyday conversation. These problems of local optima happen surprisingly often.

The deterministic search space is too large, and greedy search is too confining. Let’s look for a common ground.

Beam search resembles greedy search in that it generates words sequentially. Whereas greedy search only drills one such path in the search tree, beam search drills a finite number of paths. Consider the following example with beamwidth b=3

beam_search

As you can see, beam search elects to explore y^A as a “second rate” translation candidate despite y^B initially receiving the most probability mass. Only later in the sentence does the language model discover the virtues of the y^A translation. 🙂

Strengths and Weaknesses

Language models have three very significant weaknesses.

First, language models are blind to syntax. They don’t even have a concept of nouns vs. verbs!  You have to look elsewhere to find representations of pretty much any latent structure discovered by linguistic and psycholinguistic research.

Second, language models are blind to semantics and pragmatics. This is particularly evident in the case of language production: try having your SMS autocomplete write out an entire sentence for you. In the real world, communication is more constrained: we choose the most likely word given the semantic content we wish to express right now.

Third, the Markov assumption is problematic due to long-distance dependencies. Compare the phrase “dog runs” vs “dogs run”. Clearly, the verb suffix depends on the noun suffix (and vice versa). Trigram models are able to capture this dependency. However, if you center-embed prepositional phrases, e.g., “dog/s that live on my street and bark incessantly at night run/s”, N-grams fail to capture this dependency.

Despite these limitations, language models “just work” in a surprising diversity of applications. These models are particularly relevant today because it turns out that Deep Learning sequence models like LSTMs share much in common with VOMs. But that is a story we shall have to take up next time.

Until then.

 

Advertisements

[Video] An introduction to reinforcement learning

Part Of: Reinforcement Learning sequence

Sorry it’s been so long since my last post!  I’ve been teaching a Deep Learning class, based on Andrew Ng’s Coursera specialization.  Don’t worry, my other lectures will ultimately be cleaned & shared here too 🙂

This talk covers the mathematical intuitions of RL, which draws from content relating to Markov Chains and Markov Decision Processes. It also contains some novel material, including my thoughts on how RL compares with other machine learning techniques.

 

The Relational Sphere Hypothesis

Part Of: Demystifying Sociality sequence
Followup To: The Three Spheres of Culture
Content Summary: 1700 words, 17 min read

A Theory of Relationship Dynamics

How can we make sense of social life? Let’s start by considering a simple cup of coffee.  

  1. In my own house, I can just help myself to as much as I want, sharing with others in the framework of “what’s mine is yours.”  
  2. Or my friend can get me a cup of coffee in return for the one I got for him yesterday, so we take turns or match small favors for each other.
  3. At Starbucks, I buy my coffee, using price and value as the framework.
  4. To my children, however, none of these principles apply. To them, coffee is something that only “big people” are allowed to drink: It is a privilege that goes with social rank.

What is true of a humble cup of coffee is true of the moral dilemmas surrounding major policy questions such as organ donation. Decisions have to be made, and there are again four fundamental ways to make them:

  1. Should we hold a lottery, giving each person an equal chance?  
  2. Should we somehow rank the social importance of potential recipients?
  3. Should we sell organs to the highest bidder?  
  4. Or should we expect everyone in a local community to give freely, offering a kidney to anyone group member in need?

(The above excerpt is from [FE] )

Relational Models Theory (RMT) proposes that these four social categories are exhaustive and culturally universal. Human interactions are complex, and typically use more than one of the above processes. But every relationship, in every culture, seems to be some combination of the following:

  • In Communal Sharing (Communality), people are viewed as equals oriented around some particular identity. This can include being in love, sports fans, and co-religionists.
  • In Authority Ranking (Dominance), people are situated in a hierarchy where superiors are deferred to, respected, and in some cases obeyed.
  • In Equality Matching (Reciprocity) people are interested in restoring balance, turn-taking, and making sure everyone is treated fairly. 
  • In Market Pricing (Exchange), relationships are governed by quantitative, utilitarian concerns such as prices, exchanges, or cost-benefit analyses.

We can use relational models to explain a wide swathe of social phenomena:

  • Some examples of norm violation are in fact category errors. For example, we would interpret a situation such as the price of our meal is two hours on dishwasher duty as a conflation of Market Pricing vs. Equality Matching.
  • Some (but not all) examples of taboo trade-offs are in fact category errors. The Finite Price of Human Life thesis feels counterintuitive because it pits our Market Pricing versus the sacred values held by Communality.
  • Humans often use indirect speech acts to reconcile relationship types with semantic content.Rather than saying e.g., “pick me up after work”, we often say things like, “If you would pick me up after work, that would be awesome”. While more verbose, the latter expression feels more polite because it is couched in a Communality frame, rather than signaling Dominance.

In addition to its explanatory reach, multiple strands of evidence come together in support of  Relational Model theory:

  • Factor analysis. If you ask people to describe their relationships, you can see whether your theory predicts statistical patterns in their responses. When RMT was compared with other taxonomies (and there are a lot of them), RMT starkly outperforms its competitors. 
  • Ethnographies. RMT was invented by anthropologist Alan Fiske to capture regularities he saw across different cultures. For example, he found examples of marriage treated as Dominance, as Market Pricing, etc – but never a fifth type. A number of cross-cultural studies indicate that the four relational models constitute a human universal.
  • Social errors. When people misremember a person’s name, it tends to be a person with whom they share the same relationship type. For example, if you flub the name of your boss, you are more likely to say the name of someone else in a position of authority over you.
  • Brain studies.  In the cortex, the default mode network is universally acknowledged to perform social processing. But within this specialized region, different subregions are activated when processing e.g., Communality vs Reciprocity relationships.

The Relational Sphere Hypothesis

Human societies can be conceived as operating in three spheres: markets, governments, and communities. The Cultural Sphere Hypothesis holds this trichotomy to be fundamental, and exhaustive of social space.

Relational Models_ Cultural Regime Dissociations (4)

There seems to be a relationship between the cultural spheres and relation models. But there are three spheres vs four models. What gives?

Things become more clear when we remember that market- based economies were invented during the Neolithic Revolution, with the dawn of agriculture. Before this inflection point in history, transactions took place with gift economies.

This suggests that the Market Pricing relational model is evolutionarily recent: before the invention of agriculture, it simply did not exist.

Relational Model Theory_ Models vs Spheres (3)

I call this particular mapping from relational models to cultural spheres the Relational Sphere Hypothesis (RSH). It is an intertheoretic reduction: it purports to be a significant join point between micro- and macro-sociality.

RSH predicts that three out of four relational models can be traced back to the birthplace of Homo Sapiens. Thus, we should expect predecessors for these relationship categories in primate societies! And we find precisely that:

  • Dominance models are expressed in the dominance hierarchy (where physical dominance slowly gave way to symbolic dominance).
  • Communality models are expressed in kin selection (where attachment to and care for relatives was slowly extended towards e.g. close friends).
  • Reciprocity models are expressed in reciprocal altruism (where increasingly large delays between favor-transactions became possible).

I have argued elsewhere that the dual-process models so popular in today’s moral psychology can be captured in the interactions between (cortical) propriety frames and (subcortical) social intuitions. These two systems comprise the building blocks of sociality. RSH dovetails nicely with this dual process account, as it perceives categories within these systems, each with its own distinctive logic:

rmt_categorization

With the exception of Sanctity, these subconscious social intuitions arguably exist in primates. For example, here is evidence that rhesus monkeys have strong intuitions about Fairness:

A New Kind of Social Network

The Relational Sphere Hypothesis can be further illustrated by social networks: graphs where nodes are individuals, and edges are relationships. These kinds of models are very common across many disciplines that study aggregate social phenomena; for example evolutionary game theorists. A social network may look something like this:

Relational Models_ Aggregated Social Networks

But relationships inhabit different categories. We can express this fact by coloring edges according to their relational model:

Relational Models_ Complete Social Network (2)

Note that some nodes (e.g. A and B) are connected by more than one color. This signifies that the relationship between A and B features both Communality and Dominance.

From this more complete picture of human relationships, we can derive our cultural spheres by examining the (mono-color) subgraphs:

Relational Models_ Social Network Subgraphs (2)

Sphere Evolution & Competition

Political, social, and economic institutions have dramatically changed across the course of human history. As we saw in Deep History of Humanity, the evolution of our species can be usefully divided into three time periods:

Relational Models_ Sphere Evolution (1)

 

The Sphere Competition Conjecture comprises a set of informal intuitions that relational models “competes for our attention”: gains in one sphere are often accompanied by losses in another.

Let me illustrate this conjecture with examples. 🙂

Social vs Economic spheres

  • The religious instinct is etched deeply into the hominid mind, and evidence for shamanic animism dates back to the advent of behavioral modernity. Modern religion is located squarely within the Social sphere. But what caused its institutionalization, the invention of the full-time religious specialist: the priest? Religious institutions were founded during the transition from gift economy to market economies. For the first time in history, material wealth mattered more in transactions than interpersonal reputation. With the Social sphere threatening to collapse, perhaps it is not a coincidence that it was at this moment in history that religion became more explicitly social.
  • Some existential philosophers argue that the industrial revolution, with its obscenely large increase in Economic productivity, has correlated with a weakening of Social values, as witnessed empirically by the rise of materialism. Perhaps the malaise and cynicism of postmodernity can be explained by the weakening of the ties of community.
  • The custom of tipping can be conceived as an organ of Sociality, that feels misplaced in today’s Market-oriented economy. This institution shows no signs of abating (for example, Uber recently rescinded its no-tipping policy). Perhaps the reason this Social technology persists, while others have disintegrated, is because tipping solves the principal agent problem: customer service is otherwise not factored into the price, because that information is not easily available to management.  
  • Product boycotts are another example of Social outrage affecting Economic markets.

Social vs Political.

  • Another important event in the history of religion is the transition to universal religions: where the concerns of the gods and the consequences of moral violations were imbued with an aura of the eternal. Anthropological evidence clearly suggests that universal religions succeeded because they facilitated larger group sizes.
  • Corruption is often treated as a political problem, but in fact bribery and collusion both require high amounts of social capital.
  • In American history, political partisanship has been most severe in the 1880s, and at present. Both then and now are periods of an intense drought of social capital. Further, participation in voting strongly correlates with vibrant community and civic life. We might conjecture that weaker communities are more vulnerable to partisanship infighting. This conjecture is aligned with the oft-cited observation that partisanship tends to correlate with moderates abandoning the political arena.

Economic vs Political.

  • Capitalist Peace Theory formalizes the observed inverse relationship between free trade and international conflict. On this hypothesis, one of the strongest predictors of war is resource acquisition, and the risk-benefit calculus changes (improves) substantially with the removal of tariffs.

Economic vs Political vs Social.

  • The Size of Nations Hypothesis is the idea that the size of nation (Political) is driven by two competing factors: larger nations are able to produce public goods more efficiently (Economic), but conversely their populations are more heterogenous and thereby less cohesive (Socially).

Some of the phenomena described above have been extensively studied by social scientists. However, to my knowledge, no extant models robustly capture the doctrine of relational model theory. Perhaps the next generation of formal models will do better.

Recommended Resources

[Excerpt] The Three Spheres of Culture

The Three Sphere Hypothesis

Most people agree that human societies operate in different contexts: markets, governments, and communities. The Three Sphere Hypothesis holds that this trichotomy is fundamental and exhaustive of social space. What’s more, these spheres interact. Neither markets nor governments nor communities can be analyzed thoroughly without understanding their dependence upon, and their effects upon, the others.

Relational Models_ Cultural Regime Dissociations (4)

[Excerpt] Intellectual History of the Hypothesis

Source: Wicks (2009). A Model of Dynamic Balance among the Three Spheres of Society

Social scientists – including economists – as well as journalists and others, often refer to “the economic, political, and social conditions” underlying any particular situation, but usually without any further analysis of what these terms imply, and how they relate to each other.

Apparent references to these three spheres pop up – in both popular and technical literature – almost everywhere. It can be a fun game, like “whack-a-mole”:

  • Where and how will the three spheres “pop up” in this or that text?
  • And, given any set of three social attributes that do “pop up”, can they be seen in some way as representing the three spheres?

Etzioni (1996:122) speaks of “three different conditions: paid, coerced, or convinced”; Etzioni (1988) explores motivations in the community sphere at length.

Personalist economics, based on Catholic theology, also recognizes three organizing principles: competition, intervention, and cooperation (Jonish and Terry, 1999:465-6; O’Boyle, 1999:536-7, 2000:550-51).

Hirschman (1992) referred to three social mechanisms: exit, voice, and loyalty. Though all three can apply in varying ways to each sphere, exit refers primarily to the market sphere where, in a competitive situation, one has unlimited choice of buyers or sellers, so can “exit” from any one. Voice might refer primarily to the political sphere, where one can attempt to influence results by persuasion, and loyalty to the community sphere – though one could argue the other way as well.

Streeck and Smitter (1985:1) refer to these “three basic mechanisms of mediation or control” (Ouchi, 1980) as spontaneous solidarity, hierarchical control, and dispersed competition.

Friedland and Alford (1991:39) refer to three domains with different “logics of action”: In the marketplace, we are more likely to base our actions on individual utility and efficient means; in the polity, on democracy and justice; and in the family, on mutual support.

Van Staveren (2001:24) asserts that “three values appear time and again in economic analysis: liberty, justice, and care. Markets tend to express freedom, states to express justice, and unpaid labor to express care among human beings.” She notes (p. 213) that Ayres (1961:170) asserted a similar set of core human values: “freedom, equality, and security”. Van Staveren (p. 203) also notes:

  • the form that these values take: exchange, redistribution, and giving;
  • the locations where they operate: market, state, and the care-economy; and
  • the corresponding virtues: prudence, propriety, and benevolence.

She further asserts that there are “distinct emotions and forms of deliberation as well”.

Mackey (2002:384) refers to “economic, political, and social problems” in Saddam’s Iraq; elsewhere (p. 181) she uses a different order, referring to “the new political, social, and economic paradigm” (an order which Rothstein and Stolle, 2007:1, also use); and yet elsewhere (p. 49) she notes that something “meant more socially, politically, and economically”. The order of expression doesn’t seem to matter, to Mackey or to most other authors, and one can easily find the other three permutations as well (e.g., Friedman, 2000:131; Giddens and Pierson, 1998:89; Sage, 2003).

But the community sphere is often ignored, and thus is sometimes considered third (Adaman and Madra, 2002). In political theory, the “Third Way” (Giddens, 1998) represents an alternative to either markets or governments, focused more in communities.

Waterman (1986:123) asserts “three freedoms: economic, political, and religious (conscience)”; and Hobson (1938/1976:52) refers to “the democratic triad of liberty, equality, fraternity”.

As some of these examples illustrate, a wide variety of words are used to refer to the three spheres, as in the title of the book (cited by Bennett, 1985) Mexico: Catholicism, Capitalism, and the State, or when

  • Mackey (2002:217) discusses “political, economic, and… cultural control”;
  • Bowles (1998:105) refers to “states, communities, and markets”;
  • Wright (2000:211) refers to “governance, moral codes, and markets”;
  • Mauss (1925/1967:52) refers to the “law, morality, and economy of the Latins” and to “the distinction between ritual, law, and economic interest”;
  • Yuengert (1999:46) discusses “free markets circumscribed within a tight legal framework, and operating within a humane culture”;
  • Polanyi (1997:140), in discussing “economic life”, refers to “freedom under law and custom, as laid down and amended when necessary by the State and public opinion”.

In The Foundations of Welfare Economics (1949:230), Little points out that “if a person argues that a certain change would increase economic welfare, it is open to anyone to argue that it would decrease spiritual or political welfare.”

This tripartite taxonomy has been used by economists since Adam Smith who, of course, had first written The Theory of Moral Sentiments (1759/1982) about communities and social goods, then The Wealth of Nations (1776/1976) about markets, economics. But he was planning a third major work – which was never completed – on the political system (Smith, 1759/1982:342 and “Advertisement” therein).

Minowitz (1993) uses the same tripartite taxonomy twice (in varying order) in the title of his book: Profits, Priests, and Princes: Adam Smith’s Emancipation of Economics from Politics and Religion.

The English economist and theologian Philip Wicksteed referred to “business, politics, and the pulpit” in his book of sermons titled Is Christianity Practical? (1885/1920, referenced in Steedman 1994:83). In discussing Wicksteed’s work, Steedman (p. 99) also refers to “potatoes, politics, and prayer”. Similarly, Hobson (1938/1976:55) referred to “the purse, power, and prestige of the ruling classes in business, politics, and society”. Success itself is often defined as “wealth, fame, and power” (Bogle, 2004:1; Carey, 2006), or sometimes as “money, status, and power”.

A similar tripartite taxonomy – perhaps Marxian – of firms, social classes, and states, can easily be seen as referring to the three spheres.

According to Trotsky (1957:255), communism would demonstrate that the human race had “ceased to crawl on all fours before God, kings, and capital” (quoted by Minowitz, 1993:240).

A variety of sources also provide evidence of an apparently widespread belief that the three spheres are both fundamental and exhaustive of social space. Michael Novak refers to the “three mutually autonomous institutions: the state, economic institutions, and cultural, religious institutions” as “the doctrine of the trinity in democratic capitalism” (Abdul-Rauf, 1986:175; also Neuhaus, 1986:517).

Dasgupta (1993:104) notes “one overarching idea, that of citizenship, with its three constituent spheres: the civil, the political, and the socio-economic.”

Meyer et al. (1992:12) assert that “individuals must acquire the means to participate effectively in the economic, social, and political life of the nation.” In the same work, Wong (1992:141) makes it clear that these three spheres are considered exhaustive by referring to “all social domains… economy… polity… and… cultural system”.

Polanyi (1997:158) describes the Russian Revolution and the Soviets’ “project for a new economic, political, and social system of mankind”.

Shadid (2001:3) points out that “political Islam, or Islamism…suggests an all-embracing approach to economics, politics, and social life.”

Dicken (2007:538) says that “corporate social responsibilities span the entire spectrum of relationships between firms [and] states, civil society, and markets.”

 

The Deep History of Humanity

Human Milestones

A graphic I created summarizing key cultural and biological milestones.

Human Deep History_ Master Timeline (3)

Note that time is situated on a logarithmic scale. Full resolution image here.

Hominid Phylogeny

Of course, the hominid line began diverging genetically from that of other primates around 7 million year ago.

Human Deep History_ Homo Sapiens Phylogeny (3)

Image from Berkeley’s Understanding Evolution. Full resolution image here.

Out of Africa

Finally, here is the geography & timeline of the emigration waves out of Africa, courtesy of Huffington Post and National Geographic.

Human Deep History_ Out of Africa (1)

A couple facts that provide context on our journey out of Africa:

Related Content

This post bears on the history of human- and hominid-like species.

The Symmetric Group

Part Of: Algebra sequence
Followup To: An Introduction to Geometric Group Theory
Content Summary: 1800 words, 18 min read

On Permutations

In the last few posts, we have discussed algebraic structures whose sets contain objects (e.g., numbers). Now, let’s consider structures over a set of functions, whose binary operation is function composition.

Definition 1. Consider two functions f and g. We will denote function composition of g(f(x)) as f \bullet g. We will use this notation instead of the more common g \circ f.  Both represent the idea “apply f, then g“. 

Consider G = (\left\{ f(x) = 2x, g(x) = x+1, h(x) = 2x + 2, i(x) = 2x+1 \right\}, \bullet)

Is this a group? Let’s check closure:

  • g \bullet f = 2(x+1) = h \in G
  • f \bullet g = (2x)+1 = i \in G
  • f \bullet h = 2(2x)+2 \not\in G

Closure is violated. G isn’t even a magma! Adding j(x) = 4x+2 to the underlying set exacerbates the problem: then both f \bullet j \not\in G and g \bullet j \not\in G.

So it is hard to establish closure under function composition. Can it be done?

Yes. Composition exhibits closure on sets of permutation functions. Recall that a permutation is simply a bijection: it re-arrange a collection of things. For example, here are the six possible bijections over a set of three elements.

Symmetry Group_ Permutation Options

Definition 2. The symmetric group S_n denotes composition over a set of all bijections (permutations) over some set of n objects. The symmetric group is then of order n!.

The underlying set of S_{3} is the set of all permutations over a 3-element set. It is of order 3! = 3 \times 2 \times 1 = 6.

This graphical representation of permutations is rather unwieldy. Let’s switch to a different notation system!

Notation 3: Two Line Notation. We can use two lines to denote each permutation mapping \phi. The top row represents the original elements x, the bottom represents where each element has been relocated \phi(x).

Symmetric Group_ Two Line Notation

Two line notation is sometimes represented as an array, with the top row as matrix row, and bottom denoting matrix column. Then the identity matrix represents the identity permutation.

Definition 4. A cycle is a sequence of morphisms that forms a closed loop. An n-cycle is a cycle of length n. A 1-cycle does nothing. A 2-cycle is given the special name transposition. S_3 has two permutations with 3-cycles: can you find them?

Theorem 5. Cycle Decomposition Theorem. Every permutation can be decomposed into disjoint cycles. Put differently, a node cannot participate in more than one cycle. If it did, its parent cycles would merge.

Notation 6: Cycle Notation. Since permutations always decompose into cycles, we can represent them as (A_1\ A_2\ \ldots\ A_n), pronounced “A_1 goes to A_2 goes to …”.

Symmetric Group_ Cycle Notation (1)

Cycle starting element does not matter: (A\ C\ B) = (C\ B\ A) = (B\ A\ C).

The Cycle Algorithm

It is difficult to tell visually the outcome of permutation composition. Let’s design an algorithm to do it for us!

Algorithm 7: Cycle Algorithm. To compose two permutation functions a(S) and b(S), take each element s \in S and follow its arrows until you find the set of disjoint cycles. More formally, compose these functions x times until you get (a \bullet b)^x(s) = s.

Here’s a simple example from S_{3} = ( \left\{ 0, 1, 2, 3, 4, 5 \right\}, \bullet ).

Symmetric Group_ Cycle Algorithm S3 Ex (2)

Make sense? Good! Let’s try a more complicated example from S_4.

Symmetric Group_ Cycle Algorithm S4 Ex (1)

A couple observations are in order.

  • 1-cycles (e.g., (A)) can be omitted: their inclusion does not affect algorithm results.
  • Disjoint cycles commute: (B\ D),(A\ C) = (A\ C),(B\ D). Contrast this with composition, which does not commute (B\ D) \bullet (A\ C) \neq (A\ C) \bullet (B\ D).

Now, let’s return to S_{3} for a moment, with its set of six permutation functions. Is this group closed? We can just check every possible composition:

Symmetric Group_ Permutation Composition

From the Cayley table on the right, we see immediately that S_{3} is closed (no new colors) and non-Abelian (not diagonal-symmetric).

But there is something much more interesting in this table. You have seen it before. Remember the dihedral group D_{3}? It is isomorphic to S_{3}!

Symmetric Group_ D3 S3 Isomorphism (3)

If you go back to the original permutation pictures, this begins to make sense. Permutations 1 and 2 resemble rotations/cycles; 3, 4, and 5 perform reflections/flips.

Generators & Presentations

In Theorem 7, we learned that permutations decompose into cycles. Let’s dig deeper into this idea. 

Theorem 8. Every n-cycle can be decomposed into some combination of 2-cycles. In other words, cycles are built from transpositions.

The group S_{3} = \left\{ 0, 1, 2, 3, 4, 5 \right\}, \bullet) has three transpositions 3 = (A\ B), 4 = (B\ C), and 5 = (A\ C).

Transpositions are important because they are generators: every permutation can be generated by them. For example, 1 = 3 \bullet 4. In fact, we can lay claim to an even stronger fact:

Theorem 9. Every permutation can be generated by adjacent transpositions. Every permutation S_{n} = \langle (1 2), (2 3), \ldots, (n-1\ n) \rangle.

By the isomorphism S_3 \cong D_3 , we can generate our “dihedral-looking” Cayley graph by selecting generators 1=(A\ B\ C) and 3 = (B\ C).

But we can use Theorem 9 to produce another, equally valid Cayley diagram. There are two adjacent transpositions in S_{3}: 3 and 4. All other permutations can be written in terms of these two generators:

  • 0 = 3 \bullet 3.
  • 1 = 3 \bullet 4.
  • 2 = 4 \bullet 3.
  • 5 = 3 \bullet 4 \bullet 3

This allows us to generate a transposition-based Cayley diagram. Here are the dihedral and transposition Cayley diagrams, side by side:

Symmetric Group_ Cayley Diagram (4)

We can confirm the validity of the transposition diagram by returning to our multiplication table: 1 \bullet 3 = 5 means a green arrow 1 \rightarrow 5.

Note that the transposition diagram is not equivalent cyclic group C_6, because arrows in the latter are monochrome and unidirectional.

We’re not quite done! We can also rename our set elements to employ generator-dependent names, by “moving clockwise”:

Symmetric Group_ Abstract Cayley Diagram

We could just as easily have “moved counterclockwise”, with names like 3 \mapsto r, 1 \mapsto rl. And we can confirm by inspection that, in fact, rl = lrlr etc.

Using the original clockwise notation, one presentation of S_3 becomes:

S_3 = \langle l, r \mid r^2 = e, l^2 = e, (lr)^3 = e \rangle

Towards Alternating Groups

Any given permutation can be written as a product of permutation. Consider, for example, the above equalities

  • 1 = rl = lrlr = (lr)^3rl. These have 2, 4, and 8 permutations, respectively. 
  • 5 = lrl = lrl^3 = l^3r^3l^3. These have 3, 5, and 9 permutations, respectively.

Did you notice any patterns in the above lists? All expressions for 1 require an even number of transpositions, and all expressions of 5 require an odd number. In other words, the parity (evenness or oddness) of a given permutation doesn’t seem to be changing. In fact, this observation generalizes:

Theorem 10. For any given permutation, the parity of its transpositions is unique.

Thus, we can classify permutations by their parity. Let’s do this for S_3:

  • 0, 1, 2 are even permutations.
  • 3, 4, 5 of odd permutations.

Theorem 11. Exactly half of S_n are even permutations, and they form a group called the alternating group A_n. Just as \lvert S_n \rvert = n!, A_n has \dfrac{n!}{2} elements. 

Why don’t odd permutations form a group? For one thing, it doesn’t contain the identity permutation, which is always even.

Let’s examine A^3 = (\left\{ 0, 1, 2 \right\}, \bullet ) in more detail. Does it remind you of anything?

It is isomorphic to the cyclic group C_3 ..!

Symmetric Group_ C3 A3 Isomorphism (1)

We have so far identified the following isomorphisms: S_3 \cong D_3 and A_3 \cong C_3. Is it also true that e.g., S_4 \cong D_4 and A_4 \cong C_4?

No! Recall that the \lvert D_n \rvert=2n and \lvert C_n \rvert = nOnly n \neq 3, these sets are not even potentially isomorphic.  For example:

  • \lvert D_4 \rvert=2 \times 4 = 8 \neq 24 = 4! = \lvert S_4 \rvert.
  • \lvert C_4 \rvert= 4 \neq 12 = \frac{24}{2} = \lvert A_4 \rvert.

For these larger values of n, the symmetric group is much larger than dihedral and cyclic groups.

Applications

Why do symmetric & alternating groups matter? Let me give two answers.

Perhaps you have seen the quadratic equation, the generic solution to quadratic polynomials ax^2 + bx + c = 0.

x = \dfrac{-b \pm \sqrt{b^2 - 4ac}}{2a}

Analogous formulae exist for cubic (degree-3) and quartic (degree-4) polynomials. 18th century mathematics was consumed by the theory of equations: mathematicians attempting to solve quintic polynomials (degree-5). Ultimately, this quest proved to be misguided: there is no general solution to quintic polynomials.

Why should degree-5 polynomials admit no solution? As we will see when we get to Galois Theory, it has to do with the properties of symmetric group S_5.

A second reason to pay attention to symmetric groups comes from the classification theorem of finite groups. Mathematicians have spent decades exploring the entire universe of finite groups, finding arcane creatures such as the monster group, which may or may not explain features of quantum gravity.

One way to think about group space is by the following periodic table:

Symmetric Group_ Periodic Table

Image courtesy of Samuel Prime

Crucially, in this diverse landscape, the symmetric group plays a unique role:

Theorem 12: Cayley’s Theorem. Every finite group is a subgroup of the subgroup S_n, for some sufficiently large n.

For historical reasons, subgroups of the symmetric group are usually called permutation groups.

Until next time.

Wrapping Up

Takeaways:

  • The symmetric group S_n is set of all bijections (permutations) over some set of n objects, closed under function composition.
  • Permutations can be decomposed into disjoint cycles: cycle notation uses this fact to provide an algorithm to solve for arbitrary compositions.
  • All permutations (and hence, the symmetric group) can be generated by adjacent transpositions. This allows us to construct a presentation of the symmetric group.
  • Permutations have unique parity: thus we can classify permutations as even or odd. The group of even presentations is called the alternating group A_n.
  • It can be shown that S_3 \cong D_3 and A_3 cong C_3. However, for larger n, the symmetric and alternating group are much larger than cyclic and dihedral groups.

The best way to learn math is through practice! If you want to internalize this material, I encourage you to work out for yourself the Cayley table & Cayley diagram for S_4. 🙂

Related Resources

For a more traditional approach to the subject, these Harvard lectures are a good resource.

An Introduction to Geometric Group Theory

Part Of: Algebra sequence
Followup To: An Introduction to Abstract Algebra
Content Summary: 1500 words, 15 min read

An Example Using Modular Addition

Last time, we saw algebraic structures whose underlying sets were infinitely large (e.g., the real numbers \mathbb{R}). Are finite groups possible?

Consider the structure ( \left\{ 0, 1, 2, 3 \right\}, +). Is it a group? No, it isn’t even a magma: 2 + 3 \not\in \left\{ 0, 1, 2, 3 \right\}! Is there a different operation that would produce closure?

Modular arithmetic is the mathematics of clocks. Clocks “loop around” after 12 hours. We can use modulo-4 arithmetic, or +_{4}, on  \left\{ 0, 1, 2, 3 \right\}. For example, 2 +_{4} 3 = 1.

To check for closure, we need to add all pairs of numbers together, and verify that each sum has not left the original set. This is possible with the help of a Cayley table. You may remember these as elementary school multiplication tables 😛 .

Geometrical Group Theory_ C4 Cayley Table Modular Arithmetic

By inspecting this table, we can classify Z_4 = ( \left\{ 0, 1, 2, 3 \right\} ), +_{4}).

  1. Does it have closure? Yes. Every element in the table is a member of the original set.
  2. Does it have associativity? Yes. (This cannot be determined by the table alone, but is true on inspection).
  3. Does it have identity? Yes. The rows and columns associated with 0 express all elements of the set.
  4. Does it have inverse? Yes. The identity element appears in every row and every column.
  5. Does it have commutativity? Yes. The table is symmetric about the diagonal.

Therefore, Z_4 is an abelian group.

An Example Using Roots of Unity

Definition 1. A group is said to be order n if its underlying set has cardinality n.

So Z_4 is order 4. What other order-4 structures exist?

Consider the equation i^4 = -1. Its solutions, or roots, is the set \left\{ 1, i, -1, -i \right\}. This set is called the fourth roots of unity.

So what is the Cayley table of this set under multiplication R_{4} = ( \left\{ 1, i, -1, -i \right\}, *)? In the following table, recall that i = \sqrt{-1}, thus i^2 = (sqrt{-1})^2 = -1.

Geometric Group Theory_ C4 Cayley Table Roots of Unity (1)

Something funny is going on. This table (and its colors) are patterned identically to Z_4! Recall that a binary operation is just a function f : A \times A \rightarrow A. Let’s compare the function maps of our two groups:

Cyclic Groups_ Binary Operation as Function (2)

These two groups for structurally identical: two sides of the same coin. In other words, they are isomorphic, we write Z_{4} \cong R_{4}. Let us call this single structure C_4.

But why are these examples of modular arithmetic and complex numbers equivalent?

One answer involves an appeal to rotational symmetry. Modular arithmetic is the mathematics of clocks: the hands of the clock rotating around in a circle. Likewise, if the reals are a number line, complex numbers are most naturally viewed as rotation on a number plane.

This rotation interpretation is not an accident. It helps use more easily spot other instances of C_4. Consider, for instance, the following shape.

Geometric Group Theory_ Rotational Symmetry Object

On this shape, the group of rotations that produce symmetry is W_4 = (\left\{ 0, 90, 180, 270 \right\}, \text{rotate}). Inspection reveals that this, too, is isomorphic to C_{4}!

Towards The Presentation Formalism

We describe C_3 as a cyclic group, for reasons that will become clear later. 

Theorem 2. For every cyclic group C_n, there exists some generator g in its underlying set such that every other set element can be constructed by that generator.

Definition 3. When a generator has been identified, we can express a group’s underlying set with generator-dependent names. Two notation are commonly used in practice:

  1. In multiplicative notation, the elements are renamed \left\{ e, r, r^2, r^3 \right\}, where r is any generator.
  2. Similarly, in additive notation, the elements become \left\{ e, r, 2r, 3r \right\}.

Geometric Group Theory_ Multiplicative and Additive Notation (1)

These two notation styles are interchangeable, and a matter of taste. In my experience, most mathematicians prefer multiplicative notation.

What generators exist in C_4? Let’s look at our three instantiations of this group:

  • In modular arithmetic, you can recreate all numbers by 0 + 1 + 1 + \ldots. But you can also recreate them by 0 + 3 + 3 + \ldots.
  • In complex numbers, you can visit all numbers by multiplying by i, or multiplying by -i. Only -1 fails to be a generator.
  • In our rotation symmetry shape, two generators exist: clockwise 90 \circ rotation, and counterclockwise 90 \circ rotation.

For now, let’s rename all elements of C_{4} to be C_4 = (\left\{ 0, 1, 2, 3 \right\}, +)  = \langle 1 \rangle = \langle 3 \rangle.

Okay. But why is 2 not a generator in C_4?

Theorem 4. For finite groups of order n, each generator must be coprime to n. That is, their greatest common divisor \text{gcd}(g, n) = 1.

  • 2 not a generator in C_4 because it is a divisor of | \left\{ 0, 1, 2, 3 \right\} | = 4.
  • What are the generators in C_5? All non-identity elements: C_{5} = \langle 1 \rangle = \langle 2 \rangle =  \langle 3 \rangle =  \langle 4 \rangle.
  • What are the generators in C_6? Only 1 and 5: C_{5} = \langle 1 \rangle = \langle 5 \rangle.

We just spent a lot of words discussing generators. But why do they matter?

Generators are useful because they allow us to discover the “essence” of a group. For example, the Rubik’s cube has 5.19 \times 10^{20} configurations. It would take a long time just writing down such a group. But it has only six generators (one for a 90 \circ rotation along each of its faces) which makes its presentation extremely simple.

Another way to think about it is, finding generators is a little bit like identifying a basis in linear algebra.

Towards Cayley Diagrams

Definition 5. We are used to specifying groups as set-operator pairs. A presentation is an generator-oriented way to specify the structure of a group. A relator is defined as constraints that apply to generators. A presentation is written \langle \text{generators} \mid \text{relators} \rangle

  • In multiplicative notation: C_4 = \langle r \mid r^3 = e \rangle.
  • In additive notation: C_4 = \langle r \mid 3r = e \rangle.

The = e suffix is often left implicit from presentations (e.g., C_4 = \langle r  \mid r^n \rangle) for the sake of concision.

Definition 6. A Cayley diagram is used to visualize the structure specified by the presentation.  Arrow color represents the generator being followed.

Note that Cayley diagrams can be invariant to your particular choice of generator:

Geometric Group Theory_ Cayley Diagram (1)

The shape of the Cayley diagram explains why C_3 is called a cyclic group, by the way!

With these tools in hand, let’s turn to more complex group structures.

Dihedral Groups

Cyclic groups have rotational symmetry. Dihedral groups have both rotational and reflectional symmetry. The dihedral group that describes the symmetries of a regular n-gon is written D_{n}. Let us consider the “triangle group” D_{3}, generated by a clockwise 120\circ rotation r and a horizontal flip f.

With triangles, we know that three rotations returns to the identity r^3 = e. Similarly, two flips returns to the identity f^2 = e. Is there some combination of rotations and flips that are equivalent to one another? Yes. Consider the following equality:

Geometric Group Theory_ Rotation vs Reflection Equivalence (2)

Analogously, it is also true that rf = fr^2.

Definition 7. Some collection of elements is a generating set if combinations amongst only those elements recreates the entire group.

Cyclic groups distinguish themselves by having only one element in their generating set. Dihedral groups require two generators.

We can write each dihedral group element based on how it was constructed by the generators:

D_n = \left\{ e, r, r^2, \ldots, r^n-1, f, rf, r^2f, \ldots, r^{n-1}f \right\}

Alternatively, we can instead just write the presentation of the group:

D_{3} = \langle r, f \mid r^3 = 1, f^2 = 1, r^2f = fr, rf = fr^2  \rangle.

We can visualize this presentation directly, or as a more abstract Cayley graph:

Geometric Group Theory_ Dihedral Groups Intro (3)

The Cayley table for this dihedral group is:

Geometrical Group Theory- Dihedral Cayley Table

This shows that D_3 is not abelian: its multiplication table is not symmetric about the diagonal.

By looking at the color groupings, one might suspect it is possible to summarize this 6 \times 6 table with a 2 \times 2 table. We will explore this intuition further, when we discuss quotients.

Until next time.

Wrapping Up

Takeaways:

  • Finite groups can be analyzed with Cayley tables (aka multiplication tables).
  • The same group can have more than one set-operation expressions (e.g., modular arithmetic vs. roots of unity vs. rotational symmetry).
  • Generators, elements from which the rest of the set can be generated, are a useful way to think about groups.
  • Group presentation is an alternate way to describing group structure. We can represent presentation visually with the help of a Cayley diagram.
  • Cyclic groups (e.g., C_3) have one generator; whereas dihedral groups (e.g., D_3) have two.

Related Resources

  • This post is based on Professor Macaulay’s Visual Group Theory lectures, which in turn is based on Nathan Carter’s eponymous textbook.
  • Related to this style of teaching group theory are Dana Ernst’s lecture notes.
  • If you want to see explore finite groups with software, Group Explorer is excellent.
  • For a more traditional approach to the subject, these Harvard lectures are a good resource.