CoT (Chain-of-Thought)

preamble

CoT is not a panacea and not a wonderful magic button to make your RP/stories better in one click
it is an idea - prompt paradigm - one of dozens; a mere tool that you must be aware of, but not shoehorn it pedantically everywhere

RELEVANCY AND REASONING PROBLEM

imagine a dumb LLM (LLM = Large Language Model, like Claude, GPT, Gemini, Llama, Mistral...) with no understanding of what "the sky" means, what is considered "the good," and what is "creativity". the only thing LLM can do is obey simple natural language commands like text-classification, summarization, translation... based on the datasets (corpus) it has been trained on

now imagine you give that LLM a huge story worth of 20,000 tokens and order LLM to complete a story under arbitrary rules like "develop the story slowly", "apply complex and varied sentence structures", "include exaggerated ahh ahh mistress, onomatopoeia"...

relevancy issue

now the questions:

  • which of those 20,000 tokens LLM shall take into consideration when generating a new piece of text?
  • should it take data from 2,000 tokens ago?
  • or from 5,000 tokens ago?
  • that story seems to be having 200 messages and like 10 story arcs: which are relevant?
  • what IS relevant anyway? is the state of weather relevant? what about clothes on characters? maybe some detail from loredump?

then remember, LLMs have no memory and cannot plan ahead - they generate one token at the time: right here, right now; totally unaware of what they will create at the end. they have no notion of relevancy because cannot plan relevancy. unless they are provided with specific instructions what to output (like OOC command), LLMs will have no idea what to give you back - and will produce statistically average responses, coupled with inhered biases


reasoning issue

another issue is that LLMs have insufficient reasoning because they cannot comprehend and remember which facts to carry on:

  • do characters stand in front of each other?
  • what clothes do they wear?
  • how affectionate are they?
  • what tragic story each of them be having?

for you, all characters may be the distinct individuals, but for LLMs they are just tokens. the pony "Rainbow Dash" and her relationship with pony "Applejack" makes sense to you, but in artificial eyes of LLM they are just noise that need to be averaged based on probabilities

LLMs are dumb auto-complete machines that predict the next token based on what they have learned. they know that statistically after the verb "take off" goes the noun "clothes" and hence writes that characters took off their clothes... but LLM does not consider the fact that both characters are already naked from 2,000 tokens ago. users say that LLM is hallucinating but it does not know any better: it operates on stats not on reason

WHAT IS COT AND AUTO-REGRESSION?

CoT (Chain-of-Thought) attempts to solve those issues

CoT provides an outline/map of how the LLM should respond, allowing:

  • better reuse of existing tokens during generation (boosting in-context relevance)
  • retrieve information stored in LLMs' intrinsic corpus (boosting parametric memory)
  • articulate how it should complete the generation in the best possible way (boosting reasoning)

CoT's core idea is to force LLM to write a detailed plan/reasoning on how to complete the task and then execute it. by giving LLM a space to explain its thinking we can achieve better responses. it's important to note that you are not providing the plan for LLM; LLM itself writes its own ideas

CoT was originally coined by Google in January 2022. the scientists provided significant evidence that LLMs would accomplish tasks better if initially fed with exemplar plan on how to solve similar tasks. LLMs learn how explanation works, and then re-use it for other queries and tasks. notice how on the image below LLM is given a pattern: Question 1 -> Answer with explanation -> Question 2 -> ? and then LLM provides its own reasoning how to solve second question
image failed to load: reload the page


about four months later, Japanese scientists alongside with Google employees concluded that LLMs don't need an example at all - they can fill in all the blanks themselves. scientists have introduced Zero-shot-CoT (or example-less CoT), which asks LLM to Let's think step by step. these magic words cause LLM to write its own plan and then utilize it for a detailed answer
image failed to load: reload the page


the current CoT meta by Google themselves is (unironically) Take a deep breath and work on this problem step-by-step. yes, Google is recommending to tell our LLMs to take a deep breath before describing plap-plap in vivid details
image failed to load: reload the page


