What is AI and how does it work, from machine learning to large language models?
Quick answer: machine learning is teaching a computer to find patterns in data through examples rather than explicit step-by-step instructions — supervised (learning from labelled examples), unsupervised (finding structure in unlabelled data), or reinforcement (learning from reward/penalty feedback). Large language models are a specific, much larger case of this: trained on huge amounts of text using transformer architectures and self-attention, they predict plausible next words rather than "knowing" facts the way a database does — which is also why they can confidently generate wrong answers.
AI is a bit wonky sometimes — what the heck is it, where did it come from, what does it even do, how does it work? In this video I'm going to go through these lovely questions, telling you that it's not magic, and I'll show you exactly how it works.
Before I do that, though, just a quick mention of tech-answers.club — deploying code, creating code, is hard work. As an expert in CI/CD, observability, and DevOps and things, I've created a community so we can come together and help each other out. So if you're on my channel, you're probably in DevOps or interested in DevOps.
Why does this matter for DevOps?
AI can help us in a number of ways. Yes, it sort of helps with creating code, but it can also analyze lots and lots of data — that's what it's really good at, so it can analyse data and then give us trends. It can look at other things and code, and analyze it and tell us whether there are any security flaws in there — it's really good at sucking in information and summarizing.
It's also important to DevOps engineers from the other side of the fence — we've got our colleagues over in big data and machine learning, and they want infrastructure to be able to run their models and hold their data. The other side of the coin, as an operability engineer, is providing those environments to those very learned data colleagues of ours.
So a quick overview of AI history and what it can do for us — we might get to a point in the future where we wake up and the DevOps pipelines have been optimized overnight, your code's been reviewed and it's given you some pointers. Yeah, it's still not so great, is it, so maybe we'll just relegate it to making us coffee, but you'll have to go get it yourself. But we're in 2025, who knows — we've got AI agents (look at my previous video for that sort of stuff) and they're going to transform how we work. We can use ChatGPT, Claude, and Gemini to do those things, but by working as a team, just like humans, they can accelerate their power and understanding.
In fact, at the weekend I was talking to some colleagues and they said Facebook held an experiment you've probably heard about, where they put one AI over here and one AI over there and let them talk to each other — it wasn't very long before they'd invented their own language and were quite happily conversing, and us humans didn't have a clue what they were talking about. So getting them to talk to each other is good, but as a team you need a good manager, like any kind of work group.
Teaching versus programming
Let's talk about why AI exists in the first place — it's teaching versus programming. When I'm a programmer talking to a computer, I'm giving it step-by-step instructions — I can't just say to the computer "walk out there and pick up a thing," that's not enough detail. When you're programming it, well, first you have to stand up — okay, how do I stand up, well you've got to move your legs and keep your balance, and once you've managed that you've then got to get into the hallway — well there's a door in the way, you've got to open the door, or the door's locked and you've got to unlock it — it's a lot of stuff you need to think about and pre-empt just to tell the computer how to do a thing. We know all of this, but we do it so automatically that we forget it's there.
How do we know it? We are taught it, through two ways. We're taught it by somebody actually showing us a thing — if you're watching videos on YouTube like this one, you've got people demonstrating how to do a thing and then you can copy them, similar to how we learn language: we listen to the adults around us and we just copy them, and eventually we work out how to speak. Walking is a slightly dodgy case, because we can see people walking and the grown-ups help us a little, but for the finer detail — keeping our balance and so on — we've got to work that out on our own, so there's a certain element of self-taught going on as well.
How do machines learn?
So we've got machine learning — how do machines learn? There are three main ways: supervised, like the grown-ups helping us do the thing; unsupervised, where we're just messing about trying things — you know, we've unpacked the box, pulled the tech out, and instead of looking at the manual we just push all the buttons and work it out on our own; and that's closely tied with reinforcement learning, where you do something and you get better and better through practice, and you get the reinforced message that you're getting better — like when you're riding a bike, you go a little further, then you fall off, you try again, you go even further the second time without falling off, and eventually you stop falling off. Maybe.
In machine learning terms, supervised algorithms are supervised by "here's a bunch of pictures and we're going to label them for you" — a bit like when you learn language. I remember talking to Sophie, my daughter, and she would often point at things — I'd be holding her and she'd go "that, that, that," and I would tell her what it is — that's a light switch, that's a light, that's the carpet — and over time she would learn these things through the labels. The goal is that they understand the picture through the label, so that when you show it the label, or the picture, either way round, it can then give you the other half of that particular thing.
Unsupervised learning is where there's a data set and it doesn't have labels — I know, right, you didn't see that coming. The goal here is to infer what stuff is through a natural structure — that sounds like complete gobbledygook, but I'm sure it'll become apparent shortly.
Reinforcement learning is where we get the AI to make a sequence of decisions and it learns to achieve a goal without any particular direction — the closer you get to the goal, the more we give you a prize. So it makes decisions following a policy, takes some actions, and if the action was good then it's rewarded, and if the action was bad then it's not rewarded. A bit like dog training, I suppose.
Real-world examples
This is great, but give us some examples of real life, I can hear you saying. I use AI every day, whether I like it or not, because there are various tools that use AI. Part of my job is looking after web servers — lots of web servers — and we look at the traffic that comes in and classify it. This could be identifying where somebody is based on their IP address, and whether the account they're attempting to access is a corporate account or a personal account, and whether they've accessed from that location before, so we can have live analysis. You've probably seen the emails, right — "we've just detected a login from Timbuktu" and we're alerting you to it, because normally you're not on holiday in Timbuktu, normally you're sitting in London or Paris or something. By having AI monitor the logs we can generate alerts like that. We can also go wider — we can see if the same IP address is being used for multiple logins, and that might flag fraud detection.
My favourite example has got to be Asda, a supermarket in the UK — you've got those scales in the vegetable aisle, you've picked up some bananas, put them on the scales, and there's no panel to tell the scales what you've just put on there, but there's a camera. It can see — amazing, so it's picture recognition. It looks at the picture, and if it knew my name it would say "Neil, you've put some bananas on there, let me weigh them and print out a ticket for you" — there's a ticket with bananas, and I'm like, fabulous, off I go. I haven't got to faff about with a user interface trying to find "fruit, yellow fruit, banana," or any of that — it just prints off the ticket, which I think is an awesome use for AI.
Supervised learning models
So machine learning is what we're talking about — how to get a machine to learn something — and we've already mentioned supervised, unsupervised, and reward-based (reinforcement) learning. Let me give you an example of some supervised learning models — these are really great sounding names, academics love them, naming things is hard, what can you do.
- Linear regression — sounds very posh, but really it means "here's a sequence of stuff, guess what comes next," like a quiz question — what's next, 1, 1, 2, 3, 5? The Fibonacci sequence. Or if you're predicting trends, it can look at a graph going all over the place and predict or extrapolate the trend. You can get it to either predict new numbers or flag if something doesn't fit.
- Logistic regression — used for binary classification tasks, quite literally is it a yes or is it a no, and it estimates the chances of yes or no based on the inputs you give it. You can label it because it's supervised — if you get all these numbers that's a yes, if you get all these numbers that's a no, and you give it thousands of examples and it learns.
- Decision trees — these models predict the value of a target by learning simple rules inferred from the data, so it can come back with a more varied answer than just yes or no — a percentage, say 40%, or something like that.
- Random forests — an ensemble (posh word) of decision trees, typically used for classification and regression, for model accuracy and overfitting control. Overfitting is where, if you train something, you've got to watch out for it fitting the training data too closely. There was a picture-recognition experiment designed to spot tanks — they showed it pictures labelled "tank" or "no tank," and when they came to test it, there was a picture with no visual indication of a tank, but the person who took it knew there was a tank on the field at the time. It turned out the computer wasn't spotting tanks — it was spotting whether it was a sunny day or an overcast day, because it just so happened all the tank pictures were taken on a sunny day. So overfitting is something you've got to watch out for, because it can make your model very rigid and unable to pick up anything new — with a random forest you can throw some extra stuff at it just to widen the parameters a little.
- Support vector machines (SVMs) — effective in high-dimensional spaces. A dimension is an input coming into your neural network or machine learning model, so if you've got a lot of inputs coming in, an SVM takes all of the inputs, processes them through a system, and comes out with an answer, usually a classification — labelling pictures of cats versus dogs, say.
- Neural networks — a lot of the other models sit underneath this, in a sense, and they enable you to encode a large number of functions. Where SVMs are essentially plotting a line through data points and classifying which side you're on, a neural network mimics how our brains work and enables you to encode much more complex information — rather than a straight line, you can have a wiggly line, circles, all sorts, based on having more and more neurons, which gives you the ability to encode more complex information.
Unsupervised learning models
There's less to cover here, but we'll go through it quickly.
- Clustering — stuff like K-means, hierarchical clustering — sounds impressive, but it's where you group stuff together, a type of classification.
- Association — finds rules that describe large portions of the data, like looking at a load of Twitter/X posts and deciding whether people are happy or sad.
- Principal component analysis — a statistical procedure that uses an orthogonal transformation to convert a set of correlated values into a set of uncorrelated values. It looks like complete gibberish, but these are very good for noisy environments — really grainy photos and so on, it can still figure it out.
- Autoencoders — a special type of neural network that takes in a lot of unlabelled data and just kind of remembers it, which is sort of the basis for how a lot of large language models work.
Reinforcement learning models
- Q-learning — a model-free reinforcement algorithm that learns the value of an action in a particular state — it comes out with a state and we tell it how good it is, sometimes called a fitness function.
- Deep Q-networks — combines Q-learning with neural networks, making it more complicated.
- Policy gradient methods — use the parameters of a policy directly, as opposed to estimating the value of the actions, so if you've already got a program a programmer wrote that takes these inputs and produces this output, you can feed those same inputs into something like a neural network and reinforce it based on how close it gets to the existing model.
- Monte Carlo tree search — Monte Carlo is a reference to casinos and gambling, and is often used to create true randomness — random number generators on computers aren't truly random, it's a calculation, and true randomness takes a lot of work (measuring lava lamps and so on). With a Monte Carlo tree search we're throwing lots of true random stuff at it so it can work out the answer based on how well it's doing — useful for games like Go or chess.
So, in summary: machine learning is where we get a load of data, throw it at a machine, and tell it how the answer should look — is it right or wrong (supervised), or is it just learning a whole load of stuff and figuring it out afterwards (unsupervised/reinforcement)?
What makes large language models different
The first thing is scale and architecture — most large language models have effectively read the entire internet, that's a lot of scale, whereas traditional machine learning typically focuses on specific, narrow tasks: classify this picture library, or classify whether this email is spam. LLMs also use massive transformer architectures (more on that in a bit) and they learn language through self-attention mechanisms, allowing them to understand context across long sequences of text.
The training approach is also quite different — machine learning is often supervised with labelled data (this is an image of a cat, this is an image of a dog), whereas with language models we're just throwing lots of words at it and it's inferring the context, structure, and grammar through its own labelling system. What this really means is we have no idea exactly how it works, and it's got a general ability — machine learning gives a model one specific thing to do (is this email spam, is there a tank in this picture), whereas with LLMs we're giving general sentences and we want words back that sound right — which is great, because it can write code, translate languages (the original point of these things, believe it or not), summarize text, create gibberish or "creative output," and reason about problems, all within the same model — but again it's not very specific, it's quite generic about what it "knows."
The biggest thing to note is that as large language models get bigger and can handle more context, they develop emerging properties — because it's a large neural network, it can do and remember lots of things, and it pushes our expectations by coming up with surprising answers we didn't expect. Again, that comes back to us not truly knowing how it works — we don't even fully know how the thing between our own ears works. So we have to take a different approach with large language models — because it's not very specific, we have to get better at asking questions.
Computers are very good at remembering things, and that's lovely — we're all quite good at remembering things too. Ask you in a pub quiz: when did Princess Diana die, what year was it? You go, "yep, I know the answer" — it's in there somewhere, it's totally 1997, there you go. Prompt engineering is trying to get the answer back out again, and that can take a lot of work on our part to get the correct answer without any hallucinations (or "boasting," as we might call it if it were a human).
This is a slightly different thing to machine learning — machine learning is really quite niche and locked-down/specific, but this does mean LLMs have quite strange limitations. They can create plausible stuff — after all, an LLM is originally designed as a kind of translator, and its whole purpose is to create a line of text that's correct from a grammar point of view, not correct from a context point of view. "The dog walked down the street" is complete, true, and plausible. "The dog is flying down the street" is also valid English, but complete rubbish, because we know dogs can't fly — but the computer doesn't necessarily know that. So they can make stuff up — they don't really have true awareness, and there are lots of things we infer just by being alive that they don't know about, because they've only ever read stuff.
They can also be very computationally expensive to run — because they're doing lots and lots of calculations. We've modelled a brain, and brains are very efficient with their energy, whereas computer silicon is not so efficient, and like I've already mentioned, they require careful prompt inputs to get the right response out.
What is a transformer?
No, not from another planet, they don't turn into cars — they just get data in and transform it into something else. They're used a lot in large language models. Let me explain with a simple analogy: imagine you're at a huge conference, a big round table, loads of people, everyone's having conversations, it's really noisy, sounds like a nightmare. People are looking for attention, and attention, when someone's talking, is acknowledged by eye contact — you can gauge that someone's listening to you because they're looking at you.
So when someone speaks at the table, you don't pay equal attention to everybody — you mainly focus on the people relevant to what's being said, though you might glance at someone who made a related point earlier to bring them back into the conversation. In transformers it's all about this self-attention — each word pays a different amount of attention to the other words in the sentence. My example earlier — "the dog was flying down the street" — we want to pay attention to "dog," "flying," and "street"; we're not really worried about the rest of the words, they just give a little more context.
We've also got a certain amount of parallel processing — computers can multitask, they can focus on many conversations at once, so we've got this huge conference table with lots of conversations going on, whereas as humans we use our attention for eye contact and listen to one person at a time. Parallel processing enables the machine to listen to everybody all at once and take in all that information — though that has some drawbacks: older systems processed words one at a time, like a single person trying to follow multiple conversations by running around the tables, whereas newer systems, transformers, process everything at once — like having a conversation with multiple people and watching different parts of it simultaneously, which is difficult for us to get our heads round.
They also have positional understanding — just like knowing someone spoke at the start or the end of a conversation, transformers add a positional encoding to each word, so it knows whereabouts it is in the sentence, like giving people a seat number, and remembering the exact order every word came in. With all of that, it's effectively labelling the entire corpus of information coming in, so it can spew it back out again — though you can probably see the problems with this: if it's "listening" to multiple conversations at once there can be crossover you may not want, which is partially why AIs can come out with rubbish.
The real power comes down to finding relationships between those complex sets — understanding the relationships between words, between conversations, and building a simple or complex model between those words, combining the information in new ways, and doing that over and over again until something grammatically sensible pops out. That's why, when you type something in, the AI produces the answer word by word — it's finding out what the next word should be, doing something like a million calculations before it picks the one it likes best. That's really inefficient computationally, but it happens really fast, and yet the result comes out relatively slowly — our efficiencies are just different.
What this does mean is they can take all this information in, and we can use chatbots to steer the conversation and get information out — they can analyze text, understand the context, the words, and the weighting, and then give us an analysis or a summary. More recently there's speech recognition too — because we all talk slightly differently, but it's just turning speech into text, and because it understands how text should be structured, it can therefore understand what we're saying, or at least transcribe it.
Where to go next
That's my brief introduction to AI. Got any questions? Hit me up below. I'd like to know what's next for you with AI — if you want to go one step further and you're a programmer, look at some of the API integrations into the chatbots, and learn more about those machine learning concepts, because it all comes down to the basics — large language models are really sitting on top of that, which is why we didn't have them earlier, we had all the machine learning first. Experiment with open-source models — you can go on Hugging Face and download different trained models, because training takes a ton of resource, even more than running the thing — or run something locally on your machine, like Ollama, which will run certain models and let you experiment locally without paying OpenAI fees.
If you're not a programmer, there's still stuff you can do to play with this — there are no-code interfaces like n8n. The biggest thing you can do is research prompt engineering — what's the best prompt to give a large language model to get out what you actually want. And remember that AI has limitations — it understands what an English word looks like, but it doesn't necessarily understand the context. It doesn't know that dogs can't fly, it doesn't know that normal hands are supposed to have four fingers and a thumb, and so it can make mistakes.
That's all I have for you — that was a long one, thanks for sticking with me. If I can answer any questions, head on over to tech-answers.club and I'll do my best to help. If you want generic answers, go and talk to AI, and it may or may not give you the truth — it's up to you to decide. But until next time, may your deployments be smooth.