Different answers for same prompt?

Hi everyone,

I am new here and also new in this community.

I use ChatGPT almost every day for learning and work. But one thing I still don’t understand.

Sometimes I ask same prompt after few days and I get very different answers. Some time second answer is better, some time first one is better.

How you guys keep your results more consistent? Do you save prompts somewhere or just rewrite them every time?

Maybe this is basic question :sweat_smile: but I want to learn how experienced users do it.

Thanks everyone.

All major LLMs, not just GPT, engage in “position talk” (talking to please the listener). To put it more precisely, they are designed to predict and output “the response you will like most at this very moment.” Whether it is factually correct or not is a lower priority.

This is often different from the attitude users actually want, which sometimes frustrates me.

Therefore, when using an LLM, you need to specify its “position.” Prompt engineering isn’t very useful these days outside of image generation, but it is still preferable to at least fix “which standpoint it should speak from” in order to get a desirable response. (e.g., affirmative, negative, optimistic, pessimistic, etc.)

An LLM is a tool to dig up answers that are already asleep inside you and to fill in the gaps in your knowledge. If you skip the decision-making process, the model will fill it in with the most generic and mediocre content. Themes where opinions vary from person to person will fluctuate similarly depending on the timing of the generation.

The most important thing is to be conscious of “for what purpose am I trying to get this information?” If you make the AI generate responses with a clear purpose in mind, you will intuitively begin to understand when the AI is “lying.”

Hi and welcome to the community @JozeRizel!

Good question and it usually starts with the “basic”:slightly_smiling_face:

It may help to know what kind of prompts you are using. Are they for factual answers, writing, coding, studying, image prompts or something else?

I don’t think there is one single prompting method that works for everything. I usually work with the output. Sometimes the first prompt is enough, look at what the model understood well or misunderstood and then adjust from there.

Since LLMs generate based on pattern prediction, the same prompt can still give different answers, especially if the task is open-ended. For more consistency, I would usually save prompts that work well, include the desired format, give clear constraints and explain what kind of output I want.

In ChatGPT specifically, I’d also check whether memory/custom instructions are on and whether you are using the same conversation or starting a new one, because that can affect the output too.

If you can share an example prompt and two different outputs, it would be easier to suggest what could make it more consistent.

Try using prompt templates , for your consistency then

It also helps you in getting reliable answers each and every time , if the topic is about same one and if you want toooo get the reliable answers from gpt try creating your own custome gpt

Where you can trian your gpt on particular topic that you actually want :sweat_smile:

It’s like shooting a machine gun from a truck: your prompt points to the direction, but your bullets (outcome tokens) cover the area. So even if you’re driving the same road there are still too many variables that make impossible to guarantee that the bullets will enter the same holes from the previous shooting.

Great question! You report your self-discovery that even with the same prompt, AI language models can produce different outputs on separate runs. In other replies, you are getting some “how you can fix this” answers, but really you should be getting, “enjoy that design choice” answers.

This isn’t a bug, but a feature stemming from the core of how these large language models generate text. Unlike a simple calculator that always gives the same answer for the same input, GPT-based AI is designed to be creative and generate diverse, human-like text. Let’s explore why.

Imagine you’re asked to complete the sentence, “The cat sat on the…”. There are many valid completions: “mat,” “chair,” “fence,” and so on. A deterministic model would always choose the single-most likely word, perhaps “mat.” However, a large language model AI considers a vast range of possibilities a word at a time (actually, a token at a time, which can be parts of words), each with its own probability. Instead of always picking the most probable word, it uses a probabilistic approach, sampling from this distribution of possibilities of all tokens possible to generate. This is why you get different, yet often valid and interesting, completions each time you run the model. This probabilistic approach, based on sampling from a cumulative probability distribution, is key to the model’s ability to generate creative and nuanced text.

In using ChatGPT, you’ll see high diversity. OpenAI is often testing slightly different models, either obvously or silently, to gather feedback, but that is not the only reason for each output being different. It is the very basic fact that there is a mechanism to give you diverse possible choices of outputs, and for you to upvote, and which would generate more training data.

Now, let’s dive deeper into the technical details of this sampling mechanism, and explore how settings that you can send to the API influence the text generated.

Why Cumulative Probability Sampling?

