Yes, I know exactly what you mean! Repetitive phrasing is a common issue with local LLMs, especially when running longer-form or narrative-heavy tasks like a D&D campaign. Here are several strategies you can use to reduce or eliminate repetitive phrases like "It sends a shiver down your spine":
1. Use a Repetition Penalty
Most local LLM frameworks (like those using Transformers, such as text-generation-webui, KoboldAI, LM Studio, etc.) support a repetition penalty parameter.
- What it does: Penalizes the model for repeating the same tokens or phrases.
- How to use: Set a
repetition_penalty value between 1.1 and 1.5. Start low and increase if needed.
- Example:
repetition_penalty: 1.2
2. Adjust Top-k, Top-p, and Temperature
These sampling parameters influence the randomness and diversity of the output.
- Top-k: Limits the number of highest-probability tokens considered at each step.
- Top-p (nucleus sampling): Chooses from the smallest set of tokens whose cumulative probability exceeds p.
- Temperature: Controls randomness. Higher = more random.
Try:
top_k: 50
top_p: 0.9
temperature: 0.8
These settings can help the model be more creative and less repetitive.
3. Use Anti-Prompt or Stop Sequences
If your interface supports it, you can define anti-prompts or stop sequences to discourage or halt certain outputs.
- Add "It sends a shiver down your spine" to an anti-prompt list.
- Some tools allow you to define phrases to avoid or stop generation when they appear.
4. Fine-Tune or Use LoRA Adapters
If you're comfortable with model training:
- Fine-tune the model or use LoRA adapters to reinforce more varied narrative styles.
- Train it on a dataset with diverse D&D descriptions and avoid overused phrases.
5. Prompt Engineering
You can guide the model with better prompts:
- Add instructions like:
"Avoid repeating phrases like 'It sends a shiver down your spine'. Use varied and vivid descriptions."
- Or use a system prompt (if your interface supports it) to set the tone and style.
6. Post-Processing (Optional)
If you're building a custom interface:
- Use a script to detect and replace or rephrase repeated phrases before displaying them.
- This can be a simple regex or string match.
7. Try a Different Model
Some models are more prone to repetition than others. Try:
- Mistral, MythoMax, OpenHermes, or Pygmalion models fine-tuned for storytelling or roleplay.
- Check Hugging Face or other model hubs for models specifically trained for D&D or fantasy storytelling.
TL;DR
- Use
repetition_penalty: 1.2–1.5
- Adjust
top_k, top_p, and temperature
- Add anti-prompts or stop sequences
- Prompt the model to avoid specific phrases
- Consider fine-tuning or switching models
Let me know what model and interface you're using, and I can give more specific advice!