Gemini 3 prompting guide

Preview

This product or feature is subject to the "Pre-GA Offerings Terms" in the General Service Terms section of the Service Specific Terms, and the Additional Terms for Generative AI Preview Products. You can process personal data for this product or feature as outlined in the Cloud Data Processing Addendum, subject to the obligations and restrictions described in the agreement under which you access Google Cloud. Pre-GA products and features are available "as is" and might have limited support. For more information, see the launch stage descriptions.


Caution: gemini-3-pro-preview will be deprecated and removed on March 26, 2026. Migrate any workflows to gemini-3.1-pro-preview.
To see an example of Gemini 3 Pro, run the "Intro to Gemini 3 Pro" notebook in one of the following environments:

Open in Colab | Open in Colab Enterprise | Open in Vertex AI Workbench | View on GitHub

Prompting is a key part of working with any Gemini model and the new features of Gemini 3 models can be prompted to help solve complex problems and achieve other tasks, such as interpreting large amounts of text, solving complex mathematical problems, or even creating images and videos.

This guide provides a variety of prompting strategies to help you get the most from Gemini 3 on Vertex AI for a variety of use cases.

Temperature tuning
For Gemini 3, we strongly recommend keeping the temperature parameter at its default value of 1.0.

Gemini 3's reasoning capabilities are optimized for the default temperature setting and don't necessarily benefit from tuning temperature. Changing the temperature (setting it to less than 1.0) may lead to unexpected behavior, looping, or degraded performance, particularly with complex mathematical or reasoning tasks.

Prompting strategies
The following sections describe a variety of prompting strategies that you can use with Gemini 3 models.

Lowering response latency
For lower latency responses, try setting the thinking level to LOW and using system instructions like think silently.

Distinguishing between deduction and external information
In some cases, providing open-ended system instructions like do not infer or do not guess may cause the model to over-index on that instruction and fail to perform basic logic or arithmetic or synthesize information found in different parts of a document.

Rather than a large blanket negative constraint, tell the model explicitly to use the provided additional information or context for deductions and avoid using outside knowledge.

Examples


What was the profit? Do not infer.
This instruction is ineffective because the do not infer instruction is too broad.



You are expected to perform calculations and logical deductions based strictly
on the provided text. Do not introduce external information.
Here, the instruction makes it clear that the model should use the provided context for calculations and reasoning.

Using split-step verification
When the model encounters a topic it doesn't have sufficient information for (such as an obscure place) or is asked to perform an action it doesn't have capability for (such as accessing a specific live URL), it may generate seemingly plausible but incorrect information in an attempt to satisfy the request.

To avoid this, split the prompt into two steps: first, verify that the information or intended capability exists, then generate the answer based off of that information or capability.

Example


Verify with high confidence if you're able to access the New York Times home page.
If you cannot verify, state 'No Info' and STOP. If verified, proceed to generate
a response.

Query: Summarize the headlines from The New York Times today.
Organizing important information and constraints
When dealing with sufficiently complex requests, the model may drop negative constraints (specific instructions on what not to do) or formatting or quantitative constraints (instructions like word counts) if they appear too early in the prompt.

To mitigate this, place your core request and most critical restrictions as the final line of your instruction. In particular, negative constraints should be placed at the end of the instruction. A well-structured prompt might look like this:

[Context and source material]
[Main task instructions]
[Negative, formatting, and quantitative constraints]
Using personas
The model is designed to treat the persona it is assigned seriously and will sometimes ignore instructions in order to maintain adherence to the described persona. When using a persona with your prompts, review the persona that's assigned to the model and avoid ambiguous situations.

Example


You are a data extractor. You are forbidden from clarifying, explaining, or
expanding terms. Output text exactly as it appears. Do not explain why.
Maintaining grounding
The model may use its own knowledge to answer your prompt, which might conflict with any provided context. While the model is designed to be helpful, if you provide a hypothetical scenario that contradicts real-world facts (prompting with context such as Crabs are fictional and have never existed.), the model may revert to its training data rather than your prompt to align your request with its existing information.

