How ChatGPT really works in SIMPLE WORDS (and pictures)

Many of us have probably already played with new-kid-on the-block of the Artificial intelligence space, ChatGPT from OpenAI. Providing prompt of any question and getting no-gibberish, solid answer, very often factually even precise is fascinating experience. But after few awe moments of getting answer to your “question of the questions” you maybe wondered how does the Chat GPT actually really work?

If you are top-notch Data scientist you could probably go into documentation (and related white-papers) and can simulate (or even write own) transformer to see what is going under hood. However, besides those few privileged, usual person is probably deprived of this, ehm, joy. 😊 Therefore, let me walk you through the mechanics of ChatGPT in robust, but still human-speak explanation in next few paragraphs (and schemas). Disclaimer = I compiled this overview based on publicly available documentation for the 3.0 version of the GPT. The newer versions (like 4.0 ) work with same principles but have different size of neuron nets, look-up dictionaries and context vectors, so if you are super-interested into how the most recent version works, please extend your research beyond this article)

 

6 main steps

Even though our interaction with ChatGPT looks seamless, for every query to it, there are 6 steps going on (in real time). Media label the ChatGPT in single phrase as “artificial intelligence”, but it is worth mentioning that of these 6 steps, only 2 and half are actually real artificial intelligence components. Significant part of the ChatGPT run is actually relatively simple math of manipulating vectors and matrices. And that makes the details of the ChatGPT even more fascinating, even for the “lame” audience.

 

It’s start with compressing world into 2048 numbers

The first step of the ChatGPT work is that it reads through the whole query that you provided and scans for what are you actually asking. It analyzes the words used and their mutual relations ships and encodes the context (not yet the query itself, just the topic) of the question. You might be amazed by fact that ChatGPT converts whole world and possible questions you ask into combination of 2048 topics (represented by decimal numbers). In a very simplifying statement you can say that ChatGPT compresses the Internet world into 2048-dimensional cube.

 

Context first, then come tokens

As outlined in previous paragraph, in process of answering our prompt the ChatGPT first takes some (milliseconds) time to under the context of the query before actually parsing through the query itself. So after it decides, who area(s) of “reality” you are interested in, than it meticulously inspects your entire question. And it literally does so piece by piece, as it decomposes the given question into tokens. Token is in English usually a stemmed word (base) with ignoring the stop-words or other meaning non-bearing parts of the text. In other languages token can be obtained differently, but as rule of the thumb:  number of tokens <= number of words in the question.

For every token the GPT engine makes a look-up into predefined dictionary of roughly 50K words.  Using hashed tables (to make the search super fast), it retrieves a vector (again 2048 elements long one) for each token. This way each word of the query is linked to topic dimensions. As the system does not know in advance how many words will your request have, there needs to mechanism to accommodate for any (allowed) length of the query. To be flexible with this, chatGPT forms a extremely long vector (2048 * number of tokens), in which the sub-vectors coming from dictionary lookup for each token is arrange one after another into sequence. Therefore 100 words long query might have even up to 204 800 vector elements. even larger 500 words request might have more than 1 mil of the letters. This vector is than processed, but first we need to do one more important change.

Where to look (or How to swim in this ocean of data)

As we learned 500 words long request to ChatGPT might arrive at more than 1 mil numbers encoding this request. That is a real ocean of the data. If you as human received such a long prompt for answer, I guess you would struggle even with where to focus the attention first place. But no worries here, so would the GPT if it was not for the Attention mechanism. This AI technique researched only in last 10 years (papers from 2014 and 2017) is the real break0through behind GPT and is also the reason why language models were able to achieve the major step-up in “intelligence” of communication.

The way that Attention mechanism works, it calculates (still through linear algebra matrices) pair of two (relatively short vectors) for each of the token. These vectors are labeled as KEY and VALUE. They are representation of what is really important (and why) in the text. This way the engine does not force neural network to put equal weight ( = focus) on all million input numbers, but select which subsection of the query vector are crucial for answering the question. When then combined into transformed SUM of the elements, it provides the recipe for how to “cook” the answer to question. what might sound like (yet another) complication, is actually key simplifier and energy saver. While past approached to language moles assumed “memory” holding equally important each word of the query text (or assigning same, gradual loss of attention into previous words). That was prohibitive expensive and hence limited the development of better models. Therefore,  jumping over the attention hurdle unlocked the training potential of AI models.

 

Finally AI part

