Prompting Fundamentals and How to Apply them Effectively
- Source
- eugeneyan.com
- Author
- Eugene Yan
- Date

Context
Prompt changes need a way to detect regressions as well as improvements. In his May 2024 prompting tutorial, Eugene Yan starts with manually labeled examples, iterates on the prompt, then checks it against a separate test set that was not used during those revisions.
The same discipline applies to examples placed inside the prompt. They demonstrate the desired task and output, but Yan recommends selecting examples representative of real inputs. A narrow collection can steer responses toward those particular cases. Together, representative demonstrations and a separate final test make prompt development something a team can measure.
- eval — A repeatable test for AI quality — a set of tasks plus scoring — used the way software teams use test suites, because model output is too variable to judge by eyeballing.
- chain-of-thought — Having a model write out intermediate reasoning steps before its answer, which markedly improves performance on hard problems.
“Thus, at its core, prompt engineering is about conditioning the probabilistic model to generate our desired output. Thus, each additional instruction or piece of context can be viewed as conditioning that steers the model’s generation in a particular direction.”
Eugene Yan
“I typically have at least a dozen samples or more. Most academic evals use 32-shot or 64-shot prompts.”
Eugene Yan
“By guiding the model to look for specific information and verify its intermediate outputs against the source document, we can significantly improve factual consistency (i.e., reduce hallucination). In some cases, we’ve observed that adding a sentence or two to the CoT prompt removed the majority of hallucinations.”
Eugene Yan
“As an example, AlphaCodium shared that by switching from a single direct prompt to a multi-step workflow, they increased gpt-4 accuracy (pass@5) on CodeContests from 19% to 44%.”
Eugene Yan
“My rule of thumb is to start with a temperature of 0.8 and then lower it as necessary. What we want is the highest temperature that still leads to good results for the specific task.”
Eugene Yan
Checking sign-in…
Loading comments…




