My Experience Fine-Tuning a Model with InstructLab

My Experience Fine-Tuning a Model with InstructLab

Introduction

InstructLab is an exciting open-source project that makes it easier for anyone to improve and customize large language models (LLMs), which are used in AI applications to generate human-like text.

Working with these advanced AI models usually requires a lot of specialized skills, high-quality data, and powerful computers, making it a challenging and expensive task. However, InstructLab, a joint effort by Red Hat and IBM, changes this by allowing people from all backgrounds to contribute to and enhance these AI models, regardless of their expertise in machine learning.

This initiative enables developers to add specific knowledge and skills to the AI models, tailoring them to suit their business or industry needs using their own data. InstructLab embodies the true spirit of open-source innovation, ensuring that the latest AI advancements are accessible and cost-effective for everyone.


Fine-Tuning AI Models for Health and Fitness Trainers

Recently, I used InstructLab to fine-tune a model for health and fitness trainers who work with older adults. This process allowed me to add specific skills and knowledge to the model, demonstrating its flexibility and adaptability. Here’s a detailed and simplified overview of my experience:

Process Overview:

  1. Data Preparation: Generate 100 samples using my NVIDIA GeForce RTX 2080 8GB laptop, splitting into a 66/34 train-test ratio.? ?

I created several folders based on how instructlab folders are meant to be structured. Dataset are created by adding new skills/knowledge to the fine-tuning LLM.

Data generation folder image 1.0


1.1 Create a new skill and knowledge for the model.

In the context of InstructLab, a skill is a capability domain submitted by a contributor intending to train the AI model on the submitted information. In other words, when you submit a skill, you teach the AI model how to do something.

InstructLab skills are broken down into two main categories:

  • Composition skills. Composition or performative skills allow AI models to perform specific tasks or functions. With InstructLab, there are two types of composition skills:
  • Freeform compositional skills are performative skills that do not require additional context. For example, to train an AI model to write a poem, you would provide examples of poems.
  • Grounded compositional skills are performative skills that require additional context. One example is how an AI model reads the value of a cell in a table layout. To create the grounded skill to read a table formatted in Markdown, the additional context might be an example table layout.
  • Foundational skills. Foundational skills are skills like math, reasoning, and coding. Note: Foundational skills are not currently being accepted.
  • Skills are written in a YAML file and submitted to the InstructLab upstream project for review.?

Composition skill example: image 1.1


Knowledge skill example: image 1.2


1.2? Data Generation

To generate dataset, I simply run the command ilab data generate?

Data generation example: image 1.3


1.3? Data Validation

To validate the generated dataset, I simply run the command ilab taxonomy diff

Data validation example: image 1.4


2. Unzipping generated dataset: Uploaded and unzipped the dataset on Collab.??

?Generated dataset was stored in the generated dataset folder, which was split and stored in the taxonomy_dataset folder.

Unzipping generated dataset: image 1.5


3. Base Model Loading: Uploaded and unzipped the dataset on Collab.??

Base Model Loading: image 1.6


4. Training: Fine-tuned the model on an A100 GPU for 10-15 minutes, completing 35 iterations.???

Model Fine-tuning: image 1.6


5. Monitoring: Adjusted and evaluated the model using the test dataset with promising results.??

Model Evaluation step: image 1.6


Ilab Work flow Diagram:


Conclusion

InstructLab makes it easy for anyone, including non-technical users, to contribute to AI by using a simple YAML format and a supportive community. This approach facilitates continuous model improvement and customization by incorporating diverse, high-quality data through an effective synthetic data generation and quality assurance process.

Timothy Lam

Director of Strategic Business Development at Red Hat | CISA | CISM | CRISC | PMP | PMI-ACP | TOGAF |MACS (Snr) CP

8 个月

InstructLab embodies the true spirit of open-source innovation, ensuring that the latest AI advancements are accessible and cost-effective for everyone.

回复

要查看或添加评论,请登录

Timothy Lam的更多文章

社区洞察

其他会员也浏览了