# Is the completion API endpoint stateful in any way?

**URL:** <https://community.openai.com/t/is-the-completion-api-endpoint-stateful-in-any-way/214764>\
**Category:** API\
**Tags:** completions\
**Created:** [May 17, 2023, 1:08pm UTC](https://community.openai.com/t/is-the-completion-api-endpoint-stateful-in-any-way/214764 "2023-05-17T13:08:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![shredengineer](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/shredengineer/32/133501_2.png) [@shredengineer](https://community.openai.com/u/shredengineer)\
**Post date:** [May 17, 2023, 1:08pm UTC](https://community.openai.com/t/is-the-completion-api-endpoint-stateful-in-any-way/214764/1 "2023-05-17T13:08:51Z")

</div>

I used the completion endpoint (`openai.Completion.create(...)`) on a fine-tuned davinci model. I ran tests for several hours and got a certain desired behaviour out of a certain prompt consistently during that night. Now, a few days later, the behaviour changed and the model behaves “dumber” than before, even though I’m using the same prompt.

Is the completion endpoint stateful in any way, which could explain how my hour long testing steered the session into the desired behaviour? And a few days later, this state seems to have been reset?

Note that I did not alter the model in the meantime, nor did I change temperature or other parameters of the requests.

Are there external factors beyond my reach which could influence model behaviour over time?

---

<div class="post-metadata">

**Author:** ![anon22939549](https://avatars.discourse-cdn.com/v4/letter/a/f14d63/32.png) [@anon22939549](https://community.openai.com/u/anon22939549)\
**Post date:** [May 17, 2023, 2:26pm UTC](https://community.openai.com/t/is-the-completion-api-endpoint-stateful-in-any-way/214764/2 "2023-05-17T14:26:30Z")

</div>

It is not stateful.

Every API call goes to a blank slate.

---

<div class="post-metadata">

**Author:** ![shredengineer](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/shredengineer/32/133501_2.png) [@shredengineer](https://community.openai.com/u/shredengineer)\
**Post date:** [May 17, 2023, 5:00pm UTC](https://community.openai.com/t/is-the-completion-api-endpoint-stateful-in-any-way/214764/3 "2023-05-17T17:00:19Z")

</div>

Thank you for verifying. Then I’ll have to think about some other explanation for the behaviour observed…

---

<div class="post-metadata">

**Author:** ![sps](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/sps/32/7736_2.png) [@sps](https://community.openai.com/u/sps)\
**Post date:** [May 17, 2023, 5:49pm UTC](https://community.openai.com/t/is-the-completion-api-endpoint-stateful-in-any-way/214764/4 "2023-05-17T17:49:24Z")

</div>

Welcome @shredengineer

> [@Getting inconsistent results with same prompts](https://community.openai.com/t/getting-inconsistent-results-with-same-prompts/14353/4):
>
> This is to be expected. It is also mentioned in the [OpenAI docs](https://beta.openai.com/docs/guides/completion).
> 
> > The API is stochastic by default which means that you might get a slightly different completion every time you call it, even if your prompt stays the same. You can control this behavior with the [temperature](https://beta.openai.com/docs/api-reference/completions/create#completions/create-temperature) setting.
> 
> I’m not 100% sure on how to fix this but, being very intentional/specific with the prompt and providing examples of how you want it to complete may help.

IMO, fine-tune training data should be focused on getting the desired behavior from the model. Ideally one shouldn’t have to prompt engineer for a fine-tune to get the desired behavior.

---

<div class="post-metadata">

**Author:** ![shredengineer](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/shredengineer/32/133501_2.png) [@shredengineer](https://community.openai.com/u/shredengineer)\
**Post date:** [May 17, 2023, 6:52pm UTC](https://community.openai.com/t/is-the-completion-api-endpoint-stateful-in-any-way/214764/5 "2023-05-17T18:52:40Z")

</div>

I see. Thank you for quoting the docs on this!
