Name: Towards AI Legal Name: Towards AI, Inc. Description: Towards AI is the world's leading artificial intelligence (AI) and technology publication. Read by thought-leaders and decision-makers around the world. Phone Number: +1-650-246-9381 Email: [email protected]
228 Park Avenue South New York, NY 10003 United States
Website: Publisher: https://towardsai.net/#publisher Diversity Policy: https://towardsai.net/about Ethics Policy: https://towardsai.net/about Masthead: https://towardsai.net/about
Name: Towards AI Legal Name: Towards AI, Inc. Description: Towards AI is the world's leading artificial intelligence (AI) and technology publication. Founders: Roberto Iriondo, , Job Title: Co-founder and Advisor Works for: Towards AI, Inc. Follow Roberto: X, LinkedIn, GitHub, Google Scholar, Towards AI Profile, Medium, ML@CMU, FreeCodeCamp, Crunchbase, Bloomberg, Roberto Iriondo, Generative AI Lab, Generative AI Lab Denis Piffaretti, Job Title: Co-founder Works for: Towards AI, Inc. Louie Peters, Job Title: Co-founder Works for: Towards AI, Inc. Louis-François Bouchard, Job Title: Co-founder Works for: Towards AI, Inc. Cover:
Towards AI Cover
Logo:
Towards AI Logo
Areas Served: Worldwide Alternate Name: Towards AI, Inc. Alternate Name: Towards AI Co. Alternate Name: towards ai Alternate Name: towardsai Alternate Name: towards.ai Alternate Name: tai Alternate Name: toward ai Alternate Name: toward.ai Alternate Name: Towards AI, Inc. Alternate Name: towardsai.net Alternate Name: pub.towardsai.net
5 stars – based on 497 reviews

Frequently Used, Contextual References

TODO: Remember to copy unique IDs whenever it needs used. i.e., URL: 304b2e42315e

Resources

Take our 85+ lesson From Beginner to Advanced LLM Developer Certification: From choosing a project to deploying a working product this is the most comprehensive and practical LLM course out there!

Publication

Navigating the Mind of GPT: How to Elicit Clarity and Avoid AI Hallucinations
Artificial Intelligence   Data Science   Latest   Machine Learning

Navigating the Mind of GPT: How to Elicit Clarity and Avoid AI Hallucinations

Last Updated on November 5, 2023 by Editorial Team

Author(s): MindfulModeler

Originally published on Towards AI.

Photo by Ehimetalor Akhere Unuabona on Unsplash

Introduction

When working with cutting-edge language models like GPT, we occasionally find ourselves stumbling upon β€œhallucinations.” A hallucination, in the context of a language model, is when the model generates information that isn’t accurate, is unsubstantiated, or is simply made up. Although GPT is trained on vast amounts of text and is very proficient at generating human-like responses, it isn’t infallible.

A challenge users often encounter is how to reduce these hallucinations without having access to the model’s inner workings or training methods. This blog post is here to help with that, offering a way to get more accurate and guarded responses from GPT solely through prompting.

Diving Into GPT’s Imaginary World!

Ever seen GPT spin a tale from thin air? Here is an example, GPT knows a lot about popular TV shows or other works of fiction but doesn’t know the details (like all the scenes or episodes). But toss in a quirky detail like a β€œgiant hat,” and voila β€” you’ve got GPT daydreaming! In this episode of Community, the only hat Jeff wears is a graduate cap, no giant hats.

Understanding The Basics

First, it’s vital to grasp the data sources GPT relies upon. Take the C4 dataset, for instance. It’s a colossal collection of text that GPT uses for training. But what exactly is the C4 dataset?

Example Prompt:
> β€œExplain the C4 dataset to me, but if you’re unsure about any details, please say β€˜I’m not sure.’”

Potential GPT Response:
> β€œThe C4 dataset is a large dataset used in the training of models like GPT. It’s derived from web pages and is instrumental in providing diverse linguistic patterns for the model. However, I’m not sure about the exact number of web pages or the specific criteria used for their inclusion.”

