Ali:Chat Style (WIP) (Feel free to send feedback to AliCat - Ali#2222)

Ali:Chat v1.5 https://rentry.co/alichat - Currently updating this to be centered around SillyTavern, as this is my recommended repo for chatting! Link to repo -> SillyTavern

~~  The below guide is outdated; however, the below information is still relevant/helpful! ~~

NOTE for v2: I will be adding an in depth character example. The “interview” template (where you ask them questions) is a good simple way but there are other ways to show what Ali:Chat can do. Creating a Rentry, will link to that instead after it’s completed! Will include more examples, including World Info tips and Author’s Note / Character Bias tips.

  • Ali:Chat’s principle idea is using dialogue as the formatting to express and reinforce traits/characteristics.
  • Ali:Chat style is basically “Dialogue examples for everything!”
  • Ali:Chat is more of a style “guide” and not a specific “template”.

TL;DR:

  • “Description” box: Include various dialogue examples that express the character’s core attributes/traits. These are permanent.

  • “First Message” box (Greeting message): Include a detailed scenario, through the perspective of the character, that gives you a reason to talk to them. This establishes the story (plot, setting, character, conflict, and theme). These are temporary.

  • “Examples of Dialogue” box: Include follow-up dialogue examples which help push the scenario/conversation forward in various interesting ways. These are temporary.

*Important: Every dialogue example should express character attributes/traits through dialogue and/or *actions*. (Actions meaning words *enclosed* in asterisks).

TIPS

Important Tips:

  • Characters’ attributes/traits can be implicit—The way they talk & act, the situation & environment, their character name, and even how You react to them.

(E.g. You: *Ali looks towards Harry, drawn by his large round glasses and lightning mark scar.* or “Harry: *Harry adjusts his large round glasses.*”)

  • Example dialogues should include “You:” AND “{{char}}:”. (Note: {{char}} will convert to the bot’s name in TavernAI)
  • “You:” can be powerful in pushing a bot in certain directions (see examples below); while also creating a pattern on how the AI will react to your inputs
  • “You:” acts as a stopper for many UIs (e.g. Tavern/Ooba). If the AI generates a “You:” it stops and clips it. (<START> does not act as a stopper).
  • Use “You:” examples to create “keys” to activate bot responses. If you say *I pet Bot’s head* then the bot will react with *purrrr* or something similar.

You: *Ali pats Bot’s head*
        Bot: *purrrrrrr*

  • When using “You:” as a key, it can help to keep “You:” short as this leads to more flexibility. Can also be used to teach the AI longer responses.
  • The bot’s answers can occasionally “leak” (quoted verbatim), which leads to “in character” responses (including accent) and will be 100% (or nearly 100%) accurate. Just be careful with ‘environment’, as environment leaking could cause your conversation to switch locations or not make sense.
  • (?) If you do not want leaking, then putting the dialogue in [square brackets] can help. (I need to test this one more)
  • There is high accuracy (generally) when your conversation overlaps the dialogue examples.
  • You can add flexibility by making your example dialogues open-ended.
  • Another way to add flexibility is to keep the number of example dialogues minimal and let the AI flesh out the character.
  • When including actions, it can help to include the character’s name (e.g. *Harry Potter adjusts his glasses.*). This helps the AI connect the sentence to the person.
  • For long dialogue examples, actions that include the character’s name can be a great way to link those sentences to that character. Do this every 2-3 sentences.
  • If you want longer responses, then make your dialogues long as well. Actions make a great buffer.
  • You don’t need many example dialogues if they all embolden the character’s personality/traits; and especially if they’re also relevant to the First Message scenario.
  • If the bot isn’t acting how you’d like, you can reinforce facts/traits by: Adding, rearranging, and/or rewording dialogue (The character’s and/or user’s dialogues).
  • What you put in, is what you get out. Interesting dialogue in, interesting dialogue out. Boring dialogue in, boring dialogue out.

        Bonus Tips:

  • You can combine Ali:Chat with other styles to great success. Essentially, include the Boostyle, W++, Python List, on the first line of Description followed by a <START>. Below, have dialogue examples reinforcing those traits.
  • If your dialogue examples overall have a theme/tone, then the AI continues that pattern.
  • Including {{user}} will help the bot know your name (user name).
  • Try different perspectives (1st, 2nd, 3rd person) and tenses (past or present). Different combinations can help tie everything together, but stick to only one.
  • If responses are looping, then decrease dialogue overlap, increase repetition penalty, or delete the looping text. Basically, the AI likes to create patterns.
  • Quotation marks are not recommended, as this could confuse the bot into thinking it's a novel and not a chat.
  • You can use the example dialogues to create new ones to replace and "refresh" the character.
  • World Info (not implemented yet) can allow a very dynamic character, as the dialogue examples can be triggered by keys. This also allows huge token savings.

Character Creation Tips:

  • If you need help creating a character, you could ask the character questions using an already created/partially filled card, CAI, ChatGPT, or quote directly from sources (Note: just include actions/context).
  • You could also use boostyle as a guide (see below). Add boostyle to the top of Description with your character’s traits. Then, in Ali:Chat, reinforce those core traits via dialogue examples. You can also weave in other traits/lore, as well!

Ali:Chat vs Other Styles:

  • Ali:Chat can be more token efficient than other styles. This is because a lot of personality is implied through dialogue & actions; and a large number of words are only 1-2 tokens. Plus, it makes efficient use of dialogue examples.
  • Ali:Chat provides more control vs other styles; however, this also means it can be more difficult, as it relies more on your writing.
  • Ali:Chat should work for any model and any finetune. (However, [ ] might not work.)

TavernAI:

  • Do not add a <START> token to the end of any box.
  • Do not add a <START> token at the beginning of Description.
  • {{char}} will convert to the Character's name
  • {{user}} will convert to your user name.
  • For the character’s name, using the first name can help the AI process it easier.

TavernAI - Character Card

Description:

  • This box is used for everything you want to remain in context
  • On the first line, put a description of your character (Can use any style).
  • On the second line, include a <START>.
  • On the third and additional lines, include various dialogue examples.
  • Make sure every character dialogue has a “You:” dialogue between it.
  • The bottom has the highest strength and the top is the lowest strength.


Boostyle was used for the first line. Then <START>. Then example dialogues.

“You:” acts as a stopper for TavernAI (like CAI’s END_OF_DIALIOGE)

First Message (Scenario):

  • Used for establishing the scenario (non-hidden).
  • Content in this box is temporary and does not limit chat memory.
  • This box is super important for setting the character, story, pace, tone, and scene.
  • A large First Message can greatly improve the response length of the bot, but this is temporary.
  • Alternatively, you could skip having a scenario altogether and let the AI create it for you (see example below). You can add flavor text to help guide the AI in certain directions and reinforce the overall theme.
  • You can use my list here for ideas (Contains a little NSFW). This list was for Sigurd (GPT-J 6B) which uses the same base model as Pymalion 6B, so it should work well:
  • Tag Database -> HERE

Very basic example, would ideally be more in depth and longer.

Including {{user}} can allow the AI to include your user name in the chat/scenario.

Personality summary:

  • Do Not Use / Optional
  • Content in this box is permanent.
  • If used, keep brief just to reinforce certain traits.

Scenario:

  • Do Not Use / Optional
  • Content in this box is permanent.
  • Bottom of the Description box is the exact same spot in the context but also allows you to use [both] brackets and use any Tags (see Tag Database).
  • If you want to use “[ Scenario: ]”, add it to “Examples of dialogue” for temporary, but strong; the bottom of “Description” for permanent but weak; or the bottom/top of “First Message” for the strongest influence. (Note: If you notice bracket looping, move higher.)
  • This will typically only really activate if the context allows it (i.e. if someone brings up dementors). Note, with “First Message”, it might activate regardless.

Dialogue was used for the first line. Then <START>. Scenario added to the bottom.

Examples of dialogue (Hidden Scenario):

  • You must include <START> at the beginning (or this box doesn’t work).
  • Content in this box is temporary and does not limit chat memory. It will eventually get pushed out of context.
  • This is the “Hidden Scenario” box. The last dialogue example should be relevant to your “First Message” box. It can be used to drive the conversation in certain directions while also fleshing out the character’s personality/traits.
  • It’s important that there’s overlap between the Hidden Scenario dialogue example and the First Message for it to work consistently.
  • Alternatively, all your “Example of dialogues” could be branching paths for a conversation. (Think visual novel or quests or multiple scenarios). If they all naturally follow from the first message and your response, then they could drive the conversation in their respective directions. They need to be varied enough to prevent jumping from branch to branch and potential looping.
  • (Optional) Can also include non-permanent chat examples here at the top.

Example:

TavernAI Cards (in Ali:Chat style):

Download (v5): Pure Ali:Chat (Detailed)

https://drive.google.com/file/d/1wuOtoAhfRonYIz88y6lh_PStnZ0uDFgX

https://drive.google.com/file/d/1M5MW4cGE93PATsOt47UHm2jY_V_gX0Fu

Download (v4): Pure Ali:Chat (Simple)

https://drive.google.com/file/d/1z8Zoj4xXeAvYOXeI_70Vc1rbYeIViWe9

https://drive.google.com/file/d/1qqROh1AXqTFMyX4Epz6BADrS5YzKfuLx

Download (v4): Ali:Chat + Boostyle (Simple)

https://drive.google.com/file/d/1jiGzM6V1rnQ9dRGyBHP0GLJofPWvWX3o

https://drive.google.com/file/d/1GpnBhYPNjGKDqRZbULRdYfnY0aqyfAPq

v4: “Harry Potter” changed to “Harry”. First name is less confusing for TavernAI w/ v8. Also removed extra <START> and moved the scenario back into “Description” instead of “First Message”.

v5: More detailed version of pure Ali:Chat.

Dungeon Master in Ali:Chat format. This is a quick proof of concept, feel free to modify it accordingly.

Update the scenario, enter in an action/dialogue and the Dungeon Master will explain what happens next.

Download (v2): https://drive.google.com/file/d/1qYMs0ZC-ACcKDFyUwxXpSBoyRch1_fYF

v2: Removed a stray <START> in Example Dialogues. Updated “First Message” to include “Scenario:”

Oobabooga

  • Red: “Character’s Persona:” followed by the character description.
  • Green: <START> then dialogues. Rotate between “You:” & “Bot:”. End on “You:”
  • Blue (optional): Scenario/Author’s note [in brackets]
  • Pink: Hidden Scenario. Add “You:” between examples. End on “You:”

Another “You:” example should be added to the very bottom to stop potential looping.
Will fix it later.

KoboldAI Lite

  • Red: Description/Personality/Example dialogues
  • Green: Hidden scenario dialogue
  • Blue (optional): Scenario/Author’s note [in brackets]
  • Pink: First message (Send a message, click “Edit”, delete everything and input your First Message)

Outdated! Please follow Ooba’s example, except for the Author’s Note.

Click the Gear Icon  Then click “Edit” ->

Edit to your First Message. Make sure it starts with “Character:”


Advanced Tips (Currently untested 2/25)

  • Create a pattern with <START> [ ] and dialogue.
  • Basically, every dialogue entry you would like relevant tags for it.
  • There are many things you can do with this style. For example, a “Murder Mystery”. Basically, if someone’s response somewhat overlaps with one of the dialogue examples, it pulls that information over. You could use this to chain a mystery together.

<START>

[ Location: Madam Puddifoot's Tea Shop; Tags: cafe, Harry, Hogsmeade ]

You: Have you been to Madam Puddifoot's Tea Shop before?

Harry: Yes, unfortunately. It reminded me of Umbridge's office. *mumbles* Stupid teashop.

Scenario Maker

  • Simply make a new character. Name it something neutral like Bot, AI, Generator, Dungeon Master, etc.
  • Keep the entire card empty except for the First message.
  • For the first message you could use pretty much anything encased by square brackets.
  • Example 1: [ Author: Agatha Christie; Genre: Noir, Mystery; Scenario: Death on Diagon Alley & The Secret Affair; Tags: Harry, Ron, Draco, Dumbledore, Snape ]
  • Example 2: [Scenario: Door]
  • Tag Database -> HERE
  • Both of the following are one-shot examples:


World Info

  • Entries in world info are also done in chat format in the perspective of the character. This means they only know what they have knowledge of.
  • Each entry could have multiple example dialogues in it to help drive the responses in a certain way.
  • Be careful to include too many confusing details, as this can hurt accuracy. For example, “Tom is friend’s with Mary’s big brother, Billy.” This will end up with occasionally inaccurate “Tom’s big brother is Billy” responses.
  • Relationships can be their own WI entry. You can use “Selective” and include the one character in the Primary key and the other in the Secondary key.
  • Difficult concepts should have a high Insertion Order and “After chara”. This allows the character a higher chance to have accurate/relevant responses.

Example 1: Using keys to activate locations/scenarios using “[ ]”

Example 2: Using dialogues, including actions and multiple topics for one subject

Useful Links

FAQ

  • Do I need to use the interview format?

Nope! This is completely optional. The basic idea is to provide dialogue examples that express different parts of your character through actions and dialogue. Interview style is a simple way to do this.

  • Can I combine Ali:Chat with other styles, like boostyle?

Yep! You can definitely do this. Either by including boostyle at the top of “Description” or in the “Personality” box.

-        My Character seems to act differently after 20 messages.

This happens when your Chat Context is too large. At the moment, the Character Context is pushed to the TOP of the overall context. This means that it has a weak active influence on the current conversation. If you make the Chat Context smaller, then you push the Character Context closer to your current conversation, which makes it stronger. You can do this by either increasing “Amount generation” (which will also allow the AI to produce longer replies) or decreasing “Context size”.

Also, make sure that you are constantly reinforcing certain traits during your conversation, as this will help maintain those traits.

-        My character card is 1100 tokens, will that cause an issue?

  • Your character’s chat memory is your ”Chat Context”.
  • “Description”, “Personality”, and “Scenario” are permanent tokens. These make up your “Character Context”. These reduce your character’s chat memory.
  • “Examples of Dialogue” box, and “First message” are temporary tokens. These are part of your “Chat Context” and do not reduce your character’s chat memory.
  • Amount generation” are the tokens that get reserved for the AI’s responses. This reduces your character’s chat memory.
  • “User’s chat input also directly reduces your character’s chat memory.

        Example:

  • Context size is 1400. (e.g. Colab’s limit)
  • 800 of these tokens are “Character Context”. This leaves 600 tokens left for everything else.
  • The default “amount generation” is 180, which leaves 420 tokens left for the character’s chat memory + User’s chat input. If your chat input is 50 tokens,your character’s chat memory is 370 tokens.

        Tokens

1400                Context Size

                (800)                Character Context

                (180)                Amount Generation

                420

                (50)                User’s chat input

                370                Character’s chat memory (Chat Context)

-         Should I disable “Pygmalion Formatting” on TavernAI (1.3+)?

Honestly, this still needs testing, but feel free to either @ or DM me your experiences if you use Ali:Chat with the formatting disabled. If you do disable this, please remove all <START> from your character cards, as <START> will break TavernAI.

If Pyg formatting is disabled, 1.3 will do the following:

- {{chars}}'s personality:` is added before "Personality Summary"

- Circumstances and context of the dialogue:` is added before "Scenario"

- This is how {{char}} should talk` is added to the top of "Examples of Dialogue" box

- Then the roleplay chat between {{user}} and {{char}} begins.` is added after to the top of "First Message".

This also does not add `<START>` anywhere to your context.

If any <START> is added, it will change this to a newline. This is NOT ideal, and would recommend not including <START> at all. If you remove all instances of <START> it seems to work fine!

If Pyg formatting is enabled, 1.3 will do the following:

- {{chars}}'s Persona: is added before "Description"

- Personality: is added before "Personality Summary"

- Scenario: is added before "Scenario"

- <START> is added above "Examples of Dialogue" and above "First Message".

(Continued next page)


Appendix

Context Mockup Example #1 (2048 tokens) (based on rough avg. character card size)
(This is purely visual, other layouts would also work)

Context Mockup Example #2 (2048 tokens)

(This is purely visual, other layouts would also work)

Context Mockup Example #3 (1400 tokens)

(This is purely visual, other layouts would also work)