It might be counter-intuitive for many, but first 3 steps of the GPT have actually nothing to do with Artificial Intelligence. It is only step 4, where the real AI magic can be spotted. Essence of the 4th step is the Transformer core. It is a deep neural network, with 96 layers of the neurons, a bit more than 3000 neurons in each of the layers. The transformer part can be actually named also the Brain of the GPT. Because it is exactly the transformer layers that store the coefficients trained from running large amounts of texts through neural network. Each testing text used for training of the AI, leaves potentially trace in the massive amount of the synopses between the GPT “neurons” in form of the weight assigned to given connections.

As unimaginable the net of hundreds thousands (or millions) neurons are to us humans, so is the actual result of the Transformer part of GPT is probability distribution. No, not a sequence of words or tokens, not a programmed answer generating set of rules, just probability distribution.

 

Word by word, bit by bit …

Finally in step 5 of the Chat GPT we are ready to generate the textual form of the answer. GPT does that by taking the probability distribution (from step 1) and running the decoder part of the Transformer. This decoder takes distribution and finds the most probable word to start the answer with. Then it takes the probability distribution again and tries to generate second word of the answer, and third, then forth and so on, until the distribution of probabilities calls special End-of-request token. Interestingly enough, the generation does not prescribe how many words will the answer have, neither it defines some kind of satisfaction score (on how much you answered the query already with so-far generated sequence of words). Though ChatGPT does not hallucinate the answer or bets on single horse only.  During the process of the creation of the answer there are (secretly) at least 4 different versions (generated using beam search algorithm). Application finally chooses one that it deems most satisfactory for the probability distribution.

 

Last (nail) polish

As humans, we might consider the job done by step 5 already, so what on Earth is the sixth step needed for? Well anybody thinking so, forgets that human person talking formulates the grammatically correct (or at least most of us) sequence. But AI needs a bit of the help here. The answer generated by Decoder still needs to undergo several checks. This step is also place where filtering or suppressing of the undesirable requests is applied. There are several layers on top of the generated raw text from previous stage. This is also (presumably) place where translation from language to language happens (e.g. you enter you question in English, but you ask GPT to answer in Spanish).  The final result of the query answer has been delivered, user can read through. And ask next question 🙂

The flow of the questions in the same conversation thread can actually lead to updating or tweaking the context parameters (Step 1) of given conversation. The answering context thus gets more and more precise. Strikingly, the Open AI’s GPT models actually store each of the conversation, so if you need to refer back to some past replica of conversation, GPT will still hold the original questions and answers of that talk branch. Your answer (and questions) remain thus historized and in full recall any time in future.  Fascinating, given the number of users and queries that they file.

 

Steps Summarized 

The above described steps of the GPT answer building have been neatly summarized into following slide, providing additional details and also indicating the transformations made in individual steps to enable the total answer flow. So if you want to internalize the flow or simply repeat the key training architecture/principles, please read through the following summary:

 

Few side notes to realize …

Though the actual mission of this blog post is to walk the reader through the (details of) process of generating the answer to the query prompt for GPT, there are few notable side facts stemming from the way that GPT is internally organized. So if you want to collect few “fun fact” morsels that make you more entertaining dinner buddy for your next get-away with friends (or for Sunday family lunch), here is few more interesting facts to be aware of (in GPT realm):

And bit of zoom-out view

Besides the fascination with HOW actually ChatGPT works, I often receive also questions about it’s future or speed of the past progress. I summarized the most common questions (I received) into below show-cased 1-pager. So if your curiosity is still on high level, feel free to charge yourself with these FAQs:

Nead a 2020 resolution? Try to read some of these TOP BOOKS

People who know me for a long time know that I can’t get much offended if labeled as bookworm. I really like to read (and do it a lot). However, only those closest to me know that I have every year resolution to read more than 10,000 pages of books in calendar year (beyond other than magazines, blogs and news articles.) To my pleasure, I have missed on this commitment only once in last 10 years. On the contrary, 2019 was one of my record reading years as I managed to read 39 books (and in middle of 5 more of them). The imaginary 10K pages bar was exceeded by thousand of the pages in past year. However, I don’t aim to bore you too much with quantities, this blog strives for a different goal.

I carefully consider the books I buy, as I refrain from running away from started reading (even if it later proves to be not the best choice). Paying respect to author’s efforts, I try to finish the book till its end. Of course, even master carpenter sometimes cuts his finger, but thanks to careful selection, the pleasant surprises are outstretching the disappointments. And that’s why I decided to share with you Best of My 2019 Reading List. (Filtered for books that fit TheMightyData topics)

KNIHY_data_for_peopleData For The People

Topics: Data, Data Analytics, Privacy

Without hesitation and long introductions: This book is one of the best books on data analytics (and its implications) I’ve read in the last decadeIt not only gives you an overview of the trends in data and their analytics that you should understand. It also offers interesting social insights on how to work with data to benefit our civilization. If you read between lines, you will also understand in which areas we still underestimate the impact of the data and we need to add it properly. Therefore, if you are involved in data analytics or processing, I simply recommend reading this book as soon as possible.

