# Quick start: Prompt a foundation model using Prompt Lab #

Take this tutorial to learn how to use the Prompt Lab in watsonx\.ai\. There are usually multiple ways to prompt a foundation model for a successful result\. In the Prompt Lab, you can experiment with prompting different foundation models, explore sample prompts, as well as save and share your best prompts\. See [Prompt tips](https://dataplatform.cloud.ibm.com/docs/content/wsj/analyze-data/fm-prompt-tips.html) to help you successfully prompt most text\-generating foundation models\.

**Required services** : Watson Studio : Watson Machine Learning

Your basic workflow includes these tasks:

<!-- <ol> -->

1.  Open a project\. Projects are where you can collaborate with others to work with data\.
2.  Open the Prompt Lab\. The Prompt Lab lets you experiment with prompting different foundation models, explore sample prompts, as well as save and share your best prompts\.
3.  Type your prompt in the prompt editor\. You can type prompts in either freeform and structured mode\.
4.  Select the model to use\. You can submit your prompt to any of the models supported by watsonx\.ai\.
5.  Save your work as a projet asset\. Saving your work as a project asset makes your work available to collaborators in the current project\.

<!-- </ol> -->

## Read about prompting a foundation model ##

Foundation models are very large AI models\. They have billions of parameters and are trained on terabytes of data\. Foundation models can perform a variety of tasks, including text\-, code\-, or image generation, classification, conversation, and more\. Large language models are a subset of foundation models used for text\- and code\-related tasks\. In IBM watsonx\.ai, there is a collection of deployed large language models that you can use, as well as tools for experimenting with prompts\.

[Read more about Prompt Lab](https://dataplatform.cloud.ibm.com/docs/content/wsj/analyze-data/fm-prompt-lab.html)

## Watch a video about prompting a foundation model ##

![Watch Video](https://dataplatform.cloud.ibm.com/docs/content/wsj/getting-started/images/lc-video.png) Watch this video to preview the steps in this tutorial\. There might be slight differences in the user interface shown in the video\. The video is intended to be a companion to the written tutorial\.

This video provides a visual method to learn the concepts and tasks in this documentation\.

## Try a tutorial to prompt a foundation model ##

In this tutorial, you will complete these tasks:

<!-- <ul> -->

 *  [Task 1: Open a project](https://dataplatform.cloud.ibm.com/docs/content/wsj/getting-started/get-started-prompt-lab.html?context=cdpaas&locale=en#step01)
 *  [Task 2: Use the Prompt Lab in Freeform mode](https://dataplatform.cloud.ibm.com/docs/content/wsj/getting-started/get-started-prompt-lab.html?context=cdpaas&locale=en#step02)
 *  [Task 3: Use the Prompt Lab in Structured mode](https://dataplatform.cloud.ibm.com/docs/content/wsj/getting-started/get-started-prompt-lab.html?context=cdpaas&locale=en#step03)
 *  [Task 4: Use the sample prompts](https://dataplatform.cloud.ibm.com/docs/content/wsj/getting-started/get-started-prompt-lab.html?context=cdpaas&locale=en#step04)
 *  [Task 5: Choose a foundation model](https://dataplatform.cloud.ibm.com/docs/content/wsj/getting-started/get-started-prompt-lab.html?context=cdpaas&locale=en#step05)
 *  [Task 6: Adjust model parameters](https://dataplatform.cloud.ibm.com/docs/content/wsj/getting-started/get-started-prompt-lab.html?context=cdpaas&locale=en#step06)
 *  [Task 7: Save your work](https://dataplatform.cloud.ibm.com/docs/content/wsj/getting-started/get-started-prompt-lab.html?context=cdpaas&locale=en#step07)

<!-- </ul> -->

Expand all sections

<!-- <ul> -->

 *  Tips for completing this tutorial
    
    \#\#\# Use the video picture-in-picture Tip: Start the video, then as you scroll through the tutorial, the video moves to picture-in-picture mode. Close the video table of contents for the best experience with picture-in-picture. You can use picture-in-picture mode so you can follow the video as you complete the tasks in this tutorial. Click the timestamps for each task to follow along.The following animated image shows how to use the video picture-in-picture and table of contents features: ![How to use picture-in-picture and chapters](https://dataplatform.cloud.ibm.com/docs/content/wsj/getting-started/images/pip-and-chapters.gif)\{: width="560px" height="315px" data-tearsheet="this"\} \#\#\# Get help in the community If you need help with this tutorial, you can ask a question or find an answer in the [watsonx.ai Community discussion forum](https://community.ibm.com/community/user/watsonx/communities/community-home/digestviewer?communitykey=81927b7e-9a92-4236-a0e0-018a27c4ad6e)\{: new\_window\}. \#\#\# Set up your browser windows For the optimal experience completing this tutorial, open Cloud Pak for Data in one browser window, and keep this tutorial page open in another browser window to switch easily between the two applications. Consider arranging the two browser windows side-by-side to make it easier to follow along. ![Side-by-side tutorial and UI](https://dataplatform.cloud.ibm.com/docs/content/wsj/getting-started/images/tutorial-side-by-side-wx.png)\{: width="560px" height="315px" data-tearsheet="this"\} Tip: If you encounter a guided tour while completing this tutorial in the user interface, click **Maybe later**.  
    [Back to the top](https://dataplatform.cloud.ibm.com/docs/content/wsj/getting-started/get-started-prompt-lab.html?context=cdpaas&locale=en#video-preview)  
    
<!-- </ul> -->

<!-- <ul> -->

 *  Task 1: Open a project
    
    You need a project to store Prompt Lab assets. Watch a video to see how to create a sandbox project and associate a service. Then follow the steps to verify that you have an existing project or create a sandbox project.
    
    This video provides a visual method to learn the concepts and tasks in this documentation.
    
    1. From the watsonx home screen, scroll to the *Projects* section. If you see any projects listed, then skip to [Task 2](https://dataplatform.cloud.ibm.com/docs/content/wsj/getting-started/get-started-prompt-lab.html?context=cdpaas&locale=en#step02). If you don't see any projects, then follow these steps to create a project. 1. Click **Create a sandbox project**. When the project is created, you will see the sandbox project in the *Projects* section. For more information or to watch a video, see [Creating a project](https://dataplatform.cloud.ibm.com/docs/content/wsj/getting-started/projects.html)\{: new\_window\}. \#\#\# ![Checkpoint icon](https://dataplatform.cloud.ibm.com/docs/content/wsj/getting-started/images/checkmark--filled-blue.svg)\{: iih\} Check your progress The following image shows the home screen with the sandbox listed in the Projects section. You are now ready to open the Prompt Lab.  
      
    ![Home screen with sandbox project listed.](https://dataplatform.cloud.ibm.com/docs/content/wsj/getting-started/images/wx-home-screen.png)\{: width="100%" \}  
    [Back to the top](https://dataplatform.cloud.ibm.com/docs/content/wsj/getting-started/get-started-prompt-lab.html?context=cdpaas&locale=en#video-preview)  
    
<!-- </ul> -->

<!-- <ul> -->

 *  Task 2: Use the Prompt Lab in Freeform mode
    
    ![preview tutorial video](https://dataplatform.cloud.ibm.com/docs/content/wsj/getting-started/images/lc-video.png) To preview this task, watch the video beginning at 00:03. You can type your prompt text in a freeform, plain text editor and then click **Generate** to send your prompt to the model. Follow these steps to use the Prompt Lab in Freeform mode: 1. From the home screen, click the **Experiment with foundation models and build prompts** tile. 1. Select each checkbox to accept the acknowledgements, and then click **Skip tour**. 1. Click the **Freeform** tab to prompt a foundation model in *Freeform* mode. 1. Click **Switch mode**. 1. Copy and paste the following text in the text field, and then click **Generate** to see the output for the *Class name: Problem*.`Classify this customer message into one of two classes: question, problem. Class name: Question Description: The customer is asking a technical question or a how-to question about our products or services. Class name: Problem Description: The customer is describing a problem they are having. They might say they are trying something, but it's not working. They might say they are getting an error or unexpected results. Message: I'm having trouble registering for a new account. Class name:`  
    \#\#\# ![Checkpoint icon](https://dataplatform.cloud.ibm.com/docs/content/wsj/getting-started/images/checkmark--filled-blue.svg)\{: iih\} Check your progress The following images shows the generated output for the prompt in Freeform mode. Now you are ready to prompt a foundation model in Structured mode.  
      
    ![Generated output for the prompt in Freeform mode.](https://dataplatform.cloud.ibm.com/docs/content/wsj/getting-started/images/wx-prompt-freeform.png)\{: width="100%" \}  
    [Back to the top](https://dataplatform.cloud.ibm.com/docs/content/wsj/getting-started/get-started-prompt-lab.html?context=cdpaas&locale=en#video-preview)  
    
<!-- </ul> -->

<!-- <ul> -->

 *  Task 3: Use the Prompt Lab in Structured mode
    
    ![preview tutorial video](https://dataplatform.cloud.ibm.com/docs/content/wsj/getting-started/images/lc-video.png) To preview this task, watch the video beginning at 00:19. You can type your prompt in a structured format. The structured format is helpful for few-shot prompting, when your prompt has multiple examples. Follow these steps to use the Prompt Lab in Structured mode: 1. Click the **Structured** tab. 1. Click **Switch mode**. 1. In the *Instruction* field, copy and paste the following text: `Given a message submitted to a customer-support chatbot for a cloud software company, classify the customer's message as either a question or a problem description so the chat can be routed to the correct support team.`\{: .cp\} 1. In the *Setup* field, copy and paste the following text in each column: \| Input \| Output \| \| ----- \| ----- \| \| When I try to log in, I get an error. \| Problem \| \| Where can I find the plan prices? \| Question \| \| What is the difference between trial and paygo? \| Question \| \| The registration page crashed, and now I can't create a new account. \| Problem \| \| What regions are supported? \| Question \| \| I can't remember my password. \| Problem \|  
    1. In the *Try* field, copy and paste the following text: `I'm having trouble registering for a new account.`\{: .cp\} 1. Click **Generate** to see the output *Problem*. \#\#\# ![Checkpoint icon](https://dataplatform.cloud.ibm.com/docs/content/wsj/getting-started/images/checkmark--filled-blue.svg)\{: iih\} Check your progress The following images shows the generated output for the prompt in Structured mode. Now you are ready to try the sample prompts.  
      
    ![Generated output for the prompt in Structured mode](https://dataplatform.cloud.ibm.com/docs/content/wsj/getting-started/images/wx-prompt-structured.png)\{: width="100%" \}  
    [Back to the top](https://dataplatform.cloud.ibm.com/docs/content/wsj/getting-started/get-started-prompt-lab.html?context=cdpaas&locale=en#video-preview)  
    
<!-- </ul> -->

<!-- <ul> -->

 *  Task 4: Use the sample prompts
    
    ![preview tutorial video](https://dataplatform.cloud.ibm.com/docs/content/wsj/getting-started/images/lc-video.png) To preview this task, watch the video beginning at 00:33. If you’re not sure how to begin, sample prompts can get your started. Follow these steps to use the sample prompts: 1. Open the **Sample prompts** icon ![Sample prompts](https://dataplatform.cloud.ibm.com/docs/content/wsj/getting-started/images/sample-prompts-icon.png)\{: iih\} to display the list. 1. Scroll through the list, and click the **Marketing email generation** sample prompt. 1. View the selected model. When you load a sample prompt, an appropriate model is selected for you. 1. Open the **Model Parameters**![Model parameters](https://dataplatform.cloud.ibm.com/docs/content/wsj/getting-started/images/settings-adjust.svg)\{: iih\} panel. The appropriate decoding and stopping criteria parameters are set automatically too. 1. Click **Generate** to submit the sample prompt to the model, and see the sample email output. \#\#\# ![Checkpoint icon](https://dataplatform.cloud.ibm.com/docs/content/wsj/getting-started/images/checkmark--filled-blue.svg)\{: iih\} Check your progress The following image shows the generated output from a sample prompt. Now you are ready to customize the sample prompt output by selecting a different model and parameters.  
      
    ![Generated output from a sample prompt](https://dataplatform.cloud.ibm.com/docs/content/wsj/getting-started/images/wx-sample-prompt-output.png)\{: width="100%" \}  
    [Back to the top](https://dataplatform.cloud.ibm.com/docs/content/wsj/getting-started/get-started-prompt-lab.html?context=cdpaas&locale=en#video-preview)  
    
<!-- </ul> -->

<!-- <ul> -->

 *  Task 5: Choose a foundation model
    
    ![preview tutorial video](https://dataplatform.cloud.ibm.com/docs/content/wsj/getting-started/images/lc-video.png) To preview this task, watch the video beginning at 01:04. You can submit the same prompt to a different model. Follow these steps to choose a different foundation model: 1. Click **Model > View all foundation models**. 1. Click a model to learn more about a model, and see detail such as the model architecture, pretraining data, fine-tuning information, and performance against benchmarks. 1. Click **Back** to return to the list of models. 1. Select either the **flan-t5-xxl-11b** or **mt0-xxl-13b** foundation model, and click **Select model**. 1. Hover over the model output column and click the **X** icon to delete the previous output. 1. Click the same sample prompt, **Marketing email generation**, from the list. 1. Click **Generate** to generate output using the new model. \#\#\# ![Checkpoint icon](https://dataplatform.cloud.ibm.com/docs/content/wsj/getting-started/images/checkmark--filled-blue.svg)\{: iih\} Check your progress The following image shows generated output using a different model. You are now ready to adjust the model parameters.  
      
    ![Generated output using a different model](https://dataplatform.cloud.ibm.com/docs/content/wsj/getting-started/images/wx-sample-prompt-output-new-model.png)\{: width="100%" \}  
    [Back to the top](https://dataplatform.cloud.ibm.com/docs/content/wsj/getting-started/get-started-prompt-lab.html?context=cdpaas&locale=en#video-preview)  
    
<!-- </ul> -->

<!-- <ul> -->

 *  Task 6: Adjust model parameters
    
    ![preview tutorial video](https://dataplatform.cloud.ibm.com/docs/content/wsj/getting-started/images/lc-video.png) To preview this task, watch the video beginning at 01:28. You can experiment with changing decoding or stopping criteria parameters. Follow these steps to adjust model parameters. Note: The model parameters vary based on the currently selected model.The following table defines the model parameters available for the *flan-t5-xxl-11b* foundation model. \| Model parameters \| Meaning \| \| ----- \| ----- \| \| Decoding \| Set decoding to *Greedy* to always select words with the highest probability. Set decoding to *Sampling* to customize the variability of word selection. \| \| Temperature \| Control the creativity of generated text. Higher values will lead to more randomly generated outputs. \| \| Top P (nucleus sampling) \| Set to `< 1.0` to use only the smallest set of most probable tokens with probabilities that add up to `top_p` or higher. \| \| Top K \| Set the number of highest probability vocabulary tokens to keep for top-k-filtering. Lower values make it less likely the model will go off topic. \| \| Random seed \| Control the random sampling of the generated tokens when sampling is enabled. Setting the random see to the same number for each generation ensures experimental repeatability. \| \| Repetition penalty \| Set a repetition penalty to counteract the model's tendency to repeat prompt text verbatim or get stuck in a loop. 1.00 indicates no penalty. \| \| Stop sequences \| Set stop sequences to one ore more strings to cause the text generation to stop if or when they are produced as part of the output. \| \| Min tokens \| Define the minimum number to tokens to generate. Stop sequences encountered prior to the minimum number of tokens being generated are ignored. \| \| Max tokens \| Define the maximum number to tokens to generate. \|  
    1. Change the *Top K* parameter to `10` to make it less likely the model will go off topic. 1. Click **X** to delete the previous model output. 1. Click the same sample prompt from the list. 1. Click **Generate** to generate output using the new model parameters. 1. Click the **Session history** icon ![Session history icon](https://dataplatform.cloud.ibm.com/docs/content/wsj/getting-started/images/wx-session-history-icon.png)\{: iih\} after submitting multiple prompts to view your session history. 1. Click any entry to work with a previous prompt, model specification, and parameter settings, and then click **Restore**. 1. Edit the prompt, change the model, or adjust decoding and stopping criteria parameters. 1. Click **Generate** to generate output using the updated information. \#\#\# ![Checkpoint icon](https://dataplatform.cloud.ibm.com/docs/content/wsj/getting-started/images/checkmark--filled-blue.svg)\{: iih\} Check your progress The following image shows generated output using different model parameters. You are now ready to save your work.  
      
    ![Generated output using a different model](https://dataplatform.cloud.ibm.com/docs/content/wsj/getting-started/images/wx-session-history.png)\{: width="100%" \}  
    [Back to the top](https://dataplatform.cloud.ibm.com/docs/content/wsj/getting-started/get-started-prompt-lab.html?context=cdpaas&locale=en#video-preview)  
    
<!-- </ul> -->

>

<!-- <ul> -->

 *  Task 7: Save your work
    
    ![preview tutorial video](https://dataplatform.cloud.ibm.com/docs/content/wsj/getting-started/images/lc-video.png) To preview this task, watch the video beginning at 02:15. You can save your work in three formats: \| Asset type \| Description \| \| ----- \| ----- \| \| Prompt template \| Save the current prompt only, without its history. \| \| Prompt session \| Save history and data from the current session. \| \| Notebook \| Save the current prompt as a notebook. \|  
    Follow these steps to save your work: 1. Click **Save work > Save as**. 1. Select **Prompt template**. 1. For the name, type `Sample prompts`\{: .cp\}. 1. Select the **View in project after saving** option. 1. Click **Save**. 1. On the project's *Assets* tab, click the **Sample prompts** asset to load that prompt in the Prompt Lab and get right back to work. 1. Click the **Saved prompts**![Saved prompts](https://dataplatform.cloud.ibm.com/docs/content/wsj/getting-started/images/saved-prompts-icon.png)\{: iih\} to see saved prompt from your sandbox project. \#\#\# ![Checkpoint icon](https://dataplatform.cloud.ibm.com/docs/content/wsj/getting-started/images/checkmark--filled-blue.svg)\{: iih\} Check your progress The following image shows the project's Assets tab with the prompt template asset:  
      
    ![Project's Assets tab](https://dataplatform.cloud.ibm.com/docs/content/wsj/getting-started/images/wx-saved-prompt-in-project.png)\{: width="100%" \} ![Checkmark icon](https://dataplatform.cloud.ibm.com/docs/content/wsj/getting-started/images/checkmark--filled-blue.svg)\{: iih\} The following image shows saved prompt in the Prompt Lab: ![Saved prompt in Prompt Lab](https://dataplatform.cloud.ibm.com/docs/content/wsj/getting-started/images/wx-saved-prompt-in-prompt-lab.png)\{: biw\}  
    [Back to the top](https://dataplatform.cloud.ibm.com/docs/content/wsj/getting-started/get-started-prompt-lab.html?context=cdpaas&locale=en#video-preview)  
    
<!-- </ul> -->

## Next steps ##

You are now ready to:

<!-- <ul> -->

 *  Use the [Prompt Lab](https://dataplatform.cloud.ibm.com/docs/content/wsj/analyze-data/fm-prompt-lab.html) to prompt [foundation models](https://dataplatform.cloud.ibm.com/docs/content/wsj/analyze-data/fm-models.html) and save your work to a project\.
 *  Try the [Prompt a foundation model with the retrieval\-augmented generation pattern tutorial](https://dataplatform.cloud.ibm.com/docs/content/wsj/getting-started/get-started-fm-notebook.html)

<!-- </ul> -->

## Additional resources ##

<!-- <ul> -->

 *  [Saving your work](https://dataplatform.cloud.ibm.com/docs/content/wsj/analyze-data/fm-prompt-save.html)
 *  [Python library](https://dataplatform.cloud.ibm.com/docs/content/wsj/analyze-data/fm-python-lib.html)
 *  View more [videos](https://dataplatform.cloud.ibm.com/docs/content/wsj/getting-started/videos-wx.html)\.
 *  Find sample data sets, projects, models, prompts, and notebooks in the Samples to gain hands\-on experience:
    
    ![Notebook icon](https://dataplatform.cloud.ibm.com/docs/content/wsj/getting-started/images/notebook.svg)[Notebooks](https://dataplatform.cloud.ibm.com/gallery?context=wx&format=notebook) that you can add to your project to get started analyzing data and building models.
    
    ![Project icon](https://dataplatform.cloud.ibm.com/docs/content/wsj/getting-started/images/ibm-cloud--projects.svg)[Projects](https://dataplatform.cloud.ibm.com/gallery?context=wx&format=project-template) that you can import containing notebooks, data sets, prompts, and other assets.
    
    ![Data set icon](https://dataplatform.cloud.ibm.com/docs/content/wsj/getting-started/images/data--set.svg)[Data sets](https://dataplatform.cloud.ibm.com/gallery?context=wx&format=dataset) that you can add to your project to refine, analyze, and build models.
    
    ![Prompt icon](https://dataplatform.cloud.ibm.com/docs/content/wsj/getting-started/images/prompt.svg)[Prompts](https://dataplatform.cloud.ibm.com/gallery?context=wx&format=example-prompt) that you can use in the Prompt Lab to prompt a foundation model.
    
    ![Model icon](https://dataplatform.cloud.ibm.com/docs/content/wsj/getting-started/images/model.svg)[Foundation models](https://dataplatform.cloud.ibm.com/gallery?context=wx&format=foundation-model) that you can use in the Prompt Lab.

<!-- </ul> -->

**Parent topic:**[Quick start tutorials](https://dataplatform.cloud.ibm.com/docs/content/wsj/getting-started/quickstart-tutorials.html)

<!-- </article "role="article" "> -->