Tokens, context, and the architecture behind every response
Most people use Claude without understanding how it processes text. That's fine — until you hit a wall. Your prompts get inconsistent results, Claude ignores something you said, or you burn through tokens for no reason. Understanding the architecture turns those mysteries into predictable behavior.
Claude doesn't process words. It processes tokens: fragments that are sometimes words, sometimes syllables, sometimes punctuation. The model converts text to numeric IDs before doing anything.
"The artificial intelligence is fascinating" → ["The", " artif", "icial", " intel", "ligence", " is", " fasci", "nating"] → [464, 34345, 1967, 39941, 44369, 318, 50421, 1174]
Practical implication: if cost matters, write prompts in English. If you need Spanish output, prompt in English and ask for Spanish response.
Before Transformers (the architecture behind Claude), AI systems processed text left-to-right, word by word. By the time they reached "large" in "the trophy didn't fit in the suitcase because it was too large", the context of "trophy" had faded.
Attention solves this radically: every token can look directly at every other token in the context, regardless of distance. For each token, the model calculates how much attention it should pay to every other token.
"The cat drank the milk because it was hungry" When Claude processes "it": The → 0.02 cat → 0.71 ← high weight: "it" refers to the cat drank → 0.08 milk → 0.06 ... Claude learned that "it" most likely refers to "cat". This updates the representation of "it" to carry info about who is hungry.
With very long contexts, Claude remembers the beginning and end well — but information buried in the middle degrades. This is empirically documented and matters a lot for how you structure prompts.
Put critical instructions at the start of your prompt, and repeat the most important constraint at the end. The middle is no man's land. This is not a workaround — it's how the architecture works.
After processing, Claude produces a probability distribution over its full vocabulary (~100k tokens). Temperature modifies those probabilities before picking the next token.
"Creativity" is a metaphor. What temperature actually controls is how deterministic vs. varied the output is. For internal tools, company policies, or structured extraction: use low temperature. For brainstorming or creative writing: higher temperature.
Anthropic caches tokens it has already processed. If you send the same system prompt in every request, those tokens cost ~10% of normal price. Claude Code exploits this: it keeps your CLAUDE.md at the start of every session so it's cached on repeated calls.