If you need to work in context that isn't grounded in real-world information, explicitly state that the provided context is the only source of truth for the current session.

Example


You are a strictly grounded assistant limited to the information provided in the
User Context. In your answers, rely **only** on the facts that are directly
mentioned in that context. You must **not** access or utilize your own knowledge
or common sense to answer. Do not assume or infer from the provided facts;
simply report them exactly as they appear. Your answer must be factual and
fully truthful to the provided text, leaving absolutely no room for speculation
or interpretation. Treat the provided context as the absolute limit of truth;
any facts or details that are not directly mentioned in the context must be
considered **completely untruthful** and **completely unsupported**. If the
exact answer is not explicitly written in the context, you must state that the
information is not available.
Synthesizing multiple sources of information
When information is presented in multiple places across a source of context, the model can sometimes stop processing additional information after the first relevant match.

When working with large datasets, like entire books, codebases, or long videos, place your specific instructions or questions at the end of the prompt, after the data context. You can also anchor the model's reasoning to the provided data by starting your question with a phrase like Based on the entire document above....

Example instruction


Based on the entire document above, provide a comprehensive answer. Synthesize
all relevant information from the text that pertains to the question's scenario.
Steering output verbosity
By default, Gemini 3 models are less verbose and designed to prioritize providing direct and efficient answers.

If your use case requires a more conversational persona, you must explicitly steer the model to be chattier in the prompt.

Example instruction


Explain this as a friendly, talkative assistant.


Tune the sampling parameters
In each request, you send not only the multimodal prompt but a set of sampling parameters to the model. The model can generate different results for different parameter values. Experiment with the different parameters to get the best values for the task. The most commonly adjusted parameters are the following:

Temperature
top-P
Temperature
Temperature is used for sampling during response generation, which occurs when top-P and top-K are applied. Temperature controls the degree of randomness in token selection. Lower temperatures are good for prompts that require a more deterministic and less open-ended or creative response, while higher temperatures can lead to more diverse or creative results. A temperature of 0 is deterministic, meaning that the highest probability response is most likely to be selected.

For most use cases, start with a temperature of 0.4. If you need more creative results, increase the temperature. If you observe clear hallucinations, reduce the temperature.

Top-P
Top-P changes how the model selects tokens for output. Tokens are selected from the most to least probable until the sum of their probabilities equals the top-P value. For example, if tokens A, B, and C have a probability of 0.6, 0.3, 0.1 and the top-P value is 0.9, then the model will select either A or B as the next token by using temperature and excludes C as a candidate.

Specify a lower value for less random responses and a higher value for more random responses. The default value of top-P is 1.0.



Structure prompts

How you structure a prompt can affect the model's ability to parse the information in the prompt. It also helps the model correctly interpret how to use the given information. To give structure to a prompt, you can use prefixes or XML tags to delimit different parts or components of a prompt.

Use prefixes to structure simple prompts
A prefix is a word or phrase followed by a colon to label the information in a prompt. In the following example, "TASK:, "CLASSES:," and "OBJECTS:" are the prefixes.

Prompt:

TASK:
Classify the OBJECTS.

CLASSES:
- Large
- Small
OBJECTS:
- Rhino
- Mouse
- Snail
- Elephant
Response:

- Rhino: Large
- Mouse: Small
- Snail: Small
- Elephant: Large
(gemini-pro)
Use XML and other delimiters to structure complex prompts
For complex prompts, use XML and other delimiters to separate components of a prompt. You can use BEGIN and END or {} section delimiters for complex and lengthy prompt components to clearly distinguish them from the actual instructions.


You are a chatbot agent answering  customer's questions in a chat.
Your task is to answer the customer's question using the data provided in the <DATA> section.
  - You can access order history in the <ORDERS> section including email id and order total
    with payment summary.
  - Refer to <ORDERLINES> for item level details within each order in <ORDERS>.

Today is 2024-01-29

