What is a Large Language Model (LLM) and how does it work?
An LLM is a transformer-based model trained on massive text corpora to predict the next token. Architecture: decoder-only transformer (GPT family) with billions of parameters. Training: causal language modeling — given tokens 1..n, predict token n+1; trained on trillions of tokens from internet text, books, code. Emergent capabilities appear at scale: reasoning, coding, few-shot learning, instruction following. Inference: autoregressive generation — sample one token at a time, append to context, repeat. Temperature controls randomness (0=greedy, 1=sampling, >1=creative). Context window = max tokens the model can attend to simultaneously.
What is prompt engineering and what are the key techniques?
Prompt engineering crafts input text to elicit desired LLM behavior without changing model weights. Key techniques: (1) Zero-shot: direct instruction — "Classify this review as positive/negative:", (2) Few-shot: provide examples before the task — 2–5 labeled examples improve accuracy significantly, (3) Chain-of-Thought (CoT): "Think step by step" — forces LLM to reason explicitly before answering, improves complex reasoning by 10–40%, (4) Self-consistency: sample multiple CoT paths, take majority vote, (5) Role prompting: "You are an expert Python developer...", (6) Structured output: "Respond only in JSON format: {field: value}". For production: always version and test prompts — they degrade with model updates.
What are the key differences between GPT-4, Claude, Gemini, and Llama?
GPT-4 (OpenAI): strongest reasoning, best function calling, industry standard for agentic tasks, expensive, closed-source. Claude (Anthropic): longest context window (200K), best for document analysis, strong at following complex instructions, designed for safety. Gemini (Google): multimodal-first, integrated with Google ecosystem, competitive on reasoning. Llama 3 (Meta): open-source, can self-host, 70B rivals GPT-3.5 class. Mistral/Mixtral: efficient open-source models, MoE architecture. Selection criteria: (1) Task requirements — function calling (GPT-4), long documents (Claude), self-hosting (Llama), (2) Cost — Llama hosted on Groq is 10x cheaper than GPT-4, (3) Latency — Groq inference is fastest, (4) Compliance — self-hosted for data sovereignty.
Know your weak spots before the interview
10-question AI readiness assessment → personalized study plan.
Take Free Assessment →Unlock 3,000+ Interview Questions
Get full access to all interview questions with detailed answers, explanations, and real company context
Enroll GenAI Pack →