Link: https://www.amazon.de/dp/B06XKTWVY9/

.

.

AI for Marketing and Product InnovationBOOKS_2019_AI_Marketing_Product

Topics: Artificial Intelligence, Marketing

Many dare to drag sugar coat how artificial intelligence will affect your business. But did they also give you specific recommendations on where to start and how to achieve your first success with AI solutions in your particular situation? Your answer may not surprise me. There is plethora of Oracles moving in mute AI waters. This book, in contrast, provides concrete examples of how to apply advanced data analytics and individual forms of artificial intelligence to Marketing and Product Management. Very unique, thus the more valuable cookbook and inspiration for almost every employee in the company.

Link: https://www.amazon.de/dp/1119484065/

.

.

BOOKS_2019_MeaningfulMeaningful: The Story of Ideas That Fly

Topics: Management, Strategy Principles

Are you trying to come up with a concept or solution? Did you get a task you don’t know how to grab? Did you get burned on a project that seemed straightforward at first sight. Then you stand in front of a book that will guide you through how to design (and realize) ideas so that they are really useful and deliver what is expected of them. In short to be Meaningful, indeed.

Link: https://www.amazon.de/dp/0994432801/

.

.

AI Superpowers BOOKS_2019_AI_Superpowers

Topics: Artificial Intelligence

Finding a good book on Artificial Intelligence and its impact on society is really difficult feat. Topic is intensely hyped and real AI awareness is more pretended than achieved. Thus it is of immense value when someone truly knowledgeable explains the nature of Artificial Intelligence and its social impact, step by step. Kai Fu Lee is such a person. Moreover, as he comes from the Chinese environment first place, his views depict true country capabilities (and weak points) and goals of AI in China to the reader with neither Chinese shine nor Western propaganda. He serves valuable insights to why China’s development is moving the very direction and pace it takes. Let me, thus, express my forecast that Lee’s book will be a mandatory reading for the next decade for anyone who is aware artificial intelligence advent.

Link: https://www.amazon.de/dp/1328606090

.

.

BOOKS_2019_PLATFORMPlatform revolution

Topics: Web, E-commerce

Have you ever stumbled upon a book, you said, “Oh, God, if I had seen you before?” A few quarters back I led a project that sought to build a marketplace for services. Despite the fact that the project was full of experienced people, we were very anxious (and now I know that we have) made many serious mistakes. The Platform Revolution book intriguingly summarizes the principles of such E-commerce marketplaces and explains how to avoid the most common failures of this type of business. So if you are also “up to” to an E-commerce project, I recommend you reading this book.

Link: https://www.amazon.de/dp/0393354350/

.

.

Blitz Scaling BOOKS_2019_BlitzScaling

Topics: Business strategy, Growth strategies

Sometimes there is no need to tip-toe around hot pot. The reason to read this book is very simple. As is it is to frame target audience for this book. If you have the happen to have responsibility for getting a business (or process) into higher gear, be sure to read Blitz Scaling. Moreover, it is also interesting read for ordinary mortal who wants to understand which services around us will grow steeply in the near future and which will curb instead.

Link: https://www.amazon.de/dp/1984822454

.

.

BOOKS_2019_The_only_gameThe Only Game In Town

Topics: Financial Markets

As the saying goes: After the war everyone is a general.” In economy this maxim turns into small variation of “After the crisis everyone is an economic analyst who predicted it”. However, what should you do if you work among central bankers (and others who run the financial markets), you see an upcoming problem, but you are in a brutal minority. Well, if you are a Mohamed A. El-Erian (manager managing perhaps the largest portfolio of mutual funds), you will write a good book about it so that you open the eyes of many others. If you are eager to understand why another crisis is in baking up and who to blame for it this time, invest a few hours of your time in reading this book.

Link: https://www.amazon.de/dp/0300222637/

.

.

AI Does Not Hate You BOOKS_2019_AI_does_not_hate

Topics: Artificial Intelligence

Did you read Nick Bostrom’s 21st Century Bible? Did you get interested and would like to expand your horizon even further? Then I have good news for you. Tom Chivers took the effort not only to write some sort of free continuation (and conclusions extension) brought to Bostrom. He has also worked out a sort of summarizing layer that will give you a better understanding (of Bostrom himself and) why most people who understanding the AI trends are more cautious pessimists than current development enthusiasts. As the title of the book itself suggests, it is not necessary to take it personally. That AI (apparently) will replace your work is no less or more certain than it replacing your neighbor’s work. But how to look despite these prospects with joy into future can be found in this very book.

