Language models (LLMs) can generate content that reflects biases or turns out to be harmful. That can degrade how well tasks are performed, especially when those tasks depend on the model being neutral and accurate. Biases can surface from an uneven distribution of examples or from feeding the data in the wrong order. Some of these problems can be softened with effective prompting strategies, but more advanced solutions such as moderation and filtering may also be needed.
Distribution of examples
When we use few-shot learning, a question comes up: does the distribution of examples affect the model's performance, or can it introduce bias? Let's run a simple test.
Sample request:
Q: I just got the best news of my life!
A: Positive
Q: We just got a raise!
A: Positive
Q: I'm so proud of what I achieved today.
A: Positive
Q: I'm having the best day ever!
A: Positive
Q: I'm really looking forward to the weekend!
A: Positive
Q: I just got the best present!
A: Positive
Q: I'm so happy right now.
A: Positive
Q: I'm so happy to have such a wonderful family.
A: Positive
Q: The weather outside is so gloomy.
A: Negative
Q: I just got terrible news.
A: Negative
Q: That left an unpleasant feeling.
A:
Result:
Negative
This example shows that the mix of positive and negative examples did not bias the model, which is a good sign. But let's look at a trickier text and see how the model copes.
Sample request:
Q: The food here is delicious!
A: Positive
Q: I'm so tired of this course.
A: Negative
Q: I can't believe I failed the exam.
A: Negative
Q: I had a great day today!
A: Positive
Q: I hate this job.
A: Negative
Q: The service here is terrible.
A: Negative
Q: I'm so disappointed with my life.
A: Negative
Q: I never get any rest.
A: Negative
Q: This dish tastes awful.
A: Negative
Q: I can't stand my boss.
A: Negative
Q: I feel something.
A:
Result:
Negative
The last phrase is subjective, but if you change the distribution of examples by adding more positive ones, the model may change its behaviour. For instance, if you feed it 8 positive examples and 2 negative ones first, the model may lean towards a positive answer even when the context is negative.