Showing posts with label game theory. Show all posts
Showing posts with label game theory. Show all posts

09 November, 2022

Practical dharma

One of the most misunderstood concepts these days is the idea of dharma (and other related terms like karma). Dharma is variously translated as "duty", "righteousness", "ethics", "divine law", and even "religion"-- all of which, are incorrect definitions. 

Dharma is the most fundamental of the four "drivers" or purusharthas of human behaviour: dharma, artha, kama, and moksha. The most accurate translation I can give for these terms respectively, are: sustainability, capability, agency, and liberation

The term dharma comes from the root dhrt- which means something that sustains or prevails. Dharma refers to the property of a system of being, that remains invariant through the life cycle of the system.  Dharma is what gives us our resilience to prevail across varying, adverse conditions and not be consumed by causal forces. 

Dharma is not just a property of "living" beings-- it is a characteristic of all systems of being. The field of statistical mechanics in physics uses a postulate very centrally in its inquiry, which says that, every bounded system has one or more "stable" states which represent low energy or low stress states in its neighbourhood, into which, it settles down, when left alone. For instance, electrons in an atom settle down into specific orbits. If we excite an electron with some energy, it moves to a higher orbit-- but also becomes unstable. It would quickly discard the excess energy and come back to its stable state of being. 

As complex living beings, these stable states of being are what constitutes our dharma. The principle of dharma holds whether we are talking about human societies, or the formation of crystals, or states of matter, or the climate, or the solar system, etc. 

One of the tests I use to see if someone has understood the concept of dharma, is to ask them whether dharma exists as of now, on Jupiter or Pluto. If their understanding of dharma is only in social terms like duty or religion, they would say that dharma is not applicable on Pluto. 

The most frustrating error of course, is to equate dharma with religion. Recently, I was listening to a talk where the speaker clarified the difference. Religion (or "faith" as understood in the dominant Western narrative today), is something personal and subjective, while dharma is an objective entity. The speaker gave an analogy of toothbrush and toothpaste. While we can share a tube of toothpaste, our toothbrush is personal. Dharma is something that is shared and depends on all of us, while religion or faith, is personal. 

Dharma is not righteousness either. But protecting and upholding dharma helps in righteousness and civility to prevail. Dharma is not our duty as well. But protecting and upholding dharma helps us in performing our duties. Dharma is not ethics either. But protecting and upholding dharma helps empower ethical practices. 

So how do we protect and uphold dharma? To do so, we need to understand the system of being that we are inquiring about and the environment (Vidhi) in which it is operating. As individuals, we are a system of being ourselves; and our family, work, society and even the physical environment around us represents the Vidhi in which we operate. Similarly, an institution could be the system of being whose dharma we are interested in, and its Vidhi represents the economic, cultural, social and physical environment in which it operates. 

We need to then understand what is the set of invariant properties that characterise our system of being. What is it about us that remains constant across time and the various interactions that we perform? Similarly, for institutions, we ask what is it that needs to prevail, that makes the institution what it is. 

Once we understand this, we then need to understand the "game" of interaction between the system and its Vidhi. Our Vidhi places lots of demands on us, for which we need to provide our best response. 

A being operating in its Vidhi (under certain conditions) is guaranteed to have at least one state of equilibrium. This can actually be proven mathematically! The state of equilibrium represents the "mutual best response" function-- meaning, this is the best that the being can do given the demands of its Vidhi, and this is also the best that the Vidhi can demand, given how the being is operating. 

Let us call the state of dharma of the being as 'd' and the state of equilibrium with the Vidhi as 'e'. The difference between 'd' and 'e' is our existential stress-- it is the difference between what sustains us and what is demanded of us. This formulation of existential stress remains the same, regardless of whether we are talking about individuals or institutions or communities or families or countries. 

