Lessons available in both languages
Gen AI · Interview Prep

LLM Foundations interview questions & answers

114+ real LLM Foundations interview questions with model answers, plus free lessons to learn the concepts. Prepare in English & Hinglish, then practise with an AI mock interview.

10 topics · 114+ questions

Hirenix kaise padhata hai

Ek chapter. 90 minute.
Interview ke liye taiyaar.

Har concept ek real-world problem se — jaisa production code mein aata hai, waisa. Ratna nahi padta, samajh aa jaata hai. Har question ka model answer diya hai: interviewer ko exactly kya bolna hai, aur kyun. Phir usi chapter ka AI mock interview.

  • 📖Concept, 5 min meinJargon nahi — seedhi baat
  • 🛠️Real-world problemJaisa production code mein aata hai
  • 💬Model answerInterview mein kya bolna hai
  • 🧠FlashcardsRevision 10 min mein
  • 🤖AI mock interviewFollow-up bhi poochta hai
  • 📊Weak topicsKahan phans rahe ho, pata chale
Ye chapter shuru karo — free🌐 English🇮🇳 Hinglish
A student learning an interview concept on Hirenix at home
Video playlistsyllabus ke hisaab se18h+
Hirenix chapterinterview ke hisaab se90 min

Farq content ka nahi, filter ka hai — sirf wahi jo production mein actually use hota hai aur interview mein actually poocha jaata hai. Kitaabi topics jo industry mein kahin nahi chalte, wo yahan nahi milenge.

Lessons available in both languages

What you’ll learn

  • LLM basics
  • Prompt engineering
  • System promptsFree account
  • Advanced promptingFree account
  • OpenAI SDKFree account
  • Anthropic SDKFree account
  • Output parsingFree account
  • Token managementFree account
  • RecapFree account
  • Project: CLI chatbot

LLM basics

Ek baccha soch jisne 100 crore books padh li hain. Har language, har topic — is bacche ne sab dekha hai. Par twist ye hai: ye baccha waisa "samajhta" nahi jaisa tu samajhta hai. Bacche ne bas itne saare patterns dekhe hain ki jab tu bolta hai "Mera naam ___", baccha turant bolta hai "hai" — kyunki usne tera sentence samjha isliye nahi, balki ye pattern usne pehle bhi arabon baar dekha hai. Ek Large Language Model (LLM) bilkul yehi baccha hai, bas math se bana hua.

LLM me, core kaam simple hai: ab tak ka text dekh ke, agla sabse likely token predict karo — ek ek token karke, baar baar, jab tak reply complete na ho jaaye. Isse autoregressive bolte hain. Ye tere phone ke autocomplete jaisa hi hai ("Good mor" → "morning"), bas lakhon guna scale up, aur tere messages ki jagah internet ke bade hisse pe trained.

Under the hood, LLMs transformer architecture use karte hain. High level pe (heavy math ki zaroorat nahi): text tokens me toota jaata hai, phir ek attention mechanism ye figure out karta hai ki sentence me kaunse words ek doosre se related hain — jaise "The cat sat on the mat because it was tired" me, attention "it" ko strongly "cat" se jodta hai, "mat" se nahi. Isi tarah model sentence ke andar context track karta hai.

Models words nahi padhte — woh tokens padhte hain (≈4 characters, roughly ¾ word). Akela "ChatGPT" 3 tokens ho sakta hai. Tu per-token pay karta hai (input + output dono), toh token count = cost + speed. Har model ka ek context window bhi hota hai — max tokens jo woh ek saath "dekh" sakta hai (system prompt + chat history + tera message + reply, sab milake count hote hain). Ye limit cross ki toh purane messages drop ho jaate hain ya error aa jaata hai.

Randomness control karne ke do knobs hote hain: temperature (0 = deterministic/robot, facts aur code ke liye achha; ~1 = creative/artist, stories aur brainstorming ke liye achha; bahut zyada = nonsense) aur top_p (nucleus sampling — model ko sirf sabse probable words tak limit karta hai choose karne se pehle). Normally in me se ek hi tune karte hain, dono nahi — usually temperature.

