🧠 Prompt Engineering Language
6 exercise sets — 30 exercises. Vocabulary for systematic prompt engineering in production LLM systems.
- Advanced
System Prompt Vocabulary
System prompt vs. user message vs. assistant message, instruction following, persona instructions, system prompt confidentiality, and prompt injection defense.
- Advanced
Few-Shot & Chain-of-Thought Vocabulary
Few-shot learning, in-context learning (ICL), chain-of-thought (CoT) prompting, zero-shot CoT, self-consistency, Tree of Thoughts, and ReAct prompting.
- Advanced
Sampling Parameters Vocabulary
Temperature, top-p nucleus sampling, top-k, repetition penalty, frequency penalty, presence penalty, max tokens, and stop sequences.
- Advanced
Prompt Chaining Vocabulary
Prompt chaining, sequential and parallel prompting, prompt decomposition, sub-task delegation, map-reduce prompt pattern, and prompt DAG vocabulary.
- Advanced
Prompt Testing Vocabulary
Prompt regression testing, prompt versioning, A/B prompt comparison, golden datasets, eval harnesses, PromptFoo, and Braintrust vocabulary.
- Advanced
Prompt Security Vocabulary
Prompt injection (direct vs. indirect), jailbreak, prompt leaking, goal hijacking, adversarial suffix, sandboxing LLM outputs, and input validation.
Key prompt engineering vocabulary
Prompt structure
- "The system prompt sets the assistant's persona and constraints."
- "We use few-shot examples to steer output format reliably."
- "Adding chain-of-thought improved reasoning accuracy by 18%."
Sampling & chaining
- "Lower temperature gives more deterministic, consistent outputs."
- "We decomposed the task using a prompt chain with three steps."
- "The map-reduce prompt pattern handles long documents in chunks."
Security & testing
- "Our input pipeline includes prompt injection detection."
- "We run a prompt regression suite on every model update."
- "Jailbreak attempts are logged and reviewed by the safety team."
Frequently Asked Questions
What exactly is a 'Few-Shot' prompt in this exercise series, and why does it matter?
In Few-shot learning, you provide the model with a few example input-output pairs within your prompt itself. This demonstrates the desired behavior without needing to explicitly train the model on a large dataset; it leverages the model's existing knowledge and guides its response toward the specific format or task you're requesting.
I'm getting inconsistent results when I use 'Chain-of-Thought' prompting. What am I doing wrong?
Chain-of-Thought (CoT) prompts encourage the model to explicitly outline its reasoning steps before arriving at an answer. Ensure you're providing clear, sequential instructions that guide the model through a logical progression of thought – simply adding 'Let's think step by step' isn't enough; it needs concrete guidance.
Can I use negative constraints in my prompts to limit the model's output?
Yes, you can! Negative constraints are instructions that tell the model *what not* to include in its response. For example, 'Generate a Python function but do not use any external libraries' or 'Describe the concept of recursion without using the word 'stack'.
What's the difference between 'Zero-Shot', 'Few-Shot', and 'Fine-Tuning' within these exercises?
'Zero-shot' relies solely on the model's pre-trained knowledge, 'Few-shot' provides a handful of examples, and 'Fine-tuning' involves updating the model's weights using your own data – this exercise series focuses primarily on zero-shot and few-shot prompting techniques.
I'm struggling to get the model to generate code in a particular style. How can I influence that?
You can guide the model's coding style by including examples of your desired style within the prompt, specifying keywords like 'Pythonic,' or explicitly requesting a certain formatting approach such as 'Use docstrings and follow PEP 8 guidelines.'
What are 'Tokens' and how do they relate to the length limits of my prompts?
'Tokens' represent individual units of text – words, parts of words, or punctuation. Models have a maximum token limit for both input (prompt) and output; exceeding this will result in truncation or an error message.
How do I effectively use 'Role Prompting' to shape the model's response?
Role prompting involves instructing the model to adopt a specific persona, such as 'You are a senior Python developer'. This helps bias its responses toward that role's knowledge, expertise, and communication style – it's crucial for tailoring outputs.
What is 'Prompt Decomposition' and why is it useful in complex tasks?
Prompt decomposition involves breaking down a large, complex problem into smaller, more manageable sub-prompts. This allows the model to address each aspect sequentially, leading to improved accuracy and coherence for intricate solutions.
Can I use 'Temperature' settings in these exercises and what effect does it have?
'Temperature' controls the randomness of the model's output. Lower temperatures (e.g., 0.2) produce more deterministic, predictable responses, while higher temperatures (e.g., 1.0) introduce greater creativity and variation – experiment to see which works best for your task.
What is 'Context Window' and why is it important when building longer prompts?
'Context window' refers to the amount of text the model can consider at once. Longer context windows allow models to maintain coherence over extended conversations or complex instructions, but they also consume more computational resources – be mindful of prompt length limits.