I'm running a prompt iteratively on data.
Sometimes I get the result I'm looking for, somethimes not.
What should I add to the instructions?
Assistant
Good question — this is a common issue when you run the same prompt on many pieces of data. Even small differences in the input text (or random sampling) can lead to variability in output quality.
To make your instructions more stable, reliable, and consistent, you can add a few targeted clauses.
✅ Core Additions for Consistency
Add one or more of the following to your system or user instructions:
User
What does top P do?
Assistant
Excellent question — this goes to the heart of how language models decide which words to output.
Let’s unpack it clearly and practically 👇
🔹 What top_p Does
top_p (also called nucleus sampling) controls how much randomness is allowed in the model’s output by limiting how much of the probability mass of possible next tokens the model considers.
🔸 How It Works
When the model is about to choose the next token (word, subword, or symbol):
Explicit Output Expectations
“Your response must always include a clear and complete answer, even if the information is implicit or uncertain. Do not skip items or reply with ‘none’ unless absolutely no relevant content exists.”
This ensures the model produces something rather than skipping.
2. Force Structured Output
If you can, define a fixed format or JSON schema:
“Return your answer in this format:
{ "holocaust_references": [ { "quote": "...", "explanation": "..." } ] }”
This reduces variation in structure and missing elements.
3. Reduce Randomness
“Be consistent in your interpretation across all inputs. If uncertain, make the most plausible inference and explain your reasoning briefly.”
This discourages stochastic variation.
4. Add a Verification Step
“After generating your answer, verify that it follows all instructions. If not, correct it before finalizing.”
This creates self-checking behavior.
5. Clarify Task Scope
“Focus strictly on [specific goal]. Ignore unrelated content. Always interpret vague references in context.”
This prevents drifting when the model over- or under-interprets.
6. Anchor Examples
Provide 1–2 short examples of good outputs (“few-shot prompting”).
Even if you process many items, a single strong example often anchors the behavior.
⚙️ Optional: If You’re Automating Iterative Runs
Add meta-instructions like:
“Each response must be independent of previous ones. Do not rely on prior context.”
Or if you want consistency across runs:
“Follow the same reasoning principles used in earlier responses.”
If you’d like, you can paste your current prompt here (or at least the instructions section).
I can show you exactly what to add or rephrase to make it more deterministic and get consistent results.
It computes probabilities for all possible tokens.
It sorts them from most to least likely.
It then sums their probabilities until the total reaches p (e.g., 0.9).
Only that subset of tokens (the “nucleus”) is kept; the rest are ignored.
The next token is randomly chosen within that nucleus, proportional to their probabilities.
🔹 Example
Suppose the model predicts these probabilities for the next token:
TokenProbability“yes”0.6“no”0.2“maybe”0.1“banana”0.05“carrot”0.05
If top_p = 0.9
→ The smallest set of tokens whose probabilities sum to 0.9 = ["yes", "no", "maybe"]
→ The model randomly samples among these three.
If top_p = 0.5
→ Only "yes" is included (since 0.6 > 0.5 already)
→ The model always picks "yes" → less randomness, more deterministic.
🔸 Comparison: top_p vs temperature
temperature spreads out or sharpens probabilities before sampling (like softening or sharpening the curve).