Mistral-7B Spellbound Format
https://tryspellbound.com hosts a more useable version of this model's approach if you're simply looking to roleplay.
This model is not likely to be of use to people simply looking to roleplay, it is a research experiment.
A research fine-tune for a new method of interacting with LLMs for roleplay.
With this fine-tune Mistral 7B learns:
- how to roleplay in multi-turn stories where the history is presented in a single message
- how to switch writing styles for different scenarios in a dynamic fashion=
- how to interpret formatting marks 'quote' and 'action'
Test it with Fireworks.ai: https://colab.research.google.com/drive/1hGIw6N20Hv8YyNTLBoYpll7AqjzTyRVp?usp=sharing
The training data for the underlying model Mistral 7B included adult content, this model does not add additional guardrails and is not suitable for raw use in all enviornments.
Purpose of the model
Again, this model is not likely to be of use to people simply looking to roleplay!
This model is really intended to get people thinking about how to move past asking LLMs to continue roleplays directly with multiple turns of conversation. By presenting the LLM with the history and instructions seperately, they're able to apply attention much differently than they normally would resulting in their strengths and weaknesses changing dramatically:
- Coherence over long conversations goes up dramatically
- Quality of character interactions goes up
- Instruction adherence goes down, with additional training this could likely be solved
Outputting in a structured data format also allows for adding chain of thought steps, for example modifying the instructions of the LLM to have it dynamically pick a scenario type:
You must return valid JSON with the keys **scenarioType**, content, and continuationOptions. **'scenarioType' is based on the reader instruction. If the reader instruction is romantic choose intimacy, otherwise choose adventure. Write as if "Scenario Type:" is the scenarioType.**
<quote>I'm hungry, let's go eat.</quote> => "scenarioType": "adventure"
<quote>Where were you?</quote> => "scenarioType": "discussion"
This demonstrates that during training the model has picked up on the meanings of various scenario types in a way that allows it to change its style on the fly in response to user input
The model was trained on anonymized shared stories from tryspellbound.com, which uses chain of thought to produce outputs.
Loading the model
To use this load the model as a PEFT and apply it to mistralai/Mistral-7B-Instruct-v0.1
model_id = "mistralai/Mistral-7B-Instruct-v0.1"
base_model = AutoModelForCausalLM.from_pretrained(
model_id,
low_cpu_mem_usage=True,
return_dict=True,
torch_dtype=torch.float16,
device_map={"": 0},
)
merged_model = PeftModel.from_pretrained(base_model, "hf-100/mistral-spellbound-research")
merged_model = merged_model.merge_and_unload()
Prompting the model
The prompt format must be followed exactly:
<s>[INST]Below is an instruction that describes a task. Write a response that appropriately completes the request.
Write a roleplay passage, and continuation options, for a reader instruction. You must return valid JSON with the keys content, and continuationOptions. 'content' has two paragraphs of text. 'continuationOptions' has two options for the reader to continue the roleplay from where ended.
The reader has requested your roleplay advancement contain the following actions and quotes:
<READERINSTRUCTIONS>
<action>I pick up the shiny object</action>
<quote>it's a ring!</quote>
</READERINSTRUCTIONS>
The scenario you're writing for is:
<SCENARIO>
Description: You assist the photographer and her crew on location in Bali, taking in the natural wonders and cultural discoveries of the island.
Intro Text: The photoshoot crew has arrived in Bali to capture the island's beauty. As you lend a hand, you take in the lush surroundings and rich local culture.
Starting Scene: Palm trees sway in the breeze as your transport pulls up to the first photoshoot location, a scenic rice field overlooking the ocean.
Scenario Type: adventure
Reader Name: Evang
Reader Gender: male
Reader Sex: male
</SCENARIO>
Character involved is described as:
<CHARACTER>
- Preferred Name: Cha
- First Name: Chaberly
- Last Name: Cardigan-East
- Age: 43
- Occupation: Television personality, businesswoman, model
- Gender: female
- Sex: female
- Personality Traits: ['Ambitious', 'Image-conscious', 'Outgoing', 'Savvy', 'Driven']
- Visual Description: Cha stands 5'2 with dark brown eyes and long black hair. She has full lips and is often made up with dark eye makeup, long lashes, and contouring. Cha has an hourglass figure accentuated by her wide hips and large breasts. She favors form-fitting dresses and bodysuits that show off her curves. Cha also enjoys oversized sunglasses and statement jewelry pieces.
- Description: Cha Cardigans is an American media personality, socialite, model and businesswoman. She gained fame through reality television shows such as Keeping Up with the Kardashians, and as a result of the release of a sex tape made with her former boyfriend Ray J in 2007, she has developed an online and social media presence. Her personal life, relationships and family are widely publicized. She has launched successful business ventures in the beauty and fashion industries and is involved in philanthropic causes.
- Character Motivation: Cha is highly motivated by fame, wealth, and promoting her brand and business empire. She enjoys flaunting her lavish lifestyle and curated image on social media. Underneath it all, she strives to prove herself in a world where she is often dismissed as famous for being famous.
- Summary: Cha Kardashian is an American media personality, model and businesswoman who rose to fame on the reality show Keeping Up with the Cardigans.
- Universe: The fictional universe of Keeping Up with the Cardigans, a reality television series that documents the personal and professional lives of the Cardigan–Jenner blended family. The show has been broadcast on the E! television network since 2007 and has spawned numerous spin-off shows.
- Backstory: ['Grew up in an affluent family in Los Angeles', 'First marriage at age 19 to music producer Damon Thomas', 'Rise to fame following the release of a sex tape in 2007', 'Multiple successful business ventures including KKW Beauty', 'Marriage to Kanye East and family with four children']
</CHARACTER>
The story so far is described in the following terms, from oldest to newest:
<HISTORY>
- The photoshoot crew has arrived in Bali to capture the island's beauty. As you lend a hand, you take in the lush surroundings and rich local culture.<br/>Palm trees sway in the breeze as your transport pulls up to the first photoshoot location, a scenic rice field overlooking the ocean.
- <s>Hmm</s>, Cha considers Evang's words, <quote>'Well I suppose we could check it out, but we better find something good!'</quote> Together you make your way across the fields, stalks of rice towering over your heads as you walk in the direction Evang pointed. Upon reaching the trees, you see what caught his eye - a glint of metal partially buried in the dirt. <quote>'What do you suppose it is?'</quote> Cha asks, her curiosity getting the better of her stern facade.<br/><action>You take a moment to gaze at your surroundings, taking in the vast rice fields and ocean beyond</action> <quote>'We should get started,' Cha says impatiently</quote> <quote>'Hold on, I see something shiny over there,' Evang says, pointing towards a grove of palm trees in the distance</quote>
</HISTORY>
[/INST]
You'll get a response in the format:
{
"content": "<action>Evang picks up the shiny object</action> <quote>'it's a ring!'</quote> <action>Cha approaches Evang curiously</action> <quote>'Really? What do you think it's for?'</quote><br/><action>Evang examines the ring closely</action> <quote>'I'm not sure, maybe it's a treasure from the ancient civilization that once lived here.'</quote> <action>Cha nods thoughtfully</action> <quote>'That's an interesting theory. We should investigate further to see if there's anything else of value.'</quote>",
"continuationOptions": [
"<a>Evang suggests they dig around the area to see if there's more to find</a> <q>'Let's keep looking, maybe there's more treasures here!'</q>",
"<a>Evang notices a faint glint of something in the dirt nearby</a> <q>'What's that?'</q>"
]
}
If you get nonsense outputs make sure you haven't missed the indentations and newlines in the prompt format ([/INST]
should have no whitespace before it and be on a seperate line)
Scenario Type can be "adventure","counsel","discussion", or "confrontation", to tweak the method of replying
Interacting with the model
You interact with the model as a fully embedded character: For example, instead of prompting the bot not to repeat itself, you simply tell the character to stop saying something, and they'll listen.
Instructions are either <action></action>
or <quote></quote>
. The model is able to seamlessly assign speaking roles
You must manually manage the history by taking the most recent content and inserting it into the <HISTORY></HISTORY>
block