Fine Tuning of LLM’S in GCP VERTEX AI

Karthik Kumar G
5 min readDec 11, 2023

--

In this article lets delve into fine tuning of LLM’S why it is required, how to fine tune it and the results we can achieve through fine tuning.

Fine tuning in context of Large Language Models is when we take an existing trained model and we continue the training process on a new data set that is smaller and more domain specific than the original data set that the model is trained on to achieve specific use case results.

Let’s get started !!!

In this article, I will guide you through the process of fine-tuning the Text-Bison@001 base model using a small dataset within Google Cloud Platform’s Vertex AI.

SETUP

When you start with the Google Cloud Platform console, simply navigate to the Vertex AI section. Within this area, look for the ‘Language’ category, and there you’ll find the option to ‘Tune a Model’. This straightforward path leads you directly to the model tuning process.

When you click on ‘Tune a Model’, the first step is to select ‘Supervised Learning’ (SFT) for your model tuning process. The RLHF is still under beta and requires a different format of data to be fine-tuned with. You will then find a few options to set up your model. Start by giving your model a name, followed by choosing the base model you want to use. Next, select the region where you’ll run your operation, and finally, pick a Google Cloud Platform bucket for storing your data. These steps are designed to be straightforward, allowing you to customize the model tuning to meet your specific needs.

In the model tuning setup, you’ll encounter an array of options that let you fine-tune your model with precision. These include setting the number of training steps, adjusting the learning rate multiplier to optimize performance, selecting the type of accelerator to speed up the process, and choosing a tensor board for advanced analytics.

#Note: you can tweak with the parameters according to your dataset

Additionally, you can specify a service account for enhanced access management. Each of these settings plays a vital role in tailoring the model to your exact specifications, ensuring a more effective and efficient tuning process.

Moving on to the next phase in model tuning, you’ll step into the crucial task of dataset ingestion. Here, the focus is on a JSONL dataset, structured in a format that’s compatible with Vertex AI. You will need to upload this dataset to a Google Cloud Platform bucket. During this process, providing the precise path to the bucket is essential, as it guides the system to the right location for accessing and utilising your dataset. This step is key in ensuring your model is trained with the right data, paving the way for a more accurate and effective tuning outcome.

The subsequent step in the process is the evaluation of your model, a phase that, while optional but can be incredibly insightful when used, it involves specifying a path to a Google Cloud Storage (GCS) bucket. This designated bucket is where the model’s performance values and metrics will be stored during the evaluation. Opting for this step offers a deeper understanding of your model’s effectiveness, providing valuable insights that can guide further fine-tuning or deployment decisions.

Once you initiate the tuning process, the pipeline execution begins its journey. This is a crucial phase where your settings and parameters are put into action. As this process reaches its conclusion, you can easily check the outcome. Look for the ‘Pipeline Run Status’ — a clear indicator of your venture’s success. When it displays ‘Succeeded’, it’s a sign that your model has been finely tuned and is ready for the next steps.

In the pipeline section, a world of detailed insights awaits you. Here, you can delve into the intricacies of your model’s tuning process. It lays out the number of steps involved in a clear, sequential flow chart, providing a visual journey of the entire operation. Additionally, this section reveals the duration of each step, offering a glimpse into the time efficiency of the process. Moreover, it indicates where the model is hosted, giving you a comprehensive overview of the entire tuning landscape.

With the tuning process now complete, you’re ready to transition to the next exciting phase: testing. In the testing section of the tuning interface, you can interact directly with your model by entering prompts. This hands-on experience is not only engaging but also crucial for assessing the model’s efficiency and practical application. It’s a moment where you can witness firsthand the effectiveness of your tuning efforts and envision the real-world impact of your refined model.

Thank you for joining me on this comprehensive journey through the process of fine-tuning a model in Google Cloud Platform’s Vertex AI. This marks just the beginning of our exploration into the vast potential of AI model customization. In my next post, I’ll guide you through the creation of a dataset specifically designed for fine-tuning in Vertex AI. Meanwhile, I encourage you to experiment with fine-tuning on your own in Vertex AI. It’s a rewarding experience that offers invaluable insights into the world of machine learning and AI.

--

--