Study notes: how large language models (LLMs) work 1. What an LLM is - A program trained to predict the next token (a piece of a word) in a text. - "Large" = billions of parameters (the numbers adjusted during training). - Examples: GPT (OpenAI, used in ChatGPT), Claude (Anthropic), Gemini (Google), Llama (Meta). 2. Training in three stages - Pre-training: the model reads a huge amount of text and learns to predict the next token. This is where it picks up grammar, facts and patterns. - Fine-tuning: it is trained further on examples of good answers to instructions. - Feedback (RLHF): people rank answers; the model is adjusted toward the answers people prefer. 3. Tokens and the context window - Text is split into tokens. In English, one token is about 3/4 of a word on average. - The context window is how many tokens the model can take into account at once (your prompt + files + its own answer). - If a conversation is longer than the window, the oldest parts are dropped or summarized. 4. Why LLMs make mistakes ("hallucinations") - The model produces the most likely text, not a checked fact. - It can state a wrong date, invent a source or a quote, with the same confidence as a true one. - Fixes: give it the source documents, ask it to cite, check numbers and quotes yourself. 5. Temperature - A setting for randomness. Low temperature = more predictable answers; high = more varied, more creative. 6. What to remember for the exam - Next-token prediction is the core mechanism. - Bigger context window = more text at once, not "smarter". - Always verify facts, names, numbers and citations.