Artificial intelligence • Original RRTutors lesson
Large Language Models (LLMs) and Token Prediction
Understand tokenization, context windows, next-token generation, and common sources of LLM errors.
Concept and explanation
An autoregressive language model estimates a distribution over the next token conditioned on preceding tokens. It generates a sequence by repeatedly selecting or sampling tokens. The context window limits available input; temperature and decoding settings alter output variation but do not create knowledge or verification.
How to apply it
Separate the model’s learned parameters from supplied context, tools, memory, and application logic.
Worked example
A model can generate a plausible reference that does not exist because likely continuation and factual retrieval are different tasks.
Illustrative Python example
tokens = ["A", "careful", "answer"]
for index, token in enumerate(tokens):
print(index, token)
Expected result
A language model processes and produces token sequences rather than directly manipulating verified facts.
Limitations and cautions
LLMs can hallucinate, misread instructions, leak data, or behave differently across prompts and model updates.
Practice exercise
List what context an LLM needs to answer a current-policy question and how the answer should be verified.
Key takeaway: Fluent token generation is not the same as grounded or guaranteed truth.