# Lee Boonstra - Prompt Engineering (Highlights)

## Metadata
**Review**:: [readwise.io](https://readwise.io/bookreview/50783374)
**Source**:: #from/readwise #from/reader
**Zettel**:: #zettel/fleeting
**Status**:: #x
**Authors**:: [[Lee Boonstra]]
**Full Title**:: Prompt Engineering
**Category**:: #articles #readwise/articles
**Category Icon**:: 📰
**Highlighted**:: [[2025-04-23]]
**Created**:: [[2025-04-26]]
## Highlights
- Temperature controls the degree of randomness in token selection. Lower temperatures are good for prompts that expect a more deterministic response, while higher temperatures can lead to more diverse or unexpected results. ([View Highlight](https://read.readwise.io/read/01jsf0a606cjk0jze1w008g5xy)) ^880746133
- Top-K sampling selects the top K most likely tokens from the model’s predicted distribution. ([View Highlight](https://read.readwise.io/read/01jsf09nekqff1v50e56sggp8n)) ^880746115
- Top-P sampling selects the top tokens whose cumulative probability does not exceed a certain value (P). Values for P range from 0 (greedy decoding) to 1 (all tokens in the LLM’s vocabulary). ([View Highlight](https://read.readwise.io/read/01jsf09cwsxwdv7graamahnd4t)) ^880746101
- Let’s go back to the original prompt, but this time we include the answer of the step back as context and see what it will return. ([View Highlight](https://read.readwise.io/read/01jsfzwjezkw6fctfv7xqkxs65)) ^880869716
- Try using verbs that describe the action. Here’s a set of examples: Act, Analyze, Categorize, Classify, Contrast, Compare, Create, Describe, Define, Evaluate, Extract, Find, Generate, Identify, List, Measure, Organize, Parse, Pick, Predict, Provide, Rank, Recommend, Return, Retrieve, Rewrite, Select, Show, Sort, Summarize, Translate, Write. ([View Highlight](https://read.readwise.io/read/01jsg0aga9nca7ers9myfsrzyr)) ^880870879
- Use Instructions over Constraints ([View Highlight](https://read.readwise.io/read/01jsg0bewh421vcsyvd8e3j0r7)) ^880870901
- If possible, use positive instructions: instead of telling the model what not to do, tell it what to do instead. ([View Highlight](https://read.readwise.io/read/01jsg0c01d2yc18tz27d3whr8v)) ^880870984
- As a best practice, start by prioritizing instructions, clearly stating what you want the model to do and only use constraints when necessary for safety, clarity or specific requirements. ([View Highlight](https://read.readwise.io/read/01jsg0cj7xen0e1t44vwr3drhv)) ^880871001
- Fortunately, tools like the json-repair library (available on PyPI) can be invaluable in these situations. ([View Highlight](https://read.readwise.io/read/01jsg0er303chedk0kesxmw3xc)) ^880871049