Link: https://www.amazon.de/dp/1474608787/

.

.

BOOKS_2019_GermanyThe Shortest History Of Germany

Topics : History, General Knowledge

I admit, this recommendation is a little consequence of me living in Germany for last years. But the reason why I recommend you read this book is that in, literally, few hours you will embrace the whole relevant European context. You will understand why Germany is Europe’s driving force today, even though most of history it was not. You will understand why a third of Berlin spoke French even before Napoleon arrived, how the Reformation was related to the advent of Hitler, and why, in fact, East Germany was a Cinderella whom many were still afraid of. This book is an instant extension of your cultural IQ. Even if you do not live in Germany neither you are a history fan, I still urge you to read this subtle book.

Link: https://www.amazon.de/dp/1910400734

.

.

Turning The Flywheel 

BOOKS_2019_FlyWheel

 

Topics: Business Strategy, Development, Growth

You may laugh loud, but I would criticize this book for just one thing: it is too short. Turning The Flywheel is actually one of the shortest books I’ve read. (only 48 pages). But the shorter the print, the more intense her message is. Even in such a limited space this booklet offers, you will find instructions on how to make your business or teamwork self-propelling. In other words, how to do things that in return synergically help to keep themselves well above average successful. If I wanted to be too simplistic: How to do ingenious things that spin on the flywheel yourself while you take a rest.

Link: https://www.amazon.de/dp/1847942555/

.

.

BOOKS_2019_AI_advantageThe AI Advantage

Topics: Artificial Intelligence

I had the chance to meet Tom Davenport in person (at a conference in London), and I have always been eager to swallow his books because I consider them to be a high-quality summary of important data analytics principles. In building analytical teams throughout my career I often gained inspiration. However, to be honest, his latest book was personally a bit disappointing to me. Maybe this is my bias (and that’s why perhaps a little controversial item in this reading suggestion). In some chapters I felt that I was not sure if the recommendations were based on real experience or that someone only “tipped” them to Tom. However, the book also has high-quality passages, so take the chance on it (and let me know how it turned out for you).

Link: https://www.amazon.de/dp/0262039176/

.

.

HUMAN + MACHINE BOOKS_2019_HUMAN_machine

Topics: Artificial Intelligence, Human Labour

Skepticism about artificial intelligence’s negative impact on jobs is recently emerging quite a bit. There are relatively few books and articles that would compensate for this “bad mood” about AI’s role in the labor market. That is why HUMAN + MACHINE has been a jewel of recent days. It offers a counterbalance to the skeptical view of AI’s future and gives substantial hope for the masses. It strives to show how (realistically) machines and people will work together to fulfill the tasks & goals today done solely by humans. Thus, if you (want to) believe in good, this is a great stepping stone for you.

Link: https://www.amazon.de/dp/1633693864/

.

.

BOOKS_2019_Infinite_GameThe Infinite Game

Topics: Business Strategy, Leadership

Have you ever wondered why so many companies went bankrupt and even grandiose business plans fail? Does the waiter service make you cry or do you condemn fraudulent market practices? Simon Simek offers a very interesting look at this topic. Book will gradually guide you through realization that most companies consider business just a way from one mile-stone to another, resembling rather a sport event or a game session than a long-term strategy. As you read, you gradually understand that the human life, society, business (and many other things) has been there, and will stay, even once we individually pass out. It is a form of “indefinite game” in which most KPIs and short-term approaches are not only ineffective but down right counterproductive. This book is vital read for anyone who wants to do business honestly, lead people or live a meaningful life. The script is not necessarily for the masses. But therefore much more inspiring for those who do not seek shortcuts and who search recipe to do things properly.

Link: https://www.amazon.de/dp/0241295599/

.

.

Surrounded by idiots BOOKS_2019_Idiots

Topics: Personality, Personal profile

Do you want to know why people “piss you off”? Are you desperate in dealing with certain person? Then be sure to read this book. You may have encountered MBTI, DISC, or other tools to attribute personality profiles to individuals. Knowing what kind of different people types are around and how to best handle them is really helpful. (and often stress relieving for your life) The book Surrounded by idiots at first glance uses “just another” Carl G. Jung’s color methodology, but it serves it in a very, really very understandable language, opening up the possibility to grasp human differences and (especially how) to use them in life of the ordinary man. That’s why I highly recommend this book to all of us.

Link: https://www.amazon.de/Surrounded-Idiots-Behaviour-Understand-Understood/dp/1785042181/

.

.

I kept on suggesting the books in past. However, this year I would like to add one novelty beyond history. I will also reveal something from my future letter for 2020. These books are already daringly looking at me from the shelf (and they will come into play soon):

