Of Rules and AI

Rao Desineni
7 min readJun 25, 2020

--

We go through an 18 oz can of Ovaltine every 2 weeks. Our 2 kids love milk; Ovaltine over-loaded chocolate milk, to be precise. The first time I realized that the kids were drinking milk in Ovaltine rather the other way around, I came up with a Rule — only 2 spoons per glass of milk. It was quickly up-negotiated to 4 spoons; I caved but the rule had been set. And then the games started: “You didn’t tell us not to use the big spoon.” “You said 4 spoons but not how much we can load on each spoon.” “I only want half a glass of milk today but I still get to put 4 spoons of Ovaltine, right?” You get the idea.

The above is the problem with every rule-based system. In case you are wondering where do we use rule-based systems, the answer is: Everywhere around us. From the printing press, to car manufacturing plants, to potato chip manufacturing factories, to semiconductor chip fabs, to shoe production units, rule-based systems are at the heart of pretty much every automation system one can imagine. I think it’s fair to say that rule-based systems laid the foundation for the industrial revolution. The rules guide what steps a machine in the system takes next. These rules define all aspects of a workflow, typically in the form of “If” statements (“if A, then do B, else if C, then do D”). But there’s a problem. Rules are mostly made to be broken and are too often for the lazy to hide behind, as best stated by Douglas MacArthur (attributed as the original author of the quote in 1962). In short, we use rules to tell a machine what to do, and the machine will do exactly as we tell it. From there, a rule-based system will execute the actions until we tell it to stop. But remember: if we tell it to do something incorrectly, it will do it incorrectly.

The main idea of a rule-based system is to capture the knowledge of a human expert in a specialized domain and embody it within an automation or a computer system as rules. That’s it. No more, no less. While it sounds trivial, the problem and complexity arises when the number of actions and their permutations required to run an automation system flawlessly result in 100s, 1000s or more rules. In my simple Ovaltine example, I could get away with writing <10 rules but imagine a complex semiconductor chip manufacturing process that has 1000s of process steps and millions of permutations to keep track of. If somebody has to change one of the rules somewhere in the middle of the list, they have to go through a lot of them to find the right one. The list can start becoming unmanageably long and include contradictory and redundant rules after a while. If one rule gets out of place, it can cause a number of false positives, which can be a big loss to the business. Not to mention, traversing thousands of rules in the event of exceptions is tedious and time-consuming. Worse still, what if the human expert tasked with codifying the rules into a machine-understandable format wins the Powerball and decides to leave the company?

A rule-based system is like a human being whose growth has stagnated. Her/his knowledge doesn’t change over time. When this human being encounters a new problem, one for which no rules have been defined apriori, the human gets stuck like a ‘deer in the headlights’ and won’t be able to solve the problem. Crash, boom, system fail! What is hopefully evident by now is that the rule-based systems are missing a vital feature: Learning ability, unlike humans. The opposite of a rule-based system is a learning-based system, also increasingly called Artificial Intelligence or simply AI — similar to human intelligence but the learning is done by machines, hence artificial.

Contrary to a rule-based system whose intelligence is bounded by the rigid scope of rules, AI systems continuously learn from their experiences. In theory, a learning system is unlimited in its ability to simulate intelligence, kind of like humans in their ability to adapt. This means that existing knowledge can be changed or discarded, and new knowledge can be acquired and appended. Even if they start with a basic set of rules (much like a rule-based system), AI systems should be able to build new rules on the fly. In my Ovaltine example, I can envisage a system wherein a video camera monitors the amount of Ovaltine taken out of the can, does some real-time image analysis of the captured video, detects rule violations and generates a loud alarm played through Amazon Alexa in our kitchen every time the rule is violated. The definition of rule would continuously evolve (e.g., based on actual consumption rate vs modeled rate for the can to last 2 weeks) until it reaches a steady state; something like: “Precisely 4 teaspoons full (not heap), or less, of Ovaltine per 12 oz glass of milk.” In reality, I’d never do such things to my kids. Let them have their Ovaltine. But just saying…