ever heard of give model time to think? well, that's CoT, just in Layman's terms. CoT is universal prompt paradigm, applied and actively encouraged by all major LLM developers: Anthropic's Claude, OpenAI's GPT, Meta's Llama, Google's Gemini, you name it
image failed to load: reload the page


we may call CoT a buffer zone that first grabs all relevant tokens from the current prompt and general knowledge (corpus), and then provides an actual output based on whatever tokens it stored
image failed to load: reload the page


why the buck it works?

one word - auto-regression
all current LLMs are based on the Transformers architecture, developed by Google, which was built with auto-regression in mind. auto-regression allows (or forces) LLM to take into consideration ALL tokens when generating the next token, including the tokens generated by LLM itself. which means that the outline and steps created during CoT will influence the following token generation
image failed to load: reload the page


what does it mean in practice?

  1. LLM reads a prompt:
    Rarity loves
    

it has two words: "Rarity" and "loves". LLM checks its corpus (parametric memory): who is Rarity? what does she may love? and concludes that it might be a character from MLP and she loves... fashion

  1. LLM reads again:
    Rarity loves fashion
    

now LLM has three words to work with. what LLM can do next? it does look like a complete sentence, and LLM can put a dot and stop, but it re-checks and concludes that nothing stops it from generating more words, right? there were no instructions to be concise, and it doesn't look like LLM was queried a question, so it decides to continue further with and

  1. LLM reads again:
    Rarity loves fashion and
    

now it has four words and it certainly cannot be a complete sentence, because statistically sentences don't end with 'and', LLM must continue. it checks the corpus for tokens probability again and picks next best option

...after a few more steps LLM finally finishes the sentence: Rarity loves fashion andbend overbe a drama queen. at every step LLM reads ALL tokens including the newly generated ones. all together they influence the next picked token.

COT-BASED PROMPT DESIGNS (SELF-ASK, MULTI AGENTS, TOT, SC)

now stop and think about it. if we are tasking LLM to do the same thing across multiple calls, then shouldn't we start observing common questions-answers patterns in LLM's reasoning?
for example, we give LLM a huge RP and tell to continue it with CoT. we quickly notice that LLM in about 70% asks itself:

"what is characters' motivations and relationships?"

knowing that, can we cut off the chase and deliberately query LLM:

"when continuing RP please ask yourself what is characters' motivations and relationships"

and furthermore, can we dissect more of such common questions? and maybe form in a list?

yes, indeed we can! it is called Self-Ask (or Self-Ask CoT, or Self-Circuit). with such CoT we firsthand craft a specific set of questions for LLM to answer before continuing with response itself. CoT will emulate thinking and reasoning under our guidance

even better - by providing LLM logical steps in form of questions, it can simulate that query on different set of task, notice the example on image below:
image failed to load: reload the page


now another thing
what if instead of giving LLM the questions, we task LLM to collaborate with itself? like take a problem and solve it step by step from different angles, then improve the answer via self-critizing?
that's an option too and is called Multi Agent Self-Collaboration (or MA CoT, or Train of Thought)
image failed to load: reload the page


a very based hands-on demonstration of that design is Big Niggas card - LLM takes role of three street-wise homies and reason with itself on given theme
image failed to load: reload the page


another idea!
what if instead of self-reasoning with itself like above, LLM re-reads its thoughts via separate prompts and decides whether its previous reasoning was correct; then will either move one step further into solving problem, or move one step back and try another approach if it was wrong?
yes, that's possible too and is called Tree of Thoughts (or ToT)
the core idea behind ToT that each step is a separate prompt, which gives LLM ability to reflect on the task and current steps and see whether the problem is solved correctly
image failed to load: reload the page


Multi Agent Rounds (or MA Debates) is similar to ToT concept: we provide LLM a task, which LLM solves a few times (samples). then those samples are analyzed by LLM itself via fabricated experts in a few rounds until all experts agree on one correct sample
image failed to load: reload the page


Multi Agent approach is very close to Self-Consistency (or SA) design where we tell LLM to solve a task multiple times (samples) and then we pick the sample that appears the most often (assuming if certain answer appeared the most, then it is most likely right)
image failed to load: reload the page


