Fine-Tuning Fundamentals - Generative AI For Beginners (v2)
Tags: azure, beginners, ai, thisweekinai
Published: 2024-03-01 10:43:41

---
title: Fine-Tuning Fundamentals - Generative AI For Beginners (v2)
published: true
description: Want to understand the concepts and workflow for #FineTuning your language models? Explore the https://aka.ms/genai-beginners open-source curriculum & skill yourself up with lessons and hands-on exercises.
tags: azure, beginners, ai, thisweekinai
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8wk4tq0nudy2hls4i301.png
series: This Week In AI News
---

**3 Resources to Jumpstart Your Generative AI Journey:**

1. [Generative AI for Beginners Curriculum](https://aka.ms/genai-beginners) 
1. [Build Generative AI Apps Code-First With Azure AI](https://aka.ms/ai-studio/collection)
1. [Responsible AI Resources For Developers](https://aka.ms/rai-hub/collection) 

---

Welcome to the seventh post in my [This Week in AI News](https://dev.to/nitya/series/25819) series! Today, I want to continue my post on [Generative AI For Beginners](https://aka.ms/genai-beginners) and move on from prompt engineering to the related topic of fine tuning. Let's dive in!


---

## Generative AI For Beginners (v2)

In the previous post, I covered the v1 edition of this open-source curriculum (chapters 1-12) released in Oct 2023 - with specific focus on "Prompt Engineering Fundamentals", the chapter I contributed.

{% link https://dev.to/azure/prompt-engineering-fundamentals-generative-ai-for-beginners-v1-1kii %}

In today's post, I'll dive into the v2 extension to the curriculum that was just released in Feb 2024 (chapters 13-18) - and focus in more detail on the "Fine Tuning" chapter I contributed. But first, let's take a look at what's new in v2:

![GenAI For Beginners v2](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k3zuv0p4d65njpchs97s.png)

| Lesson | Description |
|:---|:---|
| [Securing Generative AI](https://github.com/microsoft/generative-ai-for-beginners/tree/main/13-securing-ai-applications) | Covers the adversarial threat landscape for AI and looks at options for security testing, data protection, and safety evaluation (including _red teaming_)|
| [Generative AI App Lifecycle](https://github.com/microsoft/generative-ai-for-beginners/tree/main/14-the-generative-ai-application-lifecycle) | covers the paradigm shift from MLOps to LLMOps - and explores the workflow and tools to streamline end-to-end development |
| [Retrieval Augmented Generation](https://github.com/microsoft/generative-ai-for-beginners/tree/main/15-rag-and-vector-databases) | Covers a core technique to improve LLM response quality by grounding it in your own data and using embeddings and vector databases. |
| [Open-Source Models](https://github.com/microsoft/generative-ai-for-beginners/tree/main/16-open-source-models) | Covers benefits of open-source models like Llama2, Mistral and Falcon - and the value of model hubs like Hugging Face for discovery & integration. |
| [AI Agent Systems](https://github.com/microsoft/generative-ai-for-beginners/tree/main/17-ai-agents) | Covers evolution of AI apps from _assistants_ (interactive, chat) to _agents_ (autonomous, task execution) e.g., AutoGen, LangChain Agents & JARVIS. |
| [Fine-Tuning Models](https://github.com/microsoft/generative-ai-for-beginners/tree/main/18-fine-tuning) | Covers ability to retrain foundation models with new examples to improve response quality or reduce usage costs & complexity for prompt engineering. |
| | |

---

## Prompt Engineering To Fine Tuning

In the v1 edition, I talked about the value of _prompt engineering_ to improve the quality of model responses to user questions. Specifically, we looked at ways to _construct_ the prompt using techniques like _few-shot learning_, _prompt templates_, _system prompts_ and more - all of which enhance the default user prompt with additional content or context to guide the LLM towards more relevant responses.

But prompt engineering alone may not be enough:
- **Cost**: Models have tokenization limits and usage costs that can constrain the degree to which you can enhance the default prompt. This limits the number of examples you can add in primary content, or the richness of responses in completions.
- **Customization**: You may want to add new skills or capabilities to the model that enhance its behavior _across_ user interactions. Doing this on a per-prompt basis is inefficient and may not even be possible.

So, how can you take advantage of the rich language models available to you, while getting the cost-effective and customized user experiences you need? This is where **fine-tuning** models can help.

---

## Fine-Tuning Fundamentals

In lesson 18 of this curriculum, we tackle this challenge by learning about [Fine-Tuning Models](https://github.com/microsoft/generative-ai-for-beginners/tree/main/18-fine-tuning) using new data or examples. The lesson and covers the following topics at a high-level, providing related resources and a hands-on assignment for self-guided deeper dives. Check out the illustrated guide below for more detail on what each topic covers.

| Sub-Topic | Description |
|:---|:---|
| Introduction | Understand foundation models and related concepts for response quality |
| Motivation | Learn why fine-tuning matters and when to start exploring it as an option |
| Process | Understand the steps in a fine-tuning workflow, and the related challenges |
| Data Prep | Ensure you have the right data quantity and quality for fine-tuning |
| Training | Run the fine-tuning job, monitor progress, then test & iterate for quality |
| Deployment | Make your fine-tuned model available for real-world interactions, know the constraints |
| | |

![Fine Tuning Sketchnote](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wop2uw0311xqckcv0u6w.png)

Fine-tuning is a fascinating topic with great potential for experimentation and learning. Expect more updates to that lesson with focus on _walkthroughs_ of assignments that show the application of these concepts to real-world use cases and models. For now, start by [exploring the resources for self-guided learning](https://github.com/microsoft/generative-ai-for-beginners/blob/main/18-fine-tuning/RESOURCES.md) provided in that chapter.

---

## Summary & Next Steps

In this post, we looked at what the v2 edition of the Generative AI for Beginners curriculum provides, with some focus on the **Fine Tuning Fundamentals** chapter that concludes it. 

This is a fast-evolving space so expect more updates to the curriculum - [your feedback and contributions are welcome](https://github.com/microsoft/generative-ai-for-beginners/tree/main?tab=readme-ov-file#-want-to-help)! Start your journey today by [forking the repo](https://github.com/microsoft/generative-ai-for-beginners/fork) to your profile and exploring the lessons at your own pace!! 

Happy learning!

---

**3 Resources to Jumpstart Your Generative AI Journey:**

1. [Generative AI for Beginners Curriculum](https://aka.ms/genai-beginners) 
1. [Build Generative AI Apps Code-First With Azure AI](https://aka.ms/ai-studio/collection)
1. [Responsible AI Resources For Developers](https://aka.ms/rai-hub/collection)