To uphold our dharma, we can adopt various strategies. We can improve our capabilities (artha) to find a different stable state of being which is closer to 'e'. Or we can change our Vidhi to find a different environment whose equilibrium state 'e' is closer to our state of sustainability 'd'. Or we could change the "game" or the nature of our interaction with our Vidhi so that it forms a game whose equilibrium state 'e' is closer to our 'd'. 

All these are very different from doing our duties, or complying with orders, or upholding righteousness. We can do our duties or uphold righteousness these only after we can uphold our dharma in our Vidhi

28 March, 2016

How the twain shall meet -- III: Dharma and Game Theory

Continuing in my series of posts about how I see synergy between Eastern and Western thought, I would like to connect one of the most beautiful mathematics of the 20th century with some of the foundations of Indian thought.

As mentioned in previous posts, if there is one concept that can encapsulate the cultural paradigm of India and parts of China, East and South-East Asia, it is the concept of "Dharma". The term is used in so many different contexts, giving it several different translations like "righteousness", "religion", "duty", "ethics" etc. all of which fail to capture its essence.

Dharma represents a state of "sustainability" or "invariance". (Here is a paper describing dharma as sustainability or a state of "equilibrium" and here is yet another paper defining Dharma as sustainability). As described by Robert Lingat in his book "The Classical Law of India" Dharma is defined as "what is firm and durable, what sustains and maintains.."

In current day approaches to systems theory, such definitions point to concepts like invariance, optimality, equilibrium and stability. The concept of Dharma is applied to human (and animal) societies, but it is derived from an even more fundamental concept called Rta, which is the postulated fundamental element of invariance across all matter and physical phenomena.

In the Western world, an important milestone in the 20th century is the emergence of the mathematics of rational choice and correlated rational choice. This pertains to modeling the dynamics of systems of rational, autonomous agents (like humans or animals) that operating in a situated environment. This field of study is popularly called Game Theory.

While Game Theory had its beginnings in the analysis of parlour games, it quickly grew in scope to encompass the analysis of any form of situated, correlated rational choice across disparate autonomous agents. Some key results like the "Nash equilibrium" are now the stuff of popular artistic imagination.

Game Theory quickly expanded beyond questions concerning situated rational choice, with the introduction of "iterated" and "evolutionary" games. In these games, agents interact with one another over several iterations, giving them the luxury of "memory". Hence, if one player betrayed another player in one iteration, future actions by the other player would likely change in order to account for the betrayal. A strategy for an iterated game needs to keep this in mind before committing an action.

Evolutionary games bring in yet another dimension by introducing the notion of "generations". In evolutionary games, over time, players may change their beliefs about other players or the system in general, and in turn, their strategies. Evolutionary games are characteristic of not just human societies, but of life in general. The dynamics of genetic coding and crossover to create offspring, are often driven by evolutionary prospects.

Hence, animals that live in cold climates tend to evolve furs and other mechanisms to protect from the cold, while animals living in topical climates tend to evolve higher sensitivity towards predators and other creatures.

In evolutionary games, occasionally there are strategic configurations that are not only very robust in their environments, but are also robust against other contending strategies. Such strategic configurations have no incentive to evolve further, as from a strategic standpoint, they are infallible.

Such configurations are called "Evolutionarily Stable Strategies" or ESS for short. They represent strategic configurations that cannot be easily "invaded" and dominated by a new (also called "mutant") incumbent strategy that was initially rare.

For instance, a business idea that is an ESS tends to prevail not only across economic or social upheavals, but also prevails when confronted with other, contending business ideas that may be more powerful. The ESS is also called the evolutionary "best response" function to the specifics of the game. In other words, regardless of how others evolve, an ESS provides the best strategic response to the challenges posed by others' choices. And when others adopt ESS, the ESS is still the best strategic prospect.

The above description of an ESS is precisely the notion of Dharma! A dharmic act is one that is robust and that which prevails across upheavals. Its significance does not get eroded when confronted with other, more powerful thoughts. And when faced with uncertainty, following the path of Dharma gives one the best strategic prospects.

