Context Windows, Temperature and Sampling

How LLMs Work Intermediate 4 min read Published
In this lesson

Ask an LLM the same question twice and you may get two different answers. Paste a very long document and it may “forget” the start. Both come from settings you control: temperature, sampling and the context window.

Remember from lesson 1: the model gives a probability for every possible next token. Then it picks one. Temperature changes the probabilities before the pick:

🔒 This is a premium lesson

It is part of the Gen AI Developer career track.

🎬 Live animations · 🧪 Tested code · 💼 Projects · 🎓 Certificate

See the track

Already a member? Sign in

Progress is saved in this browser. Create a free account to keep it on every device.