How (on earth) do LLMs work?

How (on earth) do LLMs work?

I reckon 90% of the people that talk about LLMs don’t actually know how they work. But are too ashamed to admit that - so let’s fix that ;)

Put simply, a Large Language Model (LLM) reads what you’ve written and tries to predict what should come next. Apply this to a basic case. ”It’s raining outside, I should bring my ———”.

Umbrella right? Or perhaps you said raincoat. Or maybe you said bagel. Or pink unicorn. (Genuinely, go try this with your friendly LLM).

Ultimately this is all an LLM is trying to do. Guess what should come next. It does this by sucking in the words you give it, breaking them up into ‘tokens’ and running said tokens through millions of learned ‘settings’ or ‘weights’. These weights help it spot patterns, and it gives potential next tokens (or, effectively, the word it's trying to place next) a score. The winning score gets that illustrious next place. ‘Umbrella’ certainly won when I asked my own chatGPT because chatGPT has generally recognised a pattern that when people go outside and it’s raining, they take an umbrella with them. It’s learnt that through crawling trillions of words, artefacts, sentences, all over the internet, books, papers, manuals, the list goes on.

Overkill? Maybe. But not so much when that same LLM can now behave like an expert in pretty much any field because - guess what - it’s trawled those words & papers too and can guess to a pretty good degree what the next word should be in a sentence like “after the cardiopulmonary bypass, we took care to avoid distortion of the left coronary ——-—”

“Ostium” obvs. Just a pretty standard cardiac surgery sentence, but guess what, the LLM is writing it as though it is a tenured 40-years of experience world-class heart surgeon.

I tell you what, I'd watch a game show like this

In practical terms, the AI is generally guessing how it should respond to your question rather than guessing the next word in your fill-in-the-blank sentence, but the principle is the same.

And it gets better at guessing every single day. More words are scraped & trawled, those 'weights' are fine-tuned & updated, patterns are more easily recognised - and also feedback from users themselves starts to help an AI figure out whether a response is good or bad.

I suppose technically AI is one massive guessing game on steroids.

But it's not a guess like a punt on a pub quiz - it is an extremely educated guess, based on billions of learnt patterns. Does this mean an AI genuinely understands what it's saying? Tough Q. I mean, that's at least a 6 hour philosophical debate right there and perhaps a blog post I'll reserve for a later date...

So based on this explanation, do you reckon I'm in the 90% or the 10%? I'll let you be the judge...

More Oliphonic

New posts, straight to your inbox.

No growth hacks. No “10x your mindset”. Just the next thing worth writing about.