Help please how do I do this? (enhance AI-generated diversity)

I’m using the API and gpt model 4 turbo.

I’m generating short product descriptions in bulk (one at a time using the API) .

They are pulled through into search results on category pages on my ecomm website, much like google’s results.

The problem I have is that GPT will often use similar words or phrases in the descriptions that are very noticeable when they are displayed on the same results page together. Repetitive.

I’ve tried playing with the temperature setting and changing the prompt.

How do you get the API to vary it’s language in this situation, when it doesn’t ‘know’ what it generated in the previous responses?

Thanks!

1 Like

What have you tried specifically? What settings? Can we peek at the prompt? (System and user/assistant…)

1 Like

Hi,

I’ve tried a temperature from 0.2 up to 0.7. I’ve also tried adding:

“Use creativity and a thesaurus.”

Here’s the settings I use for the API and the prompt:

$messages = [
[
“role” => “system”,
“content” => “You are an expert in $category and a professional in this space.”
],
[
“role” => “user”,
“content” => $query
]
];

$post_fields = array(
"model" => $model,
"messages" => $messages,
"temperature" => 0.7
);

And here’s the prompt that is generating the repetitive text:

(I give it the product description page to work from).

$category is the product category eg. treadmills
$queryText is the product page

=========================

From information below ‘Here is the text’, and what you already know about $category, extract the requested values into the tags shown.
You are a professional an expert in $category, provide detailed information and expertly written text.
Ensure that no field is left blank.
Remember that the webpage is about $category and the text should relate to that.
Strictly don’t say For added convenience, or individuals.
Strictly refer to users as something appropriate to this niche eg users, runners or just people.
Strictly UK spelling.
15-20 words covering the best things about this product. Use creativity and a thesaurus.

Here is the text

$queryText

1 Like

Just have time for a quick glance…

Temp that low (even .7) will tend to repeat a lot. Try bumping it to 1.0… Anything above 1 gets too wishy-washy usually, but 1.0 should give you more variety.

I’d add a lot more details here. Ask ChatGPT to flesh it out, after explaining you want a better message to explain to an LLM…

2 Likes

Ah ok thanks. I thought this was just a brief message stating the ‘persona’ you want GPT to adopt. Is there a resource I can read more about how to improve this bit?

Hi,

Be careful with temperature, might get some hallucinations in the middle of your data.

Have you tried to change presence_penalty?

        try:
            resposta = openai.ChatCompletion.create(
                model=model_selecionado,
                messages=[
                {"role": "system", "content": prompt_system},
                {"role": "user", "content": prompt_user}
                ],

                # parameters
                temperature = 0.8,
                # top_p=1,
                # frequency_penalty=0,
                presence_penalty=-0.5
                # n = 5

Additionally, put this information in the prompt "Be objective, avoid expressions like “This is…” → Alter according to your needs.

1 Like

You need to diversify the descriptions so they don’t appear to be generated by the same AI? Don’t have them generated by the same AI!

  • Use different AI models that are capable of performing the task. They will write differently
  • Have a random selection or subset rewritten by another API AI.
  • mix up the instructive or rewriting prompt randomly
  • rewrite in batches so that the AI can diversify within a set of outputs
  • more imagination goes here

You can also have less predictive but yet controlled output when combining a higher temperature with a reduced top-p. Something like temperature:1.6, top_p: 0.9.


My reply rewritten at temp 1.6, top_p 0.9 by gpt-3.5-turbo

Want to make your descriptions more diverse? Here are some suggestions:

  1. Use different AI models: Switch up the AI models you use for generating descriptions. Each model has its own writing style, so this will help add variety.

  2. Get a second opinion: After selecting a random description, have it rewritten by another API AI. This will further enhance the diversity of your content.

  3. Mix it up: Randomly vary the instructive or rewriting prompts you provide to the AI. This will encourage different approaches and styles in the generated descriptions.

  4. Batch rewriting: Rewrite descriptions in batches to allow the AI to diversify its outputs within each set. This can help avoid repetitiveness and foster creativity.

  5. Let your imagination run wild: Don’t be afraid to explore other creative techniques to inject more diversity into your descriptions.

For a balance between predictability and controlled output, try combining a higher temperature (e.g., 1.6) with a reduced top-p (e.g., 0.9). This can help achieve more controlled yet less predictable results.

1 Like

Why not play around with the prompt a little bit? Here are a few suggestions:

1 Like