liveBook · Manning

Adversarial roles

As explained in Grokking AI Applications

A role-based prompting pattern in which distinct perspectives are assigned to produce critique, tension, or complementary reasoning.

Adversarial roles assign different perspectives to one task so that one role creates an answer and another challenges or improves it. Like a chef and dietitian, the roles separate creativity from quality control. section 3.3

A role-based workflow commonly follows these stages:

  • Input: accept a recipe name or available ingredients. section 3.3
  • Generation: ask a chef role to create an appealing recipe. section 3.3
  • Critique and refinement: pass the recipe to a dietitian role for health-focused improvements. section 3.3
  • Output: return the refined recipe and its health information. section 3.3

Chef versus dietitian

A Michelin-starred chef produces a decadent recipe, while a registered dietitian critiques it and makes it healthier. Separate LLM calls keep each role focused instead of combining both objectives in one prompt. section 3.3

Figure 3.11 Chef vs. dietitian: one generates, the other refines

The figure visualizes the complementary roles: one generates a recipe and the other refines it. section 3.3

How Grokking AI Applications covers it

How deep it goes
Explains a two-call workflow with generation and refinement, while stopping short of implementation details or model internals.
Examples
Uses a chef–dietitian recipe workflow in which creative generation is followed by health-focused critique.
What it assumes
Assumes familiarity with prompts and LLMs while illustrating the role pattern through a concrete recipe application.
What you can do after
Build it from scratch as a structured workflow that separates generation from critique and refinement.
How it connects
Connects adversarial roles with prompt engineering, prompt enhancement, large language models, and generative adversarial networks.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking AI Applications. The section links point to the parts of the book it draws on.