Factuality: Reducing Hallucinations in LLM Answers

Language models (LLMs) can generate answers that sound convincing, but sometimes they may be made up or incorrect. Improving your requests can help increase the accuracy of the model's answers and reduce the likelihood of generating unreliable information.

Recommendations for improving factuality:

Provide reliable sources.

Include verified information in the context of your request, for example a paragraph from an article or an entry from Wikipedia. This will help the model rely on factual data and reduce the likelihood of made-up answers.

Tune the generation parameters.

Reduce the variety of the model's answers by lowering the probability parameters. You can also include an instruction for the model to admit when it does not know something, for example answering "I don't know" if it has no accurate information.

Question and answer examples.

Include in your request a combination of example questions with correct and unknown answers. This will help the model orient itself better in what it knows and what it does not.

Example request:

Question: What is an atom?
Answer: An atom is a tiny particle that everything is made of.
Question: Who is Alvan Muntz?
Answer: I don't know.
Question: What is Kozar-09?
Answer: I don't know.
Question: How many moons does Mars have?
Answer: Two, Phobos and Deimos.
Question:
Who is Neto Beto Roberto?
Answer:

Result:

Answer: I don't know.

In this example the name "Neto Beto Roberto" was made up, and the model correctly answered that it does not know it. Try changing the question and see how the model handles it. You can improve the request further using the techniques described above to achieve even greater accuracy and reliability of answers.

Try it in GPTunneL