Earning AWS certification can help you advance your career, whether you want to find a new role, show off your skills to take on a new project, or become the go-to expert on your team. And because AWS certification exams create them as experts in the relevant function or technical area, preparing for one of these exams helps you develop the necessary skills identified by qualified professionals in the field.
It is important to read the AWS services FAQ page relevant to your certification exam in order to gain a deeper understanding of the service. However, this could take quite some time. Reading FAQs for even one service can take half a day to read and understand. For example, the Amazon SageMaker FAQ contains about 33 (printed) pages of content on SageMaker alone.
Wouldn’t it be an easier and more fun learning experience if you could use a system to test yourself on AWS service FAQ pages? You can actually develop this system using state-of-the-art language models and a few lines of Python.
In this post, we present a complete guide to implementing a multiple-choice quiz solution for the FAQ pages of any AWS service, based on the AI21 Jurassic-2 Jumbo Instruct base model in Amazon SageMaker Jumpstart.
Great linguistic models
In recent years, language models have experienced a huge increase in size and popularity. In 2018, BERT-large made its debut with its 340 million parameters and innovative transformer architecture, setting the benchmark for performance on NLP tasks. In a few years, the state of the art in terms of model size has increased more than 500 times; OpenAI’s GPT-3 and Bloom 176 B, both with 175 billion parameters, and the AI21 Jurassic-2 Jumbo Instruct with 178 billion parameters, are just three examples of large language models (LLMs) that raise the bar for natural language processing (NLP) accuracy.
SageMaker foundation models
SageMaker offers a variety of models from popular model hubs, such as Hugging Face, PyTorch Hub, and TensorFlow Hub, and AI21’s proprietary ones, Cohere, and LightOn, that you can access within your machine learning development workflow (ML) in SageMaker. Recent advances in ML have given rise to a new class of models known as foundation models, which have billions of parameters and are trained on massive amounts of data. These foundational models can be adapted to a wide range of use cases, including text summarization, digital art generation, and language translation. Because these models can be expensive to train, customers want to use pre-trained foundation models and tune them as needed, rather than train these models themselves. SageMaker provides a curated list of models that you can choose from in the SageMaker console.
With JumpStart, you can find foundation models from different suppliers, allowing you to get started with foundation models quickly. You can review model features and terms of use and test these models using a test UI widget. When you’re ready to use a base model to scale, you can easily do so without leaving SageMaker using prebuilt notebooks from model providers. Your data, whether used to evaluate or use the model at scale, is never shared with third parties because the models are hosted and deployed on AWS.
AI21 Jurassic-2 Jumbo Instruct
Jurassic-2 Jumbo Instruct is an AI21 Labs LLM that can be applied to any language generation or understanding task. It’s optimized to follow natural language instructions and context, so you don’t need to provide an example. The endpoint comes preloaded with the model and is ready to serve queries using an easy-to-use API and Python SDK, so you can get started. Jurassic-2 Jumbo Instruct performs better on HELM, especially on tasks related to reading and writing.
Solution overview
In the following sections, we will go through the steps to test the Jumbo Jurassic-2 instruction model in SageMaker:
- Choose the Jumbo Jurassic-2 instruction model in the SageMaker console.
- Evaluate the model using the playground.
- Use a notebook associated with the base model to implement it in your environment.
Access Jurassic-2 Jumbo Instruct through the SageMaker console
The first step is to log in to the SageMaker console. Under jump start in the navigation pane, choose Foundation models to request access to the model list.
After your account is listed, you can view a list of models on this page and search for the Jurassic-2 Jumbo Instruct model.
Evaluate the Jurassic-2 Jumbo Instruct model in the model yard
From the AI21 Jurassic-2 Jumbo Instruct list, choose See model. You will see a description of the model and the tasks you can perform. Please read the template’s EULA before continuing.
We first test the model to generate a test based on the SageMaker FAQ page. Navigate to Children’s park tab
At the Children’s park tab, you can provide sample instructions to the Jurassic-2 Jumbo Instruct model and see the output.
Note that you can use a maximum of 500 tokens. We set the maximum length to 500, which is the maximum number of tiles to generate. This model has a context window of 8,192 tiles (request duration plus completion should be at most 8,192 tiles).
To make the message easier to view, you can enlarge it warning Box.
Since we can use a maximum of 500 tiles, we take a small part of the Amazon SageMaker FAQ page, the Low code ML section, for our test message.
We use the following indication:
Rapid engineering is an iterative process. You need to be clear and specific, and give the model time to think.
Here we have specified the context with ## as stop sequences, which tells the model to stop generating after generating this character or string. It is useful when using a few shots indication.
Next, we are clear and very specific in our message, asking for a multiple-choice quiz, consisting of four questions with four options. We ask the model to include the correct answer for each question using the initial string 'Correct Answer:'
so we can parse it later using Python:
A well-designed message can make the model more creative and generalizable so that it can be easily adapted to new tasks. Cues can also help embed domain knowledge in specific tasks and improve interpretability. Fast engineering can greatly improve the performance of zero- and few-shot learning models. Creating high-quality cues requires careful consideration of the task at hand, as well as a deep understanding of the model’s strengths and limitations.
In the scope of this publication, we do not cover this broad area further.
Copy the request and enter it in the file warning box, and then choose Generate text.
This sends the request to Jurassic-2’s Jumbo Instruct model for inference. Please note that experimenting in the yard is free.
Also note that despite the cutting-edge nature of LLMs, they are still prone to biases, errors, and hallucinations.
After reading the model output thoroughly and carefully, we can see that the model generated a pretty good quiz!
After you’ve played around with the model, it’s time to use the notebook and deploy it as an endpoint to your environment. We use a small Python function to parse the output and simulate an interactive test.
Deploy the Jurassic-2 Jumbo Instruct base model from a notebook
You can use the sample notebook below to deploy Jurassic-2 Jumbo Instruct using SageMaker. Note that this example uses an ml.p4d.24xlarge instance. If your default limit for your AWS account is 0, you will need to request a limit increase for this GPU instance.
We create the endpoint using SageMaker inference. First, we set the necessary variables and then deploy the model from the model package:
Once the endpoint is deployed, you can run inference queries against the model.
Once the model is deployed, you can interact with the deployed endpoint using the following code snippet:
With the Jurassic-2 Jumbo Instruct base model deployed on a SageMaker ml.p4d.24xlarge endpoint, you can use a gauge with 4,096 tiles. You can follow the same prompt we used in the playground and add many more questions. In this example, we’ve added the entire FAQ Low code ML section as context in the indicator.
We can see the output of the model, which generated a multiple choice quiz with four questions and four options for each question.
Now you can develop a Python function to parse the output and create an interactive multiple-choice quiz.
It is quite simple to develop this function with a few lines of code. You can easily analyze the answer because the model created a line with “Correct Answer:” for each question, exactly as we asked you in the application. We do not provide the Python code for generating the quiz within the scope of this post.
Run the test in the notebook
Using the Python function we created earlier and the output of the Jurassic-2 Jumbo Instruct base model, we run the interactive quiz in the notebook.
You can see that I answered three of the four questions correctly and got a mark of 75%. Maybe I need to read the SageMaker FAQ a few more times!
Clean up
After you have tested the endpoint, be sure to remove the SageMaker inference endpoint and the model to avoid charges:
conclusion
In this post, we showed you how you can test and use AI21’s Jurassic-2 Jumbo Instruct model using SageMaker to create an automated question generation system. This was achieved using a fairly simple prompt with embedded text from the publicly available SageMaker FAQ page and a few lines of Python code.
Similar to this example mentioned in the post, you can customize a base model for your business with just a few labeled examples. Because all data is encrypted and never leaves your AWS account, you can trust that your data will remain private and confidential.
Request access to test the base model in SageMaker today and let us know your feedback.
About the author
Eitan Sela is a solutions architect specializing in machine learning with Amazon Web Services. Work with AWS customers to provide guidance and technical support, helping them build and operate machine learning solutions on AWS. In his free time, Eitan enjoys running and reading the latest machine learning articles.
Source link
Ikaroa is proud to announce our new automated quiz generation feature for Amazon Web Services (AWS) certification exams. By leveraging Amazon SageMaker, our customers will be well-equipped to accelerate their learning and increase their success in passing the AWS exams. SageMaker provides a suite of machine learning models that enable users to quickly create and deploy high-quality quizzes. With the quiz generation feature, customers can automatically generate and track their learning progress as they progress through the certification material.
We understand the value of obtaining AWS certifications, and that the exam process can be difficult and time consuming. With Ikaroa’s automated quiz generation feature, our customers can have a faster and more effective study program. Our AI-driven machine learning models take the guess work out of the certification preparation process. With the combination of Amazon SageMaker and our quiz generation feature, customers can create customized quizzes to review the pertinent AWS materials during their studies.
The quiz generation feature provides our customers with a quick and easy way to assess their understanding of the material as they progress through the certification program. Ikaroa’s AI-driven models are designed to help customers efficiently learn the topics and increase exam performance. Additionally, with the automated tracking feature, users will be able to track, view, and analyze their progress over time to ensure they are thoroughly mastering the material before taking the exams.
At Ikaroa, we value our customers’ success and view the exam process as a collaborative journey. With our automated quiz generation feature, customers can better equip themselves to excel in the AWS certification process. We are pleased to offer this service as part of our mission to help our customers succeed.