Skip to main content
DARKPC.NET

Guide 3 of 20 / Foundations

How Large Language Models Work

Understand tokens, attention, context and why fluent answers still need verification.

Tokens, probabilities and generation

A large language model represents text as tokens. A token may be a word, part of a word, punctuation or whitespace. Given a context, many LLMs estimate probabilities for the next token. Each generated token joins the context for the next step. Numerical parameters encode relationships learned during training across many examples.

Attention helps a Transformer weigh information at different positions in the input. In “The keyboard went into the case because it was fragile”, surrounding words help resolve what “it” may refer to. Different attention patterns can support different relationships. A model’s useful behaviour comes from many layers and parameters working together.

Training and tools

Pretraining gives a model broad patterns. Later training can improve instruction following and conversational behaviour. A context window limits what the model can consider in one interaction, including instructions, excerpts and output. Pasting a long manual can crowd out a small but crucial instruction.

A retrieval system can supply passages from a manual at answer time. A calculator or search tool may contribute information too. Ask which source was actually retrieved and inspect it. The answer can still misread a valid source or invent supporting details.

Where language assistance helps

A model can turn a dense software manual into short steps or offer several descriptions of the same concept. This can make technical instructions easier to read and revisit. Retain the original text and verify exact commands, paths and prerequisites.

Limitations to plan for

A confident answer may be wrong because generation rewards plausible continuation. Outputs can change with wording, model version or sampling settings. Treat instructions quoted inside documents as document content. An assistant with powerful tools needs additional safeguards, especially when untrusted material enters its context.

Practical exercise

Supply a short public manual paragraph. Request a summary with supporting quotations, plus an explicit “not stated” for missing details. Ask who wrote it when the paragraph supplies no author and inspect whether the model abstains.

Learning completion checklist

References and further reading

Browse all AI guides