Getting Started with Generative AI on AWS
My capstone to develop a domain expert model in healthcare industry by fine-tuning a foundational model available in Amazon SageMaker Studio( Meta Llama 2 7b Chat Model). The focus lies behind on creating an AI assistant for medical analysis.
Published Sep 1, 2024
Recent advancements over the past decade in data science and artificial intelligence have revolutionized industries across the world. The convergence of machine learning, deep learning, and AI has opened up unprecedented opportunities to extract insights from vast amounts of enormous data. In this article, I'll explore how to implement these technologies using AWS to create a specialized domain expert model for the medical sector, to generate key insights using prompt techniques.
Before I dive into the project, let me explain in brief about services I have used
AWS S3:
A simple storage service that uses a bucket for storing the data provided in the console.
A simple storage service that uses a bucket for storing the data provided in the console.
AWS EC2:
A managed elastic compute instance to spin up the service. For my project I used ml.g5.12xlarge instance.
A managed elastic compute instance to spin up the service. For my project I used ml.g5.12xlarge instance.
AWS SageMaker:
A managed open-source machine learning platform, that provides end-to-end services from inferencing instances to dynamically use Foundational Models for text, or image to build assistant for specific use cases to train and deploy the models.
A managed open-source machine learning platform, that provides end-to-end services from inferencing instances to dynamically use Foundational Models for text, or image to build assistant for specific use cases to train and deploy the models.
My goal was to create an AI assistant capable of understanding a medical dataset. By fine-tuning a foundational model (I used Meta LlaMa 2 7b Chat Model) available in Amazon SageMaker Studio.
Project Walkthrough: Fine-tuning Meta's Llama 2 7b Chat Model on AWS SageMaker
1. Data Selection and Preparation
The first step in my journey was to select an an appropriate sample paper for my medical domain expert (MediSage AI Assistant).
2. Setting Up the AWS Environment
Amazon Web Services offers a robust ecosystem for AI development. We'll primarily use:
- Amazon S3 for data storage
- Amazon EC2 for compute power
- Amazon SageMaker for model training and deployment
- Creating necessary IAM permissions
3. Fine-tuning the Language Model
I incorporated Meta Llama 2 7B foundation model as the starting point to train the prompts to generate user-derived inputs. AWS SageMaker tool provides tools to efficiently fine-tune this model for the specific dataset that I have used to test against the prompts.
4. Model Evaluation and Iteration
Evaluating a domain expert model requires more than just looking at perplexity scores. Below is the snapshot of the model performance evaluation based on the prompt given.
5. Deployment:
The next step would we to deploy the model and fine tune it to get the relevant output. The most critical step is to always delete the endpoint to incur the charges. Here's what it gave me from the dataset I used to fine tune the available model using Meta LlaMa 2 7b Chat.
The next step would we to deploy the model and fine tune it to get the relevant output. The most critical step is to always delete the endpoint to incur the charges. Here's what it gave me from the dataset I used to fine tune the available model using Meta LlaMa 2 7b Chat.
Final Conclusion:
It's important to stay updated with the latest technology stack to be into the field. I was curious to know more about this framework but making projects to implement is always crucial. Please do feel free to like this post and comment. I'd appreciate the AWS community that provide me a platform to use my knowledge and put forward myself as they say "Do the hard thing and make every minute count".