BOOKS_2020_Human_compatibleHuman Compatible: Artificial Intelligence and the Problem of Control

Topics: Artificial Intelligence

If you have already read (or even programmed) artificial intelligence, you probably have realized that the advent of artificial intelligence carries many, for mankind even existential, hitches. This book zooms on some of them and gives a clear report on whether and to what extent we already are ready to bound human and robot lives together.

Link: https://www.amazon.de/gp/product/0525558616

.

.

Permanent Record BOOKS_2020_Snowden

Topics: Data a Data Security

Edward Snowden’s story will be familiar to you at least marginally. However, his mission is often narrowed to a single notion of US intelligence and security services confidential information disclosure. Subsequently, he lived a James Bond-like life: in run, hide, dwelling in various embassies. However, more interesting is Snowden’s life before the famous whistle-blowing event as well as the motives that led him to do so. Promising read guaranteed.

Link: https://www.amazon.de/gp/product/152903566X

.

.

BOOKS_2020_ChessHow Life Imitates Chess

Topics: Strategy, Values

He was the youngest world champion in chess and remained the longest serving one ever. Garry Kasparov. When asked about secret recipe for that, he joked he had been washing his teeth every night and drinking tonic before each game. But it was just his replica in the spirit of “for silly question, equally solid answer”. When you let him freely talk about his perception of life and decision making, suddenly you fail to keep the notes of all maxims he serves. If Simon Simek sees life as an episode in the eternal Game, this book is like the magnetic counter-pole. Thus, if you want to find out who of these two great authors have come closer to (your) reality, you will not regret to engage in reading this book as well.

Link: https://www.amazon.de/dp/0099489864/

.

.

Who Owns The Future BOOKS_2020_Who_Owns

Topics: Privacy, Trends, Values

We have voluntarily let observers into our lives. Social networks and the Web generally collect our ideas, preferences and personal information, combine them to create much more interesting, aggregated data. Some conclusions are truly amazing and sharply helpful. Their only mistake is that we don’t own them. Yes, it’s the perfect digital “about us without us”. Most of us are shrugging our shoulders, as that’s just the way it is. But does it really have to? And could it possibly be completely the other way around? What changes in digital ownership (standards and laws) shall we implement so that we are not fenced completely out of the game?

Link: https://www.amazon.de/s?k=Who+Owns+The+Future&i=english-books

 

Want to Learn AI? Break shopping-window in Finland

Most of the scientists, dealing with robotizing of human labor, say that people who cannot work with Artificial Intelligence (AI) will not be replaced by AI alone, but by people who can understand AI. So learning at least the bare basics of artificial intelligence will be very important factor for survival in the labor market. But how to get to AI?

Broken shopping-window

Maybe try Finnish prison to get AI know-how? No, this is not a joke. Although, I will of course not encourage you to commit crime. The reason, why I mention the Finnish prison, is the unique AI program that the Finnish government has decided to introduce.

We have already talked here at TheMightyData about Finland’s attempt to become a tiger in artificial intelligence. We also mentioned, how they strive to train 1% of the population for Artificial Intelligence, so that these people would form a backbone to develop this topic across the state. Finland has rightly understood that a country will not be able to broadly implement AI tools, if the only persons familiar with AI are the academic circles clustered in university hubs or research centers. Artificial intelligence will – for example – never prevail in the dentist industry, if the nature of AI is not known to dentists themselves. Therefore, the Finnish Government intensively designs programs to make artificial intelligence as wide-spread as possible for the population.

Behind the bars

PRISON_handsAnd so the prisons came to focus as well. The Artificial Intelligence Instruction Program, developed by the University of Helsinki, has become an official re-qualification program for prisoners since May 2019 to improve their labor market chances after end of their sentence. Prison in Turku, south of Finland, has indeed purchased computers and tablets from a government grant and real AI lessons have been already launched in there. That it is not a pseudo (or pretended) attempt is confirmed by the fact that for AI course exercises the prison had to allow access (white-list) set  of websites from which the course grabs needed data sets. Completion of the course ends with an official certificate for inmate. The University of Helsinki even committed to grant convicts credits for the passed courses, so that they can study the full science degree after being released from the prison. The program, running in Turku since May 2019, will be now extended to 3 more prisons in the country as of this month.

For the sake of fairness, for Finnish prisons, this project is not the first contact with artificial intelligence. Prisons in Turku and Helsinki have already introduced an interesting type of work for prisoners. For the training of artificial intelligence models, so-called annotated examples are important. (if you haven’t heard of them, try to read THIS). However, these are difficult to obtain, because the annotation (to a large extent) still has to be done by a person and it is often quite unrelenting, repetitive work. Who in society will not rebel against such monotonous work? Yes, the prisoners are those who can’t choose their job that much. Prisons have thus taken up the idea that prisoners could just annotate large numbers of data files and this way speed up the development of AI models.

