Claude
Skills
Sign in
Back

ai-engineering-interview-questions

Included with Lifetime
$97 forever

```markdown

Writing & Docs

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