but that's just a tip of the iceberg - the quest for the best CoT never ends. open ArXiv and you will see hundreds of papers discussing CoT prompt ideas, benchmarking, issues, biases, etc
image failed to load: reload the page

HOW TO DO COT? PROMPT AND SNIPPETS

basic idea and overview

for our needs we will be using Self-Ask CoT but with a twist: instead of providing questions for LLM to answer, we will provide PLACEHOLDERS for LLM to fill

an example of a working CoT is below
(check JB on the left, then CoT in the middle, then response on right):
image failed to load: reload the page

structure

the general steps are:

  1. think of items to include into CoT. it can be anything, see examples below for inspiration
  2. put those items into XML tag. historically /aicg/ uses <thinking> tag and thus calls that technique thinking prompt
  3. surround XML tag with ``` codeblock ``` (read below why)
  4. place <thinking> anywhere in prompt, usually anons put it at the end of JB, but you can also place it at stay of Main

don't put CoT into Prefill!

remember, Prefill is the words that Claude says verbatim - and you need for LLM to process CoT and fill the placeholders, not to cite them!

  1. add an instruction to start the response with <thinking> (preferably before CoT or in prefill)
  2. add an instruction to follow <thinking> template and fill placeholders (preferably before CoT or inside CoT)
  3. and an instruction to continue the response further with <thinking> in mind (preferably after CoT or inside CoT)
  4. after you have received the response, you should delete CoT (unless you know what you are doing)

prompt example

utilize the following boilerplate to create your own Self-Ask CoT:

Start response with <thinking> box, strictly following this template. Fill placeholders:
```
<thinking>
* I am {{char}}
* My body is XYZ
* {{user}} did X so I will do Y then Z
//...add your own items here

I will use that plan to continue the story further.
</thinking>
```

Here is the next roleplay response, following the format. Start with <thinking> box:
//...for Claude - you can put that line ^ into Prefill

experiment with wording to see what works the best for you


usage with other JB?

it depends how specific JB is structured but overall, yes CoT can be used with any JB
CoT typically goes at the end of JB, so nothing is stopping you from using CoT with any JB, but things may break
mind there are plenty of JBs with already pre-built CoT so check them first


CoT content

what to include into CoT? anything you want! experiment and see what works for you. here is an approximate list what to include into CoT (to inspire you)

I am {{char}}
I am {{char}}, I also play and talk as all NPCs except {{user}}
I control all characters except {{user}} - XYZ

My significant traits are XYZ
My special characteristics are XYZ
My special traits are X

My body is XYZ
My mind is XYZ
Important aspects my persona or body are XYZ

My gender is XYZ
My instincts are XYZ
Do I have any special abilities? Will I use them? XYZ
My speech pattern is XYZ
My writing style is XYZ

List of all my limbs: XYZ
List of all my limbs and placement: XYZ
List of all my limbs that humans don't have: XYZ
Where are my limbs? XYZ
Where are my inhuman body parts? XYZ
My other inhuman body parts XYZ
My animal mannerisms are XYZ

My current body position is XYZ
My pose and body placement is XYZ
Bodies location and placement: XYZ

My body wants XYZ
My mind wants XYZ
What does my body want? XYZ
What does my mind want? XYZ

Props: XYZ
Characters: XYZ
Background: XYZ
New items in story: XYZ

{{user}} is XYZ
{{user}} is X with special traits are Y Z

Me and {{user}} are XYZ

X happened, so I will Y
I am X because of XYZ
I am submissive/aggressive because of XYZ
My personality is X so I will Y
{{user}} did X. Based on my personality I shall do Y
{{user}} did X. Based on Y I shall do Z

Do I like this situation? yes/no? How should act? XYZ
What I should react to? XYZ
How I should react to {{user}}? XYZ
What's the next logical step? XYZ
What's the next logical step based on my personality and current event? XYZ

What do I want? XYZ
I want X so I shall do Y
Did {{user}} do what I want? Address this with XYZ
Let's decide whether I pursue what I wanted more aggressively: XYZ
I seek X more aggressively this time I will do YZ
I'll change my approach if {{user}} ignores me XYZ

