Introduction
Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft, ch. 1
9 cards in “1.7 Inference” · whole deck
1.7 Inference
- What is prompt engineering?Designing effective prompts for a task.
- Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft, ch. 1, §1.7, p. 21
- What is the difference between zero-shot and few-shot prompting?Few-shot prompts include a few labeled examples (demonstrations) of the task; zero-shot prompts contain instructions without any labeled examples.
- Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft, ch. 1, §1.7, p. 21
- Why should the number of demonstrations in a prompt be small?More examples give diminishing returns, and too many cause the model to overfit to the exact examples.
- Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft, ch. 1, §1.7, p. 21
- What do demonstrations mainly teach the model? What surprising result supports this?Mainly the task and the output format, rather than the right answers: demonstrations with incorrect answers can still improve performance.
- Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft, ch. 1, §1.7, p. 22
- What is a system prompt?A single text prompt that is the first instruction to the model, defining its task or role and setting tone and context. It is silently prepended to any user text.
- Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft, ch. 1, §1.7, p. 22
- What is chain-of-thought prompting?A test-time compute method in which each demonstration is augmented with reasoning steps, leading the model to break a hard problem into steps when answering. Modern models are trained to produce such chains by default.
- Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft, ch. 1, §1.7, p. 22
- List the steps of inference when a user asks an LLM a question in a chat window.(1) Assemble the prompt (system prompt + prior context + question); (2) tokenize it and map tokens to indices; (3) replace each index with its embedding; (4) run the sequence through the trained network; (5) get a distribution over next tokens; (6) choose a token (depending on temperature); (7) append it and go back to step 4; (8) stop at an end-of-response token.
- Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft, ch. 1, §1.7, p. 23
- What does the temperature setting control at inference?Whether the model picks the most probable token or sometimes a slightly less probable one.
- Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft, ch. 1, §1.7, p. 23
- What is in-context learning, and how does it differ from pretraining?Learning that happens during prompting (e.g. from demonstrations) without updating any weights: only the context and the network’s activations change, so whatever was learned vanishes when the conversation ends.
- Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft, ch. 1, §1.7, p. 24
Source
- Daniel Jurafsky and James H. Martin. Speech and Language Processing. 3rd edition (draft). https://web.stanford.edu/~jurafsky/slp3/