Prompting
How your words become the model's input—and why next-token prediction makes prompting matter.
What you'll learn
- Describe a prompt as the entire text the model conditions on before generating.
- Explain why small wording changes can shift outputs dramatically.
- Apply basic habits: be specific, show format, state constraints.
In plain English
Prompting is how you talk to a language model. There is no separate “command channel”—your instructions, examples, and questions are all plain text that becomes the model's input. The model continues that text as if it were the most likely next tokens.
Because the model predicts what comes next, it will happily follow a recipe, ramble, or guess—depending on what your prompt makes statistically plausible.
How it works
Products usually wrap your message with a system prompt (rules the app sets) and any prior turns in the conversation. Tokenization turns that bundle into IDs; the transformer computes logits for the next token; generation repeats until a stop token or length limit.
Prompt engineering is the craft of shaping that input: clearer tasks, output formats, examples, and guardrails—without retraining the weights.
# What you type is concatenated into the model's context
system = "You are a concise tutor. Answer in two sentences."
user = "Explain gravity to a 12-year-old."
prompt = f"System: {system}\n\nUser: {user}\n\nAssistant:"
print("--- model input (conceptual) ---")
print(prompt)
print("--- next step: model appends predicted tokens to this string ---")Going deeper
Temperature and top-p sampling change randomness after logits are computed—they do not change what the model “knows,” only how adventurous token choices are.
Prompting works best when paired with evaluation: keep a small set of real tasks and compare prompts on accuracy, tone, and failure cases—not vibes alone.
Common misconceptions
- The model reads your prompt in a special hidden language.
- It is all tokens in context. System vs user labels are conventions products encode as text.
- A perfect prompt removes hallucinations.
- Prompting reduces mistakes but cannot guarantee facts the model never reliably learned.
- Longer prompts are always better.
- Extra noise and contradictions hurt; clarity beats volume.
Key facts
- Prompting shapes behavior by conditioning next-token prediction.
- System, user, and assistant roles are text templates in most APIs.
- Specificity, format, and examples strongly influence completions.
- Sampling settings affect randomness, not factual grounding.
- Prompt changes should be tested on representative tasks.
Sources used
These free resources informed this page. ANN writes original explainers; we do not copy course text behind paywalls.
- Anthropic Prompt Engineering Interactive Tutorial — Hands-on patterns for clearer instructions and examples.
- Hugging Face LLM Course — How LLMs behave as text predictors in applications.
- Karpathy — Neural Networks: Zero to Hero — Build intuition for how model inputs become outputs.
Also explore AI companies, Live Feed, and Weekly Brief.