Akhir me, models do type ke hote hain: closed (GPT-4o, Claude Sonnet/Haiku/Opus, Gemini — sirf API se, per-token paisa, bahut capable) aur open (Llama, Mistral — free weights, khud apne GPU pe host karo).

🌍 Real-world example: Ek factual sawaal temperature 0 pe 3 baar poochh — har baar bilkul same jawab milega. "Ek poem likh de" prompt temperature 1 pe 3 baar poochh — teen alag poems milengi. Same model, sirf knob alag.

💡 Token = text ka ek tukda (~4 characters); LLM asal me isi unit ko padhta hai aur isi se bill karta hai.

💡 Context window = ek conversation turn me model jitne tokens ek saath memory me rakh sakta hai.

💡 Attention = wo mechanism jo model ko sentence ke words ko ek doosre se relate karne deta hai.

💡 Hallucination = jab LLM confidently kuch galat bol de, kyunki woh pattern-complete kar raha hai, fact-check nahi.

Standard definition (interview me bolo): A Large Language Model (LLM) is a neural network — built on the transformer architecture — trained to predict the next token in a sequence of text, and it generates responses by repeatedly predicting one token at a time based on all the tokens seen so far.

from openai import OpenAI

client = OpenAI()  # reads your API key from the environment

prompt = "Suggest one good programming language for beginners, in 5 words."

for temp in [0.0, 0.0, 1.2]:
    response = client.responses.create(
        model="gpt-4o-mini",
        input=prompt,
        temperature=temp
    )
    print(f"temperature={temp} -> {response.output_text}")

Prompt engineering

LLM ko ek genie samajh. "Khana de" bolega toh genie kuch bhi de dega — shayad kaccha, shayad wo jo tu chahta hi nahi tha. "Mujhe Hyderabadi biryani de, medium spicy, dum-pukht style, 2 logo ke liye, ek bowl mein" bolega toh genie EXACTLY wahi dega. Prompt engineering genie se sahi tarike se maangna hai — model smart nahi hua, tere instructions clear ho gaye.

LLM ke paas sirf wahi text hota hai jo tu bhejta hai. Ye tera mann nahi padh sakta, tera screen nahi dekh sakta, aur wo format guess nahi kar sakta jo tu secretly chahta tha. Jo constraint tu nahi batata, wo constraint model ignore karne ke liye free hota hai. Isliye vague prompt sirf kharab answer ka risk nahi hai — ye ek aisa answer bhi de sakta hai jo technically sahi ho par tere program ke liye bekaar ho (galat length, galat tone, galat shape).

Paanch habits zyada tar kharab prompts fix kar dete hain: (1) specific raho — numbers, audience, length batao, "kuch acha likh de" mat bolo; (2) role do — "You are a senior Python developer" bolne se model expert-level, relevant vocabulary aur depth ki taraf jaata hai; (3) output format bataao — "return ONLY valid JSON with keys x, y" taaki tera code reply ko actually parse kar sake; (4) examples do (few-shot) — 2-3 input→output pairs kisi bhi explanation se zyada fast pattern sikhate hain; (5) delimiters use karo — actual data ko """, ---, ya <text> tags mein wrap karo taaki model kabhi tere instructions aur tere diye hue content ko confuse na kare.

🌍 Real-world example: "Summarize this" ke turant baad ek paragraph likhna ambiguous hai — instruction kahan khatam hota hai aur text kahan shuru hota hai? "Summarize the text between the triple quotes in one sentence: """..."""" har doubt hata deta hai.

💡 Zero-shot = seedha poochna, koi example diye bina. 💡 Few-shot = asli sawaal se pehle 2-3 example input→output pairs dena, taaki model pattern copy kare. 💡 Delimiter = ek marker (""", ---, XML tags) jo tere instructions ko process ho rahe data se clearly alag karta hai.

Inhe side-by-side compare kar:

BAD prompt: "Tell me about this product." → Model ko pata hi nahi "acha" kaisa dikhta hai: kitni length? kaunsi tone? kiske liye? Kuch generic milega.

GOOD prompt: "You are a marketing copywriter. Write a 40-word product description for wireless earbuds, targeting college students. Tone: casual. Return plain text only, no markdown." → Role + specificity + length + audience + format — model ke paas galat jaane ki jagah bahut kam bachti hai.

Ye real apps mein isliye matter karta hai kyunki tera downstream code (UI, database, parser) ek predictable shape expect karta hai. Aaj ka vague prompt kal ka broken feature hai.

Standard definition (interview me bolo): Prompt engineering is the practice of crafting clear, specific instructions — including role, format, examples, and delimiters — to reliably get the output you want from an LLM.

from anthropic import Anthropic

client = Anthropic()  # reads ANTHROPIC_API_KEY from the environment

review_text = "The delivery was late and the box was damaged, but the product itself works great."

prompt = f"""You are a customer support analyst.

Classify the sentiment of the review below as Positive, Negative, or Mixed.
Also extract the single main complaint, if any.

Review:
\"\"\"
{review_text}
\"\"\"

Return ONLY valid JSON in this exact shape:
{{"sentiment": "...", "main_complaint": "..."}}
"""

response = client.messages.create(
    model="claude-sonnet-4-5",
    max_tokens=200,
    messages=[{"role": "user", "content": prompt}]
)

print(response.content[0].text)

Project: CLI chatbot

Kya bana rahe hain: Ek real terminal chatbot, ~20 lines Python mein — jismein tum type karte ho, wo reply karta hai, aur ab tak ki poori conversation yaad rakhta hai. Har chatbot jo tumne kabhi use kiya hai (ChatGPT, Claude, tumhare bank ka support bot) uske peeche ka trick almost embarrassingly simple hai: ek Python list jo har turn mein 2 items se badhti hai. Is project ke end tak tumne khud ek bana liya hoga, aur tumhe exactly pata hoga ki wo kyun "yaad" rakhta hai aur kahaan pe wo memory khatam ho jaati hai.


Step 0 — Mental model (pehle padho, 30 second)

Chatbot koi mysterious dimaag nahi hai jo tumhari chat yaad rakhta ho. Ye ek program hai jo, HAR single turn pe, poori conversation ab tak ki wapas ek stateless LLM ko bhej deta hai — aur LLM (jiski khud ki koi memory nahi hoti calls ke beech) poori cheez fresh padhta hai aur last line ka reply deta hai.

💡 Stateless = LLM API khud kuch bhi YAAD nahi rakhta calls ke beech. Har client.chat.completions.create(...) call ek blank slate hai. "Memory" ek illusion hai jo tumhara Python code banaata hai poori history har baar resend karke.

Toh poora chatbot asal mein bas ye hai: ek badhti hui list + ek loop. Yahi Step 0 hai — ise dimaag mein rakho neeche har step ke through.


Step 1 — Setup (Chapter 1 ka recap)

pip install openai python-dotenv
# .env file
OPENAI_API_KEY=sk-your-real-key-here

Ho ye raha hai: bilkul Chapter-1 project wala setup — ek .env file jismein tumhari secret key hai, kabhi hardcode nahi, kabhi git mein commit nahi. Yahaan kuch naya nahi; ye poora project usi foundation pe khada hai.


Step 2 — System prompt (bot ki personality)

SYSTEM_PROMPT = "You are a friendly Hinglish tutor. Keep answers short, encouraging, and beginner-friendly."

Ho ye raha hai: system prompt ek instruction hai jo developer set karta hai, user nahi — ye poori conversation ke liye bot ka role, tone, aur rules shape karta hai. Ye ek string badlo aur tumhe bilkul alag bot mil jaata hai (ek sarcastic coding reviewer, ek formal HR interviewer, ek recipe assistant) baaki code mein zero changes ke saath.

