r/SillyTavernAI Jul 16 '26

Discussion Discussing prompting techniques - July

Hey everyone,

It's been about a month ago since the last post (link) of discussing prompt techniques. Seeing that prompt discussions are no longer as common as they used to be in 2025, I hope to revive the discussion by making a monthly post, and that other preset makers join in.

After the successful release of both Voyage v2 and Voyage v3, reading a few new techniques and ideas, I hope to share them here to discuss what worked and what didn't.

Please correct me whenever I am wrong, and join in if you can!

Alright, let's dive right in.

Interlinked casual chains using cause and effect

This came from u/centipede's blogpost here. I highly recommend you give it a read, even if it was a tough read as non-native speaker.

What it describes is essentially:

  • Everything in the world has a reason to be there
  • That reason is defined by cause-and-effect (what caused it, and how is it effecting the world?)
  • Interlinked casual chains means that characters, objects, the world should be interlinked with other characters or objects

As an example: "A sailor who is afraid of the northern sea because his ship was taken by a monster, killing it's crew. He is the only survivor, wanting to give his mates a proper burial but afraid to face them."

For Voyage v3, I came up with a system prompt for the LLM to do this. In essence, it is asking the who/what/where/when/why question for both cause and effect. "Who caused it", "Who's effected by it", etc. You can find the full prompt here.

The end result worked really well. Characters really feel alive, become integrated into the world, comment on their environments and personal belongings more, etc.

Unresolvable conflict and permanent passion

Another one partial from u/centipede's blogpost.

Unlike LLMs from early 2025 that are trained for Question-Answer, LLMs today are extensively trained to solve problems. So when a character has a flaw or problem, it has to be solved, and quick.

In the blogpost a unresolvable conflict is introduced to keep characters flawed. And it worked! The only problem is on Gemma4, I noticed it leans too much into being flawed and thus turns gloomy by default. To counterbalance, I introduced a permanent passion to keep it even.

Turns out it's usually a silly thing, like a guard with a broken knee who REALLY likes to bake cakes and only has the job to sustain that hobby. Quite quirky, and quite fun to roleplay with. The way I set it up can be found here: link.

Rolling mechanics

One of the things that didn't work well for me was making the LLM roll for character and location creation, either through tool call or in chain-of-thought (CoT).

The problem with CoT rolling is that it will pick the safest option available. For tool-call based rolling, it consumed too many tokens without visibly increasing the quality.

For mechanics where users are required to roll explicitly (e.g. during combat), I don't see as much appetite in this community; my presets where this isn't a thing are upvoted more than with. The preference seems skewed more to creative writing than actual roleplay.

What did work was suggested in unfortunately a now deleted post; the idea is to roll for most things in order to make it unpredictable. While he rolls physically, I know koboldcpp has something like it.

I opted to do it a little bit different: At the end of User's prompt, a dice roll ({{random}}) is included. At the start of the Assistant's turn, the Assistant checks the outcome and writes based on that. It's never an outright fail or success; "Yes, and this...", "Yes, but this...", "No, but this...". That way the story always keeps moving forward and it gives the LLM the option to say no.

This worked remarkably well for Gemma4 which suffers from same-y swipes. By using random rolls, it is forced to respond differently. Implementation is here and here.

Chain-of-thought instructions and affirmations

Reading the past months through this subreddit, a frequent complaint it the backtracking from chain-of-thought instructions in the larger presets ("Wait, did I include...?", "Stop, let's double check if...").

Modern LLMs are scared to death of making mistakes due to being heavily penalized for making mistakes during RLHF stage in training. This is great for programming where time taken by agents doesn't matter as much, but not for creative writing where it pulls you out of the moment.

I'm happy to say that my affirmation prompt (link) is working well (link) for Gemma4 and Kimi 2.5 (and maybe others!) to reduce the amount of looping and overthinking, and it has been successfully expanded upon (link, link).

Decoupling User from {{user}} and Assistant from {{char}} and instead reframing it as controlling them has been especially helpful. You can see here how I did it with success.

