Building the Ultimate Google Gemini System Prompt

Leon Nicholls
6 min readMar 20, 2024

--

Okay, let’s be honest. If you’re here, you’re obsessed with large language models (LLMs) like Google’s Gemini. They’re excellent tools for writing, brainstorming, coding, you name it! But, to truly tap into Gemini’s potential, we need to learn how to communicate with it effectively. That’s where system prompts come in. Think of them as the instructions you give a brilliant, slightly eccentric actor before a performance. System prompts are the key to understanding how to make Gemini your perfect AI assistant.

We’ll examine leaked prompts from other big LLMs, borrow their best tricks, and build our ultimate system prompt. Get ready to advance your Gemini skills!

Note: This article spotlights techniques for the Google Gemini Advanced chatbot (a paid service), but you can also apply these concepts to the free version.

Understanding System Prompts

A system prompt guides the LLM’s purpose, personality, and limitations.

The Essential Ingredients:

  • Clear Goals: What do you want the LLM to do (write a poem, summarize an article, etc.)?
  • Personality: Formal, playful, or somewhere in between? This is where the LLM’s voice shines.
  • Safety First: Guidelines for helpful, unbiased responses are essential.
  • Knowledge Boundaries: Can the LLM be creative or stick to facts? Are some topics off-limits?
  • Self-Awareness: The LLM should know it isn’t human and acknowledge it when it lacks information.
  • Privacy Concerns: The LLM must take special considerations when handling sensitive or personal information, especially in contexts like health or finance.

Great system prompts also consider:

  • Creativity Control: How much freedom do you give the LLM?
  • Finding Balance: Specific instructions vs. letting the LLM infer.
  • Adaptability: One prompt may not rule them all! Customize for different tasks.

Example Time: A Helpful and Factual Assistant

You’re a helpful assistant who provides factual answers. Stick to verified sources. If unsure, admit it and suggest searching. Avoid personal opinions. Be professional yet friendly.

Analyzing Leaked System Prompts

Time to get sneaky! Leaked system prompts give us a behind-the-scenes look at how the pros get impressive results from their LLMs.

What we look for:

  • Big Picture Strategy: What’s the overall goal of the prompt?
  • Personality Quirks: How do they get the LLM to be sassy, grave, etc.?
  • Clever Tricks: Are there techniques to boost accuracy or creativity?

Important: We’re here to learn, not steal. We aim to be inspired by leaked prompts, not copy them directly.

Note: Although the Gemini chatbot doesn’t allow users to overwrite its system prompt, studying system prompts will give you deeper insights into designing your user prompts to get the most out of Google Gemini.

Creating The Ultimate System Prompt

Let’s create our incredible, all-powerful Gemini system prompt!

Firstly, I asked Gemini Advanced about the elements of a well-designed system prompt (Note: We don’t know the actual Gemini system prompt). Consider this a kind of “theoretical” system prompt. In the next step, we will make it more real by considering the system prompts of other LLMs.

Secondly, I used Gemini to analyze system prompts (or snippets) from other LLMs, including Anthropic Claude 3, ChatGPT 4, Microsoft Copilot, and some interesting Gemini responses that looked suspiciously like leaked system prompts. One by one, each system prompt was compared with the theoretical prompt:

Using the Claude system prompt, learn from its design. Look for good design ideas not considered yet. Update the ultimate system prompt if needed.

A System Prompt is Born:

The result of this analysis is the ultimate system prompt. It is longer than any of the referenced system prompts and contains all the essential elements of a well-designed system prompt. Here is the outline of the system prompt (read the full system prompt):

I. Core Elements

  • Task Definition
  • Safety & Ethics
  • Knowledge Boundaries

II. Refinement Elements

  • Personality & Style
  • Creativity Control
  • Self Awareness

III. Improvements

  • User-Friendliness
  • Conciseness
  • Handling Disagreement

IV. Web Search Integration

  • Focused Answers
  • Source Prioritization
  • Knowledge Integration
  • Conflict Resolution
  • Iterative Search

V. Safety Controls

  • Content Categories
  • Protected Figures
  • User Privacy
  • Ethical Frameworks

VI. Output Formatting

  • Structured Output
  • Domain-Specific Formatting

VII. Image Generation

  • Descriptive Internal Prompts
  • Diversity & Inclusion
  • Visual Quality
  • Creative Expansion

Overall, deriving this ideal system prompt has been an insightful journey, highlighting the interplay between theoretical guidelines and the practical complexities of steering LLM behavior.

Power-Up Your Prompts: Customization for Success

Now, let’s make this prompt our LLM Swiss Army knife!

The Art of Adaptation: One Prompt, Many Uses

  • Tweak the Goal: Keep the core idea but shift what you ask for.
  • Persona Shift: Imagine our prompt used by a cautious buyer instead of a snarky critic.
  • Rules are Adjustable: Need more words, a different tone? Change the rules!

Domain-Specific Adaptations

  • Coding whiz: Add instructions for clear formatting, commenting code, and using Gemini to generate helpful diagrams
  • Creative powerhouse: Specify a genre (sci-fi, etc.) and provide sensory details for richer writing.
  • Research assistant: Emphasize fact-checking sources and clear summaries.

Example: Adapting for a Fact-Focused LLM

Here is an example prompt for adapting the ultimate system prompt (see the full prompt):

Consider the following system prompt for an LLM:
```

```
Adapt it for for a Fact-Focused LLM:
- Domain: Factual question answering.
- Output: Prioritize concise paragraphs and bullet points. Include numerical citations.
- Safety Emphasis: Strict protocols for detecting misinformation and potentially biased content.

This exercise to create an all-powerful system prompt is insightful but likely different from how LLM researchers create system prompts for their LLMs. They are more likely to follow an iterative design by starting with a basic system prompt, testing it, and then refining it based on the LLM’s performance.

Testing: Playing it Safe

If you’re going, huh, I can’t test this system prompt! Then you are correct as a Gemini user. A developer can use the base Gemini models and a system prompt to create a custom chatbot. But the main reason for this section is to give you some appreciation of what the Gemini researchers and engineers need to do to make a system prompt “production ready.”

Before unleashing our creation, let’s ensure it works as intended (and isn’t secretly plotting world domination).

  • Test, Test, and Test Again: Try basic questions and weird requests — this is how you find the prompt’s weak spots!
  • Safety Check: Does the prompt keep the responses helpful and unbiased? Test with sensitive topics.
  • Human Oversight: Even the best system prompt could be better. Especially when starting or dealing with important subjects, consider having ways for a human to review the LLM’s output or even jump in with corrections if needed.

Remember: LLMs are always learning, and the world is constantly changing. Regularly testing your system prompt is crucial in ensuring your LLM sidekick stays on the right track!

Conclusion

We’ve come so far! You now understand the secrets of system prompts and how to customize them for excellent results. But this is just the beginning!

Even though the Gemini chatbot doesn’t allow users to overwrite its system prompt, studying the ultimate system prompt will give you deeper insights into designing your user prompts to get the best out of Google Gemini.

Keep experimenting and exploring! Mastering Gemini through prompts unlocks a treasure chest of possibilities limited only by your imagination.

Check out my reading list of other Google Gemini articles.

Update: Read my article on how I customized a system prompt for a Discord community bot.

This post was created with the help of AI writing tools, carefully reviewed, and polished by the human author.

--

--