🌍 Real-world example: har branded AI chatbot jo tumne use kiya — bank ka support bot, shopping assistant — SAME underlying model hai jo ChatGPT hai, bas alag system prompt diya gaya hai ("You are Acme Bank's support agent. Only answer questions about Acme accounts...").


Step 3 — Messages list start karo

messages = [
    {"role": "system", "content": SYSTEM_PROMPT}
]

Ho ye raha hai: ye WOHI EK list hai jo poori conversation hold karegi, ab se lekar jab tak user quit nahi karta. Abhi isme exactly ek item hai — ek dict jismein do keys hain, role aur content, wahi dict shape jo tum Chapter 1 se use kar rahe ho. role model ko batata hai KAUN "bol raha hai" is entry mein: "system" (developer instructions), "user" (insaan), ya "assistant" (model ke apne past replies).

💡 Message = ek {"role": ..., "content": ...} dict. Ek conversation = messages ki ek Python list, order mein.


Step 4 — Loop, aur exit condition

while True:
    user_input = input("You: ")
    if user_input.lower() == "quit":
        print("Bot: Bye! Keep practicing.")
        break

Ho ye raha hai: while True ek infinite loop hai — Chapter 1 wala hi loop type, bas fixed end nahi hai. input("You: ") program ko pause karta hai aur insaan ke line type karne ka wait karta hai, use str ke roop mein return karta hai. Hum exit condition check karte hain API ka koi kaam karne SE PEHLE — "quit" word pe paid API call waste karne ka koi matlab nahi. break is infinite loop se bahar nikalne ka ek hi rasta hai.


Step 5 — List badhao: user ka turn add karo

messages.append({"role": "user", "content": user_input})

Ho ye raha hai — yahi poora trick hai, 2 beats mein se beat 1: .append() Chapter 1 ka wahi list method hai — ye ek item list ke END mein add karta hai, in place. List jo 1 item se shuru hui thi (bas system prompt) ab 2 ki ho gayi. Har single turn yahaan exactly ek user entry add karta hai.


Step 6 — LLM ko POORI list ke saath call karo

response = client.chat.completions.create(
    model="gpt-4o-mini",
    messages=messages
)
reply = response.choices[0].message.content

Ho ye raha hai: notice karo hum messages bhej rahe hain — POORI list, ab tak jo bhi bola gaya, sirf newest line nahi. Yahi ek cheez hai jo memory ka illusion kaam karati hai: model ki apni koi memory nahi hoti, isliye hum use poora transcript saunp dete hain, har single baar, aur wo sabse recent cheez ka reply deta hai jabki uske paas pehle ki har cheez ka full context bhi hota hai. response.choices[0].message.content response object ke andar bilkul waise chalta hai jaise Chapter 1 ke project mein data["output"][0]["content"][0]["text"] chalta tha — nested indexing API ke reply shape ke andar, bas is baar openai ki chat-completions structure ke saath.


Step 7 — Print karo, fir list ko phir se badhao: beat 2 of 2

print("Bot:", reply)
messages.append({"role": "assistant", "content": reply})

Ho ye raha hai — YE line hai jo bot ko memory deti hai: agar tum ye .append() skip kar do, bot tumhare sawaal ka jawab ek baar theek se de dega, par loop ke NEXT time se, messages mein abhi bhi sirf system prompt + tumhara latest question hoga — model kabhi apna hi previous answer nahi dekhega, aur conversation bikhar jayegi (khud se contradict karega, naam bhool jayega jo tumne bataye the, khud ko repeat karega). Assistant ka apna reply append karke, list ab system prompt + turn 1 ka user message + turn 1 ka assistant reply rakhti hai — 3 items — turn 2 ke liye ready ki 4th add kare.


Step 8 — List ko badhte hue trace karo, turn by turn

Iske baad... messages list length Contents
Setup (Step 3) 1 [system]
Turn 1, tum bolte ho (Step 5) 2 [system, user1]
Turn 1, bot reply karta hai (Step 7) 3 [system, user1, assistant1]
Turn 2, tum bolte ho 4 [system, user1, assistant1, user2]
Turn 2, bot reply karta hai 5 [system, user1, assistant1, user2, assistant2]

