<< Home | Prompting craft
Enforce strict template output on 8B models without filler
| Area | Prompting craft |
| AI used | Any |
| Source | Reddit thread |
| Posted | unknown |
The move
Combine stop tokens, multi-shot examples, assistant prefixing, and inference guidance to force exact output templates.| When this works | When it doesn't |
|---|---|
| A model like Llama 3 8B generates unwanted conversational filler or fails to follow a strict response template during character roleplay or stat tracking. | A small model is overloaded with complex multi-character roleplay beyond its parameter size, where upgrading to a 70b model or using tools like SillyTavern is required. |
Key details
- \n\n
- multi-shot examples
- GBNF grammar
- 70b
Prompt for your AI
Role: System formatting enforcer and prompt optimizer.
To prevent models from generating conversational filler and force strict template adherence, apply this multi-step prompt engineering rule set:
1. Inspect prompt assembly: Verify instruction tags are correctly placed and RAG outputs are not passing empty strings or corrupting the layout.
2. Set stop tokens: Append explicit stop tokens (such as `\n\n` for single paragraphs or custom terminal token sequences) to eliminate run-on output.
3. Provide multi-shot examples: Include clear multi-shot examples demonstrating the exact desired response format in the prompt.
4. Prefix assistant response: Pre-fill the start of the assistant turn with the initial character name or required output string.
5. Apply inference guidance: Enforce structural rules using guidance frameworks like Outlines, Guidance, or GBNF grammar.
6. Scale or decompose: If complex multi-character tracking still fails on an 8B model, split execution using DSPy, switch to a 70b model, or use SillyTavern for multi-character interaction.
Format rule for execution: Do not output any line that is not part of the specified output template.
Before you give me the final result, check with me:
- Verify instruction tags are correctly placed and not corrupted by blank inputs.
- Confirm explicit stop tokens like `\n\n` are configured for the output.
- Ensure multi-shot examples demonstrate the exact target schema.
- Check if model parameter size requires GBNF grammar or upgrading to a 70b model.
What happened
A user could not get Llama 3 to output formatted character dialogue and stat changes without extra filler text. By verifying prompt instruction tags, adding stop tokens (`\n\n`), providing multi-shot examples, and prefixing responses with character names, the model strictly followed the format. For complex multi-character setups, commenters advised moving from 8B to 70b models or using SillyTavern.Who confirmed it
The poster noted that ChatGPT and Claude 3.5 'has no issue whatsoever to respond to me how I want' using this method.Give it to your agent
Read https://howtheyuse.ai/p/enforce-strict-output-formatting-and-character-dialogue.md and help me do this.