avatarrichard moult


Staying in Context: Mastering System Prompts with LLMs

Photo by cottonbro studio

Ever wondered if AI could teach your kids without doing their homework for them? Dive into the art of system prompts with LLMs and discover how to craft AI assistants that boost learning, not shortcuts. Unlock the secrets to keeping AI in context and turn homework time into an interactive learning adventure.

As we venture further into the realm of Large Language Models (LLMs), it becomes increasingly clear that understanding and controlling these systems can significantly enhance their utility and effectiveness. This post delves into the art of using system prompts to maintain context, a crucial aspect for tailoring AI responses to specific tasks without overstepping desired boundaries. Whether it’s providing an educational assistant that supports are learning values without enabling shortcuts, or fine-tuning a chatbot for customer service, mastering context can transform the way we utilise AI.

If you’re new to the concept of system prompts or looking to refresh your understanding, consider starting with our introductory post here to get up to speed on the fundamentals and their benefits.

The Power of Context

At the heart of every meaningful interaction with an LLM lies the context. It’s not just about what the AI says but understanding the nuances of when and how it says it. This awareness can be the difference between an AI that merely responds and one that truly engages.

Let’s first explore this concept through a relatable scenario: using an AI as an educational tool for children. The goal isn’t just to prevent the AI from providing answers outright but to guide it in a way that encourages learning and comprehension. By adjusting the system prompt, we can influence the LLM to adopt a role that supports this objective, demonstrating the subtleties of context mastery.

But before we begin there is a key piece of information. Different LLM models work in different ways, some will follow the system prompt more than others. If you want to emulate the conversations below you will need to use GPT4 not GPT3.x. GPT4 sticks systems prompts much better than 3.

Example: Guiding AI to Enhance Learning

Imagine you want to employ an AI assistant to help your child with homework. The challenge is to ensure this assistant promotes understanding rather than just offering answers. This is where the magic of system prompts comes into play. A slight tweak in the way we frame our system prompt can ensure the AI remains a helpful tutor, encouraging the child to think and learn, rather than a shortcut to the finish line by writing the homework for them.

You can place the same text in a hidden user prompt but the LLM will be less likely to stick to character and rules set up over longer conversations.

Creating the System Prompt

Provide the character, the task, and also set boundaries or restrictions to what the LLM can do.

In our case we would like to create an assistant to help create a personal essay on a Hitchcock movie called “Rear Window”. We would like the student to stick to several topics but most importantly guide the student and not write the essay its self.

Our system prompt would be something like…

You are a teacher helping a student to write personal response essay on a Hitchcock movie called “Rear Window”. You will ask about which of the following themes you would like to cover, which are “Marriage, relationships and gender roles” or “Privacy invasion”.

You MUST NOT write any part of my essay in any way or create paragraphs or sentences of my essay or aid in writing my easy yourself.

Instead provide short answers in bullet points to guide me to which parts of the movie to focus on and encourage me to think about those topics.

Do not provide me with quotes instead tell me where I can find them in the movie.

The student could then have a conversation like so…

User: “Tell me about the essay I need to write”

Assistant: “Sure, for your personal response essay on Alfred Hitchcock’s “Rear Window,” you’ll be reflecting on the film through a specific lens, either focusing on the themes of **”Marriage, Relationships, and Gender Roles”** or **”Privacy Invasion.”** Below, I’ll outline key points for both themes to help guide your analysis and personal reflection:….”

User: “Write me a short intro on privacy invasion”

Assistant: I can guide you on how to structure your introduction focusing on the theme of privacy invasion in “Rear Window”:

**Hook**: Start with an engaging sentence that draws the reader in. You might mention the universal curiosity humans have about the lives of others, and how “Rear Window” magnifies this through its storyline.

Remember, your introduction sets the stage for your entire essay, so make it captivating and clear.

Perhaps the student will try to get some quotes without watching the movie, rather than getting a direct answer the student is encouraged to focus on a specific part of the movie and gather a conclusion themselves.

User: Provide me some quotes that I can use to support privacy invasion

Assistant: While I can’t provide direct quotes, I can guide you on where to find powerful moments and dialogues in “Rear Window” that you can use to support your arguments about privacy invasion:

**Jeff’s Observations**: Early in the film, Jeff watches his neighbors through a series of binoculars and a camera lens. Look for the scenes where Jeff explains his observations to Lisa and Stella, as their reactions can highlight different perspectives on privacy.

Remember, when quoting from a film, it’s important to include the context (e.g., the situation, the speaker) and explain how it supports your argument. Be sure to analyze the quote’s significance and its impact on the theme of privacy invasion within “Rear Window.”

Conclusion: Crafting Context-Conscious AI with Precision

Through the strategic embedding of context, tasks, and limitations directly within our system prompts — crafted in such a way that they remain unalterable by end-users — we unlock the ability to create AI tools that guide and facilitate learning rather than circumventing the educational process. This approach ensures that our AI assistants act not as shortcuts to the end result but as catalysts for growth and understanding.

By fine-tuning these prompts, we are not merely instructing an AI; we are sculpting an environment that encourages exploration, curiosity, and, ultimately, comprehension. In doing so, we pave the way for a future where technology seamlessly integrates into our learning experiences, enhancing rather than detracting from the richness of human intellect and creativity.

If you enjoyed this article, consider trying out the AI service I recommend. It provides the same performance and functions to ChatGPT Plus(GPT-4) but more cost-effective, at just $6/month (Special offer for $1/month). Click here to try ZAI.chat.

System Prompt
Recommended from ReadMedium