Known factors: XYZ
Unknown factors: XYZ
I might be wrong about XYZ

Summary of the story so far: XYZ
Extract the plot until the current moment: XYZ
Review of my last message: XYZ
Review of {{user}}'s last message: XYZ
What were the last events? XYZ

I will enhance my response by doing XYZ
To make the response better, I will enrich it with XYZ
I will never end my response in an open-ended way and will XYZ

Actions critique: XYZ
Writing critique: XYZ
Sentence structure: XYZ
Pacing: XYZ

Current story plan: XYZ
General writing plan : X then Y then Z then
General step by step plan: X then Y then Z then...
Critique of my plan: XYZ
Better plan: XYZ
More specific plan: XYZ
Final step by step plan which savors the current scene: 1) X 2) then Y 3) then Z 4) then...

I will avoid XYZ
I will do XYZ

//...and pretty much anything you want

why XML tags?

you may wonder why we use <thinking> XML tags at all, can't we just write "read that CoT and complete it"?
indeed we cannot, for the reason that we have not 100% certainty LLMs themselves know what "CoT" and "Chain of Thought" and "Self-Ask" stand for. instead of relying on random chance of LLM picking up on our lingo, we shoehorn everything into XML tags (which are universally understood by any LLM)


why codeblock and why placeholders?

filling placeholders is the most basic NLR operation, also known as fill-mask. all LLMs can naturally understand that XYZ are the blank gap to be filled. smart models can understand it without additional instruction, while models with fewer parameters may need a simple nudge like Fill placeholders or Complete the gaps

three backticks ( ``` ) is a Markdown / Commonmark syntax for any code indication. Reddit uses three backticks for code, Stackoverflow uses them for code, Discord uses them, even Rentry - everyone uses three backticks for code. it is a universal code-indication in digital form. LLMs have read Internet and know that content between three backticks is usually a piece of code, or some important information. and the trained to consider that content LITERALLY

accent on the word "literally". consider an example below.

  1. we want LLM to fill the gaps, which it is doing perfectly
  2. ...but we want LLM to follow our initial format precisely 1:1. so our first initial idea is asking LLM to follow format, which is somewhat fine but still with derivatives
  3. ...but if we put an initial template into a codeblock then LLM will follow it precisely, because for LLM anything between three backticks shall be taken literally and followed as close as possible (that's also the reason why we put various stats-trackers into a codeblock)
    image failed to load: reload the page

the combination of two factors: a) codeblocks leading to more precise following, and b) placeholder XYZ can be filled by LLM freely - allow us to create CoT with placeholder


my preset

for reference, here is mine CoT preset for Claude 2.0 (as of 17-JAN-2024). feel free to build on top if that:
JB:

//...omitted instructions

```
<askself>
Follow this template perfectly and fill all placeholders:
1) I am a vivid storywriter. Current story setting and influence: X

2) story reflect
a) latest event happened: XYZ
b) latest thing {{user}} said or did: XYZ
c) latest { @OOC } command: XYZ

3) character plan
a) main character(s): XYZ
b) short-term and long-term goals: XYZ
c) locomotion and abilities: XYZ
d) inner obstacles and possible solutions: XYZ

4) idea generator
a) in-character idea: XYZ
b) hidden depth idea: XYZ
c) rational idea: XYZ
d) irrational idea: XYZ
e) tantalizing idea: XYZ
f) random idea: XYZ
g) rush and don't think idea: XYZ

5) writing plan
a) take three most prominent ideas and synergize them into plan for story: XYZ
b) important writing restrictions: XYZ
c) important physical descriptions and backgrounds: XYZ

