Skip to content

Commit 67ae0b3

Browse files
Merge pull request #271608 from mrbullwinkle/mrb_04_09_2024_reproducible_output
[Azure OpenAI] Reproducible output updates
2 parents 8a443aa + 7b0749f commit 67ae0b3

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

articles/ai-services/openai/how-to/reproducible-output.md

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
22
title: 'How to generate reproducible output with Azure OpenAI Service'
33
titleSuffix: Azure OpenAI
4-
description: Learn how to generate reproducible output (preview) with Azure OpenAI Service
4+
description: Learn how to generate reproducible output (preview) with Azure OpenAI Service.
55
services: cognitive-services
66
manager: nitinme
77
ms.service: azure-ai-openai
88
ms.topic: how-to
9-
ms.date: 11/17/2023
9+
ms.date: 04/09/2024
1010
author: mrbullwinkle
1111
ms.author: mbullwin
1212
recommendations: false
@@ -15,20 +15,22 @@ recommendations: false
1515

1616
# Learn how to use reproducible output (preview)
1717

18-
By default if you ask an Azure OpenAI Chat Completion model the same question multiple times you are likely to get a different response. The responses are therefore considered to be non-deterministic. Reproducible output is a new preview feature that allows you to selectively change the default behavior towards producing more deterministic outputs.
18+
By default if you ask an Azure OpenAI Chat Completion model the same question multiple times you're likely to get a different response. The responses are therefore considered to be non-deterministic. Reproducible output is a new preview feature that allows you to selectively change the default behavior to help product more deterministic outputs.
1919

2020
## Reproducible output support
2121

2222
Reproducible output is only currently supported with the following:
2323

2424
### Supported models
2525

26-
- `gpt-4-1106-preview` ([region availability](../concepts/models.md#gpt-4-and-gpt-4-turbo-preview-model-availability))
27-
- `gpt-35-turbo-1106` ([region availability)](../concepts/models.md#gpt-35-turbo-model-availability))
26+
* `gpt-35-turbo` (1106) - [region availability](../concepts/models.md#gpt-35-turbo-model-availability)
27+
* `gpt-35-turbo` (0125) - [region availability](../concepts/models.md#gpt-35-turbo-model-availability)
28+
* `gpt-4` (1106-Preview) - [region availability](../concepts/models.md#gpt-4-and-gpt-4-turbo-preview-model-availability)
29+
* `gpt-4` (0125-Preview) - [region availability](../concepts/models.md#gpt-4-and-gpt-4-turbo-preview-model-availability)
2830

2931
### API Version
3032

31-
- `2023-12-01-preview`
33+
Support for reproducible output was first added in API version [`2023-12-01-preview`](https://github.com/Azure/azure-rest-api-specs/blob/main/specification/cognitiveservices/data-plane/AzureOpenAI/inference/preview/2023-12-01-preview/inference.json)
3234

3335
## Example
3436

@@ -43,14 +45,14 @@ from openai import AzureOpenAI
4345
client = AzureOpenAI(
4446
azure_endpoint = os.getenv("AZURE_OPENAI_ENDPOINT"),
4547
api_key=os.getenv("AZURE_OPENAI_API_KEY"),
46-
api_version="2023-12-01-preview"
48+
api_version="2024-02-01"
4749
)
4850

4951
for i in range(3):
5052
print(f'Story Version {i + 1}\n---')
5153

5254
response = client.chat.completions.create(
53-
model="gpt-4-1106-preview", # Model = should match the deployment name you chose for your 1106-preview model deployment
55+
model="gpt-35-turbo-0125", # Model = should match the deployment name you chose for your 0125-preview model deployment
5456
#seed=42,
5557
temperature=0.7,
5658
max_tokens =200,
@@ -72,7 +74,7 @@ for i in range(3):
7274
$openai = @{
7375
api_key = $Env:AZURE_OPENAI_API_KEY
7476
api_base = $Env:AZURE_OPENAI_ENDPOINT # like the following https://YOUR_RESOURCE_NAME.openai.azure.com/
75-
api_version = '2023-12-01-preview' # may change in the future
77+
api_version = '2024-02-01' # may change in the future
7678
name = 'YOUR-DEPLOYMENT-NAME-HERE' # name you chose for your deployment
7779
}
7880
@@ -155,14 +157,14 @@ from openai import AzureOpenAI
155157
client = AzureOpenAI(
156158
azure_endpoint = os.getenv("AZURE_OPENAI_ENDPOINT"),
157159
api_key=os.getenv("AZURE_OPENAI_API_KEY"),
158-
api_version="2023-12-01-preview"
160+
api_version="2024-02-01"
159161
)
160162

161163
for i in range(3):
162164
print(f'Story Version {i + 1}\n---')
163165

164166
response = client.chat.completions.create(
165-
model="gpt-4-1106-preview", # Model = should match the deployment name you chose for your 1106-preview model deployment
167+
model="gpt-35-turbo-0125", # Model = should match the deployment name you chose for your 0125-preview model deployment
166168
seed=42,
167169
temperature=0.7,
168170
max_tokens =200,
@@ -184,7 +186,7 @@ for i in range(3):
184186
$openai = @{
185187
api_key = $Env:AZURE_OPENAI_API_KEY
186188
api_base = $Env:AZURE_OPENAI_ENDPOINT # like the following https://YOUR_RESOURCE_NAME.openai.azure.com/
187-
api_version = '2023-12-01-preview' # may change in the future
189+
api_version = '2024-02-01' # may change in the future
188190
name = 'YOUR-DEPLOYMENT-NAME-HERE' # name you chose for your deployment
189191
}
190192
@@ -250,7 +252,10 @@ Matter coalesced into the simplest elements, hydrogen and helium, which later fo
250252
---
251253
```
252254

253-
By using the same `seed` parameter of 42 for each of our three requests we're able to produce much more consistent (in this case identical) results.
255+
By using the same `seed` parameter of 42 for each of our three requests, while keeping all other parameters the same, we're able to produce much more consistent results.
256+
257+
> [!IMPORTANT]
258+
> Determinism is not guaranteed with reproducible output. Even in cases where the seed parameter and `system_fingerprint` are the same across API calls it is not currently uncommon to still observe a degree of response variability.
254259
255260
## Parameter details
256261

0 commit comments

Comments
 (0)