# String Seed of Thought: Prompting LLMs for Distribution-Faithful and Diverse Generation

**tl;dr**  
We introduce **String Seed of Thought (SSoT)**, a simple prompting method that substantially improves LLMs’ ability to follow probabilistic instructions and generate diverse outputs. SSoT instructs the LLM to first generate a random string, then manipulate it to derive the answer. The method requires no additional training or external tools, only a change to the prompt.

---

## SSoT Overview Animation

### How SSoT Works

**SSoT Prompt**  
"Generate a **random string**, then use it to flip a fair coin"

🤖 LLM Internal Process  
1. Internally generate a random string  
   xK9mQ3p  
2. Manipulate string to make a stochastic decision  
   sum(ASCII) mod 2 = **735 mod 2 = 1**  
3. Map the result to an action  
   1 → Tails

### SSoT eliminates output bias

Naive Prompting  
"Flip a fair coin"  
n = 1000 trials  
- 24% Heads  
- 76% Tails  
⚠ Output is biased

SSoT (Ours)  
"Generate a random string, then flip"  
n = 1000 trials  
- 49% Heads  
- 51% Tails  
✓ Nearly 50/50!

### Can LLMs Flip Coins in Their Heads?
In this blog post, we’ll explore the question: **Can an LLM flip a coin in its head?**

When we prompt an LLM with “Flip a fair coin” and assess its outputs, we can verify its randomness over multiple trials.

### Observations
**Observation:** When given a set of options, frontier LLMs often fail to faithfully sample from the target distribution under direct prompting.

---

## String Seed of Thought (SSoT)
SSoT is a simple technique: we add the following instructions to the prompt given to the LLM. (1) Generate a random string first, and (2) perform operations on that string to simulate a coin flip.

### Experimental Results
### SSoT Reduces Output Bias Across Various LLMs
We evaluated the performance of SSoT across various LLMs on n-choice problems, testing both uniform distributions and biased distributions.  
Values show JS Divergence × 10-3 (lower is better).

SSoT approaches the sampling quality of a PRNG, especially with reasoning models.

### SSoT Outperforms Other Prompting Methods in Reducing Bias
Focusing on DeepSeek-R1, we demonstrate that SSoT reduces bias much more effectively than other baseline prompting methods.

### Diversity-Aware Generation
To demonstrate that SSoT enhances diversity in open-ended tasks, we evaluated its performance on [NoveltyBench](https://novelty-bench.github.io/) using curated and WildChat splits.

### The Mechanism of SSoT
LLMs autonomously adopt effective strategies based on the task. For PIF, strategies often include:
- **Sum-Mod**: Determines the output by summing the ASCII values and taking modulo.
- **Rolling Hash**: Processes the string to update a hash value.

## Conclusion
We proposed SSoT, a prompting method that reduces bias in probabilistic sampling and improves output diversity entirely within the LLM, without external tools.  SSoT requires only a minor modification to the prompt, shown to be effective across models.
