(Cleaned-up, faithful adaptation)

NOTE


Prompt Design Fundamentals (Text-only)

Prompt design involves creating natural language requests (prompts) to elicit accurate, high-quality responses from a language model.

Clear and Specific Instructions

Customize model behavior by providing clear, precise instructions. Instructions can be:

  • Questions (to get answers)

  • Tasks (step-by-step directions)

  • Entities (for classification)

  • Partial inputs (for completion or continuation)

Example Inputs and Outputs:

Input TypePrompt ExampleGenerated Output Example
QuestionWhat's a good name for a flower shop specializing in dried bouquets? List 5 names.1. Everlasting Blooms 2. Dried & Delightful 3. Petal Preserve 4. Whispers of Wildflowers 5. Forever Blooms
TaskList just 5 essential camping items.1. Tent 2. Sleeping Bag 3. Sleeping Pad 4. Headlamp 5. First Aid Kit
EntityClassify items as [large, small]: Elephant, Mouse, SnailElephant: Large, Mouse: Small, Snail: Small
Partial CompletionProvide partial content and examples; the model will complete based on context.

Constraints

Explicitly state limits or constraints to guide responses clearly:

Example:

  • Summarize this text in one sentence.

Response Format

Specify exactly how the response should be formatted (JSON, table, bulleted list, paragraph, etc.):

Example:

  • Create an outline for an essay about hummingbirds. (model chooses outline format)

  • To control outline format precisely, provide partial format as a prompt prefix.

Zero-shot vs Few-shot Prompting

  • Zero-shot: No examples given, just instructions.

  • Few-shot: Provide 1–3 examples demonstrating the desired format, style, and scope.

Recommendation:
Always include a few-shot example to ensure clearer task understanding.

Optimal Number of Examples

Balance between providing enough examples to clarify the task without causing overfitting.

Patterns vs Anti-patterns

  • Positive examples: Show correct behaviors clearly.

  • Negative examples (anti-patterns): Avoid explicitly showing incorrect behaviors, as they confuse models.

Positive Example:
Always end haikus with an assertion.

Negative Example:
Don't end haikus with a question. (Avoid this style)

Consistent Formatting

Ensure your few-shot examples consistently use the same formatting and spacing for clarity and predictability.

Adding Context

Include all necessary contextual information in the prompt to avoid generic responses.

Example:

  • Provide the troubleshooting guide for a router in the prompt if you want router-specific instructions.

Adding Prefixes

Prefixes clearly label input sections, output formats, or example segments.

Example:
Text: Rhino
Answer: large

Breaking Down Complex Prompts

  • Break down instructions into simpler prompts.

  • Chain prompts sequentially (output of one becomes input of next).

  • Aggregate responses when multiple parallel operations are needed.

Experimenting with Model Parameters

Tune parameters to control model output characteristics:

  • max output tokens (response length limit)

  • temperature (randomness vs determinism)

  • topK (select among K highest probability tokens)

  • topP (select tokens until sum probabilities reaches P)

  • stop_sequences (stop generation when reached)

Prompt Iteration Strategies

If a prompt isn’t working, consider:

  • Rephrasing

  • Switching to analogous tasks

  • Changing prompt content order

Fallback Responses

If model gives safety fallback (“I can’t help with that…”), try increasing temperature.

Things to Avoid

  • Don’t rely on generative models for factual precision.

  • Use caution for math and logic-heavy prompts.

Generative Models Under the Hood

  • First stage: Deterministic (model predicts probabilities).

  • Second stage: Sampling (can be deterministic or stochastic/random based on temperature).


Multimodal Prompting Strategies (Images, Video, etc.)

Multimodal prompts integrate media (images/videos) and text for richer tasks.

Prompt Design Fundamentals (Multimodal-specific)

  • Be specific: Clearly instruct the model on what information to extract from media.

  • Add examples: Use few-shot examples to clearly show desired outputs.

  • Break it down step-by-step: Split complex tasks explicitly or instruct the model to “think step-by-step.”

  • Specify output format: JSON, markdown, HTML, etc.

  • Put single-image media first: For single-media inputs, place the image/video before text prompt.

Troubleshooting Multimodal Prompts

If output is unclear, generic, or incorrect:

  • Directly instruct the model to “describe the image/video first.”

  • Explicitly state what information the model should draw from media.

  • Ask the model to explain its reasoning or interpretation.

Troubleshooting Examples:

  • If model misses diaper quantity from image, explicitly instruct:
    Use the diaper count from the box image and divide by daily usage to estimate duration.

  • For generic outputs (e.g., “What’s common among images?“):
    First, describe each image in detail, then explain what's common.

  • To troubleshoot understanding, use prompt:
    Describe what's in this image/video.

Controlling Output Format (Multimodal-specific)

Clearly specify how outputs should appear:

Example Prompt:
Parse this image’s table into markdown format.
(Model returns markdown table.)

Sampling Parameters for Multimodal Prompts

  • Adjust temperature/topK/topP to refine creativity, specificity, or randomness.

Prompt Iteration and Improvement

  • Use varied phrasing: Change wording slightly if stuck.

  • Analogous tasks: Reframe tasks as multiple-choice or categorization if direct prompts fail.

  • Content order: Experiment with changing the sequence of instructions, examples, and context.


Next Steps (Original guide suggestions)