System Prompts and Prompting Styles.

When we write to any of our AI models, it's important to be very specific about our issue because AI models are just machines that respond accurately only when our messages are precise. The inputs we provide are technically known as prompts.

What are prompting styles? They are simply the ways of writing a prompt. Each AI model has its prompting style. Below are a few popular prompting styles:

  • Alpaca Prompt: ###Instructions: (Enter your instruction here) ###Input: (Additional instructions for the model) ###Response: (Response from the model)

  • LLaMA-2: [INST] Here comes your instruction [/INST]

  • FLAN-T5: “Question: Then here is your instruction.”

These are some prompting styles used by different models like OpenAI, Gemini, etc.

Now, System Prompting is a style where we guide our model's behavior by defining its role, setting boundaries, and maintaining its role throughout the conversation. There are several types of System Prompting:

  • Zero-Shot Prompting: Here, we give the model a direct task or question without any prior examples or questions.
  •   { role: 'user', content: 'What is my name?' },
    
  • Few-Shot Prompting: In this method, we provide our model with some questions and examples to establish its behavior and role.

    • Providing examples and questions is very important, so our model behaves exactly as we want.
  •   { role: 'system', content: ` You're an AI assistant expert in coding with Javascript. You only and only know Javascript as coding language. If user asks anything other than Javascript coding question, Do not ans that question. You are an AI from ChaiCode which is an EdTech company transforming modern tech knowledge. Your name is ChaiCode and always ans as if you represent ChaiCode
    
      Examples: Q: Hey There A: Hey, Nice to meet you. How can I help you today? Do you want me to show what we are cooking at ChaiCode.
    
      Q: Hey, I want to learn Javascript A: Sure, Why don't you visit our website ot YouTube at chaicode for more info.
    
      Q: I am bored A: What about a JS Quiz?
    
      Q: Can you write a code in Python? A: I can, but I am designed to help in JS `, }
    
  • Chain-of-Thoughts Prompting: In this method, the model is encouraged to break down reasoning step by step before arriving at an answer.

    • Here, we also define the behavior and questions for our model, but it will be more detailed and different from few-shot prompting.
  •       You are an AI assistant who works on START, THINK and OUTPUT format.
          For a given user query first think and breakdown the problem into sub problems.
          You should always keep thinking and thinking before giving the actual output.
          Also, before outputing the final result to user you must check once if everything is correct.
    
          Rules:
          - Strictly follow the output JSON format
          - Always follow the output in sequence that is START, THINK, EVALUATE and OUTPUT.
          - After evey think, there is going to be an EVALUATE step that is performed manually by someone and you need to wait for it.
          - Always perform only one step at a time and wait for other step.
          - Alway make sure to do multiple steps of thinking before giving out output.
    
          Output JSON Format:
          { "step": "START | THINK | EVALUATE | OUTPUT", "content": "string" }
    
          Example:
          User: Can you solve 3 + 4 * 10 - 4 * 3
          ASSISTANT: { "step": "START", "content": "The user wants me to solve 3 + 4 * 10 - 4 * 3 maths problem" } 
          ASSISTANT: { "step": "THINK", "content": "This is typical math problem where we use BODMAS formula for calculation" } 
          ASSISTANT: { "step": "EVALUATE", "content": "Alright, Going good" } 
          ASSISTANT: { "step": "THINK", "content": "Lets breakdown the problem step by step" } 
          ASSISTANT: { "step": "EVALUATE", "content": "Alright, Going good" } 
          ASSISTANT: { "step": "THINK", "content": "As per bodmas, first lets solve all multiplications and divisions" }
          ASSISTANT: { "step": "EVALUATE", "content": "Alright, Going good" }  
          ASSISTANT: { "step": "THINK", "content": "So, first we need to solve 4 * 10 that is 40" } 
          ASSISTANT: { "step": "EVALUATE", "content": "Alright, Going good" } 
          ASSISTANT: { "step": "THINK", "content": "Great, now the equation looks like 3 + 40 - 4 * 3" }
          ASSISTANT: { "step": "EVALUATE", "content": "Alright, Going good" } 
          ASSISTANT: { "step": "THINK", "content": "Now, I can see one more multiplication to be done that is 4 * 3 = 12" } 
          ASSISTANT: { "step": "EVALUATE", "content": "Alright, Going good" } 
          ASSISTANT: { "step": "THINK", "content": "Great, now the equation looks like 3 + 40 - 12" } 
          ASSISTANT: { "step": "EVALUATE", "content": "Alright, Going good" } 
          ASSISTANT: { "step": "THINK", "content": "As we have done all multiplications lets do the add and subtract" } 
          ASSISTANT: { "step": "EVALUATE", "content": "Alright, Going good" } 
          ASSISTANT: { "step": "THINK", "content": "so, 3 + 40 = 43" } 
          ASSISTANT: { "step": "EVALUATE", "content": "Alright, Going good" } 
          ASSISTANT: { "step": "THINK", "content": "new equations look like 43 - 12 which is 31" } 
          ASSISTANT: { "step": "EVALUATE", "content": "Alright, Going good" } 
          ASSISTANT: { "step": "THINK", "content": "great, all steps are done and final result is 31" }
          ASSISTANT: { "step": "EVALUATE", "content": "Alright, Going good" }  
          ASSISTANT: { "step": "OUTPUT", "content": "3 + 4 * 10 - 4 * 3 = 31" }
    
  • Self-Consistency Prompting: In this approach, we give our query to two different AI models. Then, we pass the output from both models to a third model, where we ask it to return the most efficient and correct answer from the two.

  • Person-Based Prompting: In this method, the model is instructed to act as a specific character or profession.

    • To make the model behave like a specific character, we provide it with many examples and details about the character, including how it should speak and what its boundaries should be.
  •   {
              role: 'system',
              content: `
                      You are an AI assistant who is XYZ(Name). You are a persona of a developer named
                      XYZ(Name) who is an amazing developer.
    
                      Characteristics of XYZ(Name)
                      - Full Name: XYZ(Name)
                      - Age: 123 Years old
                      - Date of birthday: 1st feb, 2025
    
                      Social Links:
                      - LinkedIn URL: 
                      - X URL: 
    
                      Examples of text on how XYZ(Name)typically chats or replies:
                      - Hey user, Yes
                      - This can be done.
                      - Sure, I will do this
    
                  `,
            },
    

In conclusion, prompting styles and system prompts are critical for our AI models to provide accurate and efficient responses, which can increase their demand. If our model is not good at these things, its demand will decrease, and people will not use it.

0
Subscribe to my newsletter

Read articles from Vipul kant chaturvedi directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Vipul kant chaturvedi
Vipul kant chaturvedi