Advanced Prompt Engineering · Lesson 1
LLM as a text completion engine
Why an LLM is a probabilistic next-token predictor, why prompt wording changes the output so much, and what controls output stability in 2026: wording, a JSON schema, effort and tests.
How an LLM actually works
A common engineering mistake is treating an LLM as a database ("fetch me a fact") or an oracle ("tell me the right answer"). A more accurate picture is a text completion engine: at every step the model estimates a probability distribution over the next token P(token | all preceding text) and picks a token from that distribution.
Everything else follows:
- Context is a condition in the probability formula. Every word in the prompt shifts the distribution, so wording affects the output every time.
- The model computes a plausible continuation. A hallucination is expected behavior whenever the plausible continuation diverges from the truth.
- A prompt defines a "region" of text space. A good prompt narrows that region to where plausible = correct.
The rest of this lesson opens after a free sign-up
Sign up with email or Google: the first two lessons of every course stay open for good, and the whole catalog is open for 7 days. No card needed.


