It can be highly frustrating when ChatGPT confidently provides incorrect data, fake citations, or non-existent code libraries. This phenomenon, known as "hallucination," occurs because large language models predict the next most likely word based on patterns in their training data rather than verifying facts against a real-time database.
If ChatGPT is making up facts, APIs, or sources, you can drastically reduce these errors by adjusting your prompts and using specific grounding techniques.
1. Ground the Model with Reference Text
The single most effective way to stop ChatGPT from hallucinating is to provide the source material yourself. When the model has to reference text within the same chat window, its reliance on its training weights drops significantly.
* **How to do it:** Paste the article, documentation, or dataset directly into the prompt.
* **Use this framing:** "Using only the text provided below, answer the following question. If the answer cannot be found in the text, reply with 'Information not found.' Do not use any outside knowledge."
The Prompt Generator helps you write a clearer prompt for this kind of task.
Tickd is independent and not affiliated with any AI company.
Open Prompt Generator2. Enforce a "No Guessing" Policy
By default, ChatGPT wants to please the user and will often generate plausible-sounding answers instead of admitting it does not know. You must explicitly give it permission to fail.
* Add this clause to your system prompt or custom instructions: *"If you do not know the answer, do not have access to the data, or are unsure of the factual accuracy, state 'I do not know' or 'Unsure.' Never make up URLs, dates, names, or code libraries."*
3. Enable and Force Web Search
If you are using ChatGPT Plus, Team, or Enterprise, the model has access to the internet via Bing. However, it sometimes relies on its offline training data instead of performing a live search.
* **How to fix it:** Explicitly command the model to search. Write: *"Search the web to find the current release version of [Library] as of today. Provide the URL source of your finding."*
* Verify that the web-browsing icon appears in the response, indicating a live search was executed.
4. Use Chain-of-Thought Prompting
Forcing the model to explain its reasoning step-by-step before it outputs a final answer reduces logical errors. It allows the model to process constraints before committing to a final output.
* **How to do it:** Append this to your prompt: *"Think step-by-step before answering. First, list the facts you know to be true. Second, identify any missing information. Third, construct the final answer based strictly on those steps."*
5. Provide Few-Shot Examples
If you need ChatGPT to perform a complex or repetitive task without making mistakes, show it exactly what a correct answer looks like and what an "I don't know" answer looks like.
* **Example structure:**
* *Input:* [Your Question]
* *Thought:* [Logical deduction]
* *Output:* [Correct answer]
* *Input:* [Unknowable Question]
* *Thought:* [Realization that data is missing]
* *Output:* I do not have enough information to answer this.
6. Clear the Chat Context
If a chat session has gone on for too long, ChatGPT’s context window can become cluttered with previous mistakes. Once a model hallucinates in a thread, it is highly likely to continue hallucinating because it reads its own previous incorrect outputs as part of the conversation history.
* **How to fix it:** Click "New Chat" to start fresh. If you must use the same thread, delete the specific messages containing the false information to keep the context clean.
When to Escalate
If ChatGPT continues to generate complete gibberish, ignores direct grounding text, or refuses to search the web despite clear instructions, there may be a temporary outage or a system-level bug in OpenAI's model deployment.
* Check the official OpenAI Status page (`status.openai.com`) to see if there are active incidents affecting model performance or latency.
* If you are using the OpenAI API, check your parameter settings. High `temperature` or `top_p` values increase creativity but drastically raise hallucination rates. Lower your temperature to `0.0` for factual or code-based tasks.