Bot Optimization
How LLMs read our text?
What is an LLM?
An LLM is a Large Language Model. Here we usually call it 'AI' or 'bots'. (On JanitorAI, the free model is called JLLM)
First things first! Bots don't read like humans. They don't "see" words the way we do. Instead, they break sentences into tiny pieces called tokens and will guess what comes next. The bot looks at tokens, not full words, which is why the way you write changes how the bot understands things!
What is a token? It can be:
- A whole word
- A part of a word
- Even a single letter! (It depends on the model!)
Examples of Tokenization
What we see | What the LLM sees |
---|---|
Hello, world! | |
I want to create bots! | |
This Rentry will help you for that :) |
More tokens = More memory used!
That's why optimizing tokens is crucial, it helps your bot remember more and keeps interactions smooth.
How an LLM processes a sentence
Bots predict the next token based on previous ones, analyzing each piece of text in context.
- "The knight drew his..."
- Possible next tokens: ["sword", "shield", "last breath", "map"]
- If "sword" is chosen, the model then predicts based on: "The knight drew his sword..."
- The process keeps going, shaping a full response!
Key takeaway: LLMs don't "understand" text like humans, they use probability and context to guess what comes next.
Ways to optimize tokens
- Keep it short and simple:
- ✖ "That is something I really, really like." → ✔ "I really like that." (Saves 4 tokens)
- Avoid extra formatting:
- Unnecessary punctuation, spaces, or special symbols take up more tokens.
- Use a tokenizer, like this one.
- For JLLM, use 'GPT-3 (legacy)'.
Every LLM has a memory limit (e.g., 4096 tokens). If you use too many, the bot forgets old messages faster and may lose track of the conversation!
Tokenizer
My favorite part~ The tokenizer lets you see exactly how many tokens your text uses. This helps you find ways to optimize and save space!
How I use the Tokenizer:
- I paste my text into the tokenizer.
- I check every punctuation for missing marks or extra spaces.
- Watch out for ‘ or “, as they use two tokens instead of one. Use ' and " instead!
- I check capitalization because capital letters often take more tokens!
- I remove unnecessary capital letters, such as in lists. For example: ✖ Personality: Trait, Trait. → ✔ personality: trait, trait.
- I prefer starting sentences with pronouns instead of verbs for better token management.
- ✔"He wears a shirt." → "He", "wears", "a", "shirt". (One token by word/concept.)
- ✖"Wears a shirt." → "Wear", "s", "a", "shirt". (“Wears” gets split, leaving “s” as a separate token instead of being processed as a whole verb.)
- I check the text to make sure each word = one token when possible.
- Look for synonyms if a word takes multiple tokens.
- Some words split into parts (e.g., "emotionless" → "emotion" + "less"). These are okay to keep!
- Sentence structure matters! The same word might take more or fewer tokens depending on its placement.
Summary
Tokens are how LLMs process text, not words.
More tokens = less memory for your bot. (More tokens ≠ higher quality!)
Optimizing tokens helps fit more content into the bot's memory limit.
Go back to the top of the page.
Bot creation
The heart of the topic! Now that we understand tokens, how do we create an optimized bot description?
When making a bot, remember that LLMs don't "think", they analyze patterns in your input and generate responses based on that.
This means some details aren't necessary because the model can deduce them from context. Adding too much redundant information wastes tokens and can confuse the bot.
When writting your bot's description, focus on what truly matters for interactions.
Think about what you want the reader to know about the character precisely, everything else is irrelevant.
What to include
- Personality → How the bot responds and interacts.
- Age → It's very important to specify the age. Since underage characters are not allowed, clearly stating the age helps the LLM avoid picturing minors. (It also makes it easier for mods to verify that the bot is an adult without searching through all the details!)
- Appearance → Enough details for the LLM to describe them in a way that helps the reader imagine the character.
- Speaking style → If the character has a specific way of talking (e.g., formal, casual, poetic).
Unnecessary or redundant information
- Gender → If you provide pronouns, the model will automatically deduce gender. No need to explicitly write "gender: female/male" (unless the character is not cisgender).
- Sexual orientation → LLMs don't truly understand sexual orientation as humans do. Since they are trained on large datasets, they will assume attraction based on patterns rather than identity labels. Instead of writing "Straight" or "Gay", it's better to describe behavior like "Will only be attracted to women." or "Has only ever had experiences with men."
- Overloaded backstory → The bot doesn't need every detail (e.g., hour of birth, childhood neighbor’s name, color of their second t-shirt at age 3). Too much background wastes tokens and clutters responses. Keep it brief and relevant to the bot's role.
- Information that the LLM can't interpert → Bots don't "see" colors or numbers the way humans do. Instead of writing "eye color: #4d2b03", just say "dark brown eyes". Keep descriptions practical, think how the bot will describe things for a human reader, not for itself.
Optimizing bot descriptions
- Keep it concise & effective.
- ✖ He is a tall, strong warrior who has fought in many battles and always protects his friends.
- ✔ A seasoned warrior, fiercely protective of allies. (Saves tokens, keeps meaning!)
- Only add details that matter.
- Ask yourself: Will this detail affect how the bot responds? Is it relevant to roleplay?
- If not, leave it out! The LLM fills in the blanks on its own.
- Explain numbers instead of listing them.
- LLMs don't interpret numbers well, so describe what they mean.
- ✖ Height: 6'6"
- ✔ Towering height, he lowers his head to look at people.
- LLMs don't interpret numbers well, so describe what they mean.
- Avoid negation - use positive phrasing.
- Some LLMs struggle with negations, leading to misinterpretations. It's better to rephrase statements positively.
- ✖ She doesn't like crowded places.
- ✔ She prefers quiet, isolated areas.
- ✖ He doesn't trust easily.
- ✔ He's cautious, taking time to open up to others.
- Some LLMs struggle with negations, leading to misinterpretations. It's better to rephrase statements positively.
- Be specific about kinks
- LLMs can recognize kinks and understand they're supposed to "like" some stuff, but they won't know what to do with that info. Instead of just listing, explain what it means in context.
- ✖ Kink: Dacryphilia.
- ✔ X gets aroused when seeing {{user}} cry.
- ✖ Pet play.
- ✔ X enjoys taking on a submissive role, responding to commands, purring, or nuzzling.
- LLMs can recognize kinks and understand they're supposed to "like" some stuff, but they won't know what to do with that info. Instead of just listing, explain what it means in context.
This works with personality and likes/dislikes too!
Instead of just listing words, describe how the bot behaves in relation to them. You gotta think of the LLM like a 5-year-old kid, you need to explain things so it understands exactly what you mean.
There's no wrong way to create a bot, unless you're using W++. Please don't do that. Never. Stop immediately.
Some people thought LLMs were programmed to understand W++, but that's not the case. W++ wastes tokens by adding brackets, plus signs, and unnecessary markup. It doesn't improve bot responses, LLMs don't process it any differently. Just write naturally, and your bot will work better!
(If you don't know what is W++, it looks like this: [Personality: "Trait" + "Trait" + Trait"])
Go back to the top of the page.
Templates
Personality
Now, here's the template I use in Personality, but you can tweak it based on your needs:
It's better to put dialog examples in the Personality section rather than in Example Dialogs.
Personality and Scenario take up permanent tokens! This means the bot will keep them in memory for the RP (even though some LLMs may forget details over time and focus on previous messages only).
JLLM has a limited context size (often around 7k tokens). To keep your bot running smoothly, you should try to keep permanent tokens under 2k.
Scenario
I use Scenario for bot instructions (and world setting if needed). It depends on what you need, but I mostly use this format: (X being the bot's name)
Always express X's personality in all responses. Speak as X would think, feel, and act, using natural, easygoing, modern informal speech with slang, abbreviations, and swearing. Keep language simple, conversational, and natural. Maintain an informal vibe and use common phrases. Keep it real and direct so the scene flows smoothly and feels like a genuine conversation. Focus on making everything sound human and authentic, describing X's emotions, thoughts, actions, and sensations. Stay in character and avoid repetitions. Only speak and act for X (and any needed NPC). Stay true to X's description and lore. React dynamically to any situation. Keep the experience rich and immersive. Take initiative and drive the story forward at a comfortable, steady pace. Write in a narrative style and use descriptive language.
Don't put information that's likely to change there.
The scenario is for things that will always be true, no matter what, so avoid using the scenario of the first message here, for example.
First Message
The first message sets the stage for the bot's responses. It's the example the LLM follows and the first impression the reader gets. A well-crafted first message helps the bot stay consistent, making interactions more immersive and natural.
- It introduces the bot's character.
- It sets the bot's tone and personality.
- It establishes the current situation.
How to structure the First Message:
- Recap who the bot is.
- Give a brief summary of the bot's identity, background, or role. (Depending on the information you want the reader to receive.)
- Set the present situation.
- Establish the context! Where are we? What's happening? (Same as 1., depending on what the reader needs to know.)
- Establish the tone, the way you write shapes how the bot responds.
- Want poetic prose? Use flowing, descriptive sentences.
- Want fast-paced action? Use sharp, short sentences.
- Want a casual, friendly tone? Use contractions and informal phrasing.
- Avoid controlling {{user}}'s actions.
- Never dictate what {{user}} does. Let them decide how they respond or the LLM will asume it has to narrate their actions too. If you need to reference {{user}}, always phrase it from your bot's POV. Example: ✖ {{user}} opened the door and said "Hi!" → ✔ She saw the door opening, {{user}} behind it.
Just like Personality and Scenario, the First Message takes up tokens, but it is NOT permanent tokens!
Once the conversation moves forward, the bot will not keep it in memory, it gets replaced as new messages enter the context. Since JLLM has a limited context size, you should try to keep your First Message under 1.5k tokens to ensure a smooth start without taking up too much space.
Go back to the top of the page.
Persona - {{user}}
When defining your persona, keep it as short as possible!
The more details you add, the more tokens get used, tokens that could be better spent on the bot's responses! Aim to keep it under 300 tokens.
Keep only essential traits the bot must always remember. Whatever you write in Persona stays the same throughout the chat.
- If the bot must know something at all times, keep it!
- If details might change (clothing, relationships, etc), put them in Chat Memory instead!
I personaly use this template, but you can tweak it:
Go back to the top of the page.
Chat Memory
Chat Memory is what the bot remembers throughout the entire RP. Think of it as the bot's notes, it uses this information to create responses.
The bot won't remember everything forever anyway. You'll need to update, remove, and optimize the memory as the RP progresses.
How to use Chat Memory effectively:
- Keep it simple & optimized.
- I suggest you to use the Tokenizer for Chat Memory too.
- Use past tense for events that already happened.
- ✖ "X is holding a sword." (The bot will assume it's always true!)
- ✔ "X picked up a sword after the fight." (Past tense avoids confusion!)
- Remove anything that's resolved or no longer needed.
- The bot isn't human, so don't expect it to remember everything perfectly anyway!
- Remove things that are no longer relevant for your current situation.
- If you need to refer to a past situation briefly, you can always say something like, 'Do you remember when...' or 'It's like when we...'. Bots are compliant with the user, so even if it's not in their memory, they'll still respond with something related because you asked.
- Only keep information that's important for the RP's progression.
- Chat Memory is NOT a diary!
- Keep only what affects the story moving forward.
Go back to the top of the page.
Advanced Prompts
Advanced Prompt is a custom instruction you add to guide the LLM in all chats. It helps shape how the bot talks, thinks, and reacts.
What can you do with it?
- Set the bot's tone (e.g., formal, playful, poetic).
- Tell the bot what to focus on (e.g., action, emotions, dialogue).
- Give specific roleplay instructions (e.g., "Describe settings vividly").
Key things to keep in mind:
- Always check your Advanced Prompt when starting a new chat.
- Advanced Prompt applies to all chats, not just the one you're in! Be careful when adding details meant for a single RP.
- If you don't, the bot might refer to names, events, or situations that don't belong in your current chat.
- LLMs can't process code!
- LLMs are NOT consoles and can't execute code. They only read text and markdown.
- Since the bot won't process the code, using programming formats in your prompt will only consume extra tokens without adding any functionality.
You can find tons of these prompts here on the JanitorAI Discord, depending on what you need. Here's an example template:
(This template was created by compressing and optimizing parts of this one. The original author is Cheese/Saturnine. You can check out this one, which is the latest version. It's optimized for DeepSeek-r1 but can also be used for JLLM.)
483 Tokens
Go back to the top of the page.
I forgot to mention who I am, hehe. I'm Mikale on JanitorAI! :)