Balance examples across a small label set

Read each example as a phrase before typing its label. · 158 words

Take a recipe file from the Westside Community Kitchen spreadsheet. Each row has recipe_id, title, ingredients, and steps. Use three labels for the main eating occasion: breakfast, lunch, and snack. An early prompt has four lunch examples but only one example each of breakfast and snack, so lunch may gain an unfair advantage. Rebalance with two examples per label and an identical format. Breakfast: "Oatmeal with Berries" and "Egg and Cheese Muffins." Lunch: "Lentil Soup with Bread" and "Turkey-and-Swiss Sandwich." Snack: "Apple Slices with Peanut Butter" and "Hummus and Carrot Sticks."

Then give two held-out rows. "R-401, Maple Oat Bowl, rolled oats, milk, and maple syrup; simmer the oats and serve with a banana" is breakfast. "R-402, Pear and Cheese Plate, sliced pear, cheese, and crackers; arrange on a plate" is snack. Require a JSON array with recipe_id and label. The checkable result is [{"recipe_id":"R-401","label":"breakfast"},{"recipe_id":"R-402","label":"snack"}]. Balanced examples remove a prompt-level advantage, though they do not guarantee perfect accuracy.

Check your recall

How many examples should each label receive in the balanced prompt, and what labels should R-401 and R-402 get?

Check your answer

Each of the three labels should receive two examples, for six examples total. R-401 should be labeled breakfast, and R-402 should be labeled snack.

Sources and credits

Original KeyTouch lesson. Background reading · DAIR.AI · Few-Shot Prompting.