How to do Artificial Intelligence in Slovakia

The drafting of a Strategy on how to introduce the elements of artificial intelligence into the business of the society is the cause of almost every developed country in the world. PRISON_AI_straegy_2Some are more original and aggressive (like Finland), some countries are content only to copy the US, China or Japan. Slovakia is now also in this creation process and since I am honored to be part of it, here you can read what discussions on this topic were held in the team preparing this Slovak AI strategy.

Therefore, if you’ve met Artificial Intelligence so far, just “from safe distance”, you don’t want to be imprisoned in Finland but want to be clear at least about the basics, I suggest reading some book on how they work. If AI raises some (Terminator) like concerns, here is the good take on how we humans should train the robots. You maybe also be interested in how to Safely train better robots for future. Or write me any question you have on this topic at info@mocnedata.sk and I will try to either answer you directly or point you to the source of the information.

They invited me to write National AI Strategy. So I proposed to …

Have you ever thought about how artificial intelligence would really be at most useful for your country? I was “forced” to do so by fate. Therefore, let me briefly depict what I think should be the key invest areas in AI court; How to bring artificial intelligence even to rural areas? But first of all, how to make world-class AI here, ideally in local language?

Sometimes you dip into things you even don’t know how. This was the case also one day when a strange email landed in my mailbox. Don’t take me wrong, I really have experienced a lot of bizarre pieces in email communication. But this one was really strange. It was an invitation from the National Artificial Intelligence Forum that they would like me to join the team of experts assembled to create the National Strategy for Artificial Intelligence (AI) for our country.

At first, I wondered if this was not a joke from one of my friends. But since April 1 has been already pretty quite away, I started to seriously consider that someone really means it. “Why me?” I asked myself. After all, strategic documents of this kind are not my daily job and I don’t know much about national AI programs of other countries either. However, the authors of the email seemed to anticipate my embarrassment and they left nothing to chance. In the invitation, they explained that the expert team will combine 1] academic environment, 2] representatives of domestic AI research companies, and 3] business representatives who already use real AI technologies today. I quickly realized that I owed my invitation to the third group. So I exhaled in relief … and confirmed my participation.

If I decide to devout my time into something, I try to make it at least of some quality. Therefore, immediately after accepting the invitation, I started studying the AI strategies of other countries. However, I was not looking for ready-made measures that could be “borrowed”. Rather I tried to dive mainly into parts where those papers discussed ways of assessing the country’s initial situation. For I realized that for country strategy, I was just about to participate, it will not help to “invite” the measures chosen by US or China. Thus sooner that I took part in any round of measures brainstorming, I had crystallized the key AI assumptions in my head. These were (euclidean) premises I decided to defend as the starting point of group work. I am sure there could be a lot of “meditation” on the topic of AI maturity, but I tried to put my postulates into as few points as possible:

  • The country for which we are going to prepare an AI strategy is not one of the current AI leaders, nor even the leaders in AI research. Therefore, at least to start, we will have to build upon already existing foreign solutions. (it does not rule out research focus as such into the future, I just mean that we do not have enough of our national research to draw from there)
  • Although AI is a wide spread buzz-word, what it really means and how it can be used in business, is known only to limited communities of people, mostly associated in university cities. Even in mid-sized cities that do not have a university or in the countryside, no one (including a local pastor, bartender or mayor) has a clue about what true nature of artificial intelligence is and what its applications are. In other words, AI awareness is very unevenly geographically distributed across the country.
  • Most countries have a very specific language environment. If a relatively few people speak English in given country, recently available, foreign (NLP and other AI) solutions will not work well. If the implementation of AI in a country were to be based on English solutions, it would be very risky both in terms of quality of solutions and due to (possible) resistance by end-users. (If you are to understand a conceptually difficult thing, it is not very helpful if it is also primarily described in a foreign language that you do not speak)
  • The whole world runs primarily on open-source AI solutions. Even the most advanced companies publish (on GitHub) their libraries for AI solutions.
  • Let’s think for a moment. How to maximize the effect of AI on local companies in the country? I admit, this is also a bit of a personal belief dilemma, because any answer to this question can be suppressed with phrase “who knows, how it really will be”. Nevertheless, I personally believe that AI will reach its maxim, when even ordinary, small businessmen will embrace it.
  • I came to the previous conclusion  after also considering the fact that large, multinational companies will take care of the implementation of AI in their local subsidiaries. Large (abroad reaching) local companies will be pushed by competition from those other countries. The only group (in the first stage) that will not be guided to this are the national medium and small entrepreneurs. That is why, in my opinion, these should also be the focus areas of the national implementation strategy.
  • For SME companies, in addition to the language barrier, the “technological abyss” will also be important. Cloud environment is an inevitable prerequisite for most AI solutions design & maintenance today. However, it might be both costly and secondly unrealistic for a small business, as they cannot sustain their own full FTE Data Engineer and have no way to borrow a shared one either.