Isn’t that somewhat similar to what humans do? We observe events unfolding real-time (video camera), use the “experiences” stored in our brain (rules), make a data-based decision (image analysis) and communicate out the result (alarm via Alexa) to course-correct an action, if it doesn’t “feel” right. Experiences and Feel are two keywords to note here because they are the ones that separate Human Intelligence from Artificial Intelligence.

Experiences is but a collection of data and rules that, in theory, can be codified for machines. But easier said than done. How the knowledge gets stored in the billions of neurons within human brain is a mystery still. To ‘teach’ a machine to effectively store experiences and more importantly, fetch seemingly random experiences out of the memory via trillions of synapses to make a computational decision in real-time is a big challenge. My real-time decision-making when I see my kids pour 4 heaps of Ovaltine into a 6 oz glass of milk might be informed by the memories of my own childhood, or recollections of statistics about poverty around the world, or the shortage of Ovaltine supply, or just my mood at that precise moment of time. While AI holds the promise, for it to capture all human experiences as rules might be a long way off.

Feel is the all-important human sentiment that drives the final decision-making process. In AI terms, Feel is the amalgamation of several algorithms that ‘weight’ available data (experiences) in various ways to determine the decision. How the weights are selected is based on the training AI systems go through before they are deployed. Training is no different than how a human child learns as she/he grows up, acquiring insights along the way — how to react in a given situation and their respective outcomes. An AI system needs to go through the same process before it can become truly intelligent. Train it less and it will be farther from the abilities of an expert human, much like a child is typically less qualified than an adult.

There are applications where employing AI makes sense. Image Classification for example, is a perfect AI usecase deployed on social media platforms like Facebook, Twitter and Google— remember how Google Photos automatically groups all your pictures under your name, or how Facebook automatically tags pictures containing you and shows under your profile even if you never posted them yourself? That is done using AI techniques like machine learning and neural nets. But there’s a catch; there always is. Every once in a while, there are errors in photo-tagging, specifically, Facebook or Google might label somebody else as you or vice-versa. Or classify a cat as a dog. There is an interesting TEDx Talk (Dec. 2017), where Peter Haas (Brown University) discussed a simple example where a learning system was asked to distinguish dogs and wolves in images. The AI system kept tagging some dogs as wolves. Analysis revealed that the learning system paid attention mostly to the snow in the background of wolf images, which is a form of bias in the data set that was fed into the learning system. The learning system as a result, was classifying dogs as wolves in the pictures where the dog appeared with snow in the background. This reminds me of a Sanskrit verse:

अज्ञः सुखमाराध्यः सुखतरमाराध्यते विशेषज्ञः ।
ज्ञानलवदुर्विदग्धं ब्रह्मापि नरं न रञ्जयति ॥

An ignorant man can be pleased easily. A wise man can be persuaded even more easily. But even the creator cannot win over a conceited snob smattering with his little knowledge. In simple English: No knowledge is better than half knowledge. Half knowledge, or inadequate training data, is the biggest risk with AI system implementations because it can do more harm than good, especially in non error-tolerant applications. Misclassifying a picture once in while on social media might not have nefarious outcomes most of the time, but making a mistake in medical data analysis for example, can be the difference between life and death. And that is the biggest hurdle before humanity starts relying solely on learning-based AI systems. The decision whether to go for a rule-based system or learning system depends on the problem you want to solve, and it’s always a trade-off among efficiency, training costs, error-tolerance and understanding.

Finally, in case you’re wondering, we have a long way to go before worrying about technological singularity — a hypothetical point in time at which technological growth becomes uncontrollable and irreversible, resulting in unforeseeable changes to human civilization. Specifically, we won’t be seeing a real-life version of Arnold Schwarzenegger from the Terminator movie franchise rampaging our world anytime soon!

--

--