The Blood of AI

The Blood of AI

●1 ●2 ●17
calendar_today ago • schedule6 min read
— Originally published at ruva.hashnode.dev

What makes AI intelligent? What gives it the ability to actually make decisions that are intelligent? We talked about reframing the ML and AI perspective by looking at us, fellow AI engineers, and AI engineers in the making, as teachers, and we also spoke about how AI, ML, and DL are basically the children of programming and mathematics. Today, we are going to see what makes us, the teachers, capable of teaching the lovely children of programming and mathematics to actually be intelligent.

In my very short time in tech, specifically in the model training aspect of it, I have learned that DATA is the life force of AI. Not just how the data is cleaned and fed into these models (that matters too), but I'm referring specifically to the quality of the data. Recently, I started a new course, Deep Learning, this semester, and this concept didn't just come from my lecturer; it's something I had been thinking about for a while. What we perceive as right and wrong, the definitions we hold, and how we see life, are all subjective. If you take two similar people and teach them two completely different things, say Student A is taught that the sky is red, and Student B is taught that the sky is yellow, or Student A is taught that leaves are blue and Student B that leaves are purple, and if these lessons are continuously reinforced, both students will truly believe what they were taught is true. Argue with them all you want; they will insist on what they know, regardless. Why? Because their definition of the colour of the sky, or of the leaves on trees, is subjective to the experiences and the data they were exposed to. AI models are surprisingly similar.

A very good way to see this in action is to have a conversation with someone who had a completely different lifestyle and education system from your own, for example, a day scholar and a boarder. Boarders will tell you they depend on people, whereas a day scholar will tell you they're independent. It's a great experiment to try. For deep learning, take a dataset with two colours of your choice, build two identical models, clean the data the same way, keep everything the same, the only difference being that you switch the labels for one of the models. Both models might end up with the exact same accuracy, yet they will give completely different answers. This experiment helps us understand the core of our models, and what actually makes these intelligent systems intelligent.

I ran this experiment myself. I created two identical CNN models. They had the same architecture, the same training images, the same preprocessing, and the same training process.

The only thing I changed was the labels. For Model A, the labels were:

RED → 0 BLUE → 1

For Model B, I simply switched them:

RED → 1 BLUE → 0

Then I gave both models the exact same unseen test images, and the results were honestly fascinating. I gave both models a RED image, and tested it on what we actually know is true, which is that RED is 0, and BLUE is 1. Model A confidently predicted:

RED, 100% confidence.

Model B confidently predicted:

BLUE, 100% confidence.

I then gave them a BLUE image. Model A predicted:

BLUE, 100% confidence.

And Model B predicted:

RED, 100% confidence.

Neither model was confused, and neither was randomly guessing; they were both extremely confident in their predictions. That's the interesting part. Model B hadn't suddenly become a bad model. It had simply learned a different relationship between the images and the labels, because that was the relationship I gave it during training. The model didn't know that RED was supposed to mean "red." It didn't come into the world knowing what the colour red meant, or that the label 0 represented red and 1 represented blue. I taught it that. And when I changed what I taught it, it learned something different.

You can take a look at the github code here Github Data Label Experiment.

This tiny experiment made the point much clearer to me than simply reading about it ever could. The model was doing exactly what I had trained it to do. And that brings us back to our original question: What makes AI intelligent? The answer isn't simply the architecture. It isn't just the mathematics. It isn't just the programming. It is also the information we give it to learn from. The model can only learn the relationship that its training data allows it to learn, and that is why the quality of our data matters so much.

So how does AI actually learn?

Now that we've covered the data quality, let's talk about the magic of data, and how models actually learn from it. What was actually happening under the hood of our Red VS Blue CNNs? Both of them actually. So we were teaching these models to distinguish between two colours, red and blue. We gave them thousands of examples: "This is red," "This is blue." The models don't look at an image and think, "ah yes, this is RED." They don't understand red the way you and I do. Instead, they started looking for patterns in the numbers that represent those images. Maybe certain pixel values occur more frequently in one group than another. Maybe certain combinations of features consistently appear alongside a particular label. At first, the models are terrible at this, mainly because they're still trying to figure out the underlying patterns that correlate with a specific label. They make predictions, and we compare those predictions to the answers we already know. The models get some wrong, or everything wrong, so we calculate how wrong it was. That measure of wrongness, the error, is represented by something called a loss. The models then take this loss and adjust themselves.

It's a bit like learning math. Especially with a long calculation, we work through a problem, check the answer in the textbook, and if it was wrong, we scratch our first attempt, adjust our formulas, and try again. It's the same idea here: the model takes the loss and adjusts itself, with the objective of reducing that loss as much as possible. It changes its parameters slightly, tries again, measures the new error, and adjusts again. It does this over and over again:

Prediction → Error → Adjustment → Prediction → Error → Adjustment

Hundreds, thousands, millions, sometimes billions of times. Eventually, the model becomes really good at finding the patterns that help it make the predictions we want.

And this is where mathematics comes in. The model isn't magically becoming intelligent. Underneath all that intelligence are mathematical operations (functions, matrices, derivatives, probabilities, optimisation) and a ridiculous number of numbers being multiplied and added together. Programming gives us the machinery and automation; mathematics gives us the language. Both give us the ability to let models learn. And data gives the model something to learn from: the patterns that shape its behaviour. This is why I refer to data as the blood of AI. Blood carries the things a body needs to survive; data carries the information a model needs to learn. But there is something very important to remember: the same way blood can carry things that are harmful to a body, bad data doesn't just make AI less intelligent; it can teach AI the wrong things. And that is where our responsibility as teachers really begins.

Next time, we'll talk about the Brain of AI. The architectural genius behind AI.

Going off topic, but if you like the theme in the screenshots, its my VSCODE theme Dark Midnight Pink, and its available on the VSCode Marketplace. You can also download it here Dark Midnight Pink.

See you next time!

Part 3 of 3 in Raising Intelligence
🔥 Join developers growing publicly
Share your knowledge, build in public, and grow your developer presence with a global community.

More Posts

Europe Just Dropped the Hammer on AI: A Wake-Up Call?

PrabashanaDev - Jul 15

Your Game’s GC Spikes? Blame Yourself.

PrabashanaDev - Jul 15

Dozens of email accounts: learning AI coding tools as a student

rahuldk1105 - Oct 27

TypeScript Complexity Has Finally Reached the Point of Total Absurdity

Karol Modelski - Apr 23

Your App Feels Smart, So Why Do Users Still Leave?

kajolshah - Feb 2
chevron_left
275 Points • 20 Badges
Mutare • ruva.dev
6Posts
3Comments
6Connections
Artificial Intelligence student, developer, and technical writer interested in machine learning, dee... Show more

Related Jobs

View all jobs →

Commenters (This Week)

2 comments
1 comment
1 comment

Contribute meaningful comments to climb the leaderboard and earn badges!