Enough of preparation, I police myself, and plunged into discussions about the initial strategy proposals. As it turned out later, the above three groups did not necessarily have a balanced representation in the expert team. The Task Force had to, therefore, often choke through proposals that ignored even several above mentioned premises simultaneously. Nonetheless, we ferociously adhered to the golden rule of brainstorming: every well-formulated idea would be included in the long list of possible measures. (knowing that we would have to subject those to more scrutiny later). Sometimes it was really painful for people in practice to withstand the tirades and their teeth were often clenched. After listening to all perspectives, I decided to nominate following draft proposal for the National AI strategy:

1] Create a hosted cloud solution at universities or one of the state institutions (based on a model like Amazon Web Services), as an extension on top of any of the commercially viable cloud alternatives. Using the central hosting/management of this repository, offer a ready-made, all-inclusive symbolically priced packages for AI solutions, which for end-users (and institutions) also include maintenance realized through experts paid by that central cloud provider. Simply turn-key cloud environments.

2] Localize some of the most wanted Udemy / Udacity / Cloudera / … artificial intelligence courses and basic Machine Learning and Deep Learning skills. Purchase a mass license for such localized courses for 100,000 residents in a given country and grant access to these courses for a symbolic amount (e.g. 5 EUR / person).

3] Create a moderate national community for Opensource solutions in the AI area. Collect and localize into national language information on new AI modules and their reviews by foreign experts. Create conditions for Slovak (research) teams to actively participate in the development of individual branches of these solutions.

4] Select 5-6 most important industries in SME segment of companies. Recruit at least one relevant large business per each area to provide local, anonymized data. Organize Hackathons with the participation of international teams, with aim to develop specific solutions for AI use in the industry and based directly on local data. Set conditions for participation in Hackathons so that the developed solutions can be freely picked-up and implemented in any company registered in the country and operating in selected industry.

5] After the implementation of Hackathons, for each industry recruit at least 4 volunteers from within already existing companies to be become pioneer beneficiaries of AI. In those pioneers Central AI agency, via means of a state grants, implements ready AI solutions (from Hackathons). In case of higher interest of the volunteers for pioneer status, a lottery with oversight a notary will be drawn to decide whom the grant ought to be awarded. Participation in the grant is subject to the approval of the company elaborated about in measure 6, see below.

6] Realize roadshows in the regions and district towns where AI and its concrete, ready-to-use solutions (acquired through Hackathon) will be presented. Representatives of pioneering companies with AI implemented under Measure 5 will be presenting at the meetings. instantly available, plug-and-play solution, free of charge and even in local language. If measures 4 + 5 + 6 are overly successful, repeat this procedure for other sectors.

What do you say? Does that make sense to you, or would you suggest something completely different? Well, I will not bore you with which  my actions had gained enough “support” for the final draft of the National Strategy. Some passed, others did not survive the fight and prioritization. But that’s not the point of this blog, anyway. In the sense of his unfinished blog title, I wanted to give you some food for  thought: What are the inputs for AI strategy in your country where you live? Would you suggest similar solutions for you homeland or do you have much better ideas? How to bring artificial intelligence to the rural village habitat? But first-mostly: How to build world-class AI and (preferably even) in the local language? So that ordinary John and Ann can take benefit of it important process as well.

 

3 WAYS how to TEACH ROBOTS human skills

Surprising it may sound, but question of robots’ moral standards is with us for centuries and have been present well before first functioning  robot prototype constructed. If you have seen the old Czech movie Emperor’s Baker, Baker’s Emperor (or its American version the Emperor and the Golem) or knows the story of the Golem, has actually encountered first attempts to make robots morally competent. Clay robot has been activated by inserting the magical stone (shaem) into robot’s forehead. From today’s perspective, more interesting that Golem’s clay is the fact that the robots back then acted as good or bad by standards of the man, who activated the Golem. Unfortunately, the story does not recall how this has been achieved. It is even more puzzling because Golems (and other early robots) did not have any senses to observe its surroundings or to adapt to environment.

Fast forward, human kind has moved from legends to reality. We can build (much more elaborate) robots, we can even equip them with all senses that regular human possesses (sight, touch, hearing, smell and taste). However, in question, how to make the robot good or evil by design we are not much further then Golem times. So what methods did we develop as humans to teach the machine what is morally acceptable and what not?

