Avoid model hallucinations

Avoid model hallucinations


This week in "2 minutes for...", we'll be looking at how to minimize hallucinations in language model responses and that's no mean feat, as OpenAI news coverage in the EU attest. This post is the third in a series on prompt engineering, following on from "Mastering the Art of Prompting" and "5 key prompt engineering techniques using Claude".


What is hallucination and why does models hallucinate?

Generative AI models like ChatGPT and DALL-E have revolutionized content creation, but a concerning phenomenon called "hallucinations" has emerged. Hallucinations occur when a generative AI confidently fabricates content that doesn't align with reality. A non-exhaustive list of factors are causing theses fake realities:

  • Misinformation in the training dataset: Internet contains a lots of inaccuracies, biases and flawed data.
  • Lack of understanding: While incredibly fluent, current AI models don't truly comprehend the information they process. They predict what text is likely to come next based on patterns, not knowledge
  • Overconfidence: Instead of saying "I don't know," models may confidently hallucinate an answer just to match the query.

The worst of it is probably the confidence that the model inspires, which is often misleading: it's too believable to be true, and sometimes too complex to be verifiable.


How to Deal with hallucinations

Apart from avoiding pills with dubious effects, hallucinations can unfortunately never be completely avoided. But I'm going to give you 4 techniques to apply in your prompts to minimize their appearance as much as possible.

  1. Ask your language model to say "I don't know" if he doesn't know. You can also do this with your children, it works very well ;)
  2. Tell him to answer only if he is very confident in the answer.
  3. As indicated in the "5 key prompt techniques", ask your model to think step by step. This will allow the model to double-check. For example, you can ask it to <think> in tags that you will then remove from the final response.
  4. Ask the model to find relevant quotes from long documents then answer using the quotes



Conclusions

You want to put genAI into your products, but hallucinations are bad for your startup. By implementing these techniques in your prompts, you'll be able to take your application from a not-so-reliable prototype to a production version that doesn't talk nonsense.


About Me

I help startups get through their journey: architecture on AWS, security, cost optimization, business development. In short, if you've got a great idea and a good team, don't hesitate to message me!

要查看或添加评论,请登录

Julien Coupez的更多文章

社区洞察

其他会员也浏览了