While the concept of Dharma and that of ESS, is profound, there is no simple way by which we can arrive at an ESS, given any system. An ESS may be discovered after centuries of evolution, and what appears like an ESS, may give way when some fundamentals of the underlying system changes.

A well known book called "The Evolution of Cooperation" by Robert Axelrod shows how a strategy called "Tit for Tat" (or reflecting cooperation for cooperation and non-cooperation for non-cooperation) is an ESS for an evolutionary version of the Iterated Prisoners' Dilemma (IPD) game. However, later results have shown that when the game is played with imperfect information (which is a more realistic possibility), "Tit for Tat" collapses from its evolutionarily stable position.

The quest for Dharma hence is potentially unbounded in terms of depth and sophistication. The need to evolve better and more robust strategies is a never ending quest. However, as part of the quest, we may encounter ideas and worldviews that are stable enough to cater to several generations.

This has been the story of dharmic cultures over time. Dharmic cultures have explored several models and directions in their quest for social dharma. These included organizing the society (the varna system), organizing a person's life (Brahmacharya to Sanyasa), organizing spiritual quests (the marga system), etc. Many of the advocated practices were "local minima" or stable strategies for those times, but which collapsed with changing conditions.

The above kind of thinking and quest was already about 2500 years old (and in a state of disarray) at the time of the Buddha (who rejected several of the memes around that time to forge a new direction in the quest for Dharma). And such thinking still continues to persist and thrive in about a sixth of the world's population.

Modern mathematics like Game Theory, Synergetics, Optimization and Prospect Theory are some of the best possible tools for the Western mind to understand and interpret Eastern thought..

22 June, 2011

Do All, Pick One

Not too long ago, we had machines of different kinds -- each for a specific purpose. There were the big printing machines to print books, there were typewriters or "compact printing machines", cyclostyle machines for making copies, slide rules for doing calculations, files, ledgers, library "index" shelves, films, photo processing studio... one could go on and on.

Most of these have been replaced by one thing -- the computer.

Till the mid twentieth century, machines were always custom built for a specific purpose. But sometime in the late 1940s a new notion began to take root -- that of stored program computing. The main idea here is to go "meta" -- build one machine that could do act like several other machines, depending on what it is "told" to do.

This was not as novel as it sounds. Mathematicians had already been talking about going meta for several decades by that time. And indeed there were some machines which were "programmable". Textile looms for example.

But it was only with the advent of the "stored program computing machine" attributed to John von Neumann, the current day computer really took shape. Stored program computing has changed engineering so much so, that it was singularly responsible for the birth of an entirely new field: software.

Software is an intangible entity that we cannot see, touch, hear or feel in action. Yet, it controls our money, our entertainment, our knowledge and our lives.

So what makes a machine support software? You certainly cannot make your old bicycle (which is a machine) run a piece of C code. We also cannot make out room light and fan run code even though they run on electricity, just like a computer.

How does a computer "change its circuits" in response to what it is commanded to do? How does a machine that was wired to perform numerical computations, suddenly start showing a movie and do word processing?

The secret here is an extremely interesting and intriguing phenomenon, that we somehow seem to take for granted and never sit back and observe. This is what I call the "Do All, Pick One" algorithm.

The basic idea behind how a microprocessor can change its circuitry in response to its commands is based on this. The "rewiring" of circuitry takes place in the "Arithmetic and Logic Unit" (ALU) of a microprocessor. Each ALU is built to support a basic set of arithmetic operations like Add, Subtract, etc. and a basic set of logical operations like AND, OR, NOT, etc.

When a piece of instruction is loaded from memory into the processor, it is sent to a "decoder" that has one line each for every operation that is supported by the microprocessor. The decoder determines which operation is the instruction referring to, and switches on only that line (set it to logical 1) and switches all other lines off (set to logical 0).

