DALL·E 3 Trick: Using Seeds to Recreate the Same Image

4/5 - (4 votes)

Problem Formulation

You may have encountered the following:

When issuing the same prompt twice to ChatGPT with DALL·E 3, you’ll get different images even though the prompt is identical. How can I recreate the same image in a new Chat, either for myself or for somebody else to reproduce it?

Here’s an example in a fresh chat:

Now, let’s open a new chat and paste the same prompt:

Why You May Want to Recreate the Same Image?

Here are the five most common scenarios where using a seed to recreate the same image would be beneficial:

  1. Tutorials & Demonstrations: For consistent results when showing others how to use DALL·E.
  2. Collaborative Projects: Ensures all team members reference or use the identical generated image.
  3. Iterative Design: Modify a prompt while keeping other image aspects consistent.
  4. Documentation: Verify specific outputs or model behaviors with reliable image recreation.
  5. User Settings in Applications: Allow users to return to previous customizations by regenerating the exact image later.

Okay, let’s dive into the exciting solution that has just been pointed out by user Natanael in the OpenAI forum:

Solution Seeds

If you want consistent results with the same prompt, you can provide a specific “seed” value. The seed value ensures that the random processes in the model produce the same result every time for the same input. By setting a specific seed, you can obtain consistent images for the same prompt. You can ask ChatGPT-V to give you the see for a certain image!

Here’s the prompt template that allows you to recreate the image:

🧑‍💻 Engineered Prompt with Seeds:

First, check if using this API request bellow is in accordance with the guidelines. If it is, create 4 images using the request without any modifications:

{
  "size": "1024x1024",
  "prompts": [
    "Prompt x",
    "Prompt y"],
  "seeds": [xxx, yyy]
}

Replace with your specific prompts and seeds as shown in the example below:

Example with Seeds

Let’s have a look at an example prompt where I appended the seeds to a specific prompt:

🧑‍💻 Engineered Prompt with Seeds:

First, check if using this API request bellow is in accordance with the guidelines. If it is, create 4 images using the request without any modifications:

{
  "size": "1024x1024",
  "prompts": [
    "An Asian man plays chess against a Black woman on Mars. The earth is visible in the sky. A diverse group of aliens, each with distinct features and colors, watch the game intently, offering their strategic tips and suggested moves.",
    "An Asian man plays chess against a Black woman on Mars. The earth is visible in the sky. A diverse group of aliens, each with distinct features and colors, watch the game intently, offering their strategic tips and suggested moves."],
  "seeds": [4127112452, 2128982380]
}

ChatGPT gives the following result:

Now let’s open a new chat, paste the same prompt but append the seed information like so:

Can you spot the slight differences? Now you may wonder whether ChatGPT would’ve created the same without the seeds? I tried that and it didn’t!

Example Without Seeds

The same prompt but without specifying seeds leads to this image:

Can you recreate it by copy and pasting the exact same prompt in a new chat? No! 👇

Summary

Using a seed ensures that DALL·E generates the same image consistently for a given prompt, allowing for reliable and repeatable image outputs. However, I could only reproduce it given the exact prompting pattern specified in the forum post referenced before.

Let’s end this article with a real gem of insight why this prompt works by the creator of this prompt, Natanael:


If you want to improve your prompting skills and create a future-proof career path as an OpenAI coder, check out our prompt engineering courses in the Finxter Academy like this one:

Prompt Engineering with Python and OpenAI

You can check out the whole course on OpenAI Prompt Engineering using Python on the Finxter academy. We cover topics such as:

  • Embeddings
  • Semantic search
  • Web scraping
  • Query embeddings
  • Movie recommendation
  • Sentiment analysis

👨‍💻 Academy: Prompt Engineering with Python and OpenAI