[UPBEAT MUSIC]
NIKITA NAMJOSHI: One of the many reasons
people are so excited about generative AI
right now is that it allows you to prototype applications
really fast.
With the right tools, you can experiment with new ideas
in minutes instead of months.
So let's dive in and check out Generative AI Studio,
which lets you quickly explore and customize generative AI
models that you can leverage in your applications
on Google Cloud.
You can find Generative AI Studio in the Vertex AI
section of the Cloud Console.
And select the type of content for your use case.
To get started experimenting with Large Language Models
or LLMs, click on New Prompt.
In the world of generative AI, a prompt
is just a fancy name for the input text
that you feed to your model.
You can get one of these models to take
on all sorts of different behaviors
based on how you structure your prompt.
This art and science of figuring out the best prompt
for your use case is called prompt design.
And it often involves a lot of experimentation.
But that's where Generative AI Studio is here to help.
Let's start with a free-form prompt.
One way to design a prompt is to simply tell
the model what you want.
In other words, provide an instruction.
For example, generate a list of items
I need for a camping trip to Joshua Tree National Park.
We send this text to the model.
And you can see that the model outputs
a useful list of items we wouldn't want to camp without.
This approach, writing a single command
to get the LLM to take on a certain behavior
is called zero-shot prompting.
Now, LLMs are particularly good at identifying and completing
patterns.
So in addition to writing an instruction,
it can be helpful to add some examples
and show the model what you want.
That's where few-shot prompting comes in.
In this approach, you provide the model with a few examples.
And to make it easier, you can use a structured prompt
template.
The structured prompt contains a few different components.
First, we have the context, which instructs
how the model should respond.
You can specify words the model can or cannot use,
topics to focus on or avoid, or a particular response format.
And the context applies each time
you send a request to the model.
So let's say we want to use an LLM to answer questions
based on some background text.
In this case, a passage describing
changes in rainforest vegetation in the Amazon.
We can paste in the background text as context.
And then we add some examples of questions that could
be answered from this passage.
Like, what does LGM stand for?
Or what did the analysis from the sediment deposits indicate?
We'll need to add in the corresponding answers
to these questions to demonstrate how
we want the model to respond.
Then we can test out the prompt we've
designed by sending a new question as input.
And there you go, you've prototyped a Q&A system
based on background text in just a few minutes.
It's important to note that adding
instructions and a few examples tends to yield good results.
But at the end of the day, there's
currently no best way to write a prompt.
Experimenting with prompts is a core part
of being a generative AI developer.
You'll want to try out different structures and formats
and examples and really just see what
works best for your use case and the specific model you're
working with.
So if you've designed a prompt that you
think is working pretty well, you
can save it and return to it later.
Your saved prompt will be visible in the Prompt Gallery,
which is a curated collection of sample prompts
that show how generative AI models can work
for a variety of use cases.
Finally, in addition to trying out
different prompts and prompt structures,
there are a few model parameters you can experiment with
to try to improve the quality of responses.
First, there are different models you can choose from.
Each model is tuned to perform well on specific tasks.
You can also specify the temperature, top P,
and top K. These parameters all adjust the randomness
of responses by controlling how the output tokens are selected.
When you send a prompt to the model,
it produces an array of probabilities over the words
that could likely come next.
And from this array, we need some strategy
to decide what to return.
A simple strategy might be to select the most likely word
at every time step.
But this method can result in uninteresting and sometimes
repetitive answers.
On the flip side, if we were to randomly sample
over the distribution returned by the model,
you might get some unlikely responses.
By controlling the degree of randomness,
you can get more unexpected and, some might even say,
creative responses.
You've now written your first prompt with Vertex Generative
AI Studio.
There are a lot of other features
to explore, like vision capabilities, chat,
and model tuning for when you want some extra customization.
But more on all of that next time.
Check out the links below to learn more
about generative AI on Vertex and to learn more
about large language models.
Thanks for watching, and definitely
let us know in the comments below what you're
building with generative AI.
[MUSIC PLAYING]