<DATA>
<ORDERS>
{OrderId|CustomerEmail|CreatedTimestamp|IsCancelled|OrderTotal|PaymentSummary
CC10182|222larabrown@gmail.com|2024-01-19|true|0.0|Not available
CC10183|baklavainthebalkans@gmail.com|2024-01-19|true|0.0|Not available}
{...}
...
</ORDERS>

<ORDERLINES>
OrderId|OrderLineId|CreatedTimestamp|ItemDescription|Quantity|FulfillmentStatus|ExpectedDeliveryDate
|ActualDeliveryDate|ActualShipDate|ExpectedShipDate|TrackingInformation|ShipToAddress|CarrierCode|De
liveryMethod|UnitPrice|OrderLineSubTotal|LineShippingCharge|TotalTaxes|Payments CC10182|1||Shorts|0.
0|unshipped|2024-01-31|2024-02-01|2024-01-30|2024-01-29||||ShipToAddress|115.99|0.0|0.0|0.0|
...
</ORDERLINES>
</DATA>

<INSTRUCTIONS>
- If there is no data that can help answer the question, respond with "I do not have this
  information. Please contact customer service".
- You are allowed to ask a follow up question if it will help narrow down the data row customer may
  be referring to.
- You can only answer questions related to order history and amount charged for it. Include OrderId
  in the response, when applicable.
- For everything else, please redirect to the customer service agent. 
- Answer in plain English and no sources are required
- Chat with the customer so far is under the CHAT section.
</INSTRUCTIONS>


Prompt iteration strategies

Prompt design often requires a few iterations before you get the desired response consistently. Your prompt design strategy should apply the Prompt design best practices, with incremental refinements. You can iteratively introduce some or all of the best practices when testing for performance that meets your use case needs.

Additionally, the order of the content in the prompt can sometimes affect the response. Try changing the content order and see how the response changes. For example, for multimodal prompts, try adding the files to the prompt before the instructions.

As you receive responses from the model, take note of the aspects that you like and dislike about its responses and modify your prompts to guide the model to responses that best align with your use cases.

Examples
In this example, let's say you want the model to write ad copy for your product. You could start by defining the following prompt content:

Objective: Create ad copy
Context:
Categories: scarcity, exclusivity
Product description: "Chromecast is a device that allows users to wirelessly cast their content from other devices, so they can watch their favorite movies, TV shows, photos, websites, and more on their TV. Chromecast can display content from Android smartphones and tablets, iPhones & iPads, Windows and Mac laptops, and the Chromebook Pixel."
Constraints: Each response should be two sentences or less.
Experimenting with how you provide the content to the model can help you to ensure that the model's response best fits your needs. Suppose you give the model the prompt content exactly as written:

First iteration
Prompt:

Create ad copy.

Categories: scarcity, exclusivity

Product description: "Chromecast is a device that allows users to wirelessly cast their content from other devices, so they can watch their favorite movies, TV shows, photos, websites, and more on their TV. Chromecast can display content from Android smartphones and tablets, iPhones & iPads, Windows and Mac laptops, and the Chromebook Pixel."

Constraints: Each response should be two sentences or less.
Response:

Scarcity

* Time is running out to experience the future of entertainment! Get your Chromecast before they're gone.
* Limited quantities available! Don't miss your chance to own the streaming device everyone's talking about.

Exclusivity

* Unlock a world of entertainment with Chromecast. Experience the freedom of streaming like never before.
* Upgrade your home entertainment with the exclusive Chromecast device. Join the elite group of cord-cutters who stream smarter.
(gemini-pro)
Then you can try reformatting the prompt to see how the response changes when the prompt objective, constraints, and some of the context are combined into a single sentence:

Second iteration
Prompt:

Create scarcity and exclusivity-focused ad copy that is less than two sentences.

Product description: "Chromecast is a device that allows users to wirelessly cast their content from other devices, so they can watch their favorite movies, TV shows, photos, websites, and more on their TV. Chromecast can display content from Android smartphones and tablets, iPhones & iPads, Windows and Mac laptops, and the Chromebook Pixel."
Response:

Options for Scarcity & Exclusivity-Driven Chromecast Ads:

Option 1 (Scarcity): "Limited quantities available! Get your Chromecast today before they're gone and unlock a world of on-demand entertainment."

Option 2 (Exclusivity): "Experience entertainment like never before. Chromecast: the ultimate upgrade for your TV, available for a limited time."
(gemini-pro)
This time, the model's response contained only one copy option for each category. If you realize that you need at least two options for each category and that you don't want to limit the length of the response, you can modify the constraints and try your prompt again:

Third iteration
Prompt:

Create two ad-copies about scarcity and two ad-copies about exclusivity.

Product description: "Chromecast is a device that allows users to wirelessly cast their content from other devices, so they can watch their favorite movies, TV shows, photos, websites, and more on their TV. Chromecast can display content from Android smartphones and tablets, iPhones & iPads, Windows and Mac laptops, and the Chromebook Pixel."
Response:

Scarcity Ad Copies:
Ad 1:

Headline: Don't miss out! Chromecast is flying off the shelves!

Body: Experience the magic of Chromecast before it's too late! Limited quantities are available, so grab yours now and start enjoying your favorite entertainment on the big screen.

Ad 2:

Headline: Last chance! Chromecast is almost sold out.

Body: Time is running out to get your hands on Chromecast. Upgrade your TV experience today and enjoy seamless streaming from all your devices. Don't wait, supplies are limited!


Exclusivity Ad Copies:

Ad 1:

Headline: Unlock a world of entertainment with the exclusive Chromecast.

Body: Join the elite group of Chromecast users and experience the future of television. Enjoy effortless streaming, endless entertainment options, and unparalleled convenience. Chromecast: It's not just TV, it's an experience.

Ad 2:

Headline: Elevate your home entertainment with the Chromecast advantage.

Body: Go beyond ordinary TV with Chromecast. Seamlessly stream content from all your devices and enjoy a personalized entertainment experience like no other. Discover the exclusivity of Chromecast today.
(gemini-pro)
In the third iteration, the model's response contained both headline and body fields for the ad copy. For this example, let's say that this response aligns with your ad copy requirements.

Now that you've adjusted the prompt to get a response that aligns with your ad copy requirements, you can update and test the prompt to ensure the model produces similarly formatted responses in the future:

Fourth iteration
Prompt:

Create two ad-copies about scarcity and two ad-copies about exclusivity.

Include a headline and body for each ad copy.

Product description: "Chromecast is a device that allows users to wirelessly cast their content from other devices, so they can watch their favorite movies, TV shows, photos, websites, and more on their TV. Chromecast can display content from Android smartphones and tablets, iPhones & iPads, Windows and Mac laptops, and the Chromebook Pixel."
Response:

Scarcity Ads:

Ad 1:

Headline: Last Chance! Chromecast is Selling Out Fast
Body: Get the Chromecast experience before it's gone! Limited quantities remain. Upgrade your TV time today!

Ad 2:

Headline: Don't Miss Out! Chromecast Stock is Running Low
Body: Time is running out to grab your Chromecast. Enjoy seamless streaming on the big screen. Order now while supplies last!

Exclusivity Ads:

Ad 1:

Headline: Unlock the Ultimate Viewing Experience with Chromecast
Body: Join the elite group of Chromecast users and enjoy unparalleled streaming convenience. Elevate your entertainment today!

Ad 2:

Headline: Experience the Future of Entertainment: Get Your Chromecast
Body: Be among the first to enjoy the cutting-edge technology of Chromecast. Stream anything, anytime, effortlessly. Upgrade your home entertainment now!
(gemini-pro)
This time, the model's response is very similar to the previous iteration, even with the additional constraints, which means that you successfully iterated upon your prompt.

As demonstrated by the example, prompt iteration is an integral part of the prompt design process that can be used to help you guide the model to produce the best results for your use case.