# What Is Prompting?

Prompting is the process of providing instructions or "prompts" to an artificial intelligence system, particularly with **chatbots** like ChatGPT or Claude. When you provide your AI with a clear question, a specific task, or a creative prompt with context, it zooms in and generates higher quality results.

## **What Is GIGO?**

GIGO stands for “Garbage In, Garbage Out", **the quality of your input determines the quality of your output**. If you provide unclear, incomplete, or nonsensical inputs to an AI model, you’ll get similarly poor results in return.

Bad vs Good Prompt

|  | Prompt | Likely result |
| --- | --- | --- |
| Bad | "Tell me about Python." | A vague, generic overview. You don't know if you'll get the snake, the language, or its history. |
| Good | "You are a programming tutor. Explain Python lists to a beginner in under 150 words, with one code example." | A focused, beginner-friendly answer with an example, at the right length. |

**The Importance of Prompts**

A **prompt** is the initial input or instruction you give to an AI model. Think of it like this:

- If you want output “4, 5, 6”, you should provide input “1, 2, 3”
- If you instead provide “a, b, c”, you won’t get the numerical sequence you desire

AI-generated prompts can be generic if you don't give them enough context, so you should review and customize them.

Prompting Formats:

There are several established formats for structuring prompts:

1. Alpaca Prompt Format

```plaintext
### Instruction: [Task to perform]
### Input: [User input]
### Response: [Expected output]
```

Example:

```plaintext
### Instruction: Add the two numbers.

### Input: 2 and 2

### Response: 4 
```

```plaintext
<s>[INST] <<SYS>>
[Your system message here — optional, but useful for setting the tone or behavior of the model.]
<</SYS>>

[Your instruction or question here — this is what you want the model to respond to.] [/INST]
[The model's response goes here]
```

Example:

```plaintext
<s>[INST] <<SYS>>
You are a helpful and friendly assistant.
<</SYS>>

How do I make spaghetti carbonara? [/INST]
```

3. ChatML

Example:

```plaintext
<|im_start|>system
You are a code explainer.<|im_end|>
<|im_start|>user
Explain this Python snippet.<|im_end|>
```

## Prompt Types:

1. **Zero shot prompting:**
   - Zero shot prompting means that the prompt will not contain any kind of examples.

     ![](https://cdn.hashnode.com/uploads/covers/6ac64ead971136340615b3da/01e3a755-0a79-4233-a500-442238dbffa2.png align="center")
   - **Example:**\
     *Prompt*: “Write a short story about a journey through space.”\
     *AI Output*: The stars glittered like diamonds against the vast emptiness of space. As the spaceship zoomed past distant ...
2. **Few shot prompting:**
   - Few shot prompting means giving prompts with some examples.

     ![](https://cdn.hashnode.com/uploads/covers/6ac64ead971136340615b3da/e54464a8-9004-41cd-8631-1e4070aa23a1.png align="center")
   - **Example**:\
     Classify the sentiment of each review as Positive or Negative.

     Review: "Great phone, super fast and the screen is gorgeous!" Sentiment: Positive

     Review: "Battery died in a day and the camera is blurry." Sentiment: Negative

     Review: "Delivery was quick and the packaging was perfect." Sentiment: Positive

     Review: "The camera quality is amazing, totally worth the price." Sentiment:
   - output: Positive
3. **Chain-of-Thought Prompting (add just before Self-consistency, since it leads into it)**
   - Chain-of-thought (CoT) prompting asks the model to reason step by step before giving the final answer. This improves accuracy on math, logic, and multi-step problems.

     ![](https://cdn.hashnode.com/uploads/covers/6ac64ead971136340615b3da/1195568b-bb27-4bd2-a7b3-55d9d063735b.png align="center")

     ```plaintext
     Q: A shop sells pens at 12 rupees each. I buy 5 pens and pay with a 100 rupee note. How much change do I get?
     Think step by step.
     ```

     **AI Output:** "5 pens cost 5 × 12 = 60 rupees. Change = 100 − 60 = 40 rupees. Answer: 40 rupees."

     Self-consistency builds on this idea: it runs chain-of-thought several times and picks the answer most runs agree on.
4. **Self-consistency prompting:**
   - Self-consistency prompting is a technique where an AI model generates multiple responses for the same query, each through a different reasoning path. It then selects the final answer using aggregation techniques such as majority voting, choosing the most consistent output.

     ![](https://cdn.hashnode.com/uploads/covers/6ac64ead971136340615b3da/5692a795-bb17-49ee-a8af-1969c6a1ba11.png align="center")
   - ***Example*** : Basic Arithmetic Reasoning\
     Prompt 1: "If I have 3 apples and I give away 1 apple, how many apples do I have left? Think step by step."
     1. *Without Self-Consistency (Single Response)*

     In a standard approach without self-consistency, the model generates only one answer based on a single reasoning path.

     Model Answer: "I have 2 apples left."

     This answer may be correct, but it depends on a single reasoning path and is not verified.
     2. *With Self-Consistency Prompting (Multiple Responses)*

     With self-consistency prompting, the model generates multiple answers using different reasoning paths to improve reliability.

     *Response 1:* "I start with 3 apples. If I give 1 apple away, I subtract 1 from 3, leaving me with 2 apples."\
     Response 2: "I have 3 apples. After giving 1 apple away, I have 3 - 1 = 2 apples left."\
     *Response 3:* "If I take away 1 apple from my 3, that leaves me with 2 apples." Aggregation: All three responses agree that the correct answer is 2 apples. Since the responses are consistent, the final answer is selected as 2 apples.\
     However, if the responses had differed, for example:

     *Response 1:* "I have 3 apples. I give away 1, so I have 1 apple left." *Response 2:* "3 apples minus 1 apple is 2 apples."\
     *Response 3:* "3 apples minus 1 is 2 apples." Here, there is one response saying 1 apple and two responses saying 2 apples. Model would select 2 apples as the final answer since it is the more consistent answer.
5. **Persona based prompting**
   - Persona prompting controls *how the model sounds and what expertise it brings*. You give it an identity or voice, then ask for a single piece of output.
   - **Example:**\
     *Prompt:* "You are a senior nutritionist with 15 years of experience.\
     Explain why protein is important after a workout, in simple language\
     for a beginner."
6. Role-playing prompting
   - **Role-playing prompting** sets up an *interactive scenario* where the model plays a character and you play another. It's a back-and-forth, not a one-shot answer.
   - **Example**:\
     Prompt: "Act as an interviewer for a Node.js developer position. I am the candidate. Ask me one question at a time, wait for my answer, then give brief feedback before moving to the next question."
