Foundry theme
Resource

How LLMs actually work.
Enough to debug them.

You do not need the mathematics. You do need a model of what is happening, because almost every surprising behaviour becomes predictable once you have one — and stays baffling without it.

THE MECHANISM

Text becomes tokens. Not words and not characters — fragments, chosen by a compression scheme fitted to a training corpus. Common words are single tokens; unusual ones split into several. This is why models are bad at counting letters in a word: they never see the letters, only the fragments.

The model predicts the next token. That is the entire mechanism. Given everything so far, it produces a probability distribution over what comes next. Everything a model appears to do — reasoning, summarising, coding, refusing — is that operation repeated, with the output appended and the process run again.

Attention decides what matters. When predicting the next token, the model weighs every previous token by relevance. This is what lets it connect a pronoun to a noun forty sentences back, and it is also why cost scales the way it does with context length.

Sampling introduces variation. The model gives a distribution; something has to pick. Picking the highest-probability token every time gives repetitive text, so a sampling strategy adds controlled randomness. That is why the same prompt gives different answers, and why lowering temperature makes output more predictable rather than more correct.

Training happened once, before you. Pre-training on a large corpus, then fine-tuning toward helpfulness and safety. The weights are frozen when you use it. It has no memory between conversations, no ability to learn from you, and no access to anything after its training cut-off unless you put it in the context.

WHY THIS EXPLAINS THE FAILURES
01

Why it invents things

It produces the most plausible continuation, and a plausible continuation of “the case citation is” is a well-formed citation. It has no mechanism for distinguishing recalled from constructed. Retrieval fixes this by putting the real answer in the context; nothing about the model itself does.
02

Why it cannot count characters

It sees tokens, not letters. Asking how many times a letter appears in a word is asking about information the model never received. This is not a capability gap that scale fixes.
03

Why prompt wording matters so much

The prompt is the entire conditioning. Changing phrasing moves the distribution over continuations, sometimes substantially. This is why prompts need testing rather than reasoning about, and why a change that seems cosmetic can move quality.
04

Why it forgets

There is no memory. Every conversation is the whole history re-sent as context. When it exceeds the window, something is dropped — and unless your system is deliberate about what, it will be dropped arbitrarily.
QUESTIONS
QUESTIONS — 3

A question about meaning that we are not equipped to settle. What is answerable is the engineering version: it produces outputs consistent with understanding across a wide range of tasks, and it fails in ways a person who understood would not. Design for the second observation and you will build systems that hold up.

Not within a conversation and not between them — the weights are frozen. Some providers may use submitted data for future training depending on your agreement, which is a contractual question rather than a mechanical one, and one worth checking rather than assuming.

Sampling. The model gives probabilities and something picks from them, with deliberate randomness. You can reduce it with temperature settings, and reducing it makes output more consistent rather than more accurate — a distinction worth keeping straight.

Keep reading
30-minute technical call · no deck

The failures stop
being surprising.

Most AI project problems we are called into are explained by one of the five mechanisms above.

CASE STUDIES

Shipped work.
Go and check it.

The work we can name, with the live site, our scope and the boundary made explicit. Select a project to see the evidence; each is a full case study, not a logo or a claim.

sonora.com
The Sonora homepage on desktop: a full-bleed dune landscape behind the headline “Transform Your Life with Sound”, with App Store and Google Play download buttons.
sonora.com — homepage, 1440×900 sonora.com →
Live Consumer wellness · Mobile + web

Sonora

Cognitive AI Ltd · 2026

A free sound-wellness app, described by its publisher as AI sound therapy that reads a short vocal sample at the start of a session and generates a soundscape for that moment. We designed and built the website and its backend, produced assets for the iOS and Android apps, and supported the application prototype.

Read the case study →

See every published project →

WHO WE HAVE BUILT FOR

Twenty-one years of applications, platforms and campaigns for names you know.

See all of our work →