Nestor G Pestelos Jr · ELI5

Phase 2: The User Interaction

Prompt Engineering

How to talk to artificial intelligence so you get predictable, accurate answers on the first try.

01 / Show, Don't Just Tell

Giving examples works better than writing descriptions.

Instead of describing the formatting you want in long paragraphs, show the model one or two finished examples (few-shot prompting).

✗ ZERO-SHOT (VAGUE) "Extract names and titles nicely in a standard style please." Outcome: Inconsistent commas, random conversational filler. ✓ FEW-SHOT (SHOW EXAMPLES) Input: "Alice (CEO)" → "Alice: CEO" Input: "Bob (CTO)" → "Bob: CTO" Outcome: 100% formatted match Model copies the exact pattern.
Why few-shot examples are so effective

Because language models predict patterns, a concrete input-output demonstration provides an unambiguous mathematical template. The model does not have to guess your preferred punctuation, capitalization, or casing.

02 / Chain of Thought

Thinking out loud prevents stupid mistakes.

When solving math, logic, or code puzzles, telling the model to "think step-by-step" gives it scratchpad space to compute before answering.

"A bat and ball cost $1.10. Bat is $1 more than ball." ✗ NO THINKING TIME "Ball costs $0.10" (Common human reflex trap! Wrong!) ✓ "THINK STEP-BY-STEP" x + (x + 1.00) = 1.10 2x = 0.10 → x = $0.05 Correct: Ball costs $0.05
Why the model needs to generate tokens to think

A Transformer has a fixed computational budget per token. It cannot "pause" to solve a difficult algebra problem internally. If forced to answer immediately, it guesses. By writing its reasoning steps into the output stream, each previous step becomes available context for the final calculation.

03 / Negative Fences

Tell the AI what NOT to do.

Default models love to apologize, repeat your question, and add chatty pleasantries. Clear negative constraints eliminate the fluff.

NEGATIVE CONSTRAINTS IN PROMPTS ✗ "Do not apologize." ✗ "Do not echo the prompt." ✗ "No pleasantries or filler." ✓ "Return code block ONLY."
Why negative constraints protect software pipelines

If an AI script outputs "Certainly! Here is your JSON object:" before the actual JSON, your code crashes with a JSON parsing error. Strict negative constraints ensure machine-readable payloads remain clean.

04 / Structured Schemas

Lock down the output shape.

Tell the model the exact data schema you expect, such as JSON or Markdown tables, so downstream software can parse it instantly.

REQUEST FORMAT "Output JSON with keys: name, age, city" {"name": "Nestor", "age": 42, "city": "Manila"} ✓ 100% Valid JSON Object
What is structured output enforcement?

Modern inference engines allow developers to pass a formal JSON schema. The engine uses grammar-based logit masking to physically forbid the model from emitting any token that violates the syntax of the schema.