Revision notes

Generative AI & Prompt Engineering: Practice

The key points, rules to remember, tables and diagrams from all 5 lessons, on one page for quick revision. To keep a copy, use your browser's Print and choose "Save as PDF".

Lesson 1

Generative AI basics: next-token prediction, training, temperature and the context window

Kinds of generative AI (tools named only as examples)
OutputWhat it makesWell-known examples
TextAnswers, summaries, letters, translationsChatbots such as ChatGPT, Gemini and Claude
ImagesPictures from a written descriptionImage generators such as DALL-E, Midjourney and Stable Diffusion
AudioSpeech in a chosen voice, musicText-to-speech and voice tools
CodePrograms, spreadsheet formulas, bug fixesCoding assistants such as GitHub Copilot

How an LLM builds an answer, one token at a time

  1. Take the text so far Your prompt plus everything written up to now
  2. Estimate how likely each next token is A token is a word or a piece of a word
  3. Pick one token
  4. Add it to the text Then the loop repeats until the answer is complete

Then back to step 1: Take the text so far

GPT = Generative Pre-trained Transformer
LetterWordMeaning
GGenerativeIt produces new text rather than only classifying text
PPre-trainedIt is first trained on a huge general text collection, then adapted
TTransformerA neural-network design that uses 'attention' to weigh how the words in a passage relate to one another
SettingWhat it controlsIn practice
TemperatureHow much randomness is allowed when the next token is chosenLower: more focused, more repeatable wording. Higher: more varied, more surprising wording. It does not change what the model knows.
Context windowHow much text, counted in tokens, the model can take into account at once: instructions, the conversation, pasted documents and its own replyText beyond the limit cannot be considered, so in a very long chat early instructions or details may be lost or need repeating.

Choosing the temperature

  • Lower temperature
    • More focused, more repeatable wording
    • Suits: each day's notes as a five-point summary in the same layout
    • Does not make answers more true
  • Higher temperature
    • More varied, more surprising wording
    • Suits: twenty different slogans for a poster
    • Does not change what the model knows

An LLM writes by predicting the next token, again and again. Temperature changes how varied the wording is, not how true it is. The context window limits how much text it can consider at once.

Key takeaways: an LLM is pre-trained on huge text collections, then fine-tuned, and writes one token at a time. GPT means Generative Pre-trained Transformer; diffusion models turn noise into images. Higher temperature gives variety, lower gives consistency - never truth. Restate what matters in long chats.

Read the full lesson

Lesson 2

Effective prompts: role, task, format and examples, zero-shot and few-shot

A strong prompt

  • Role Who to act as
  • Task The exact job to do - must always be clear
  • Format The shape and size of the answer
  • Examples A sample of the output you want
PartWhat it tells the AIExample line
RoleWho to act asYou are a patient maths teacher for competitive-exam students.
TaskThe exact job to doExplain how to find a discounted price.
FormatThe shape and size of the answerFive numbered steps, then one worked example in rupees, under 150 words.
ExamplesA sample of the output you wantWrite each item like this: Benevolent - kind and generous - The benevolent officer helped every applicant.
Weak promptWhat is missingStronger prompt
Tell me about GSTTask, level, formatExplain GST to a beginner in five short points, then give one simple example of a shop bill.
Write about riversScope and formatMake a revision table of six peninsular rivers of India with columns River, Where it rises, Where it drains.
Make questionsTopic, number, type, answersMake 5 MCQs on the Fundamental Rights, four options each, with answers and one-line reasons listed at the end.
Explain thisWhat 'this' is, the levelExplain the paragraph below in simple English for a Class 8 student, in under 120 words: ...

Zero-shot and few-shot

  • Zero-shot
    • No examples in the prompt
    • e.g. "Translate this sentence into Hindi."
  • Few-shot
    • One or a few samples in the prompt
    • Helps when a style or fixed labels cannot be guessed
    • The samples guide that reply only - no retraining

Strong prompt = Role + Task + Format (+ Examples). Zero-shot = no examples; few-shot = a few samples. Ask for step-by-step working so you can check it - not because it is guaranteed right.

Key takeaways: make the task unmistakable, then add a role, a format and examples as needed. Fix weak prompts by naming the topic, level, size and layout. Use few-shot prompting when you need a particular style or set of labels, and ask for step-by-step working so that every step can be checked.

Read the full lesson

Lesson 3

Context and instructions: background, audience, constraints, source text and iteration

Four kinds of context

  • Background What you already know - the answer starts at the right point
  • Audience Who it is for - vocabulary, examples and language suit the reader
  • Constraints Your limits - length and style stay within them
  • Source text Material you trust - the answer is tied to it, not the model's memory
