# Performance problems with finetuned model (Llama 2 7B based)

**URL:** <https://discuss.huggingface.co/t/performance-problems-with-finetuned-model-llama-2-7b-based/91020>\
**Category:** Beginners\
**Created:** [June 8, 2024, 8:49am UTC](https://discuss.huggingface.co/t/performance-problems-with-finetuned-model-llama-2-7b-based/91020 "2024-06-08T08:49:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![taoofstefan](https://avatars.discourse-cdn.com/v4/letter/t/5fc32e/32.png) [@taoofstefan](https://discuss.huggingface.co/u/taoofstefan)\
**Post date:** [June 8, 2024, 8:49am UTC](https://discuss.huggingface.co/t/performance-problems-with-finetuned-model-llama-2-7b-based/91020/1 "2024-06-08T08:49:52Z")

</div>

Hello,

I am trying to finetune Llama 2 7B to enhance its function calling abilities. I am not sure what I am doing wrong, but the model is not really converging while training and the performance, hence, isn’t good at all.

I am using [this](https://github.com/taoofstefan/fine-tuning-project/blob/main/finetune-own-data-llama%202%207B-S_test.ipynb) Jupyter Notebook and tried it with and without quantization.

These are the training and eval/test [datasets](https://huggingface.co/datasets/taoofstefan/function_call_weather). I made them, and they are designed to learn the ‘get\_current\_weather’ function.

As my datasets are small, I picked higher values for r and lora\_alpha

`r=256, lora_alpha=512`

Does anyone have any ideas on how to improve the model? Am I doing something wrong?

I am very new to the topic of finetuning LLMs. So, any feedback or help would be very much appreciated.

---

<div class="post-metadata">

**Author:** ![nielsr](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/nielsr/32/39617_2.png) [@nielsr](https://discuss.huggingface.co/u/nielsr)\
**Post date:** [June 10, 2024, 9:24am UTC](https://discuss.huggingface.co/t/performance-problems-with-finetuned-model-llama-2-7b-based/91020/2 "2024-06-10T09:24:20Z")

</div>

Hi,

i’d recommend taking a look at the following resources to fine-tune open-source LLMs:

- Unsloth: [GitHub - unslothai/unsloth: Finetune Llama 3, Mistral, Phi & Gemma LLMs 2-5x faster with 80% less memory](https://github.com/unslothai/unsloth). I see they recommend lower values for lora: [Google Colab](https://colab.research.google.com/drive/135ced7oHytdxu3N2DNe1Z0kqjyYIkDXp?usp=sharing).
- the Alignment handbook (optimized for chat fine-tuning): [alignment-handbook/scripts at main · huggingface/alignment-handbook · GitHub](https://github.com/huggingface/alignment-handbook/tree/main/scripts).

I’d recommend starting with a super tiny dataset and see if the model is able to overfit it.

---

<div class="post-metadata">

**Author:** ![taoofstefan](https://avatars.discourse-cdn.com/v4/letter/t/5fc32e/32.png) [@taoofstefan](https://discuss.huggingface.co/u/taoofstefan)\
**Post date:** [June 10, 2024, 2:46pm UTC](https://discuss.huggingface.co/t/performance-problems-with-finetuned-model-llama-2-7b-based/91020/3 "2024-06-10T14:46:38Z")

</div>

Thanks, I will have a look 🙂

I tried lower values for both before going up. The higher values seemed to work a little better but still not good.

I used a different approach, adding the SFTTrainer to the fine tuning process, which makes things work well.

---

<div class="post-metadata">

**Author:** ![nielsr](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/nielsr/32/39617_2.png) [@nielsr](https://discuss.huggingface.co/u/nielsr)\
**Post date:** [June 10, 2024, 2:58pm UTC](https://discuss.huggingface.co/t/performance-problems-with-finetuned-model-llama-2-7b-based/91020/4 "2024-06-10T14:58:32Z")

</div>

Yes see also my fine-tuning notebook regarding Mistral: [Transformers-Tutorials/Mistral/Supervised\_fine\_tuning\_(SFT)\_of\_an\_LLM\_using\_Hugging\_Face\_tooling.ipynb at master · NielsRogge/Transformers-Tutorials · GitHub](https://github.com/NielsRogge/Transformers-Tutorials/blob/master/Mistral/Supervised_fine_tuning_(SFT)_of_an_LLM_using_Hugging_Face_tooling.ipynb)
