ELI5: How Do LLMs Work? Part 5 - Rise of the Machines

...
7 minute read

We’ve made it to the final article in the series. Or maybe your eyes glazed over and you skipped ahead because you were tired of reading. Hey, I get it. Thanks for reading. You do you.

If you do want to catch up on what you missed, you can check out Part 1, Part 2, Part 3, and Part 4 here, here, here, and here.

In this final article, we’ll cover a few last LLM topics now that we’ve unpacked how they work.

Foundational Models

A foundational model is a large, pre-trained general-purpose model trained on massive, diverse datasets. You can take a foundational model and fine-tune it to:

  • Write code, like OpenAI Codex which was fine-tuned from GPT-3
  • Analyze medical data, like Med-PaLM which was fine-tuned from Google's PaLM
  • Analyze biomedical or scientific literature, like SciBERT

Foundational models are like a blank canvas, and you've probably heard of the major players in the space (at least at the time of this article) as:

  • OpenAI: Creator of the GPT series (GPT-2, GPT-3, GPT-4), including Codex and ChatGPT.
  • Anthropic: Creator of the Claude model family, focused on alignment and constitutional AI.
  • Meta: Creator of the LLaMA (Large Language Model Meta AI) series, including open-weight models.
  • Google DeepMind: Creator of the Gemini family, successor to PaLM, with multimodal capabilities.
  • Mistral AI: Developer of lightweight, high-performance open-weight models like Mistral 7B and Mixtral.

Reinforcement and RLHF

So you’ve got yourself a foundational model — GPT, Claude, LLaMA — trained on a galaxy of internet text. It’s powerful, sure. But is it the best that it could be for you're particular task? Probably not. That’s where fine-tuning comes in — specifically Reinforcement Learning from Human Feedback (RLHF).

Reinforcement learning is a training method where a model learns through trial and error: take an action, get a reward (or punishment), and adjust behavior to get better rewards next time.

Here’s how RLHF works in three steps:

  1. Supervised fine-tuning — First, the model is trained on human-written examples of "good" answers.
  2. Reward modeling — Then, humans compare several possible responses to a prompt and rank them best to worst. This allows the model to score the output.
  3. Reinforcement learning — Finally, the model generates responses, has them scored, and updates itself using reinforcement learning to maximize helpfulness and reduce weirdness.

RLHF essentially puts a human in the loop to guide the model’s behavior — someone who can say, "No, LLM, that wasn’t helpful. Please try again."

Prompt Engineering

I'll be honest, I assumed that the phrase "prompt engineering" was a scam. “You mean to tell me the trick to better AI is... phrasing the question differently?” Actually, yes. That does work (sometimes).

Now that we understand how these models work, it’s not that surprising. Remember back in Part 3 when we talked about attention? The model literally focuses on the parts of the input stream (i.e. your prompt) it thinks are important. So the more helpful context you include — tone, structure, examples — the easier it is for the model to lock onto what you actually want.

That’s the whole game: make the model’s job easier, and it gives you better answers.

In fact, the cooler kids are starting to call this context engineering — same idea as prompt engineering, but expanded. Instead of just rephrasing your prompt, you’re using everything in the model’s toolkit: long-term memory, retrieval, system instructions, and more.

Emergent Properties

Emergent properties are capabilities that weren’t explicitly trained, but somehow appear once the model is big enough. Like the model spontaneously learning how to do math, translate languages, or write poetry. Nobody explicitly taught it how to do those things, it just picked up those skills from the patterns in the training data.

As models scale — more parameters, deeper layers, more diverse training data — they hit a kind of complexity threshold. Once they cross that line, they stop just memorizing examples and start generalizing. Not because they were explicitly trained to reason or rhyme, but because it helped them minimize the loss function across billions of tokens.

Researchers started seeing this kind of emergent behavior in large models like GPT-3 — where abilities like question answering, summarization, or code generation only showed up once the model got big enough.

Emergent properties are closely tied to zero-shot and one-shot learning — which basically describe how much help a model needs to perform a new task:

  • In zero-shot, you give the model just the prompt, and it somehow figures out what to do.
  • In one-shot, you show it one example before asking it to try.

It’s not magic — it’s math. But it feels magical when your autocomplete figures out how to summarize an academic paper after reading one sentence.

Hallucinations

You’ve seen it. I’ve seen it. We all know about it. But why does this happen?

Because LLMs aren’t search engines. They don’t fact-check. They don’t "know" things. They’re just extremely advanced guessers — predicting the next token based on patterns they’ve seen in their training data. If you ask about a fake law or a non-existent scientist, the model will happily invent one. Not because it wants to lie — but because, statistically, that’s what a plausible response looks like.

This is called a hallucination — when a language model confidently outputs something that sounds correct but is completely made up.

Hallucinations are a side effect of how LLMs are built. These models aren’t querying a database of facts — they’re generating responses by completing patterns. If the training data didn’t cover a topic accurately (or at all), the model will still try to fill in the blanks with something that looks right.

Some newer models try to reduce hallucinations by connecting the LLM to external tools — like search engines or fact-checking APIs, like:

  • OpenAI’s ChatGPT with browsing uses Bing to fetch real-time web results.
  • Google’s Gemini integrates search and fact-checking pipelines under the hood.

But unless you’re using one of those fancier setups, always take a model’s answers with a grain of salt.

Copyright Considerations

Here’s the billion-dollar question: if LLMs are trained on human-created content, who owns what they generate?

These models learn from mountains of text, code, music, and art — much of it copyrighted. That raises some thorny legal questions. Is AI-generated output original, or a remix? What is "fair use" for LLMs? If models were trained on open-source code, do the outputs inherit the license?

Right now, the law hasn’t caught up. Lawsuits are in progress — including cases against OpenAI (NYT v. OpenAI) and GitHub Copilot (Doe v. GitHub) — and regulators are still figuring it out.

GPU Mania

As we covered in our previous articles of this series, training and running LLMs involves performing billions (or trillions) of matrix operations. GPUs (Graphics Processing Units) are optimized for exactly that kind of parallel math. Unlike CPUs, which handle tasks sequentially, GPUs can process thousands of operations simultaneously, making them ideal for deep learning workloads.

Without GPUs, training a model like GPT-4 would take years — or just plain fail.

NVIDIA dominates the space, powering most major LLMs today (NVIDIA Blog) - so now you know why NVIDIA's stock went bananas in the 2020s.

Conclusion

Well, we made it.

We’ve gone from “What even is an LLM?” to deep-diving into embeddings, attention, training loops, fine-tuning, hallucinations, and legal gray zones.

So what’s the big takeaway? LLMs aren’t magic. They’re just really good at spotting patterns in massive amounts of text — powered by math, scale, and a bit of human feedback.

And now that you know a little about how they work, you’ll be in a much better position to spot the real deal versus the phonies.

Author Image

The team at /dev/null Digest is dedicated to offering lighthearted commentary and insights into the world of software development. Have opinions to share? Want to write your own articles? We’re always accepting new submissions, so feel free to contact us.

Related Posts

Leave a Comment



By posting you agree to our site's terms and conditions , ensuring that we can create a positive and respectful community experience for everyone.