ai-engineering-interview-questions
```markdown
What this skill does
```markdown
---
name: ai-engineering-interview-questions
description: Comprehensive cheat sheet and study guide for AI Engineering interview questions covering LLMs, RAG, agents, fine-tuning, quantization, and more.
triggers:
- help me prepare for an AI engineering interview
- what are common LLM interview questions
- explain RAG interview topics
- AI agent interview preparation
- fine-tuning and quantization interview questions
- LLMOps interview questions and answers
- prompt engineering interview prep
- vector database interview questions
---
# AI Engineering Interview Questions Skill
> Skill by [ara.so](https://ara.so) — Daily 2026 Skills collection.
## What This Project Does
[ai-engineering-interview-questions](https://github.com/amitshekhariitbhu/ai-engineering-interview-questions) is a curated, community-maintained cheat sheet of AI Engineering interview questions and answers. It covers all major topics an AI/ML/LLM engineer needs for interviews at AI-focused companies, targeting roles such as:
- AI Engineer / Gen AI Engineer
- LLM Engineer / Agentic AI Engineer
- AI Solutions Architect
- MLOps / LLMOps Engineer
- Applied AI Engineer
Topics span: LLM Fundamentals, Prompt Engineering, RAG, AI Agents, Fine-Tuning, Vector Databases, AI System Design, LLMOps, Evaluation, AI Safety, Multi-Modal AI, and Infrastructure.
---
## Installation / Setup
This is a Markdown reference repository — no installation required. Clone or bookmark it for study.
```bash
# Clone the repo locally for offline study
git clone https://github.com/amitshekhariitbhu/ai-engineering-interview-questions.git
cd ai-engineering-interview-questions
# Browse the main README
cat README.md
# Or open in your editor
code README.md
```
---
## Topic Coverage Map
Use this map to navigate interview prep by role focus:
| Role Focus | Key Sections |
|---|---|
| LLM Engineer | LLM Fundamentals, Prompt Engineering, Fine-Tuning |
| RAG Engineer | RAG, Vector Databases & Embeddings, AI System Design |
| Agentic AI Engineer | AI Agents, MCP, Prompt Engineering (ReAct) |
| MLOps/LLMOps | LLMOps and Production AI, AI Infrastructure |
| Applied AI / Full-Stack | All sections + Coding & Practical Implementation |
---
## Core Concept Summaries
### LLM Fundamentals
```
Key Concepts:
- Transformer architecture: encoder-only, decoder-only, encoder-decoder
- Self-attention: Q (Query), K (Key), V (Value) matrices
- Multi-head attention vs Grouped-Query Attention (GQA)
- Tokenization: BPE, WordPiece, SentencePiece
- Positional encoding (absolute, learned, RoPE)
- KV Cache: speeds up autoregressive inference by caching past K/V
- Mixture of Experts (MoE): sparse routing to expert sub-networks
- Flash Attention: memory-efficient attention with IO-aware tiling
- Context window: maximum tokens the model can process at once
- Temperature, Top-k, Top-p: controls for text generation randomness
```
**Quick answer — Self-Attention:**
```
Attention(Q, K, V) = softmax(QK^T / sqrt(d_k)) * V
- Q, K, V are learned linear projections of the input
- Scaled dot-product prevents vanishing gradients in softmax
- Multi-head: run H attention heads in parallel, concatenate outputs
```
**Quick answer — KV Cache:**
```
During autoregressive generation:
- Without cache: recompute K, V for ALL previous tokens each step → O(n²)
- With KV cache: store K, V for previous tokens, only compute new token → O(n)
- Trade-off: memory grows linearly with sequence length
```
---
### RAG (Retrieval-Augmented Generation)
**Architecture:**
```
[User Query]
│
▼
[Embedding Model] → Query Vector
│
▼
[Vector DB Search] → Top-K Chunks
│
▼
[Re-ranker] (optional) → Reordered Chunks
│
▼
[LLM] + [System Prompt] + [Retrieved Context] + [User Query]
│
▼
[Response]
```
**Key RAG Components:**
```
1. Document Ingestion
- Load → Parse → Chunk → Embed → Store in Vector DB
2. Chunking Strategies
- Fixed-size: simple, predictable, may break context
- Recursive: respects document structure (headers, paragraphs)
- Semantic: groups semantically similar sentences together
3. Retrieval
- Dense (vector similarity): semantic search via embeddings
- Sparse (BM25/TF-IDF): keyword matching
- Hybrid: combine both with RRF (Reciprocal Rank Fusion)
4. Re-ranking
- Cross-encoder model scores query-document pairs more accurately
- More expensive but improves precision of top results
5. Generation
- Inject retrieved context into LLM prompt
- Ground responses to prevent hallucination
```
**Agentic RAG:**
```
Standard RAG: single retrieval → generate
Agentic RAG: agent decides WHEN and WHAT to retrieve
- multi-hop: retrieves multiple times
- self-query: reformulates query based on initial results
- tool use: retrieval is one of many agent tools
```
---
### AI Agents and Agentic Systems
**Agent Components:**
```
┌─────────────────────────────────────────────────────┐
│ AI Agent │
│ │
│ [LLM Brain] ←→ [Memory] ←→ [Tools/Actions] │
│ │ │
│ [Planning] (ReAct, CoT, Tree-of-Thought) │
└─────────────────────────────────────────────────────┘
Memory types:
- In-context (short-term): conversation history in prompt
- External (long-term): vector DB, key-value store
- Episodic: past interaction summaries
- Semantic: knowledge base
Tool types:
- Web search, code execution, API calls
- RAG retrieval, database queries
- Other agents (multi-agent systems)
```
**ReAct Pattern (Reasoning + Acting):**
```
Thought: I need to find the current stock price of AAPL.
Action: search("AAPL stock price today")
Observation: AAPL is trading at $213.45
Thought: I have the answer.
Final Answer: AAPL is currently trading at $213.45.
```
**MCP (Model Context Protocol):**
```
MCP standardizes how LLMs interact with external tools/data sources.
- Server: exposes tools, resources, prompts
- Client: LLM application that consumes MCP servers
- Transport: stdio (local) or HTTP/SSE (remote)
Use case: connect Claude/GPT to your database, filesystem, APIs
via a standardized protocol instead of custom integrations.
```
---
### Prompt Engineering Patterns
```python
# Zero-shot
prompt = "Classify the sentiment: 'The product is amazing!'"
# Few-shot
prompt = """
Classify sentiment as positive/negative/neutral.
Input: "Great experience!" → positive
Input: "Terrible service." → negative
Input: "It was okay." → neutral
Input: "I loved every moment!" →
"""
# Chain-of-Thought (CoT)
prompt = """
Q: Roger has 5 balls. He buys 2 more cans of 3 balls each. How many does he have?
A: Roger starts with 5. Buys 2 cans × 3 balls = 6 balls. Total = 5 + 6 = 11.
Q: The cafeteria had 23 apples. They used 20 to make lunch and bought 6 more. How many?
A:
"""
# Structured output
prompt = """
Extract entities from the text and return valid JSON only.
Schema: {"people": [], "organizations": [], "locations": []}
Text: "Elon Musk founded SpaceX in Hawthorne, California."
"""
# System prompt for role
system = "You are an expert Python developer. Be concise. If you don't know, say so."
```
---
### Fine-Tuning
```
When to Fine-Tune vs RAG vs Prompt Engineering:
Prompt Engineering → Try first. Zero cost, fast iteration.
RAG → When model needs external/updated knowledge.
Fine-Tuning → When you need style/behavior change,
consistent format, or domain-specific capability
that prompting can't achieve.
Fine-Tuning Methods:
┌─────────────────────────────────────────────────────┐
│ Full Fine-Tuning: update ALL weights │
│ Pro: maximum flexibility │
│ Con: very expensive, catastrophic forgetting risk │
├─────────────────────────────────────────────────────┤
│ LoRA (Low-Rank Adaptation): Related in Writing & Docs
jax-development
IncludedUse this skill when the user is writing, debugging, profiling, refactoring, reviewing, benchmarking, parallelising, exporting, or explaining JAX code, or when they mention JAX, jax.numpy, jit, grad, value_and_grad, vmap, scan, lax, random keys, pytrees, jax.Array, sharding, Mesh, PartitionSpec, NamedSharding, pmap, shard_map, Pallas, XLA, StableHLO, checkify, profiler, or the JAX repo. It helps turn NumPy or PyTorch-style code into pure functional JAX, fix tracer/control-flow/shape/PRNG bugs, remove recompiles and host-device syncs, choose transforms and sharding strategies, inspect jaxpr/lowering/IR, and benchmark compiled code correctly.
nature-article-writer
IncludedDrafts, rewrites, diagnostically critiques, and style-calibrates primary research manuscripts for Nature and Nature Portfolio journals. Use when the user wants a Nature-style title, summary paragraph or abstract, introduction, results, discussion, methods, figure legends, presubmission enquiry, cover letter, reviewer response, or when a scientific draft sounds generic, jargon-heavy, structurally weak, or AI-ish and needs precise, broad-reader-friendly prose without inventing data, analyses, or references. Best for primary research articles and letters rather than reviews or press releases unless explicitly adapting one.
deckrd
IncludedDocument-driven framework that derives requirements, specifications, implementation plans, and executable tasks from goals through structured AI dialogue. Use when user says "write requirements", "create spec", "plan implementation", "derive tasks", "structure this feature", "break down into tasks", or "document this module". Also use for reverse engineering existing code into docs (/deckrd rev). Do NOT use for direct code writing — use /deckrd-coder after tasks are generated. Do NOT use when the user only wants to run or fix existing code without planning.
clinical-decision-support
IncludedGenerate professional clinical decision support (CDS) documents for pharmaceutical and clinical research settings, including patient cohort analyses (biomarker-stratified with outcomes) and treatment recommendation reports (evidence-based guidelines with decision algorithms). Supports GRADE evidence grading, statistical analysis (hazard ratios, survival curves, waterfall plots), biomarker integration, and regulatory compliance. Outputs publication-ready LaTeX/PDF format optimized for drug development, clinical research, and evidence synthesis.
handling-sf-data
IncludedSalesforce data operations with 130-point scoring. Use this skill to create, update, delete, bulk import/export, generate test data, and clean up org records using sf CLI and anonymous Apex. TRIGGER when: user creates test data, performs bulk import/export, uses sf data CLI commands, needs data factory patterns for Apex tests, or needs to seed/clean records in a Salesforce org. DO NOT TRIGGER when: SOQL query writing only (use querying-soql), Apex test execution (use running-apex-tests), or metadata deployment (use deploying-metadata).
accelint-ac-to-playwright
IncludedConvert and validate acceptance criteria for Playwright test automation. Use when user asks to (1) review/evaluate/check if AC are ready for automation, (2) assess if AC can be converted as-is, (3) validate AC quality for Playwright, (4) turn AC into tests, (5) generate tests from acceptance criteria, (6) convert .md bullets or .feature Gherkin files to Playwright specs, (7) create test automation from requirements. Handles both bullet-style markdown and Gherkin syntax with JSON test plan generation and validation.