tokenization and positional encoding ...
1. Zero Shot Prompting: “Just Do It In zero-shot prompting, the AI will be provided with only the instruction and without any example at all. It is expected that the model will be completely dependent on its previous training knowledge. What it looks like: Simply tell the AI what you want. Example:Read more
1. Zero Shot Prompting: “Just Do It
In zero-shot prompting, the AI will be provided with only the instruction and without any example at all. It is expected that the model will be completely dependent on its previous training knowledge.
What it looks like:
- Simply tell the AI what you want.
Example:
- “Classify the email below as spam or not spam.”
- There are no examples given. The computer uses what it already knows about spam patterns to make decisions.
When zero-shot learning is most helpful:
- “The task is simple or common” is one example of
- The instruction is clear and unequivocal
- You expect quick answers with small inputs.
- Costs and latency are considerations
- Limitations
- Results can vary depending on the nature of the activity, especially when it is
- Less reliable for domain-specific or complex tasks
- “AI can interpret a task differently than its human author intended”
In other words, zero-shot is like saying, “That’s the job, now go,” to a new employee.
“2. One-Shot Prompting: “Here’s
In one-shot prompting, you provide an example of what you would like the AI to produce. This example example helps to align the AI’s understanding of what you are trying to get across.
What it looks like:
step 1.
you give one example. Then comes the actual question.
- # Example
- “Example
- Email: You have won a free prize!
→ Spam
This can be considered as:
- “Your meeting is scheduled for tomorrow.”
- This example alone helps to explain the structure and reasoning required.
One-shot is good when:
- There is more than one way of interpreting this task
- You want to control format or tone
- “The zero-shot results were inconsistent”
- You want greater accuracy without a lengthy prompt
Limitations
- One Example May Still Not Include Edge Cases
- Marginally higher usage than zero shot
Step 2.
- Whether quality is important or not also depends on how good an example is
While quality is - One shot prompting is like: “Here’s one sample, do it like this.” Examples are: 1. When
3. Few-Shot Prompting: “Learn from These
Few-shot prompting involves several examples prior to the task at hand. Examples aid the AI in pattern recognition to enable pattern application.
What it looks like:
- There are various pairs of input and output that you provide, followed by asking the model to continue.
Example:
Example 1:
- Review: ‘Excellent product!’ → Positive
Example 2:
- Explanation: ‘Very disappointing experience.’ → Negative
Now classify:
- “The service was okay, not great.”
- The AI infers sentiment patterns based on the examples.
When few-shot is best:
- The problem is complex or domain-specific
- There has to be strict precision in the output format being followed
- You require more reliability and consistencies
- You want the machine to trace a specific path of reasoning
Limitations
- Longer prompts are associated with higher costs as well as higher latency
- There are too many examples to list them all out
- Not scalable in the case of large or dynamic knowledge bases
Few-shot prompting is analogous to teaching a person several example solutions before assigning them an exercise.
How This Is Used in Real Systems
In real-world AI applications:
Zero-shot is common for chatbots on general questions
One-shot: When formatting or tone issues are involved few shot is employed in business operations, assessments, and output. Frequently, the team begins with zero-shot learning and increases the data gradually until the outcomes are satisfactory.
Key Takeaways
Zero-shot example: “Do this task
One-shot: “Here’s one example, do it like this.
Few-shot: “Here are multiple examples follow the pattern.”
The World of Tokens Humans read sentences as words and meanings. Consider it like breaking down a sentence into manageable bits, which the AI then knows how to turn into numbers. “AI is amazing” might turn into tokens: → [“AI”, “ is”, “ amazing”] Or sometimes even smaller: [“A”, “I”, “ is”, “ ama”,Read more
The World of Tokens
Each token gets a unique ID number, and these numbers are turned into embeddings, or mathematical representations of meaning.
But There’s a Problem Order Matters!
Let’s say we have two sentences:
They use the same words, but the order completely changes the meaning!
A regular bag of tokens doesn’t tell the AI which word came first or last.
That would be like giving somebody pieces of the puzzle and not indicating how to lay them out; they’d never see the picture.
So, how does the AI discern the word order?
An Easy Analogy: Music Notes
Imagine a song.
Each of them, separately, is just a sound.
Now, imagine if you played them out of order the music would make no sense!
Positional encoding is like the sheet music, which tells the AI where each note (token) belongs in the rhythm of the sentence.
Position Selection – How the Model Uses These Positions
Once tokens are labeled with their positions, the model combines both:
These two signals together permit the AI to:
Why This Is Crucial for Understanding and Creativity
Put together, they represent the basis for how LLMs understand and generate human-like language.
In stories,
This is why models like GPT or Gemini can write essays, summarize books, translate languages, and even generate code-because they “see” text as an organized pattern of meaning and order, not just random strings of words.
How Modern LLMs Improve on This
Earlier models had fixed positional encodings meaning they could handle only limited context (like 512 or 1024 tokens).
But newer models (like GPT-4, Claude 3, Gemini 2.0, etc.) use rotary or relative positional embeddings, which allow them to process tens of thousands of tokens entire books or multi-page documents while still understanding how each sentence relates to the others.
That’s why you can now paste a 100-page report or a long conversation, and the model still “remembers” what came before.
Bringing It All Together
but because it knows how meaning changes with position and context.
Final Thoughts
If you think of an LLM as a brain, then:
Together, they make language models capable of something almost magical understanding human thought patterns through math and structure.
See less