Ho ye raha hai: har turn exactly 2 items add karta hai — ek user, ek assistant. Ye table HI chatbot hai. client.chat.completions.create(...) ki har call ye poori badhti hui list resend karti hai, isliye model turn 5 ka jawab dete waqt turn 1 "yaad" rakhta hai — sirf isliye kyunki turn 1 abhi bhi us list mein bethi hai jo tum bhej rahe ho.


Step 9 — Context window awareness (list forever kyun nahi badh sakti)

💡 Context window = ek model ek call mein max kitne tokens (roughly ¾ word each) padh sakta hai — POORI messages list iske andar fit honi chahiye, har single baar.

Ek lambi chat session — 50, 100, 200 turns — messages ko bada aur bada banati jaati hai. Aakhir mein do cheezon mein se ek hoti hai: ya toh tum context window limit hit kar dete ho (call error de deti hai ya model silently tumhare shuru ke messages truncate/bhool jaata hai), ya bas tumhe har call ke liye zyada pay karna padta hai, kyunki har call poori badhti hui history ko input tokens ke roop mein resend karti hai. Ek real chatbot ko is list ko trim, summarize, ya cap karne ki strategy chahiye jab wo lambi ho jaaye — yahi exactly Chapter 7 (Memory Management) ke baare mein hai. Abhi ke liye: jaan lo ki ye simple "append forever" approach ek short session ke liye great kaam karta hai, aur yahi exactly wo jagah hai jahaan production systems ek limit add karte hain.


🔎 Poora flow (wiring ka recap)

  1. SYSTEM_PROMPT — ek plain string, bot ki personality/rules.
  2. messages = [{"role": "system", ...}] — WOHI EK list jo poori conversation hold karti hai, 1 item se shuru hoke.
  3. while True + input() — loop jo har turn insaan se ek line padhta hai; quit bahar nikaal deta hai.
  4. messages.append({"role": "user", ...}) — beat 1: insaan ka turn list mein join hota hai.
  5. client.chat.completions.create(model=..., messages=messages) — POORI list bheji jaati hai, har baar, kyunki LLM khud stateless hai.
  6. messages.append({"role": "assistant", ...}) — beat 2: bot ka apna reply bhi list mein join hota hai — YE hai jo agle turn use "yaad" rakhne deta hai.
  7. Repeat — list per turn 2 se badhti rehti hai, jab tak context window limits (Ch7) kuch aur na kahen.

✅ Jo tumne abhi seekha — aur aage kya hai

  • Chatbot = ek badhti hui Python list, koi magic memory nahi. Iske peeche ka LLM stateless hai; tumhara code poori history har call resend karke memory ka illusion banaata hai.
  • role (system/user/assistant) model ko batata hai kis order mein kisne kya bola.
  • Har turn exactly 2 items append karta hai — ek user se, ek assistant se — API call return hone ke turant baad.
  • Context window ek hard ceiling hai ki wo list kitni badi ho sakti hai — Chapter 7 ki memory-management techniques (trimming, summarizing) ka foreshadow.
  • Ye project Chapter 1 (loops, lists, input(), .env/API keys) aur Chapter 2 (system prompts, SDK, tokens) ko ek working program mein jod deta hai.

Standard definition (interview me bolo): A CLI chatbot maintains a single growing list of role-tagged messages (system, user, assistant); each turn appends the user's input, sends the ENTIRE list to a stateless LLM API call, appends the model's reply back onto the list, and repeats — the resend-the-whole-history pattern is what gives a stateless LLM the appearance of memory within a session, bounded by the model's context window.

import os
from dotenv import load_dotenv
from openai import OpenAI

load_dotenv()
client = OpenAI(api_key=os.environ["OPENAI_API_KEY"])

SYSTEM_PROMPT = "You are a friendly Hinglish tutor. Keep answers short, encouraging, and beginner-friendly."

