Basics of GenAi

1. Key Full Forms
| Acronym | Full Form | Short Meaning | Example Use |
| LLM | Large Language Model | AI model trained on massive text data to understand and generate language | ChatGPT answering your questions |
| GPT | Generative Pre-trained Transformer | Type of LLM trained in two steps — first learns language patterns from huge data, then fine-tuned for tasks | GPT-4 writing a blog post |
| RAG | Retrieval-Augmented Generation | Technique where an LLM fetches extra data from an external source before answering, so it’s more accurate | An AI that searches a company database before replying |
2. LLMs (Large Language Models)
Definition: AI models trained on huge amounts of text data to understand and generate human-like language.
Example: ChatGPT, Claude, Gemini — they can answer questions, write essays, or even generate code.
Analogy: Like a super well-read friend who has read millions of books and can talk about almost anything.
3. GPT vs Reasoning Apps
| Feature | GPT (General Purpose) | Reasoning App |
| Main Goal | Broad knowledge & natural conversation | Deep logical problem solving |
| Strengths | Creativity, language understanding, knowledge recall | Step-by-step reasoning, decision making |
| Example | GPT can write a poem or explain a science topic | A reasoning app can solve a complex math puzzle or plan a multi-step project |
4. Few LLMs & Their Capabilities
| LLM Name | Key Strengths | Example Use |
| GPT-4 / GPT-5 | Language understanding, creativity, coding | Writing blogs, solving coding problems |
| Claude | Long context handling, polite tone | Analyzing 100+ page documents |
| Gemini | Google search integration | Real-time updated answers |
| LLaMA | Open-source flexibility | Custom AI projects |
| Gemma 2 Instruct | Supports tool calling (can call APIs, databases, or other functions directly from responses) | Automating workflows — e.g., getting live stock prices, booking flights, or triggering scripts |
5. Tokens & Tokenizers
Tokens: Small pieces of text (words or subwords) that an LLM reads and processes.
Key Point: Models understand tokens, not whole words.
Tokenizer: Breaks a sentence into tokens; different models use different tokenizers.
Example: “I love cats” →
"I"," love"," cats""unbelievable"→"un","believ","able"
Tiktoken: Example tokenizer used by OpenAI models.
Billing: You pay for tokens, not words.
6. Context
Definition: The combined information the model uses to generate a response.
Made up of:
User Inputs — Latest prompt
Instructions — Rules or roles for the AI
Additional Information — Facts, uploaded files, retrieved documents
Message History — Previous conversation turns
Example: Asking "Summarize this report" includes the report, your request, prior clarifications, and assigned roles.
7. Context Window
Definition: Maximum number of tokens the model can remember at once.
Examples:
GPT-3: ~2,048 tokens (~1,500 words)
GPT-4.1: Up to 1 million tokens (~750,000 words)
8. Knowledge Cutoff
Definition: Latest date up to which the model has been trained.
Why it matters: Model won’t know events after this date unless connected to real-time tools.
9. Attention Is All You Need
Definition: Research paper introducing Transformer architecture, which powers modern LLMs.
Key idea: Uses attention to focus on important words rather than reading sequentially.
10. Distilled LLMs
Definition: Smaller, faster versions of big LLMs via knowledge distillation.
Benefits: Faster, cheaper, lighter.
Trade-off: Slightly less depth in answers.
11. GroqCloud
- Definition: Cloud platform providing ultra-fast inference using Groq chips.
12. Inference
Definition: Time it takes for a model to process input and produce output.
Factors: Model size, hardware, task complexity.
13. Prompt Engineering
- Definition: Crafting prompts to improve answer quality, accuracy, and consistency. Good prompt engineering ensures the model outputs what you want in a clear, reliable way.
Types of Prompting & When to Use
| Prompt Type | When to Use | Pros | Cons | Notes |
| Zero-shot | Simple tasks, when no examples are available | Quick, no setup` | Can be inconsistent, prone to hallucination | Works for general questions but less reliable for complex or multi-step tasks |
| Few-shot | Complex tasks, when accuracy and consistency matter | More reliable, reduces hallucination, guides style | Requires examples, slightly more setup | Preferred for multi-step tasks or specific formats |
| Chain-of-Thought (CoT) | Reasoning or multi-step problems, explaining logic | Produces step-by-step reasoning, helps debugging | Slower, verbose | Not needed if using reasoning-focused models (they handle steps internally) |
| Negative Prompting | Avoiding unwanted outputs (e.g., “Do not include…” instructions) | Can steer model away from errors | Can confuse model if overused | Use sparingly, combine with clear positive instructions |
Elements of a Prompt
| Element | Description | Example |
| Instructions | What the model should do | “Write a formal email” |
| Input Data | Content or question to process | “Client request: …” |
| Context | Extra guidance | “You are an expert in project management” |
| Output Indicator | How answer should be formatted | “Use bullet points, max 150 words” |
When to Use Each Prompt
Zero-shot: Quick answers, testing ideas, or general questions.
Few-shot: When style, accuracy, or specific formatting matters.
CoT: Multi-step reasoning or tasks needing logic explanations.
Negative prompting: Only to steer away from specific unwanted behaviors; combine with positive instructions.
Types of Prompting with Examples
1. Zero-shot Prompting
(No examples are given; just instructions and input.)
✅ Example 1:
Prompt:
“Translate the following sentence into French: I love learning new things.”
Output:
“J’aime apprendre de nouvelles choses.”
✅ Example 2:
Prompt:
“Write a tweet about coffee in less than 15 words.”
Output:
“Coffee: the fuel that turns thoughts into action. ☕🔥”
2. Few-shot Prompting
(A few examples are provided before asking the model to generate new outputs.)
✅ Example 1:
Prompt:
“Classify the sentiment of the following reviews as Positive, Neutral, or Negative.
‘The food was delicious and service was amazing!’ → Positive
‘The movie was okay, nothing special.’ → Neutral
‘The product broke the first day I used it.’ → Negative
Now classify: ‘The delivery was quick but packaging was bad.’”
Output:
“Neutral”
✅ Example 2:
Prompt:
“Convert numbers to words.
42 → forty-two
103 → one hundred three
999 → nine hundred ninety-nine
Now convert: 275”
Output:
“two hundred seventy-five”
3. Chain-of-Thought (CoT) Prompting
(Ask model to “think step by step” for reasoning tasks.)
✅ Example 1:
Prompt:
“If a train travels 60 km in 1 hour, how far will it travel in 4.5 hours? Think step by step.”
Output (CoT):
Speed = 60 km/h
Time = 4.5 hours
Distance = 60 × 4.5 = 270 km
Final Answer: 270 km
✅ Example 2:
Prompt:
“A shopkeeper bought 50 apples at ₹20 each. He sold them at ₹25 each. What is his profit? Think step by step.”
Output (CoT):
Cost price per apple = ₹20
Selling price per apple = ₹25
Profit per apple = 25 – 20 = ₹5
Total apples = 50
Total profit = 50 × 5 = ₹250
Final Answer: ₹250
4. Negative Prompting
(Steer the model away from unwanted behavior.)
✅ Example 1:
Prompt:
“Write a professional email to a client about project delay. Do not use any casual words like ‘hey,’ ‘buddy,’ or emojis.”
Output:
“Dear Client,
We regret to inform you that the project will be delayed by two weeks…”
✅ Example 2:
Prompt:
“Summarize this article in 100 words. Do not add your own opinions or analysis.”
Output:
“A summary of the article without extra interpretation.”
General Tips for Effective Prompting
Start simple and iterate
Test a basic prompt first, then refine.
Example: “Summarize this article” → “Summarize in 100 words with bullet points.”
Clearly state instructions
Avoid ambiguous language.
Example: “Write a professional email to a client summarizing the update in three bullet points.”
Use separators
Helps model distinguish instructions, data, and expected output.
Examples:
"""or###
Be specific and detailed
Include style, tone, format, and length.
Example: “Write a 150-word summary in a casual tone suitable for teenagers.”
Provide examples of desired output
Guides the model on style and content.
Example: Show one sample summary before asking for another.
Avoid negative instructions when possible
- Instead of “Do not include slang,” say “Use professional language.”
Move from simple to complex
Break tasks into steps.
Example: First list key points, then expand each into paragraphs.
Reduce fluff
- Avoid vague or overly descriptive language; keep prompts concise but clear.
Leverage leading words for code generation
Words like
Write,Generate,Createhelp the model understand intent for code tasks.Example: “Generate a Python function that sorts a list of numbers in ascending order.”