AI & Machine Learning
What’s to talk about?
There are a lot of people talking about AI these days. You might hear it referred to as machine learning, or large language models, or Skynet, or any of a dozen hot phrases. You may be wondering what these things are. Wonder no more.
As always, I will be using simplifications and analogies to try and explain complex ideas simply. As things get more complex, the analogies get more strained and the simplifications may include outright inaccuracies that are too complex to be simplified. Generative AI is very complex. I’ll try to make it clear when I’m playing fast and loose, but don’t include any of this as a citation in your dissertation. You have been warned. Oh, and this may get a bit long…
MENACE
Would you like to play a game? Let’s start with tic tac toe. Specifically, let’s design a system that will learn to win tic tac toe. It starts, simply enough, with 304 jars and an infinite number of marbles in nine distinct colors. If you analyze every possible legal pattern of a tic tac toe board, and you eliminate ones that are identical, accounting for rotation, mirror image, or both, you wind up with 304 different possible states for the board. These different states each corresponds to one of those jars. The nine different colors for the marbles each correspond to one of the nine possible spaces on the board.
The first step is to initialize the system. We do this by going through each of the 304 states we determined before, and for each board pattern, any legal move’s square gets two of its corresponding marbles placed in the appropriate jar. So for the board where there’s one X in the middle square, there will be sixteen marbles in the jar, two for each square except the one with the X in it. Conversely, a nearly full board may have only six, four, or even two marbles in the jar. Give each jar a good shake to randomize, and the system is ready to be trained.
To train the system, identify the jar that corresponds to the state the board is in. Pick a random marble out of the jar, and set it aside. Move on the board indicated by the marble. Repeat until the game is determined. For each of the marbles you’ve set aside, in case of a tie, place the marble back in the jar it came from. In case of a win, place the marble and a second of the same color in the jar it came from. In case of a loss, discard the marble. Then, play again. And again. Over and over. Ideally, you have it play itself, so it learns twice as fast. Eventually, when you’re done training, using the system is the same, except just put every marble back by itself every time.
Congratulations! You’ve just built one of the world’s first machine learning systems: MENACE. MENACE, or the Matchbox Educable Noughts and Crosses Engine, is this exact system, except using matchboxes instead of jars and beads instead of marbles. It was described and built in 1961 by Donald Michie, and if you understand this, you have the basis on which all of this AI machine learning stuff builds. So let’s do some building now.
TD Gammon
Consider backgammon. While tic tac toe has a very limited possible pool of board positions, games like backgammon (and chess, go, and the like) are much too complex with too many possible states to have each one trained with the ideal best move. Instead, a more generalized model must be used, where instead of a one-to-one correspondence where any given board has a specific response trained for it, a model is used to analyze the input and generate a deterministic result, even if the model has never “seen” that specific board configuration before.
To explain how this system works, we’re going to need to add a layer of abstraction. Instead of jars, we will now refer to nodes. Instead of each node leading directly to an outcome, we have layers of interconnected nodes. So instead of marbles, there are links between the nodes with various strength, and the answer is some result determined by the strength or absence of the links between various nodes.
It is, admittedly, very complicated, but you don’t have to think about it too much. What you need to get out of this description is there’s some input to the system. The system runs the input through some array of nodes that interconnect in complex ways, and as a result there’s an output. In the case of TD gammon, the input is the state of the board and dice, the output is the move. As with MENACE, during training when the moves are successful and result in a win, the connections that lead to that result are strengthened. When they result in a loss, the opposite occurs.
This is an incredible oversimplification, but if you are still following along (Hi!) this type of multiple node array is what’s known as a neural net, and it’s the basis for much of modern machine learning. This model of input -> [neural net] -> output is the basis of pretty much all of the modern machine learning you’re hearing about, with the only variety being what that neural net is trained for, and how it’s trained.
Image Recognition
This brings us to the critical topic of training. So far it’s been easy. We’re playing games, and the point is to win. Whether the model has succeeded or failed is straightforward, and training is a simple matter of noting if the game was a win, loss, or draw and taking the appropriate action. But what about when the correct answer isn’t so straightforward? Let’s say the input is an image, and you want the output to be a list of words associated with that picture? For the sake of not making this blog post still longer than it has become, we’ll leave aside the complexity of what that kind of a neural net looks like. Let’s just treat it as a black box, feed in an image, and it spits out a list of words. It’s key to note that the training itself isn’t difficult, but it does take a human to look at the picture and determine what a correct reply is. Unlike games, there’s no easy way to automate the training, a person needs to be involved. This leads to a number of important considerations to keep in mind.
First, it means that the training is only as correct as the decisions of the people involved in the training. If everyone in the training incorrectly identifies a square as a circle, the system will happily call a square a circle and be “certain” it is right. It also requires a lot (and I mean A LOT) of manual training before the system has a large enough data pool to begin to develop patterns. The numbers of images needed to generate even basic image descriptions is staggering. Happily, you’ve almost certainly donated your time to this project. If you ever remember having to identify where the bus is, or what a crosswalk looks like, congratulations! You’ve helped one of the self-driving car companies train their AI.
This kind of crowd sourced, involuntary training has become very common, and it can lead to some odd results if the people training the system aren’t sufficiently careful about cleaning and sanitizing the training pool. Specifically, a number of the early Large Language Models bots were trained on one or another of the online communities. In at least one case, the trainers forgot to exclude sarcastic, ironic, and intentionally incorrect/joke text. When these get mixed into the system, the results can be unpredictable, and (to be mild) incorrect.
If you take nothing else from this entire blog, take this. This is key, so let me reiterate it clearly: Any machine learning system is only as good as the dataset used to train it. Garbage in, garbage out. Just because an “AI” says it doesn’t mean it’s true, it just means that’s what it was trained to say.
Pattern Generation
Finally, we’ve reached today. MENACE was developed in the 1960s. TD Gammon was in the 1990s. Neural net image recognition really took off in the 2010s. And Large Language Models (LLMs, a technical name for chatbots) and AI image generation is all the rage here in the 2020s.
At this point, unfortunately, my analogies, hand wavings, metaphors, and oversimplification have all broken down. You can think of these things working similar to the recognition ones, but once you’ve trained it to recognize things, you turn it around and use the words that would have been the output as the input. It’s not accurate, and it doesn’t explain anything, but it’s the best I can do. Honestly, I’m surprised anyone’s even reading at this point.
Summary, and so what?
AI is incredibly complicated. Hopefully, this historical overview of a few major steps in the development of machine learning have given you a framework on which to hang what you read about chatbots and artificial intelligence in the media. It’s unlikely to be going anywhere soon.
Finally, let me just repeat this here:
Any machine learning system is only as good as the dataset used to train it. Garbage in, garbage out. Just because an “AI” says it doesn’t mean it’s true, it just means that’s what it was trained to say.
ChatGPT is designed to appear friendly, but it’s not your friend. It presents as intelligent, but it doesn’t actually know anything. It is literally making everything up as it goes along based on patterns that human beings, some potentially with agendas, have trained it to be desirable. But the bot itself has no desires, no adenda, no knowledge, and isn’t aware. It just knows how to repeat back things that sound like what the humans who wrote it think sounds good.
Thank you for reading this blog. If you have any technology questions you’d like to see addressed, please help me write next month’s blog by asking them! Feel free to reach out to me at it@homesteadbookkeeping.com.