messages = [
    {"role": "system", "content": SYSTEM_PROMPT}
]

print("Chatbot ready! Type 'quit' to exit.\n")

while True:
    user_input = input("You: ")
    if user_input.lower() == "quit":
        print("Bot: Bye! Keep practicing.")
        break

    messages.append({"role": "user", "content": user_input})

    response = client.chat.completions.create(
        model="gpt-4o-mini",
        messages=messages
    )
    reply = response.choices[0].message.content

    print("Bot:", reply)
    messages.append({"role": "assistant", "content": reply})

LLM Foundationsinterview questions & answers

10 sample questions below — 114+ in the full bank inside.

Teen main Claude models kaunse hain, aur har ek kab use karega?

Claude ke teen version hain: Haiku (sabse fast, sabse sasta), Sonnet (balanced, zyada tar kaam ke liye recommend), aur Opus (sabse powerful, sabse mehnga). Haiku simple kaam ke liye, Sonnet default choice, Opus bas complex problems ke liye jab best reasoning chahiye.

In simple terms: Models vehicle choices jaisa hain — Haiku motorcycle (fast aur sasta), Sonnet car (reliable sab kaam ke liye), Opus truck (powerful par expensive). Teenon hi same language samjhte hain aur same tarah kaam karte hain — bas speed vs quality vs cost ka farq. Example: chatbot ke liye Sonnet use karo, simple task ke liye Haiku.

Anthropic SDK ko Python me kaise install karte ho?

Tum pip se install karte ho: `pip install anthropic python-dotenv`. Python-dotenv package environment variables ko .env file se load karta hai, jo API key ko secure rakha ka standard tareeka hai.

In simple terms: pip ko ek package store samjho — tum anthropic maangta ho aur wo download karke install karta hai. dotenv package ek password locker jaisa hai jo API key ko safe rakhta hai, code me likhne ki jagay .env file se padha. Example: terminal me `pip install anthropic` likho.

ANTHROPIC_API_KEY ko setup kaise karte ho Claude use karne ke liye?

Apne project root me .env file banao aur likh do `ANTHROPIC_API_KEY=sk-ant-your-key-here`. Phir apne Python code me `from dotenv import load_dotenv` likho aur Anthropic client banane se pehle `load_dotenv()` call karo.

In simple terms: API key ek unique ticket hai jo prove karta hai ki tume Claude use karna allowed hai. .env file secret storage hai — usse .gitignore me rakha iska matlab GitHub pe nahi jayega. Jab load_dotenv() call karte ho, Python ne .env file padha aur key ko environment variable bana deta hai. Example: code me `load_dotenv()` run hota hai, phir `Anthropic()` automatically key dhoond leta hai.

Claude ko message bhejne ke liye basic syntax kya hai?

Tum Anthropic client banate ho aur `client.messages.create()` call karte ho model, max_tokens, aur messages array ke saath. Example: `response = client.messages.create(model='claude-sonnet-4-6', max_tokens=1024, messages=[{'role': 'user', 'content': 'Hello'}])`.

In simple terms: client.messages.create() ko Claude ko phone dial karna samjho — tumhare ko model batana zaroori hai (Haiku ya Sonnet), reply kitna lamba ho (max_tokens), aur poocho kya (messages). Restaurant se order karte ho jaisa: model = chef, max_tokens = plate ki size, messages = tumhara order. Example: messages=[{'role': 'user', 'content': 'Python kya hai?'}] ek simple sawaal bhejta hai.

Prompting mein self-consistency kya hoti hai?

Self-consistency ek technique hai jisme tum same question multiple baar (usually 5-10 times) puchte ho aur different jawab collect karte ho. Fir sab se zyada common answer ko final result banate ho, jaise voting se.

In simple terms: Jaise ek math ke question ke liye 10 logon se puchna taaki verify kar sako. Agar 8 kah 'haan' aur 2 kah 'nahi', to majority 'haan' par bharosa kar sakte ho. Example: 'Is 17 prime?' paanch bar pucho different temperatures pe. Char baar 'yes' aur ek bar 'no' milega, toh confidently 'yes' kahte ho.