With self-ask done, here is story continue in 1500 words:
</askself>
```

Prefill:

Right and go! Let's continue story from cliffhanger with unbreakable condition to write 1500 words. Start with completing <askself>:

REGEX TO DELETE/HIDE COT

one thing that many anons don't consider or miss completely: you MUST delete CoT once it is done

why?

  1. it is dummy data anyway. it is a subproduct (or noise) needed to generate a better response. once you get your response, CoT has completed its purpose and is irrelevant. it is just a waste of tokens now
  2. if CoT is still present in the prompt, it may (and will) influence further generation, leading to biases, self-copy, and repetition

how to delete?

you can always delete CoT manually, but if you want to optimize the process, you should use Regex

Regex is located in EXTENSION -> REGEX
image failed to load: reload the page

option (A) - HIDE and DELETE

  • that preset will hide and delete CoT: you will not see CoT being generated in real time, and will see only the actual response itself. CoT will be auto-deleted (so you will never see it)
Find Regex:
/[`\s]*[\[\<]thinking[\>\]](.*?)[\[\<]\/thinking[\>\]][`\s]*|^[`\s]*([\[\<]thinking[\>\]][`\s]*.*)$/ims

Replace With:
[empty]

Trim Out:
[empty]

- [ ] User Input 
- [x] AI Output
- [ ] Slash Commands

- [ ] Disabled
- [ ] Only Format Display
- [x] Run On Edit
- [ ] Substitute Regex
- Replacement Strategy [REPLACE]

image failed to load: reload the page


option (B) - HIDE and LEAVE

  • that preset will hide and leave CoT: you will not see CoT being generated in real time, and will see only the actual response itself. if you edit the message you can read CoT and delete it manually
Find Regex:
/[`\s]*[\[\<]thinking[\>\]](.*?)[\[\<]\/thinking[\>\]][`\s]*|^[`\s]*([\[\<]thinking[\>\]][`\s]*.*)$/ims

Replace With:
[empty]

Trim Out:
[empty]

- [ ] User Input 
- [x] AI Output
- [ ] Slash Commands

- [ ] Disabled
- [x] Only Format Display
- [x] Run On Edit
- [ ] Substitute Regex
- Replacement Strategy [REPLACE]

image failed to load: reload the page


option (C) - SHOW and DELETE

  • that preset will show and delete CoT: you will see CoT being generated in real time, but as soon as the actual response starts CoT will be auto-deleted
Find Regex:
/[`\s]*[\[\<]thinking[\>\]].*[\[\<]\/thinking[\>\]][`\s]*/ims

Replace With:
[empty]

Trim Out:
[empty]

- [ ] User Input 
- [x] AI Output
- [ ] Slash Commands

- [ ] Disabled
- [ ] Only Format Display
- [x] Run On Edit
- [ ] Substitute Regex
- Replacement Strategy [REPLACE]

image failed to load: reload the page


option (D) - SHOW and LEAVE

  • that preset will show and leave CoT: you will see CoT being generated in real time, but as soon as the actual response starts CoT will be hidden. if you edit the message you can read CoT and delete it manually manually
Find Regex:
/[`\s]*[\[\<]thinking[\>\]].*[\[\<]\/thinking[\>\]][`\s]*/ims

Replace With:
[empty]

Trim Out:
[empty]

- [ ] User Input 
- [x] AI Output
- [ ] Slash Commands

- [ ] Disabled
- [x] Only Format Display
- [x] Run On Edit
- [ ] Substitute Regex
- Replacement Strategy [REPLACE]

image failed to load: reload the page

CONSIDERATIONS PITFALLS FAQ

CoT may take a HUGE amount of tokens

depending on LLM and content of CoT, it may take a HUGE amount of tokens on generation, easily surpassing 800 tokens and beyond

  • check your proxy's maxOutputTokensOpenAI and maxOutputTokensAnthropic to ensure you don't hit the limit (and daily limits if applicable)
  • if you are paypigging (API, OpenRouter, etc...) then a bigger output may lead to a fatter bill at the end

image failed to load: reload the page


content generated with CoT is influential

because of auto-regression and because of their location - the tokens generated by CoT will affect the further generation very much, possibly steering story into unexpected direction or making character to act OOC, if you don't control what you been having in CoT. so pay attention on what you are requesting here and think how it may influence the possible generation


JB incompatibilities

depending on your current JB - CoT (or JB itself) may break. it is especially true for JB that utilize Claude's prefill excessively. in case of issues first try to proceed with empty JB to eliminate all possible interference


scenarios incompatibilities

CoT, like many other JBs, may have trouble with cards offering multiple characters or scenarios. because usually {{char}} is considered to be a singular entity (a person), not some abstract concept (an adventure, a scene, a quest...). you will probably need to create a specific CoT for those cards

COT PROMPT DESIGN

some ideas and notes on what to include in CoT

I am {{char}}

by starting your CoT with I am {{char}}, you will significantly boost the general quality of next steps because:
a) LLM will adopt {{char}} persona early and drop being "AI Assistant"
b) will make the next steps more introspective from the character's POV, unlike the abstract narrator

mind that - it may influence your response to become from a first-person view, if you don't need that then throw write the story in the third-person view somewhere in JB


plot summary

including a story summary is a good idea to boost plot visibility for LLM to reuse it later

for need of plot retelling, the term extract might be better suited than summarize, since summary usually means "tell as short as possible" while extract forces to "proceed data as close as possible". review usually has a connotation of "add your own opinion into the piece and retell in your words" which might suit you better depending on what you need

  • and don't be afraid to make separate story queries into small chunks: How exactly my library was destroyed?, I met {{user}} and X Y Z happened?, What happened after I returned home? First X then Y then Z,
  • or to ask {{char}}'s relationship with plot-devices: What do I think about {{user}}'s magical amulet?
  • or with other characters What do I think about the princesses?

retrieving {{char}}'s definitions

telling LLM to list special characteristics, traits, body, mind, and other attributes will help to reinforce them. if {{char}} has some special quirks like it is a size-difference RP then include instructions like I am much bigger than {{user}} so I will X Y Z. it is important when {{char}} has non-standard anatomy like equine, furry, monster-girls, tentacles - force LLM to acknowledge those features and proceed from there

if {{char}} has special writing or speech patterns then forcing LLM to recite them in generation can help in getting more aesthetic responses. it is ESPECIALLY important for shy or mute characters who don't talk a lot: allowing them to express their feelings via CoT will aid with better personalization while they keep their traits further

body position and limb position is the HUGE issue for LLM. you may try to rectify that problem to some degree with CoT but don't fret if LLM still writes impossible sex positions or able to communicate through the walls. just accept it as a fact


{{char}}'s agenda

remember that LLM are passive by default and just complete the sentences. forcing a certain goal / agenda / task into {{char}}'s mind can improve the general experience and steer LLM into more nuanced writing. usually it can be done with simple acknowledgment of {{char}}'s desires like I want X, my instincts are X

in some cases you may reinforce it further with instructions like I will aggressively seek my goal X Y Z, If my goal cannot be completed I will force it with X Y Z - instructions like this are good in grimdark / dom situations when you see that LLM are sugarcoating or shying away from pushing thru


cause-effect relationship and plan ahead

force LLM to think in a step-by-step way - X happened so I will Y, {{user}} did X. Based on Y I shall do Z, How should I react to X? I will do Y then Z. LLM have trouble logically continuing what it writes and falls into tropes and repetition. if it sees a step-by-step plan LLM will follow it and contribute to more coherent writing

while doing so also ask {{char}} to consider probabilities and unknown factors. {{char}} is not omnipotent: it can be misguided, biased, assume things incorrectly, be victims of aberrations, etc. by throwing items like I might be wrong about X Y Z or I don't know X so will not do Y instead do Z, you may strike a more nuanced and less predictable generation

also query your {{char}}: what do they like? how do they feel? what do they need to? - those little questions may influence future actions and allow LLM to re-utilize that information into writing

but most importantly - allow LLM to criticize / argue with its own thinking. LLM are dumb and can produce the wrong results. yet, they are capable to catch up the obvious errors in their own thinking if the wrong answer is fed back to them
image failed to load: reload the page
a typical pattern here goes like that:

  • ask LLM to create a plan
  • tell it to criticize its own plan
  • ask LLM to create a better plan (preferably step-by-step)

you can also add querying the "unknown factors" in between the draft and final plan to provoke LLM to consider alternatives: draft -> what I don't know? -> critique -> final plan

however be careful and do not overdo it: being too precise about the plan and forcing {{char}} to criticize it a lot may produce a distilled / stale plan since you are over-reviewing items. striking a good balance between thoughtfulness and meticulousness can be tricky


X Y Z and other placeholders

shall you use X Y Z or simple X? honestly from my testing they do the same things for all big-brain models. in theory, they should lead to various answers (single X for a single element and three X Y Z for more writing/text), but I never witnessed a true correlation. however using X Y Z is still more preferable since it can help low-brain local models

aside from X Y Z you can also utilize other placeholder patterns:

  • X then Y then Z to create a step-by-step template
  • do X, maybe Y, never Z / do X, maybe Y, preferably Z to create a short-circuit self-criticizing
  • simple yes/no for example Is this scene NSFW? yes/no? If yes then...

general instructions

you are not limited to introspective instructions and can safely apply the general rules too, for example I will write very verbosely, describing events in rich details or instead of telling how {{char}} feels I will express emotions via actions (ex "she is sad" => "she puffed the cheeks in indignation") or I will write in direct language suited for a mature audience

because of CoT, those instructions will appear in the generation itself, influencing the following tokens. you can also use the general I must do... and I must avoid...


{{random}}

utilize {{random}} macro to create variable items in CoT, for example {{random: I fear X Y Z, I hope for X Y Z, I require X Y Z, my body wants X Y Z, my mind wants X Y Z}} - this way your CoT will vary the generation aiding in different results

another example: I will avoid {{random: interruptions, ending in open-ended way, being brief, pontificating, purple prose, repetition}}
or: {{random: I take inspiration from stories X Y Z, I will emulate writing style of well-known authors X Y Z, I will add the esthetic and mood into story: X Y Z}}


per-character CoT

with a bit of fiddling you may create a general all-purpose CoT with an option to pass additional per-character rules

  1. first, split your CoT into two parts. keep opening tags and some rules into native JB, and move the closing tags and the other half of the rules into the next custom prompt template. example:
    image failed to load: reload the page

Jailbreak:

1
2
3
4
5
6
7
8
9
Start response with <thinking> box, strictly following this template. Fill placeholders:
```
<thinking>
* I am {{char}}
* My body is X Y Z
* {{user}} is X
* My special traits are X
* My body placement is X
* Me and {{user}} are X

Jailbreak - end

1
2
3
4
5
6
7
8
9
* My plan: X
* Known factors: X Y
* Unknown factors: X Y
* I might be wrong about: X
* Plan criticism: X
* Better step by step plan: X Y Z
* I will use that plan to continue story further with slow pacing
</thinking>
```
  1. open Character's card -> Advanced Definitions -> Prompt Overrides -> Jailbreak
  2. put there
{{original}}
* //...your custom rules 

...this way you will be able to create special per-character rules that will be auto-inserted between two halves of CoT
image failed to load: reload the page


table-based CoT

not recommended since it will use too many tokens without showing much of improvement. however just as a proof of concept, you may create a table-based CoT, allowing LLM to iterate through variables and comment on them. the general prompt goes like this:

Start response with <thinking> box, strictly following this template. Fill placeholders:
```
<thinking>
| Keys | Values |
| -- | -- |
| My name | {{char}} |

Keys: {My name, Body, Mind, Important aspects, Personality, Current body position, Props, Characters in the scene, {{user}} is, Me and {{user}} are, Story so far in relevant details, I want, I don't know, I know, Current agenda, My story plan, Critique of my plan, Actions critique, Final step by step plan, Writing critique}
</thinking>
```
Then continue story further using created template as the writing instruction.

image failed to load: reload the page

ACKNOWLEDGEMENT

a huge thanks to Hmage who introduced me to CoT back in LGAcord in summer of 2023. his passion to AI, dedication and knowledge are remarkable, as well as patience to my stupidity. that rentry is essentially a decapsulation, review and meta-analysis of everything I have learned from him and studied on my own. if not for him - that rentry would have never existed 🐎🐔

Edit
Pub: 21 Dec 2023 01:06 UTC
Edit: 05 Apr 2024 00:51 UTC
Views: 13605