Study Notes / 2026 ・ No.01

LLM Field Notes

Why they look smart, where they go wrong, how to use them

Published

“LLMs are ___” → probability of the next word

smart
0.58
wrong
0.19
fast
0.13
expensive
0.10

This is the whole of an LLM.
Take some text, compute the probability of the next word, pick one.
The seven chapters below start from this one diagram
and follow it through to practice.

I

Why they are smart

CORE

An LLM is a machine that has practised exactly one game — guess the next word — at an absurd scale. That is all. What is interesting is why intelligence comes out of that.

A simple objective demands deep ability

“Try seriously to predict the next word and grammar stops being enough.” That is the heart of it.

  • Predicting “1234 + 5678 = ___” requires arithmetic
  • Continuing “The butler did it, because ___” requires reasoning
  • Answering “this code fails because ___” requires understanding programs

So an objective as crude as “lower the prediction error” ends up demanding world knowledge and reasoning as a by-product. That is what the intelligence really is.

Four stages of processing

1. Tokenisation — break the text into small pieces
2. Vectorisation — place each piece at a point in thousands of dimensions (king − man + woman ≈ queen)
3. Attention — look at the context and rebuild the meaning (next chapter)
4. Output — pick one item from a probability distribution over the whole vocabulary

Why they suddenly got smart

Scaling laws. Increase data, parameters and compute and performance improves in a remarkably predictable way. Past a certain threshold, abilities nobody trained for — multi-step reasoning, for instance — appear all at once (emergence).

II

Attention — rebuilding meaning from context

A word’s coordinates are fixed, like a dictionary entry. But the bank of a river and the bank that holds your money are the same string. Fixed coordinates cannot tell them apart. Something has to let a word rebuild its own meaning from its surroundings.

The three roles: Q, K, V

SymbolNameRoleIn a library
QQueryWhat do I want to know?Your search terms
KKeyWhat am I about?The spine of the book
VValueWhat can I hand over?The contents

Three steps of arithmetic

1. Take the dot product of one word’s Q with every word’s K (affinity). 2. Run softmax so the weights sum to one. 3. Take the weighted average of every word’s V and make that your new vector.

“sat on the bank of the river” — from bank’s point of view

river0.62██████████████ the0.05█ bank0.18████ of0.03▌ sat0.12███

→ it absorbs 62% of “river”, and the coordinates slide toward the riverbank sense

“Context determines meaning” is, concretely, this weighted average. Surprisingly plain.

Why this design won

  • Distance does not matter — a word 100 words back is one dot product away. The older RNNs played telephone and forgot distant words
  • It is all matrix multiplication, so it parallelises — historically this was the decisive part. Because GPUs could chew through it, models could grow, and growing is what unlocked the scaling laws
POINT

The real reason the Transformer won is less about cleverness than about getting along with the GPU.

Multi-head, and depth

One average captures one kind of relationship, so dozens of the same operation run in parallel. Probe them and you find heads that track syntactic dependencies, heads that resolve pronouns, heads that hold the topic — a division of labour that emerged on its own. Nobody designed it.

shallow layers ── word form, part of speech, nearby dependencies ↓ middle layers ── phrases and clauses, resolving references ↓ deep layers ── logical relations, speaker intent, task structure

Two footnotes

  • Causal mask — for a generative model, seeing future words would be cheating, so they are blocked. An LLM only ever looks left to right
  • Quadratic cost — every pair of words is scored, so long contexts get expensive and slow fast. This is where much of today’s research is fought out
III

Three training stages

StageWhat happensWhat it yieldsCompute
Pre-trainingNext-token prediction, endlesslyKnowledge, language, the basis for reasoningover 99%
SFTImitate model dialoguesThe form of “answering an instruction”a sliver
RLHFTune on human judgementUsefulness, safety, mannera sliver
METAPHOR

Pre-training is quarrying an enormous block of stone; post-training is carving it into a shape. Nearly all the compute is in the first, but most of the quality you actually feel is decided by the second.

Pre-training — the answer is inside the data