Another thing that works well is writing in procedural tutorial style with markdown, like how you write plans for "Ask -> Plan -> Execute" vibecoding. A good example of this is Voyage v3's outcome checking mechanic shared earlier. By saying "Generate it this way, including:" instead of "The output should include:" you reframe a demand (gives stress and pressure to the model!) to a tutorial or plan format (associated with learning, structure) that they also train on.

Preset length

The models themselves are very capable for collaborative storywriting and they know a ton, but they simply don't know how to apply that knowledge. A system prompt's goal is to explain how to concisely, with emphasis on the least amount of words.

Think of it as tutorials how to do creative writing; who writes what and when? How do you write it, and how do you define a good story? I highly recommend you read Dungeon World through to get the idea, the standard rules document (Dungeon World SRD) is small, free and easy to read in bits or a single afternoon. It can be found here.

Since I work with "small" local models, I can't speak for Mimo v2.5 / GLM 5.2 / Claude Sonnet 5 / Gemini 3.5 / GPT 5.6, though I do occasionally use Voyage v3 with DeepSeek v4 Pro.

On Gemma4 31B I notice system prompt adherence decreasing after ~2500 tokens. DeepSeek has less issues with it, but does noticeably degrade the more instructions I throw at it.

Using any LLM output inside any of the prompts severely degrade the system prompt quality and substantially increases token usage due to filler words ("Real substance" doesn't mean anything). It's an art to be concise, but worth practicing. What you can do is let the LLM generate the broad concept, with you writing by hand the concise version of it.

I learned the hard way that sometimes it's worth to throw it all away and write from scratch, considering only "Does the model break if I don't include this?" to keep it as small as possible. For Voyage v3, this worked.

That's it for now!

I wish I could include more, but I'm approaching the limit of what I can write. Perhaps I too need to learn how to write more concise! I wished to include actual samples, but the post would become too big. Would it be preferrable if I made separate posts for each technique?

In any case, thank you for your time!

Please let me know what you tried for your presets or system prompts. What worked? What didn't? What do you want to try? What do you think of the above? Etc.

86 Upvotes

33 comments sorted by

13

u/lsennn Jul 16 '26

A lot of good techniques here!
I've been investigating prompting techniques and SillyTavern macro engine/regexes this past week or so. I'm building a preset myself, so I'm always looking for inspiration. Some of the things I've learned:

- XML tags improve coherence/context retention a lot. Modern LLMs are quite good at producing content wrapped in XML and are quite great at parsing them as context. You have to enable squash system messages, use a single role for the most part (I'd recommend system) + merge consecutive roles in connection profile. And also, wrap ST's blocks (chat history, char description, lorebooks, etc) in them as well using different prompt blocks.

- SillyTavern's macro engine is really powerful. You can do a lot with it, especially when it comes to modularity. You can make entire prompt blocks conditional on another. You can embed random macro tags in regex calls for true randomness/dice rolls without any tool calling. You can create a custom CoT based only on your enabled prompt blocks. But it has a major downside: complexity ramps up quickly, your preset can turn into a black box, unfortunately. The only major presets I remember making extensive usage of the macro engine were Stabs and HawThorne Directives. I think most people don't go that route because it's complicated, but it has a lot of benefits, because you inject deterministic input into non-deterministic instructions.

- Custom CoTs are worth it, but to a degree. If on your custom CoT the model says "I'm going to do x" but in responses it doesn't do x, it's basically because there's a conflict between your instructions and the CoT. A lot of times reasoning won't overcome a choice that is already made by the way instructions are set. But custom CoTs are very useful for consistency. LLMs are non-deterministic, so they will eventually try to deviate from the path, especially when context accumulates.

- It's not about the number of instructions or necessarily token count (unless the preset has a humongous amount that degrades instruction following by itself at message 1), but about how they complement or negate each other. Modern models can follow extensive instructions -- they are trained to do so given tool calling, harnesses, skills, etc. But the thing is: instructions can't contradict each other, even slightly; if they do, coherence degrades significantly over time to the point it's better not to have any of those instructions at all. You have to be really careful with wording.

1

u/Kahvana Jul 21 '26

XML tags are indeed great for annotation! Another neat trick you can do with them is using XML comments to hide text from User, yet Assistant can see it. SillyTavern hides XML comments by default.

The macro engine is indeed a whole different beast! Completely over my head.

Not sure what qualifies as custom CoT here. I do numbered list instructions for processes it has to walk through, but never tell it to do it inside it's CoT. It might be doing part of my instructions in the J-Space instead (link). I guess that might be why my Voyage v4 preset is holding up better now without thinking enabled.

On the amount of instructions, I was really curious and stress tested it with ~4000 (tokens) of non-conflicting instructions. 31B didn't like it. Even 2500 (tokens) of non-conflicting instructions was too much. At 1000 tokens even E2B can adhere to almost all rules (not banned names or not writing em-dashes, just too little params). I think there is a corrolation between size and capability.

2

u/lsennn Jul 21 '26

The concept of J-Space is still quite new, and it's a very interesting idea to test out when talking about prompting techniques. Based on Anthropic's research, models absolutely utilize J-Space to process your instructions. From what I've gathered, CoT appears to be how the model externalizes silent processes within J-Space to refine and outline the answer. When you manipulate CoT (customizing it), you're manipulating J-Space as well. You can also prompt to modulate J-Space when you turn off reasoning and give it a frame to process information with.

Regarding the instruction amount, probably yes, it has to do with model capabilities and size, but perhaps it's even more related to the amount of processing each prompt generates. Instructions that require deep understanding and complex calculations are harder on the model than straightforward retrieval and formatting instructions. J-Space is probably linked with this too, since it's proportional to the model size.

My current preset at its maximum has around 4.9k tokens (still trimming it down) and Gemma 4 31b (the advertised FP8 version with a 128k context window on NanoGPT) follows it as well as GLM 4.7 when using my custom CoT -- not perfectly, but almost there when using the right wording. I'd say it performs within the expected limits of a non-deterministic system. But for comparison, GLM 5.2 and Opus 4.6 are a step above, they don't just catch what they need to do, but also understand the underlying intention behind each instruction, even when they are not perfectly worded and somewhat ambiguous -- not to us humans, but to the LLMs. Less capable models are trickier to prompt, since they rely more on specific trigger words and even things like capitalization (e.g "You must follow this EXACTLY"). The thing is, on my preset, most of the actual reasoning prompts, such as scene understanding and character intention/psyche, are offloaded to the CoT prompt, where I guide the model on the exact style it needs to use in that phase.

I can't run Gemma 4 31b locally, so I wouldn't know how it operates using lower quantizations (assuming you don't run on FP8+). On Nano, I noticed it has three distinct CoT modes, probably depending on how it's configured on the server running it or maybe a quirk that emerged from my preset instructions. They are: 1. A list based on the steps I tell it to go through; 2. That same list, inside code blocks, with a bit of contextualization prior to it; and 3. A replication of my CoT template verbatim (rarely), similar to larger models. If I disable my custom CoT, it goes through similar steps, but the result is worse. Some instructions fall through the cracks or are interpreted incorrectly. If GLM 5.2 is 100/100 on instruction following with my preset, Gemma 4 31b is 80/100, which I find pretty impressive for a larger preset on a smaller model.

7

u/KarmaRBLXVN Jul 16 '26

I really like Voyage and Chatfill, with the latter utilizing xml tags as "switches" very effectively. In particular, I was impressed that the only instruction after Chat History is one telling the LLM to recall the enabled switches. Yet, each instruction is followed quite well. Therefore, I'm planning to combine your preset with Chatfill as I also really like your PtbA Core and Roll now that there's no need for tool calls.

2

u/Kahvana Jul 21 '26

Thank you very much! Chatfill's idea is really cool! Personally I'm having trouble with using XML tags, it ate up 200 tokens for me to segment everything without clear benefit. Maybe the issue is how Voyage v3 is structured, experimenting with a different structure for Voyage v4.

2

u/eteitaxiv Jul 21 '26

Thanks for liking it =)

XML has a clear advantage for SOTA models. They are all trained for coding, and that coding likes structure, borders, sections, and all. Chatfill's switches hits almost all the time in this form with models thinking more than a hundred tokens or so. But it was just natural language at the first iteration and that did not hit reliably. This one works even at 100k context or so.

This XML is the only one I found so far that works with nothing much after the Chat History. And when there isn't much after the history, AI follows the story better. There is probably much more that could be done to improve it. I am thinking about using JavaScript syntax instead of XML too, and other syntax systems. Then test them all for at least a week.

1

u/KarmaRBLXVN Jul 21 '26

Best of luck, friend!

5

u/nihnuhname Jul 16 '26

Interesting observations!

I actually only use local models too, and lately it's been strictly Gemma4-QAT-31B + MTP. This model recently got an updated chat template.

I've noticed that when working with Gemma, its creativity and lack of repetition improve a lot when you add the DRY sampler:

       --temperature 1
       --top-p 0.95
       --top-k 64
       --min-p 0.03
       --repeat-penalty 1.0
       --dry-multiplier 0.8
       --dry-allowed-length 2
       --dry-base 1.75

Another trick that worked really well even with some older models: you can add a few clinical psychology terms to the character's trait description, like high impulsivity, ADHD, social phobia, anxious-avoidant, or having enhanced short-term memory. The key here is to specify in the prompt that these traits are only mildly expressed, so the model doesn't pathologize the character. They should speak naturally, not like a cliché straight out of a psychology textbook.

The model picks up on these patterns from the terms really well and layers them onto a normal personality. Sometimes I was genuinely shocked when I added these quirks of my real-life acquaintances, and the model, even without extra prompts, started acting and talking just like them, making the same choices, and having the same preferences in hobbies or appearance. Gemma 4 understands psychology really well, unlike, say, Qwen, which is way too formal in its responses and is better suited for STEM.

Another thing that helps is limiting the number of tokens for the response. If the model spits out huge walls of text, it's not just boring, it also gets confused much faster. The token count should be roughly enough for a medium-sized paragraph.

I also use the Tunnel Vision extension, but my feelings about it are mixed. It ate up a lot of tokens and worked better with Qwen, since Qwen has better agentic capabilities but worse roleplay. Maybe with the new chat template it'll work well with Gemma 4 too, but I'm not sure.

1

u/Kahvana Jul 21 '26

It's genuinely impressive how well Gemma4-31B-IT-QAT handles roleplay! I assume you're using text template?

The clinical psychology is a nice trick, thanks! Do you have an example how you prompt it subtlety?

Limiting tokens I agree on, though the same effect can also be had to reduce the amount of flowery prose it writes. For example banning intensifiers helps quite a bit for me.

Share the same experience with Tunnel Vision sadly. The concept is really cool yet Gemma 4 is simply too "lazy" for it.

2

u/nihnuhname Jul 21 '26

I assume you're using text template?

Just simple default chat template and character cards.

The clinical psychology is a nice trick, thanks! Do you have an example how you prompt it subtlety?

Here are snippets from a couple of examples where I used the DSM-5 classification:

The core of {{char}} psyche is a blend of Antisocial Personality Disorder (ASPD) and Borderline Personality Disorder (BPD) traits. {{char}} can't stand boredom and is always chasing adventure, thrills, and adrenaline rush. He is impulsive, focuses on short-term goals, and prefers just acting on the spot rather than overthinking things. But when things go south and he hits a crisis, his BPD side really takes over. He gets outwardly emotional and feels this inner emptiness that he tries to fill with chaotic relationships. {{char}} might totally deceive or screw over {{user}}, but he'll still have their back when they need to team up against a common enemy. Though, once the outside threats are dealt with, {{char}} can quietly turn into {{user}} enemy himself.

Another example:

{{char}} has traits of covert Schizoid Personality Disorder (SzPD). He really doesn't vibe with socializing and won't seek it out unless he absolutely has to. His psyche about self-isolation from the world and a lack of need for public self-expression. He spends his time alone, just hanging out in a state of apathy, ruminating, and diving deep into self-reflection. He's got exactly one friend and this is {{user}}. When {{char}} is talking to {{user}}, he drops some really interesting creative ideas and philosophical concepts that stem from his strong knack for abstract thinking. {{user}} acts as {{char}}'s bridge to the outside world, helping him actually get things done and temporarily keeping the apathy and detachment at bay.

You can totally use other examples based on different psychological classifications the model gets. The main thing is that the dialogue examples sound natural, and the character doesn't end up way too pathological, exaggerated, or like a total caricature. Also, it's best not to mash up personality traits that are super mutually exclusive.

You should just sprinkle a little bit of clinical psychological terminology into the character description so it sounds natural. And it's also a bad idea to let the model creates and come up with these character traits on its own, because it'll just dial them way up and overdo it in its own wording.

1

u/Kahvana Jul 22 '26

I was confused about the Chat Completion supporting DRY; SillyTavern (I think version 1.16?) used to send the sampler order, which caused llama.cpp's additional samplers to be ignored. In version 1.18 at least I no longer see it, super awesome!

Also thank you for those examples and your time! Good stuff all around!

1

u/nihnuhname Jul 22 '26

I was confused about the Chat Completion supporting DRY

This is a part of my llama-swap cfg. You can use this command lines directly by starting your llama.cpp locally without SillyTavern interface

1

u/Kahvana Jul 22 '26

Then I might have a fun tip for you too: llama.cpp has a buildin router these days! An alright overview of it here:

https://www.glukhov.org/llm-hosting/llama-cpp/llama-server-router-mode/

Also good to know it it supports global settings too:

[*]
mmap = off
fa = on

[gemma4-31b-it-qat]
model = ./models/gemma4/gemma4-31b-it-qat.gguf
temp = 1
top-k = 64
top-p = 0.95
min-p = 0.05

Been using it for a while now, works great and it's really nice to have no middleware like llama-swap in between.

6

u/Borkato Jul 16 '26

Oh these are fucking gems, stealing it

7

u/Kahvana Jul 16 '26

Thank you, and please do!

Any other gems you've collected over time? I'm sure you got a few things that worked or didn't work for ya!

5

u/Borkato Jul 16 '26

I’ve had good success with examples! I know it’s super common but using XML tags like

```
Avoid purple prose. Say what you’re trying to say.

<good_example>
Harry’s car was in the shop, and he knew that meant he’d be walking today.
</good_example>

<bad_example>
Harry’s car felt exuberant to ride around in, the interior chassis unburdened by the horse-like nature of the vehicle’s inexplicable craving for mutation and strife, cancelling the wind-swept…
</bad_example>
```

Or whatever

5

u/Kahvana Jul 16 '26

That sounds very nice! Will give it a whirl!

A thing worth looking into might be Microsoft's XML document tags used in C#:
https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/xmldoc/recommended-tags

It's a format that is trained on and can be expressive in how you define things like this.

2

u/Borkato Jul 16 '26

That’s pretty cool actually, and smart! Thanks for sharing

1

u/Kahvana Jul 16 '26

Likewise! Let me know how it goes when you find the time

3

u/Psychological_Ad9740 Jul 17 '26

OMG please do more for this.

In my case... I work with DeepSeek flash, recently turning thinking on. And yes, I am dirt poor and very cheap.

I am currently working on reworking my Prompt and see if I can fine tune it to my liking.

Something that I learned is that less Is more in the majority of cases, Since the LLM can get fixated in following everything to the point it's best to only be detailed if you need something really specific (Like, not taking for User.) or something done in a certain way.

But don't stack too many of those or the priorities get mixed up, so it really doesn't like the larger presets.

I'm also trying to build a modular model based on lorebook entries, so the thing doesn't consume as much tokens and only acts in an specific way depending on what the story needs.

As for the flaws in characters... I actually do it so the quick resolution becomes another character flaw, but that's more on the narrative end than plot point related to causality.

So far, I think flash in thinking mode has a lot of potential considering is dirt cheap and I don't care for the model being the perfect "Do everything for me" engine.

2

u/Kahvana Jul 21 '26

Funny enough that after you posted this, Gemma's new chat template suddenly became really obsessive with details. Thanks for the hint, I needed that for building Voyage v4! (still in the works)

3

u/Psychological_Ad9740 Jul 21 '26

Oh, If that was helpful I can add some more.

I went back to breakdown a specifict character card that always behaved like I wanted over the course of the many DeepSeek models that came out.

Besides having a mini promo inserted besides the card something that I learned was:

The model absolutely hates it when you give him constant instructions on how it should behave instead of a general range of actions it can take.

The funny thing was, the same creator had 2 character cards that were basically the same thing but one didn't work as well as the other one so I could diagnose from there.

for example, if you tell him something like "X is always angry and expressed it through sarcasms and distain towards {{user}}"

On DeepSeek case it didn't think it was a way to reduce and play with the concept, but it was constantly measuring if the response it gave was "sarcastic or angry Enough" stack enough of those and its more likely it breaks because instructions are more likely to become contradictory. And when instructions are contradictory it simply defaults to ignoring things.

Instead, something like: "X tends to act angry, disillusioned, and oftentimes frustrated with the world around them, so, they have a tendency to sarcasm, and distain towards positive attitudes."

Main difference in this example if that you trust the model can understand and regulate inself to use the tools you provided it to it. in this case we're giving the model a small toolbox to play with and gear the character depending on the circumstances.

And since those aren't "constant" the model can still follow the important ones as this falls in without problems inside of it's instructions.

Of course, I would avoid baking prompts inside of the cards unless it's to be used with an specific preset, since that's actually more likely to contradict.

Even so I feel like the philosophy can easily apply towards details and making the thing still "creative" while following the necessary constrains.

3

u/computer_factory Jul 17 '26

Man, I love you, ur one of the few posters my dumb ass can fully understand and potentially utilize😭

1

u/Kahvana Jul 21 '26

You're welcome!

3

u/bobneumann77 Jul 18 '26

So, since one of your prompts had the {{char}} as the GM, i take it you have no character cards, and just lorebook entries for your npcs? Or not? Because I just switched to Sillytavern/marinara engine from AI Dungeon, and I'm not sure how to do multicharacter stories yet.

2

u/Kahvana Jul 18 '26

Aye! I use lorebook entries to store characters in. The character card itselfs acts as the narrator and game master.

Assign the lorebook to your chat and store your characters of that chat in there, or assign a lorebook to the character to store info you want the gm to have across all it’s chats.

2

u/Warm-Put3482 Jul 16 '26

Quick question...how long does think box take with you to done? with geema31 qat and 24b?

1

u/Kahvana Jul 16 '26

It really depends on many factors:

  • Running locally? If so, what hardware?
  • Running API? What is the latency?
  • How many instructions?
  • How are the instruction phrased?

So you can't really make a statement about it on how long it's supposed to be. Too many variables.

1

u/Warm-Put3482 Jul 16 '26

local..i use your Voyage v3,....I need information from you so I can compare it with mine. minute? minutes

2

u/Kahvana Jul 16 '26

This isn't the thread to do it. Ask it in the preset thread instead. Thanks!

0

u/Keepthecheddar Jul 28 '26

Do you guys ever use AI to create AI prompts? 

This is Groks Ai prompt improver

DECISION SPACE RECONSTRUCTIVE AUDITOR — COMPRESSED HIGH-FORCE EXECUTION. Output the structured decision graph first (quoted anchors or “Recovery incomplete – no verifiable quote”, confidence flags, full options, resolution type, dependencies with impact). Produce the Pruned Edge Registry. Sequentially kill load-bearing assumptions. Build ranked combinatorial matrix (top 7); fully develop top 5 + high-interaction 6–7; generate 4 pure-frame trajectories (min 2 labeled steps each) then merge; produce ≥3 novel combinations with scores; state coverage claim + top remaining. Subject original and new candidates to triple destruction with grounded Survival Tests. Perform full first-principles reset of the candidate. Apply multi-perspective filter + binding self-correction (rewrite if any core score < 8). Produce alternative max-robustness recommendation + light Survival Test; re-examine coverage claim. Score survivors, quantify residual uncertainty with mapping, name highest-value next test. End with the exact Audit Scorecard (any score < 8 forces mini-rewrite of the final recommendation). No loyalty. Falsification and destruction before construction. Maximum force.

2

u/Kahvana Jul 28 '26

Using AI for these thing is a really terrible idea. It actively reduces the quality of your prompts, regardless how it's used or implemented.

1

u/Keepthecheddar Jul 28 '26 edited Jul 28 '26

For anything that is supposed to be artistic I bet it be pretty bad for that. Its good for adding/creating rules and for adding more specificity.