How LLMs Work Preview image

AI

Design Engineering

Personal Project

How LLMs Work — Build Your Own Local LLM

The Complete Beginner’s Guide from how the model reads text to how to build your own LLM Base

Portrait of the article author

Kingsley Anagbuo

The first serious AI use case does not look glamorous.

It looks like a messy folder.

Price lists. PDFs. supplier emails. refund messages. product notes. old SOPs. half-written replies. files named “final-final-new.pdf.” A business owner does not care about transformer architecture. He wants to ask one question:

“Can I make AI understand my work without sending everything to the cloud?”

That is the moment LLMs stop being a demo.

A normal chatbot answers from memory. A useful private AI answers from your files, your rules, your examples, your workflow. It can read a customer complaint, find the order note, draft the reply, and keep the tone calm. It can scan 30 pages and pull out the one line you were looking for. It can help a student turn scattered notes into an argument. It can help a founder build a support assistant before hiring a support team.

But only if you understand the machine a little.

Not PhD-level. Not research-lab level.

Just enough to know why it works, why it fails, why it becomes slow, why a 7B model can feel smart one minute and lost the next, and why the prompt format matters more than people think.

That is what this guide is for.

How LLMs Work reference image

The trick is small. The scale is not.

An LLM does one tiny thing again and again.

It predicts the next token.

You type:

“The customer wants a refund because…”

The model looks at the tokens already there and predicts the next token. Then it adds that token. Then it predicts again. Keep repeating this loop and you get a paragraph, a Python script, a legal-style explanation, a translation, or a clean email.

It feels like the model is thinking in full sentences.

It is not.

It is walking forward one token at a time.

That small loop is why these models are so strange. They can explain a hard topic beautifully, then fail at a tiny detail. They can write a strong draft, then invent a citation. They can sound confident even when the answer is wrong, because the system is built to produce likely text, not guaranteed truth.

The useful mental model is this:

Weights are what the model learned during training.

Context is what you give it right now.

The output is the next-token probability game.

Once you see this, the whole stack becomes easier. Tokens explain cost. Context explains memory. Chat templates explain why one model follows instructions and another ignores them. RAG explains how private document search works. Fine-tuning explains how a model learns your style.

The magic gets smaller.

The usefulness gets bigger.

Create a free website with Framer, the website builder loved by startups, designers and agencies.