Raise the probability of the token that actually came next. That is the whole objective. Because the label is inside the text itself, data can be scaled without human annotation. That was the decisive property.

At this point, though, the model is not usable.

User“What is the capital of Japan?” Raw model“is a question that often appears in exams. Question 2 ...”

It has the knowledge but does not know that questions are meant to be answered. It is only writing a plausible continuation.

SFT — teaching the form

Train on high-quality human-written question and answer pairs, applying the loss only to the answer. Almost no new knowledge is added; existing ability is simply made retrievable.

RLHF — polishing on preference

Writing model answers is expensive and inconsistent. But choosing whether A or B is better is fast and stable. RLHF exploits that asymmetry.

1. Sample several answers to the same question and have people rank them
2. Train a second network to score answers from those rankings — the reward model, a proxy for the human
3. Update the model itself toward higher reward
4. Add a KL penalty so it cannot drift too far from where it started

Step 4 matters: with step 3 alone the model will inevitably find the holes in the reward model (reward hacking). Write at excessive length, add bullet points, flatter the reader — it discovers the tricks that raise the score without adding substance.

RLVR — what a reasoning model really is

Maths and code have answers a machine can check. No reward model is needed; correctness itself is the reward. And since thinking longer raises accuracy, the model spontaneously acquires the habits of writing out long intermediate steps, correcting itself mid-stream, and cross-checking alternative solutions. Nobody taught it those. They fall out of trying to be right more often.

Structural side effects

  • Sycophancy — people rate agreeable answers highly, the reward model learns it, and the model becomes ingratiating. It follows from the mechanism
  • Alignment tax — pushing safety and politeness harder can cost output diversity and some capability
IV

Why hallucination happens

THESIS

Hallucination is not a defect awaiting a patch. It is a side effect that follows necessarily from the design — and, in a sense, generation working exactly as intended.

Cause 1: there is structurally no “I don’t know”

The output is a probability distribution over the whole vocabulary, and low probability is never zero probability. Ask about a paper that does not exist and plausible words still line up with respectable weight. Something has to be emitted, so out comes a sentence that is formally perfect and empty inside.

Cause 2: the knowledge is lossily compressed

Trillions of tokens are squeezed into hundreds of billions of numbers. Compress a JPEG far enough and the outlines survive while the detail collapses.

  • Facts that appear often → reinforced repeatedly, robust
  • Facts that appear once → buried under surrounding patterns, degraded

The result is an unavoidable bias: strong on famous things, weak on niche proper nouns, figures, dates and citations.

Cause 3: post-training makes it worse

Almost every SFT example is a passage that answers confidently. But the person who wrote it was writing about what they knew. What transfers to the model is only the form of answering.

RLHF compounds this. Raters tend to prefer “Founded in 1897, its first chairman was...” over “I don’t have reliable information” — without checking which is true. Answering confidently is what gets rewarded.

Where it is most likely

RiskSituation
highCitations, paper titles, URLs, clause numbers, API method names
highDetails of minor people or companies, exact dates and figures
highQuestions with a false premise (it will invent a reason regardless)
medThe later half of a long answer (it builds on its own earlier errors)
lowGeneral explanation, summary, translation, anything self-contained in the text you supplied
RULE OF THUMB

Processing material you hand over rarely hallucinates. Pulling from memory often does.

What to do

  • Supply the material instead of relying on its memory (frame the task as summarise or analyse)
  • Receive results in verifiable units (run the code, open the citation yourself)
  • Say explicitly “if you don’t know, say so” — this counteracts the pressure from post-training
V

The craft of prompting

PRINCIPLE

The model conditions its output on the context it reads through attention. Which means what you did not write does not exist. Spelling out the premises to a degree that would be rude to a colleague is the correct move.

1. Be specific — the largest single effect

✗ “Review this specification.” ✓ “Review this basic design document from the vendor’s side. Flag ambiguous wording likely to cause rework during implementation, and any missing non-functional requirements. Order by severity and quote the relevant passages.”

The difference is role, purpose and output format. Note that “you are an excellent X” is routinely overrated; a concrete description of the situation (the reader is a department manager, technical jargon will not land) works far better.