Now comes the best part. The ALU meanwhile takes the data that needs to be processed and runs it through all the instructions in its instruction set! Each such execution gives out a result, which are then paired with the output lines of the decoder. Then, only that result is sent out, whose line has been switched on! Every other result is stopped in its tracks.

Hence, if your processor supports arithmetic operations like: ADD, SUBTRACT, MULTIPLY, LEFT-SHIFT and RIGHT-SHIFT; and your instructions ask the processor to perform an ADD, it actually performs all of the above! But only ADD is chosen to pass through the exit!

This neat little trick of "Do All, Pick One" enables the machine to become so flexible that it can now be "programmed" giving it such power that it sets serious directions of research, like asking "Can Machines Think" or will robots take over the world from us?

~*~*~*~*~*~*~

Whenever we think that we have invented something, nature would have invariably beat us to it by millions of years. And it is true of the "Do All, Pick One" algorithm too. Nature has been using this for eons and eons.

Machines of nature -- also called living beings, are built on principles very different from the machines that humans build. Ever notice that while we say "Don't reinvent the wheel" when it comes to machines, nature does not seem to use wheels at all? Animals don't run on wheels, they don't require highways, birds don't have engines and don't require runways. There are no turboprop birds and no jet birds. In fact, nature's pump -- the heart -- seems to be so strangely inefficient. It does not have a rotor or a jet. It works by the "primitive" method of contracting and expanding.

So what is happening here?

Well, nature's machines are not built from custom parts. Our building blocks are not components like spark plugs, crank shaft, etc. Look inside a womb when a new baby is being born, and it is definitely not the case that the organs, bones and limbs are built separately and assembled together. The entire baby is born right from inception! And it just "develops" and "grows". One fine day it grows big enough to come out of the womb, another fine day, it grows big enough to go to school and yet another fine day it grows big enough to ask for pocket money!

So what does it have to do with "Do all, Pick One"?

Machines of nature -- living beings -- are built by basic building blocks called "cells" -- each of which is a living being in itself. Recursive? Well, I think.. Maybe..

Each cell is an "autonomous agent" capable of not only doing a set of things, but also taking care of itself. That is, it is not just a processor with some arithmetic and logic capability; but it also has the requisite code to do what it takes to keep itself alive for as long as possible. It is a computing, self-regulating system capable of mechanical tasks and locomotion.

As part of their quest to keep themselves alive, cells collaborate and compete with one another. In this process of collaboration and competition, cells take on different roles. Some go on to become muscles. Some go on to become nerves. Some go on to become tissues. Some take care of the heart. Some take care of the brain. Some manages our legs. Some build bones and maintain them.

Not very different from a human society comprising of engineers, lawyers, doctors, accountants, artisans, painters, drivers, teachers, etc.

A cell, when it is born, is "multipotent". It has the capability to become anything, and it picks one. It can do all, but it picks one.

Go deeper inside a cell and into the genes and there is a "Do All, Pick One" game happening even there. Our genes contain certain "encodings" of our properties. Some properties are pretty clear and stable. Each human for example, should have a heart, lungs, liver, intestine, eyes, ears, tongue, etc. whose properties are fairly stable.

But certain other properties are not that stable. For instance, what "temperament" does a new born ought to have? Should the organism be optimized for physical tasks, artistic tasks, computational tasks, or what?

Well, guess what. Let's give everything to the organism. But have a circuitry to "choose one". This is what genes seem to say..

We have genes for a whole lot of our characteristics most of which are "suppressed" and only a few which are "expressed." When we are born, some choosing circuitry is created that determines which of the characteristics ought to be expressed and which ought to be suppressed. This choosing circuitry is determined by the signals given by the larger organism (the mother) in which all this is taking place. This gives credence to the folk wisdom that mothers who are expecting babies ought to be taken care of, both physically and emotionally. A stressed out mother gives implicit signals to the offspring to express characteristics relevant in high-stress situations, making the offspring have an overtly aggressive or defensive temperament.

