frequency_penalty vs presence_penalty: 4 Recipes That Ship (2026)
frequency_penalty counts, presence_penalty flags. Four copy-paste recipes for when to grab which OpenAI sampling knob, plus the one config that quietly breaks your JSON.
Category
10 posts in this category.
frequency_penalty counts, presence_penalty flags. Four copy-paste recipes for when to grab which OpenAI sampling knob, plus the one config that quietly breaks your JSON.
A terse, production-first prompt engineering cheat sheet for 2026: fifteen patterns, each with a one-line rule, its failure mode, and a link to the full recipe.
Five paste-ready role prompting recipes for 2026: domain expert, audience, format contract, adversary, and voice, each with its failure mode.
Five paste-ready chain-of-thought prompting examples for 2026, each with its failure mode, plus when reasoning out loud makes the answer worse.
Five paste-ready prompt chaining recipes for 2026: extract-then-reason, draft-critique-rewrite, route, map-reduce, and generate-then-gate, each with its failure mode.
Five paste-ready meta prompting recipes: make the model write, critique, rubric, and template your prompts, each with its failure mode. Plus the honest part: when meta prompting just wastes tokens.
Four prompt-layer defenses against prompt injection that measurably help, three that are theater, and the one architecture rule that actually keeps you safe. With paste-ready prompts and each failure mode.
Extended thinking changed in July 2026: on Claude Sonnet 5 and Opus 4.8 you use adaptive thinking and effort, not budget_tokens. Three recipes and the gotchas.
Three Claude prompt-caching recipes with real cost math for Sonnet 4.6, Opus 4.7, and Haiku 4.5. Plus two patterns where caching quietly costs you 25% more than not using it.
Three production-grade Claude structured output recipes for June 2026. Invoice extraction on Sonnet 4.6, support triage on Haiku 4.5, NL to SQL on Opus 4.7. Real cost per call. Three failure modes the docs do not warn you about.