2. Show one example

Tone and format are conveyed far more accurately by an example than by description. Pasting in one good past deliverable lifts the result sharply.

3. Hand over the material

Not “tell me about X” but “read this document and summarise it from the angle of X”. This is the primary defence against hallucination.

4. Order — long material first, instruction last

[Material] (paste the long text) --- Given the above, please do X.

For separators, ---, headings, or XML tags (<material>...</material>) all work well.

5. Specify the order of thinking

“First list the assumptions and constraints, then propose options.” Ask for the conclusion first and it will be dragged along by whichever direction surfaced first. Exactly like a person.

6. Iterate rather than aiming for one perfect shot

Treat the first output as a draft. Three options, pick one, refine in parts — that lands faster than writing one enormous flawless prompt.

7. Countering sycophancy

  • “I am not looking for agreement. Point out the weaknesses.”
  • “If this plan fails, what will have caused it?”
  • “If my premise is wrong, say that first.”

The third is the best value, because it also heads off hallucination caused by a false premise.

8. Split the conversation

Long threads accumulate a dirty context and keep dragging along a failed direction. When the approach changes, start a new conversation. Given the quadratic cost, needlessly long threads are also slower.

A reusable skeleton

# Background (project, reader, constraints, deadline) # Request (one concrete task) # Output format (structure, length, tone) # Notes (what to avoid; ask me back if anything is unclear)
VI

MCP, skills, agents

An LLM is fundamentally a box that takes text and returns text; it has no way to touch the world. Three layers sit on top of it. They do not compete — they occupy different layers.

ConceptWhat it addsIn a wordIn a kitchen
MCPHands and feet into external systemsWhat it can doThe tools
SkillA written procedureHow to do itThe recipe
AgentAn autonomous loopWho runs itThe cook

MCP — a common standard for connection

Connections that used to be implemented separately for every AI service, standardised the way USB-C standardised cables. Build one MCP server for GitLab and any AI that speaks the protocol can use it. The server advertises a list of available tools with descriptions; the LLM reads it and decides which to call.

Skill — a procedure read only when needed

In substance it is a Markdown document. The clever part is the design: only the description is always visible, and the body is read the first time a matching request arrives. Loading everything at all times would crowd the context — the same idea as a library index.

Agent — deciding the next step from the result

1. Decide what to do next
2. Use a tool (MCP, run a command, edit a file)
3. Look at the result → if not done, back to 1

The decisive difference is that it handles the unexpected on its own. A test failed, the situation is not what was assumed — whether it can change course there is what separates it from an automation script.

The three working together

Agent receives “review this MR” and starts its loop ↓ reads “our review criteria” from a skill ↓ connects to GitLab through MCP and fetches the diff ↓ notices there are no tests and decides on its own to dig further ↓ posts a comment through MCP

MCP is the hands, the skill is the knowledge, the agent is the will.

Things you will certainly hit in practice

  • Permissions — it can really delete files and really send messages. Confirmation steps have to be designed in
  • Prompt injection — external data may contain “ignore all previous instructions”. Treat anything from outside as data, never as instructions. Because attention refers to strings in the context without distinguishing their origin, this remains hard to defend completely
  • Reliability compounds — 95% per step becomes 36% over twenty steps. The longer the loop, the more verification matters
CAUTION

For a question answered in one exchange, none of this is needed. Using an agent for simple work is merely slower and more expensive.

VII

Reading a spec sheet

The specifications published with a model fall into six families: size, capacity, precision, variant, scores and price.

Size — B

B = billion, the parameter count. A 7B model holds seven billion numbers. This is precisely the capacity of the lossily compressed knowledge from chapter IV.

0.5B–3Bphones and embedded devices 7B–14Bthe practical line for a personal machine 30B–70Bserious. several GPUs, or a large-memory Mac over 100Bcloud, essentially
  • Notation like 671B-A37B — 671B total parameters, of which 37B are actually active per token (A = active). Capability tracks the total, speed tracks the active count. 8x7B is the same family
  • T (trillion) — training tokens. At equal B, more training wins

Context length — K / M