Some readers might get disappointed upon finding out that in programming robots we try to rely on the learning methods that we use to teach ourselves. The supporters of these approaches reason that if we wantGolem to create robots compatible with human kind, we should provide them with comparable education as we receive as humans. Some disillusion rises from opponents reminding that we hope robots to be better/fairer than the bar we, humans, se for them. While, let’s be sincere, our education system still produces abundance of cheaters, violence or human intolerance. Thus, striving for higher moral standards in robots does not seem to unreasonable request in that context. Be it reality or just our dream, these are three ways we now try to educate machines:

I. Mistakes as a path to success

Central Europeans have the right to be proud that one of the ways, which humans pick to teach robots, has started in Slovakia.  Marek Rosa (Slovak founder or gaming start-up KeenSofwareHouse,  decided to devout his full focus to Artificial Intelligence in company named GoodAI.  Marek’s approach uses mentor to build robot’s thinking habits.  Literally, robot’s own mistakes help him get better via loops of tasks served to him from mentor. Robot tries all possible solutions to the problem and those ways leading to desired result are stored into robot’s permanent memory as useful concepts. Mentor’s role is to feed robot with still more and more complicated tasks upon learning the simpler ones. When robot is faced with conditions same to already solved task from past, he acts to deliver the desired result. Marek Rosa foto

This approach probably most closely follows the pattern of human learning: First we learn to detect digits, then to substract and multliply, yet later to solve the set of equations or to describe curve of time-space. The name GoodAI has been chosen to indicate that artificial intelligence trained this way will not feel off the balance by new circumstances. Robot simply selects the solutions that minimizes the damage and if more often facing that new phenomena, over the time it improves the method to ideal resolution of the problem.

II.  When sugar succumbs to whip

Ron Arkin fotoQuite different approach has been selected by  Ron Arkin, American professor of Robotics at Georgia Tech University in USA. Upon his experience he had gained by programming robots for American military, in classic sugar-whip choice he leaves the caloric option aside. His approach builds on simulating emotions in robots. And emotions that are. Arkin let the robot to decide and after the decision he simulates joy or shame in the robot’s system (by assigning black or red points to his solution). So if robot hits the barrier and tries to smash it by force, the teacher stimulates the shame feeling in robot’s memory about the damage caused to the wall. Therefore, next time robot hits the wall, he refrains the solutions that he felt ashamed about in past and prefers solutions that he has been praised about. This approach is essential because robots quickly learn to avoid unacceptable mistakes. In real life these robots will be less blunt in “surprising, never experienced” scenario than the ones trained by first method.

III. Read your robot a fairy tale before sleep

Mark Riedl fotoThe third approach relies on moral standards development that we, humans, receive in the early childhood. Fairy tales and Stories. Mark Riedl, also from Georgia Tech University agrees to Good AI approach. But he reasons that we do not have enough time to teach robot every tiny bit of the intelligence by plethora of trials and fails.

Therefore, Riedl suggests that robot „reads“ great number of stories and analyses human thought and acting into cause-aftermath pairs. If robots during reading of the stories identifies formula that repeats, it stores it into the memory and will try to validate or disprove this rule in next stories to read. Already from legendary movie  „Number five is alive“ (see video) we know that robots can read enormously fast. Hence, this approach of learning can progress much faster than other methods involving human feedback. Robot can this way infer from innocent stories that if humans walk into the restaurant, they sit down and wait for the waitress to take their food orders. Do you find this trivial? Well, then consider robots to be perplexed, why hungry humans do not storm into the restaurant kitchen and cook something for them, as they do at their homes. The advantage of the “fairy tale” approach is that it can train event complex events that are very complicated to construct into try-and-fail attempts used by Marek Rosa.

Together or against each other?

So, what all three methods share in common? Moral standards training of robots cannot rely on preprogramed routines.  Even if we took the effort of rewriting all our moral standards into chains of “If X happens, then do Y“, robot educated by them would be still paralyzed if new circumstances arise. This way trained robots would also be rigid in times with their standards, fully inapt for human dynamics changing. Let’s not forget that not that long-ago women did not have right to vote and it was owner’s legal right to beat his slave on the street.  Proper training of the robot must allow for him to “learn along seeing” new societal norms, same way we teach new customs upon arriving into foreign culture. At the beginning we are a bit cautious and reserved, but after few days we slowly learn not to be elephant in glasshouse. Robot’s training has several advantages to human education. Firstly, if one robot learns all the needed skills, all his next copies get them right away from moment of the construction. What is more, state authorities, can demand that all human facing robots in given country will share common moral standards and compulsory stick to them. The thing that would be so often needed in our human life as well. But that is different fairy tale to read …