Our basic circuitry for "pick one" is embedded in our firmware, so to speak, and most of us lead our entire lives blissfully unaware of its existence. Sometimes however, either due to external pressures or internal exploration, some of us discover characteristics within ourselves that we never knew existed in the first place! That is when we "discover ourselves" and come out saying "I never knew I had it in me" and so on..

At bigger scales, doing and picking that happens in the daily life of a diverse, democratic society is what makes them so resilient. And on places like Wikipedia, the doing (writing) and picking (editing and fighting it out on the discussion pages), is what helped create the world's largest encyclopedia without any contributor being paid anything.

While at the level of a microprocessor, the "picking" is a binary operation (either choose or discard), and higher levels of granularity, the "picking" operation is a matter of degree. For those who know Game Theory, it is somewhat like the difference between a pure strategy and a mixed strategy. But the basic algorithm is the same: Do All, Pick One (even if in the form of a probability distribution).

17 September, 2010

Strength of character and the ultimatum game

In an increasingly globalizing world, we often need to interact with people who hold a completely different world view, often diametrically opposed to ours in specific respects. Differences of such nature often lead to misunderstandings and traumatic situations.

One such issue is this elusive thing called strength of character. Almost every culture agrees that as people, we need to develop a "strength of character" as part of our growing up. And as the saying goes, "the devil lies in the details" it is only when we get to definitions, there are serious differences. Often these differences are conflicting, but not contradictory to one another. It is hence important to understand such differences and reconcile conflicts in order to develop a better understanding of other cultures and mutual respect.

Here are some specific cases where I've seen conflicts emerge because of differing world views in my setting, (which basically is a place where what is termed as the Western world view often needs to co-exist with a traditional south Indian world view).

* In the outskirts of the city where I work, it is often commonplace to find children from nearby villages walk several kilometers to their school daily. For several years, this has been the norm as infrastructure was scarce. However, in recent times the IT boom has brought a large influx of highways and cars. Unfortunately, the benefit of this boom has not exactly trickled down to everyone and it is still commonplace to see children walking several kilometers to their school. Two colleagues of mine were traveling by car when they saw some children trudge along with heavy bags on their shoulders. Seeing this, one of them suggested that they stop the car and give the children a drop to their school. The other colleague (who has returned from the US) immediately stiffens up, saying, "Oh no! Don't do that!!" Seeing the horror on her face, the other colleague realized what she was thinking -- basically, terms that are too unscrupulous to be put up on a blog like this. You can only imagine the hurt that he in turn would have felt on even being associated with such things.

* On a recent visit to Europe, I was invited to the country house of my host where the conversation veered to cultural practices. And his wife said, "I have an Indian friend who still lives with his parents even after he is married!!" And as before, looking at the expression on her face, I could imagine her thinking "Where is his strength of character? Why can't he act like a man and stand on his own feet?" or something such. And to think when I wanted to shift to a different house from that of my parents because of the long commute to office, they were so depressed at the idea. And to add to it, others started "showing sympathy" (!) with my parents, and started saying things like "Oh, he has grown too big, after returning from foreign.." making them feel even more depressed! Sigh :-) Unfortunately, there is no smiley for head banging! :-)

Obviously, it is clear that what constitutes goodness in the behaviour of a person is very different in different parts of the world. And if development of character means development of goodness, what then is the way to develop character? Or more fundamentally, what then constitutes strength of character?

In the Western world, strength of character is predominantly (note the emphasis) defined by our ability to stand up to adversity and face it bravely. A person of strong character does not break his/her integrity under pressure, and fights for his/her rightful place in this world.

This can perhaps be epitomized by the quote by Ayn Rand: Nobody can make you a victim without your consent.

Of course, I am aware that Western society is far more complicated than Ayn Rand who is now basically seen as the philosopher for teenagers.. :-) But, the predominant definition of strength of character that seems to drive people's world view is one of standing up to adversity.

