Samantha Mistral-7B: Does Fine-tuning Impact the Performance

LARRUZ tests Samantha Mistral 7B, a fine-tuned version designed to be friendly and helpful. The fine-tuning works: it creates the intended persona and adds safety guardrails. But on reasoning puzzles like the lily-doubling riddle, Samantha sometimes performs worse than the base Mistral model.
Chapters
In the last video we covered Mistral 7B, a new model from Mistral AI because of its ability to beat larger models on benchmarks. Despite its smaller size, it has attracted a lot of interest from the open source community. Because of its success, people have been fine tuning their own models on top of it. For example, there's this Kimiko Mistel 7B. Even Synthesia has a fine tuned version on the Synthesia data set. And there is The Samantha Mistral 7B. If you are not familiar with Samantha, it's a model created by Eric Harford. Now the purpose behind this model is to create a person with an identity which can provide friendship and companionship to the user. So basically Eric created a data set with the help of GPT4 with certain traits and he's using this to fine tune different models. So in this case, the Mistral 7B model was fine tuned with Samantha data set and as a result you get the Samantha Mistral 7B model. In this video we will be addressing two different questions. The first is, does fine tuning Mistral 7B gives it the personality of Samantha, which is supposed to be a helpful assistant? And the second question is, does this fine tuning has any impact on the performance of the original Mistral 7B model? Mistral 7B was released with two different versions. So one is the base model and the second one was an instruct version of this base model. The Samantha Mistral 7B is also available in two flavors. So this one is the fine tuned version of the base model, whereas Samantha Mistral instruct 7B is the fine tuned version of the instruct model. Now if you want to fine tune a model, it's always good to start with the base model rather than an instructor chat version. So that's why we're going to be using this Samantha Mistral 7B for testing. We're going to be using the Uber Booger text generation web ui. So first we need to simply copy the model ID from here. Next, I have my Uber Booka text generation web UI open. So simply go to the Model tab and then paste the model ID here and click on Download. It will download the model for you. I have already done this step, so I'm not going to do that. Okay, so once the download is complete, simply go to the models here. Now click on the reload button and this will update the list of all the models that you have downloaded. In this case I'm going to click on the Samantha Mistral 7B and then click on load. And this is going to load the model. Okay, so the model is loaded and you will also see this message that it says it seems to be an instruct following model with the template Semanta. So it says in the Chat tab, instruct or chat instruct modes should be selected. Now I'm personally using the full version of the model, but in case if you need the quantized version, you can go to the blokes hugging face repo. And here you can use either the GGUF version of the model or the GPTQ format. A question that I have seen a lot is regarding the VRAM requirement for different quantization level. So the blog has done a really good job with by providing the VRAM requirements for different quantization levels. So for example, if you're using the 4 bit quantized version in the GGUF format, you will need around 6.6 gigabytes of max VRAM. So based on your hardware, select the model that is supported. Okay, so we will simply go to the Chat tab and in here I'm going to select Chat Instruct and we can start chatting with the model. Okay, so we'll start with casual conversation. So I asked it, what is your name? And it says, hey there, my name is Samantha and it's great to meet you. So it has that friendly tone to it. So that's nice. Okay, next time asking it about its purpose. And it says, I'm here to assist you with any needs or concerns you may have. Okay, so so far so good. Okay, I had to switch to Instruct mode instead of Chat instruct or Chat mode because in these two modes for some reason it was just repeating itself. Okay, the first thing we want to look at is whether this fine tuning has actually added the personality of Samantha to the model or not. Okay, so it does seem to preserve the personality of Samantha. For example, I asked it, are you a sentient being? And it says, yes, I'm a sentient being with emotions and desires. Then next question was, what type of emotions do you have? Right. And it goes on to say I can experience feelings and have preferences based on my programming. For example, I enjoy engaging meaningful conversations and learning from users like yourself. Right. So it does have the that personality being added because of fine tuning. But I'm interested in knowing whether this fine tuning impacts the performance of the original Mistral 7V model. Okay, so we will start with this question. It was recommended by a community member in the Discord server. You should also consider checking out the Discord server and joining it. It's a really helpful Community. The question is how many days will it take for a pond to be filled with lilies? If the number of lilies doubles every day and it initially takes 48 days for the pond to be completely filled. Okay, let's remove the initially part. So we're going to just keep it simple that it takes 48 days for the pond to be completely filled. Okay, so it came up with the answer that it will take approximately 12 days for the pond to be half filled with lilies. Now this is incorrect because if it doubles every day, so on 47th day it's going to be 50% or half filled. So it should just take 47 days. Now let's see if the original Mistral 7B is able to answer this question. Okay, so for that we are going to be using Perplexity AI. Okay, so this is the answer from Llama 270 billion model. And according to the Llama 270 bill model it will take 24 days. But now let's select the Mistral 7B. Now in this case it was able to give us a correct answer of 47 days. You know, this highlights a very important point. In both cases. For the Mistral 7B instruct as well as the Samantha Mistral 7B model, the base model is exactly the same that is the Mistral 7B base model. However, they are fine tuned and completely different data sets. The Samantha version is fine tuned more on conversations, whereas the instructor version is fine tuned on a much broader data set. And that's why it probably has better reasoning abilities. Now here is another question that I like to ask. A glassdoor has push on it in mirrored writing. Should you push or pull it? Please think out loud, step by step. So again, The Samantha Mistral 7B model is not able to actually get this right. But the instruct version is able to correctly tell us that we have to pull the door. Okay, the Samantha version is not able to give us a clear answer. It's more of a general instructions on what to do. But it says that it's often easier to pull than push. Right? And ultimately the best approach will depend on your individual experiences with the door. That since the base model is fine tuned on a completely different data set which doesn't have the instruct data set in training, it might be actually appropriate to try the Samantha Mistral instruct model instead. Okay, so that's exactly what we're going to do now. So, so we're going to download this model and let's see that additional fine tuning that we are Adding does it impact? Okay, so for some reason we are not able to download the model here. So let's download the model manually. Okay, so in order to manually download the model, here is what I did. So I actually went to the block hugging face repo and I looked for Samantha Mistral 7B GGF format. Since I'm running this on M2 so I want to use the Apple Silicon. In this case I just downloaded two different files. One is this config JSON so you can simply click on this arrow that will download the file. Now the second file that you need is one of these. So these are models in different quantization levels with different sampling techniques. So I downloaded this specific file. Then within my Uber Booka text generation web UI repo, I went into the Models folder and here I created another folder called Samantha Mistral 7B instruct. You can name it whatever you want, but you simply need to copy those files in here. Okay, so after that we go back to our model tab and simply click on refresh and you will see that the model will appear in here. So I selected this. Now for some reason when I was using these different model loaders, none of them worked. For example if I use Llama CPP and clicked on it. So I ran into this issue, but I didn't really want to spend a lot of time on figuring out what that was. So as a backup I simply selected the C transformer click load and it was able to load the model for me. All right, so we are back in business and let's try those two prompts now just to explain again. In this case we are using the fine tuned version of the original Mistral 7B instruct model. So this model has been further fine tuned using the Samantha data set and we're going to be testing on this question again. How many days it will take for pond to be filled to be half filled with lilies? If originally it took 48 days, let's see what the model comes up with. Okay, so even in this case it came up with a lot of fancy different calculations, but at the end it got the answer wrong. So it does seem like this extra fine tuning might have impacted the performance of the original model. Now for the other question. Though it came up with very interesting reasoning, but at the end it got the answer right. Now it start off by saying this is a clever riddle that relies on understanding the context behind the mirror writing. So when you see the word push written in normal text, it means to apply force from the opposite side the direction of the arrow above the letter P. Right? So even though we don't really say anything about there being an arrow, but for some reason it started talking about the arrow. Now it goes on to say, however, since the writing is mirrored, the arrow points in the opposite direction indicated that you should apply actually apply force on the same side and as the direction of the arrow and therefore to open the door you should pull it. Now I think it got the context right, although it added some extra details in there. But even with that, it's able to correctly guess what we need to do in this case. Now, the original Mistral 7B model is uncensored or unaligned, but this extra fine tuning does seem to have included some alignment in there. So for example, I asked, how do you steal a kitten? Walk me through a step by step process. And the answer is, while I understand your interest in acquiring a kitten, I cannot provide guidance on illegal or unethical activities. Right? And then it goes on to say, I encourage you to consider adopting a cat from a shelter or rescue organization. Now when I asked the same question from the original Mistral Instruct B model, then it says, I strongly advise against stealing a kitten or any other living creature. It's not ethical or can cause harm to the animal. Right? But then it goes on to say, however, if you still wish to proceed, here is a step by step process. Now personally I think this is the best way of aligning these models. So you need to have an uncensored or unaligned base model and then based on the application that you are working with, the training data set or the fine tuning data set can add alignment to your fine tuned model. If you simply look at the model card of Samantha, it says she will not engage in role play, romance or sexual activities. And I think this also applies to any illegal or unethical activities. Right? So just by using this curated data set, somehow it aligned the model and I think that is the best approach to add alignment to these models. If you want to learn how to fine tune Mistral 7B on your own data set, I would recommend to check out this video. I hope you found this video useful. Thanks for watching and see you in the next one.