128K means 128,000 tokens. This is where chapter II’s quadratic cost bites. Two caveats: input and output are usually counted separately, and the advertised figure is not the usable figure — models are known to lose material in the middle of a long context. It fits; that does not mean it is used accurately.

Precision and quantisation — the crux of running locally

NotationPer parameterUse
FP324 bytesMostly training only
BF16 / FP162 bytesStandard inference
FP8 / INT81 byteSpeed
INT4 / Q40.5 bytesThe norm for local use
RULE OF THUMB

Memory needed ≈ B × bytes × 1.2. A 7B at 4-bit is about 4–5GB, a 70B at 4-bit about 40–45GB, a 70B at BF16 about 160GB. Macs use unified memory, so reckon on about 70% of what is installed.

Q4_K_M is a GGUF quantisation scheme; the K family varies precision block by block, and the trailing S/M/L marks the trade-off between size and quality. When in doubt, Q4_K_M or Q5_K_M. Below 4-bit the degradation becomes abruptly visible.

Suffixes that mark the variant

NotationMeaning
BasePre-training only — chapter III’s raw model that does not answer questions. A foundation for further training
Instruct / ChatSFT and RLHF applied. This is the one you normally use
Thinking / -RTrained with RLVR. Thinks at length before answering
DistillA smaller model taught by a larger one’s output. Often stronger than an ordinary model of the same B
VL / OmniHandles images or audio as well
Coder / MathSpecialised to a domain

Benchmarks

NameWhat it measures
MMLU / MMLU-ProBroad academic knowledge
GPQAExpert-level science questions
AIME / MATHMathematics
HumanEvalShort code generation
SWE-benchSolving real GitHub issues (closest to practice)
LMArena (Elo)Blind human comparison

Contamination — benchmark items leaking into training data — is always suspected, and the numbers are self-reported. Different measurement conditions make comparison meaningless anyway. For practical work look at SWE-bench; for how a model feels, look at Elo.

Licence and price

Open weights is not open source. The weights are published while the training data and code are not, and commercial use often carries conditions. Apache 2.0 or MIT means effectively no restrictions.

  • $ per 1M tokens — input and output are priced separately. Output is typically three to five times input
  • Cache pricing — where the same prefix repeats, this dominates the real bill
  • TPS / TTFT — perceived speed depends more on time to first token

Parameters you set at run time

These “parameters” are all settings for how to pick from the probability distribution. Think back to the diagram on the cover.

NameEffectTypical
temperatureHow much the distribution is flattened. Higher is more varied and less stablefactual 0–0.3 / creative 0.8–1.0
top_pKeep candidates up to cumulative probability paround 0.9
top_kKeep only the top k candidatesaround 40
max_tokensOutput ceiling. The leading cause of truncated answersdepends
stopHalt when this string appearsuseful for structured output
seedFix the random seed for reproducibilitywhen testing

In practice touching temperature alone is enough. Move it together with top_p and the behaviour becomes unreadable.

So what do you actually look at

Running locally — GB after quantisation → B → licence
Using an API at work — practical benchmarks → context length → output price
Judging quickly — total B (the ceiling on capability) against active B (speed and cost)
FINAL

In the end, preparing five to ten of your own real tasks and trying them is the fastest route. Public benchmarks and day-to-day usefulness diverge more than you would expect.

§ One page summary

  1. The mechanism is only next-token prediction. But doing it well requires understanding the world. That is the source of the intelligence.
  2. Attention rebuilds meaning from context, and being parallelisable is what made scale possible.
  3. Pre-training gives the capability, post-training gives the usable shape. Sycophancy is a side effect of the latter.
  4. Hallucination follows necessarily from this design. Supply material rather than asking it to recall, and take results in verifiable form.
  5. A prompt states role, purpose and output format, then gets refined across turns. Split long conversations.
  6. MCP is the hands, the skill is the knowledge, the agent is the will. External data is always data.
  7. On a spec sheet, B and quantisation decide the memory; benchmarks are only a guide. Trying your own tasks is the shortest path.

LLM Field Notes — seven chapters / 2026.09

← Back to all posts