Chain-of-thought prompting kya hoti hai?

Chain-of-thought (CoT) ek prompting technique hai jisme tum LLM se puchte ho ke kisi problem ke baare mein step-by-step socho aur fir final answer do. Direct answer maangne ke bajaye, tum usse apni thinking process dikha ne ke liye kaho, jisse kayi baar better jawab aata hai.

In simple terms: CoT ko ek math exam mein 'apna kaam likho' (show your work) bolne jaisa samjho. Jab student steps likhe (1 + 2 = 3, fir 3 + 4 = 7), galti kam hoti hai. Jaise: Seedha 'What is 15 × 8?' pucho mat; instead 'Step by step karo: 15 × 8 = ?' likho aur LLM likhega 15 × 8 = 15 × (5 + 3) = 75 + 45 = 120.

Prompting mein task decomposition kya hoti hai?

Task decomposition ka matlab ek bada complex problem ko chhote, aasan sub-problems mein todo aur har ek ko step-by-step solve karna. LLM har chhoti piece ko alag se handle karta hai, fir sab ke answers ko combine karke complete solution deta hai.

In simple terms: Jaise ek ghar banana: sirf 'ghar banana' mat kaho; todo 'foundation bigao', 'diwaren banao', 'chhatt lagao'. Sochna asaan hota hai aur steps miss nahi hote. Example: Sirf 'REST API design kar' mat kaho; pucho 'Kaun-kaun tables chahiye? Kaun-kaun endpoints? Authentication kaise?' aur har ek solve kar.

Few-shot prompting kya hoti hai?

Few-shot prompting mein tum apne prompt mein kuch examples (zyada tar 2-5) dete ho taki LJM ko pattern ya format samjh aaye. Model in examples se seekh kar apne actual question pe woh pattern apply karta hai, bina extra training ke.

In simple terms: Jaise kisi ko kuch karne se pehle dikhao aur fir bolo do. Agar kisi dost ko funny captions likha sikh ana hai, pehle 2-3 examples dikha do, fir naye photo ke liye likha bolo. Example: 'Yeh 2 translations dekho: "Hello" → "Namaste", "Thank you" → "Shukriya". Ab "Goodbye" translate kar' — model pattern dekh kar sahi jawab dega.

Prompts mein examples kyun add karte hain LLM se structured output maangte waqt?

Prompts mein examples ek clear pattern aur format establish karte hain jo LLM ko follow karna ho. Ye ambiguity kam karte hain aur model ko exactly woh output style dete hain jo tum chahte ho, toh response predictable aur useful ho jaata hai.

In simple terms: Jaise barber ko hairstyle describe karte waqt sirf baat mat karo; ek photo dicha do. Photo (example) confusion kam karta hai. Example: JSON output chahiye, toh pehle ek sahi JSON example dikha do aur LLM saare jawab JSON mein hi dega, weird text nahi.

Claude ke response se text kaise nikalta hai?

Claude ek response object return karta hai. Text access karne ke liye `response.content[0].text` likho. `.content` field boxes ki ek list hai (zyada tar ek text box), toh [0] se first element leta hai aur .text se actual string nikalta hai.

In simple terms: Claude ka jawab ek package hai jisme multiple boxes hain — `.content` boxes ki list, [0] pehla box pick karta, .text andar ka content nikalta. Zyada tar ek hi box (text) hota, toh [0] standard. Example: agar response.content = [TextBlock(text='Namaste')], toh response.content[0].text se 'Namaste' milta hai.

104+ more LLM Foundations questions inside

Create a free account to read the full question bank, learn every topic, and practise with an AI mock interview.

Unlock all questions — free

Ready to practise LLM Foundations?

Unlock every topic free, then face an AI interviewer that asks follow-ups and grades your answers.

LLM Foundations Interview Questions & Answers | Hirenix