In the example above, GPT generates a response that provides a general overview of the C4 dataset but admits uncertainty regarding specific details.

Crafting Careful Prompts

The trick to getting more accurate responses lies in the prompt’s phrasing. Here are some strategies to consider:

1. Be Specific: Asking vague questions will often lead to vague answers. Narrow down your inquiry.
2. Request Confirmation: Ask GPT to provide sources or admit when it’s unsure.
3. Limit the Scope: Instead of seeking a long answer, ask for brief responses and then follow up for clarity.

β€œI’m not sure” β€” Your New Safety Net

Adding qualifiers like β€œif you’re not sure, say β€˜I’m not sure’” can be an effective way to reduce hallucinations. It offers GPT a β€œway out” instead of pushing it to guess or fabricate an answer. For instance:

Prompt:
> β€œTell me about the origin of the Eiffel Tower, and if you’re not certain about any facts, mention β€˜I’m not sure.’”

Potential GPT Response:
> β€œThe Eiffel Tower is an iron lattice tower located in Paris, built as the entrance arch to the 1889 World’s Fair. It was designed by the engineer Gustave Eiffel, although he wasn’t the primary architect. I’m not sure about the exact duration of its construction.”

The β€œI’m not sure” clause can act as a filter, signaling the model to be more cautious with its output.

Avoiding Overloading

While the β€œI’m not sure” method is handy, it’s essential not to overdo it. Using it too often might yield overly cautious responses, where the model constantly defaults to saying, β€œI’m not sure” instead of providing potentially useful information. Balance is the key.

Additional Strategies to Enhance Prompt Clarity and Reliability

1. Ask Direct Questions: Ambiguous queries can lead to more instances of hallucination. When you ask direct questions, you offer less room for the model to wander.

Bad: β€œTell me about datasets.”

Good: β€œCan you describe the C4 dataset and its key features?”

2. Encourage Fact-Checking: Ask GPT to cite its sources or state the confidence in its response.

β€œExplain the C4 dataset and if possible, cite a source or let me know if you’re unsure.”

3. Multi-step Queries: Breaking down your main question into smaller parts can be effective. This way, if the model is uncertain about one segment, it can express it without affecting the other parts.

β€œFirstly, what is the C4 dataset? Secondly, what is its main purpose? If you are uncertain about any part, indicate which one.”

4. Ask for Confirmation: After getting a response, you can ask the model to confirm its accuracy.

User: β€œWhat is the C4 dataset?”

GPT: β€œThe C4 dataset is a large-scale dataset used for training language models like GPT.”

User: β€œAre you certain about that information?”

GPT: β€œYes, I am.”

5. Utilize Follow-up Questions: Don’t just rely on the initial response. Dive deeper with follow-up questions. If the model is consistent in its answers, it’s a good sign. If it starts to waver or shows inconsistency, it’s a hint that it might be uncertain.

User: β€œTell me about the C4 dataset.”

GPT: β€œThe C4 dataset is a collection of diverse web text used for training models.”

User: β€œWhat kind of web text? Can you be more specific?”

GPT: β€œI’m not sure about the specific types of web texts included.”

Wrapping Up

Hallucinations can be a hurdle when interacting with models like GPT. However, with careful prompting, one can substantially reduce these occurrences. The beauty of GPT lies in its adaptability to prompts, giving users the power to guide the kind of responses they receive. By making your prompts more specific, requesting confirmatory details, and providing the model with a β€œway out” when it’s unsure, you can harness the best of what GPT has to offer while minimizing misinformation.

Remember, technology is only as effective as how we choose to use it. With the right approach, GPT can be a reliable and insightful tool in your information-gathering arsenal.

Join thousands of data leaders on the AI newsletter. Join over 80,000 subscribers and keep up to date with the latest developments in AI. From research to projects and ideas. If you are building an AI startup, an AI-related product, or a service, we invite you to consider becoming aΒ sponsor.

Published via Towards AI

Feedback ↓