Module deck

Prompting and structured output flashcards

Reviewing needs JavaScript. You can read every card in the list below.

Loading your cards...

Back to the module13 cards in this deck

Read all 13 cards as a list

Prompting fundamentals

  1. Front
    Few-shot prompting vs fine-tuning: what is the difference?
    Back
    Few-shot shows examples in the prompt at inference time: no weight changes, but you pay for the example tokens on every call. Fine-tuning updates weights on labelled examples: upfront cost, and shorter prompts afterward.
  2. Front
    Chain-of-thought: benefit and caveat?
    Back
    It helps multi-step reasoning on models that do not already reason on their own. It costs tokens and latency, and the written reasoning may not reflect what actually drove the answer.
  3. Front
    What is a solid prompt skeleton?
    Back
    Role, context, task, format and constraints, including what to do when information is missing (for example answer 'unknown'). Show the exact output shape with an example.
  4. Front
    How do you reduce prompt injection from a document you pass to the model?
    Back
    Delimit the untrusted text, tell the model it is data and not instructions, validate the output, and limit what the output can trigger. Delimiters lower the risk; they do not remove it.
  5. Front
    Self-consistency: how does it work and what does it cost?
    Back
    Sample several chain-of-thought answers and take the majority. It raises reliability on short, votable answers, at about N times the cost and latency.
  6. Front
    How do you tell whether a prompt change helped?
    Back
    Run old and new prompts on the same labelled set (with edge cases) and compare pass rate. Keep the set as a regression test for later prompt or model changes.

Reasoning models and structured outputs

  1. Front
    When use a reasoning model and when not?
    Back
    Use for hard multi-step tasks where errors are costly and latency is tolerable. Prefer a fast model for extraction, classification, FAQ and tight latency targets. Decide by measuring on your own tasks.
  2. Front
    Does schema-constrained output guarantee correctness?
    Back
    No. It guarantees form, not truth. Still handle truncation and refusals, validate semantics, retry with the error a bounded number of times, and have a fallback.
  3. Front
    What do reasoning tokens cost, and are they visible?
    Back
    They are billed as output tokens and count toward the output limit, even when the API does not return them. Watch the reasoning-token count in usage data.
  4. Front
    Can you trust a reasoning model's visible reasoning as an audit trail?
    Back
    No. In one 2025 study, models mentioned a hint they used only 25% to 39% of the time on average. Treat it as a clue.
  5. Front
    JSON mode vs schema-constrained structured outputs?
    Back
    JSON mode gives syntactically valid JSON. Schema-constrained outputs restrict decoding to your JSON Schema, so the shape and types conform. Neither makes the values true (on Anthropic, enum capitalisation is also not guaranteed).
  6. Front
    Tool calling vs structured outputs: how do you choose?
    Back
    They are not a ladder. Use schema-constrained outputs to shape the reply. Use tool calling when the model should act or fetch through your functions. Validate arguments either way.
  7. Front
    What schema limits and quirks should you plan for?
    Back
    Providers support only a subset of JSON Schema (unsupported features return a 400), Anthropic does not guarantee enum capitalisation, and the first request with a new schema is slower because the schema is compiled.