LLM Fundamentalsgpt-oss-120b on Groq · groq 1.7 · Python 3.10+
Dashboard
0%
1
Curious builder0 XP earned · 300 to level 2
0 daysFinish a lesson to begin
Badge collection0 of 6 unlocked
19 small wins to finish your pathNext lesson →

Seeds

A seed is a number that fixes the random choices made while sampling, so the same request can give the same answer again; hosted APIs treat it as a best effort.

Last updated: 30 Sep, 2026 · groq 1.7 · gpt-oss-120b on Groq

At any temperature above 0, each token is drawn at random. A seed makes the draws repeat, which helps when you change a prompt and want to know that the change, not chance, moved the answer.

Syntax: client.chat.completions.create(..., temperature=1, seed=42).

Three slogans with no seed

ExampleAPI key
from groq import Groq

client = Groq()  # reads GROQ_API_KEY from the environment
prompt = [{"role": "user", "content": "Write a six-word slogan for a small online tea shop."}]

for run in range(3):
    response = client.chat.completions.create(
        model="openai/gpt-oss-120b", messages=prompt, temperature=1
    )
    print(run, response.choices[0].message.content)

The first slogan differs from the other two. Same prompt, same model, same settings: the difference came from the random draws.

Three slogans with seed=42

This continues the same file:

ExampleAPI key
for run in range(3):
    response = client.chat.completions.create(
        model="openai/gpt-oss-120b", messages=prompt, temperature=1, seed=42
    )
    print(run, response.choices[0].message.content)
  • All three slogans are identical with the seed set.
  • The seed fixes the draws, not the answer. A different seed would give a different, equally repeatable slogan.

Seed vs temperature 0

seed=42temperature=0
RandomnessStill random, but repeatableNone: the likeliest token each time
Variety across seedsYesNo
Guaranteed across timeNo, best effortNo, but close in practice

When a seed helps

  • Comparing two prompts at the same temperature, so only the prompt differs.
  • Reproducing a surprising answer while you debug it.
  • Tests that expect a sampled answer to stay the same over a short time.
Watch out. Groq's documentation describes the seed as a best effort. A change on the provider's side, such as new hardware or a new model version, can change the answer for the same seed. Store answers you need to keep instead of generating them again.
Try it yourself
  • Run the no-seed example twice and compare the slogans.
  • Change seed=42 to seed=7. Are the three slogans still identical to each other?
  • Set temperature=0 without a seed and run it three times.

This is what real progress feels like.