ContextExample lineWhat it changes
BackgroundI already understand simple interest and want to learn compound interest.The answer starts at the right point and skips what you know.
AudienceExplain it for Class 8 students in a Hindi-medium school.Vocabulary, examples and language suit the reader.
ConstraintsUnder 150 words, amounts in rupees, no technical jargon.Length and style stay within your limits.
Source textUse only the passage below. If it does not answer the question, say so.The answer is tied to material you trust instead of the model's memory.

Splitting a long task

  1. Ask for an outline and check it
  2. One section at a time Each with its own instructions
  3. Review each section Correct errors early
  4. Combine the sections Ask for a combined version, or combine it yourself
RoundPromptWhat was wrong with the reply
1Explain inflation.400 words, unfamiliar terms.
2Explain inflation in about 100 words for a beginner.Better, but in English; the student studies in Hindi.
3Now give it in simple Hindi as a table: Term, Meaning, Everyday example.Usable. Student checks terms against the Hindi-medium textbook.
4Ask me three questions to test whether I understood.Turns reading into practice.

Context = background + audience + constraints + source text. Give standing instructions once, split long jobs into checked steps, invite "I don't know", and refine with specific follow-ups.

Key takeaways: tell the AI what you already know, who the answer is for, the limits it must keep and the text it should use. System instructions frame the whole conversation and normally outrank user requests. Break long tasks into checked steps, allow the model to admit uncertainty, and iterate with precise follow-ups - then compare the result with the source.

Read the full lesson

Lesson 4

Evaluating AI outputs: hallucination, outdated knowledge, bias and a checking routine

FailureWhat it meansExample
HallucinationThe model produces false information that sounds plausibleA made-up book title, court case or quotation
Outdated knowledgeIts knowledge stops when its training data was collected (the training cut-off)It does not know a recent scheme, result or rule change
Confident wrong answerThe tone is equally sure whether the content is right or wrongAn arithmetic slip stated firmly
BiasIt repeats unfair patterns present in its training dataShowing only men when asked for a picture of an engineer

A checking routine for AI output

  1. Mark the checkable claims Names, numbers, dates, article or section numbers, quotations
  2. Facts: official source or NCERT Government matters on the official website; subject facts in standard textbooks
  3. Calculations: redo every number
  4. Quotes: find the original If you cannot, do not use the quote
  5. Compare two independent sources Two chatbots agreeing does not count
  6. Cited links: open each one Confirm it exists and says what was claimed
Where to lookPossible warning sign
Hands and fingersExtra, missing or merged fingers
Text in the pictureSignboards or labels with garbled letters
Edges and detailsMelting edges around hair, ears, earrings or glasses
Light and shadowShadows pointing different ways; skin too smooth
SourceNo original source; shared only by unknown accounts

Fluent is not the same as correct. Check facts in the official source or NCERT, recompute numbers, find quotes in the original, and confirm in two independent sources.

Key takeaways: AI output can hallucinate, be outdated, sound confident when wrong and reflect bias. Mark the checkable claims, verify facts in official sources and textbooks, redo calculations, trace quotations, compare two independent sources and open every cited link. Judge images by their source, not by how real they look.

Read the full lesson

Lesson 5

Safe and responsible use: personal data, deepfakes, plagiarism, exam rules and prompt injection

Safe to typeNot safe to type
Your own notes on the Mughal empire, asking for a summaryYour email password
A maths question from a practice bookAn OTP received on your phone
A letter draft with names and numbers replaced by XXXXA scanned file of applicants' forms from your office

Answering a suspicious call in a familiar voice

  1. Spot the red flags Urgency, money, secrecy, a story you cannot check on the call
  2. Hang up Do not pay or share anything during the call
  3. Call back on the saved number
  4. Tell a family member
Fair useNot fair
Asking AI to quiz you on a chapterSubmitting an AI-written essay as your own
Getting feedback on your draft, then rewriting it yourselfChanging a few words of AI text and calling it original
Stating how AI helped, where the rules allow its useHiding AI help where the rules require you to declare it

How prompt injection works

  1. Hidden text in a page, email or document e.g. white text on a white page
  2. The AI reads it as a command
  3. The AI obeys it
  4. The answer serves whoever planted the text Not you

Keep secrets out of chats. Judge the request, not the voice: urgency + money + secrecy = stop and call back. Present only your own work as your own. Instructions hidden in content are not your instructions.

Key takeaways: never paste passwords, OTPs, Aadhaar, bank details or confidential files into an AI tool; remove personal details first. Hang up and call back on suspicious calls, and confirm viral clips from official sources. Declare AI help honestly, leave devices out of the exam hall as the admit card directs, and treat any instruction that appears inside AI-read content with suspicion.

Read the full lesson

Privacy · Terms · Refunds · Delivery