openai-cookbook icon indicating copy to clipboard operation
openai-cookbook copied to clipboard

[PROBLEM] Inconsistent Deterministic Outputs with Seed Parameter in OpenAI API

Open hengqujushi opened this issue 7 months ago • 15 comments

Identify the file to be fixed N/A - This issue is related to the OpenAI API's deterministic behavior when using the seed parameter.

Describe the problem I am encountering an issue where I receive inconsistent outputs from the OpenAI API despite setting the same seed parameter for deterministic behavior. This is unexpected as the seed parameter is intended to ensure reproducibility of results. Both the System Fingerprint and the Seed values are identical for different requests, but the responses differ.

Describe a solution A potential solution would be to investigate the determinism functionality within the OpenAI API when the seed parameter is set. Ensuring that the outputs are consistent across multiple requests with the same seed would resolve this issue.

Screenshots image

Additional context

  • The code is being run using the following notebook: https://github.com/openai/openai-cookbook/blob/main/examples/Deterministic_outputs_with_the_seed_parameter.ipynb
  • The issue persists across multiple attempts and different times, suggesting it is not an intermittent issue.
  • No concurrent requests were made that could affect the outcome.

hengqujushi avatar Nov 15 '23 11:11 hengqujushi

I confirm that the same issue is happening to me as well.

  • model: gpt-3.5-turbo-1106
  • temperature: 0
  • seed: 12345

Getting different responses each time, while getting the same system_fingerprint.

tsilva avatar Nov 17 '23 13:11 tsilva

Same here using the parameters from the original notebook

lionelchg avatar Nov 19 '23 19:11 lionelchg

Anybody able to reproduce the deterministic results?

jd-codelink avatar Nov 21 '23 08:11 jd-codelink

Anybody able to reproduce(重现) the deterministic results?有人能够重现确定性结果吗?

The same problem was encountered at least two weeks ago, but no logical explanation has been seen so far

SovereignRemedy avatar Nov 21 '23 08:11 SovereignRemedy

Some problems that output few tokens may have a high probability of stable output,But the odds are less than 50%

SovereignRemedy avatar Nov 21 '23 08:11 SovereignRemedy

I believe this is actually an API issue, as reported here: https://github.com/openai/openai-python/issues/850

gaborcselle avatar Nov 28 '23 22:11 gaborcselle

I believe this is actually an API issue, as reported here: openai/openai-python#850

If it is an API issue it isn't specific to the Python API as I am unable to get reproducible output when using the Python API as well with equivalent direct calls against the REST API. But I agree the cookbook is probably not the best place to get this issue triaged.

mrbullwinkle avatar Dec 06 '23 19:12 mrbullwinkle

We have this issue too.

chrispy-snps avatar Jan 09 '24 11:01 chrispy-snps

I am still looking for the solution/fix/patch

In the mean time I have been following these threads:

  1. https://community.openai.com/t/seed-param-and-reproducible-output-do-not-work/487245
  2. https://community.openai.com/t/the-seed-option-for-gpt-does-not-increase-the-determinism-level/512892

Try subscribing for updates there, who knows when this gets fixed! 🤷🏻‍♂️

AayushSameerShah avatar Jan 09 '24 13:01 AayushSameerShah

We have this issue too, who knows when this gets fixed?

yongyaoduan avatar Jan 24 '24 07:01 yongyaoduan

@yongyaoduan let me call Sam Altman, I will let you know.

AayushSameerShah avatar Jan 24 '24 07:01 AayushSameerShah

Here is a script I wrote to plot the word similarity across N OpenAI responses for one or more LLM parameter configurations:

plot_openai_response_similarity.py

Here is an example plot for four LLM configurations, with N=100 responses for each one:

tell_me_a_story

The X axis indicates how far into the string is considered. The Y axis indicates similarity (higher is more similar).

The gist link has more details.

chrispy-snps avatar Jan 29 '24 00:01 chrispy-snps

Something to double check: the openai docs point out that seed is only supported on gpt-4-1106-preview and gpt-3.5-turbo-1106 https://cookbook.openai.com/examples/reproducible_outputs_with_the_seed_parameter

That said, my anecdotal experience matches what chrispy-snps showed -- the beginning of my response is the same across queries, but I get variety further into the response

ross-nordstrom avatar Mar 19 '24 20:03 ross-nordstrom

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 10 days.

github-actions[bot] avatar May 19 '24 01:05 github-actions[bot]

This is useful discussion and it would be nice to keep it open a bit longer.

chrispy-snps avatar May 21 '24 11:05 chrispy-snps