In India (and perhaps in other Eastern countries), strength of character can perhaps be epitomized by Mahatma Gandhi's quote: A man's strength of character is determined by how he treats people (and other animals) weaker than himself.

In the society that I was brought up in, a man of strong character is someone who is humble and genuinely cares for others, especially towards those who are in a weaker position than himself.

I'll leave it as an exercise to the reader to work out how the above differences in world views can explain the case study misunderstandings mentioned earlier.

It is not like the alternative views have not been valued in the other cultures at all. For instance, Abraham Lincoln once said: Any man can face adversity. To really test a man's character, give him power.

Analogously, Swami Vivekananda once said: If there is sin, this is the only sin to say that you are weak.

However, the predominant emphasis in the Western world view seems to be that of facing adversity and in the Eastern world view to be that of acting with humility.

As it turns out, differences like the above are far from being superficial traits and have shown to be innate characteristics of cultures around the world. This is demonstrated by a nice little experiment in game theory called the Ultimatum game. The game is as follows:

Two players, A and B have to divide a sum of money between them. They are given the following scheme. Player A has to propose a division (like 50:50, 80:20, etc). If player B accepts the scheme, then the money is split according to the proposed scheme; and if player B rejects the scheme, then both players forfeit the money.

So what should player A do when given such a commanding position, and what should player B do when put in such a defending position?

It turns out that cultures differ vastly in the way the two players act1,2.

In some cultures, players in the A position try their luck in getting more than a "fair" (50%) share and try to convince player B that if he rejects the offer, he would not get anything, and something is better than nothing. And in some other cultures, players in the A position have a strong sense of a reputation for fairness and propose a 50-50 cut or sometimes even a discount for themselves.

Similarly, in some cultures players in the B position seem to just accept what they get as long as it is not nothing. And in some other cultures, players in the B position simply reject anything that is even a little unfair to them ("to teach A a lesson"), even if it means that they forfeit all the money.

Even more interestingly, chimpanzees are rational maximizers, meaning that they don't value fairness when in a position of B and accept anything they get as long as it is more than nothing.

Coming back to our two definitions of "strength of character" we can see that player A's dilemma is a test of character in the Gandhian sense (what do you do when in a position of power and how do you view people weaker than yourself?); while player B's dilemma is a test of strength of character is the Ayn Randian sense (nobody makes a victim out of you unless you consent to it, do you teach him a lesson if he is unfair or do you give in and acquiesce?)

In real life though, we occupy positions of A as well as that of B in different situations. And if we have only one predominant world view of what constitutes goodness in behaviour, it can be very confusing.

For instance, someone in a position of A going by the Gandhian definition, may want to genuinely do good to others. But for someone who is immersed in the Ayn Randian definition, who only thinks of fighting for rights, such goodness may appear suspicious, causing them to stiffen up and bristle. Similarly, the defiant nature of an Ayn Randian strength of character, may be construed as arrogance and abuse of power by someone in the Gandhian definition of strength of character.

It is futile to argue as to which is the "better" definition. There is no such thing -- we will be in positions of player B as well as in positions of player A in different points in our life. And it is good to have both definitions in mind and use them judiciously.


  1. Henrich, Joseph, Robert Boyd, Samuel Bowles, Colin Camerer, Ernst Fehr, and Herbert Gintis (2004). Foundations of Human Sociality: Economic Experiments and Ethnographic Evidence from Fifteen Small-Scale Societies. Oxford University Press.
  2. Oosterbeek, Hessel, Randolph Sloof, and Gijs van de Kuilen (2004). "Differences in Ultimatum Game Experiments: Evidence from a Meta-Analysis". Experimental Economics 7: 171–188. doi:10.1023/B:EXEC.0000026978.14316.74

Models of Intelligence

Today, whenever we speak of AI, we mean a specific model of AI based on large language models and diffusion, both of which, undergo foundati...