At the heart of these models lies the prediction of the next token in a sequence. The model outputs a probability distribution over its entire vocabulary for each possible next token. Instead of always picking the highest probability token (greedy decoding), which can otherwise lead to repetitive and predictable text. OpenAI will employ cumulative probability sampling, also known as nucleus sampling, to tweak how much low-likelihood output is seen, or can just have their models completely sampled from the raw prediction values. This method allows us to inject creativity and diversity into the generated text. Think of it like choosing a path through a branching tree of possibilities. Greedy decoding always takes the most obvious path, while cumulative probability sampling explores less-trodden paths, leading to more surprising and interesting results, while still favoring that more good outputs will still show up.

This sampling approach is crucial for several reasons:

  • Avoiding Repetition: Greedy decoding often gets stuck in loops, repeating phrases or patterns. Sampling breaks free from these loops, generating more varied and natural-sounding text.

  • Generating Creative Text: For tasks like storytelling or poetry generation, sampling is essential for producing imaginative and engaging content. It allows the model to explore different stylistic choices and come up with novel combinations of words.

  • Reflecting Uncertainty: The model’s predictions aren’t always certain. Sampling acknowledges this uncertainty by sometimes choosing less probable but potentially more interesting tokens. This can lead to more nuanced and human-like text.

Technical Underpinnings of Sampling from Softmax

The model’s output is a softmax distribution – a probability distribution where each token in the vocabulary is assigned a probability between 0 and 1, and the sum of all probabilities equals 1. Cumulative probability sampling works by:

  1. Calculating Cumulative Probabilities: We sort the tokens in descending order of probability and calculate the cumulative probability for each token. The cumulative probability of a token is the sum of its probability and the probabilities of all tokens preceding it in the sorted list.

  2. Generating a Random Number: We generate a random number between 0 and 1.

  3. Selecting the Token: We select the token whose cumulative probability is the first to exceed the random number. This ensures that tokens with higher probabilities are more likely to be selected, but lower probability tokens still have a chance.

Controlling Sampling with top_p (Nucleus Sampling) and Temperature

  • top_p (Nucleus Sampling): This parameter controls the size of the “nucleus” from which tokens are sampled. For example, top_p = 0.9 means that only the tokens comprising the top 90% of the probability mass are considered. This helps to filter out very low probability tokens, which are often nonsensical, while still allowing for some diversity.

  • Temperature: This parameter controls the “sharpness” of the probability distribution. A higher temperature (e.g., 1.0) makes the distribution flatter, increasing the probability of selecting less likely tokens and leading to more diverse, but potentially less coherent, text. A lower temperature (e.g., 0.2) makes the distribution sharper, concentrating probability mass on the most likely tokens, resulting in more predictable but often higher quality text.

These are handles which the API has historically exposed on non-reasoning models.

To sum up

The same inputs can generate different outputs - by design. This is to break up potential looping repetitions and also make the output seem more human.

This is the other side of it: different inputs can still result in the same output over and over again, aka looping. That is something that isn’t discussed as much (what I’ve seen at least), but I think it is also very interesting.


But as pointed out, output variation can also be a good thing, even when the prompt/input is the same. It means the user still needs to think, compare outputs and decide what actually fits the goal.

This happens to everyone. AI models get updates often, and that changes how they respond, even to the exact same prompt. Also, small changes in wording, context, or even the time of day can shift the output a bit. It is normal, not something you are doing wrong.

Demonstrated below is two identical AI API calls executed at the same time, at a low temperature. You will see that neither of the just-mentioned factors can enter into this equation.

Further, I show the effect of low variance in the non-determinism - the outputs do start identically. You will see that when sampling does deliver a different selection of a different word finally [particularly/as], then the language must follow appropriately, a branch.

Both had grandfather on the AI’s mind, and both finished at near-identical lengths by model post-training (as well as the despicable em-dash), and still converging on a similar conclusion.

There’s also likely a significant influence of load balancing via Mixture of Experts routing which helps deal with the huge load on the servers more efficiently.

Whilst we can’t be sure this is happening this will may also contribute to variation.

The models generate text with built-in randomness so they don’t sound robotic/repetitive, so even the exact same prompt won’t produce the same wording twice. the model itself also gets updated over time so answers may naturally sound different if you run the same prompt week to week.

if you want to keep everything consistent, you should be as specific as possible in your prompt and set up constraints on the responses. i find that working with a persona (like “I am working for _ and looking to build _”) lets me get an answer that is maximally relevant and helpful.