Course contentsShow
← AI Engineering
Lesson 1579 of 1,88638. Bias, Fairness, and AlignmentFree lesson

Few-Shot Examples for Fairness

Use balanced, diverse few-shot examples in prompts to guide models toward more equitable outputs across groups.

Few-Shot Examples for Fairness

What you'll learn: How to use carefully selected few-shot examples in your prompts to steer language models toward more balanced and equitable outputs across different demographic groups.

The Core Idea

Just as a teacher shapes student behavior through choice examples, the few-shot examples you include in your prompts actively teach the model what "good" looks like. If your examples consistently feature doctors as men and nurses as women, the model learns to perpetuate that bias. But when you deliberately choose balanced, diverse examples—showing women as CEOs and men as caregivers, representing various ethnicities, ages, and backgrounds—you guide the model toward fairness.

This is prompt-based bias mitigation in action, building on lesson 1578's foundation.

Why This Matters

Few-shot examples act as implicit instructions. The model pattern-matches against them when generating responses. A loan application prompt with examples showing only approvals for traditionally "safe" demographic profiles will bias the model's reasoning, even if your explicit instructions say "be fair."

Applying the Technique

When crafting few-shot prompts:

  • Balance representation: Include examples spanning different genders, ethnicities, ages, and other relevant attributes
  • Vary outcomes equitably: Don't always show one group succeeding and another failing
  • Match your use case: If evaluating resumes, show qualified candidates from diverse backgrounds getting positive assessments
  • Check intersectionality: Include examples representing multiple marginalized identities simultaneously (building on lesson 1573)

Think of it like a jury selection process—a biased sample leads to biased verdicts, no matter how fair the instructions sound.

Key Takeaway: The few-shot examples you choose train your model in real-time; diverse, balanced examples are essential for achieving fairness in model outputs across demographic groups.