Skip to content

Week 01 — LLM Fundamentals

Five days of foundational sessions covering how large language models work, how to call them, and how to build your first retrieval and evaluation systems. By the end of Week 01 you'll have the conceptual grounding and practical API skills to move into Week 02 without gaps.


What You'll Be Able to Do After This Week

  • Explain how transformers, attention, and tokenization work at the level needed to make system design decisions
  • Write effective zero-shot, few-shot, and chain-of-thought prompts for a range of tasks
  • Call the OpenAI and Anthropic APIs — completions, vision, tool use — and handle cost and rate limits correctly
  • Build a working semantic search engine using embeddings and cosine similarity
  • Implement a complete RAG pipeline from PDF ingestion to grounded answers
  • Store and query embeddings in ChromaDB, Pinecone, and Qdrant
  • Measure RAG quality using RAGAS and identify hallucination failure modes
  • Defend your application against prompt injection, jailbreaks, and content policy violations
  • Load and run open-source models via Hugging Face and Ollama

Daily Breakdown

Day 01 — How LLMs Work + Prompt Engineering

The foundation. Everything in this course — model selection, context window design, chunking strategy, temperature tuning — traces back to understanding what the model is actually doing.

Topic What You'll Learn
Transformers and Attention Self-attention, multi-head attention, why transformers parallelise where RNNs couldn't
Tokenization BPE, token counting, why gpt-4o and claude-sonnet-4-5 tokenize differently
Context Windows How much the model can "see", KV cache, practical limits
How LLMs Generate Text Temperature, top-p, top-k, greedy vs sampling, why randomness matters
Practice Exercises Tokenize text, observe sampling behaviour, compare context window limits
Interview Questions 6 questions you'll face in LLM engineering interviews

The highest-leverage skill. A well-crafted prompt turns a mediocre model into an excellent one. Before reaching for fine-tuning or RAG, exhaust what good prompting can do.

Topic What You'll Learn
Zero-Shot and Few-Shot When each works, how many examples is enough, example selection strategy
Chain-of-Thought "Let's think step by step", when CoT helps vs hurts, zero-shot CoT
Structured Output JSON mode, schema enforcement, prompt-based vs API-native approaches
System Prompts Persona, scope, format — the three dimensions of a system prompt
Advanced Prompt Patterns ReAct, self-consistency, meta-prompting, prompt chaining
Practice Exercises Rewrite weak prompts, implement CoT, extract structured data
Interview Questions 6 prompting Q&As with model answers

Day 02 — LLM APIs + Embeddings

The tools you'll use every day. Two frontier providers with different design philosophies — learn both well enough to build production systems with either and switch between them without rewriting code.

Topic What You'll Learn
OpenAI Chat Completions Messages API, streaming, async client, key parameters
Vision and Multimodal Image inputs, PDF processing, structured extraction from documents
Tool Use with OpenAI Defining tools, parsing tool_calls, parallel tool execution
Anthropic Messages API Key differences from OpenAI, tool_use blocks, streaming context manager
Cost and Rate Limits Token pricing, exponential backoff, budget guardrails
Practice Exercises Build a unified client that works across both APIs
Interview Questions API behaviour, error handling, cost estimation

Text as geometry. Once language lives in vector space, you search it with math instead of keywords — the foundation of every RAG system you'll build.

Topic What You'll Learn
What Are Embeddings Dense vectors, semantic meaning, why similar text clusters together
Embedding Models text-embedding-3-small, Sentence Transformers, MTEB benchmark
Cosine Similarity Dot product, L2 norm, distance vs similarity, implementation
Vector Search Brute force, FAISS, approximate nearest neighbour tradeoffs
Semantic Search Pipeline End-to-end: chunk → embed → index → retrieve → rerank
Practice Exercises Build a semantic FAQ search engine from scratch
Interview Questions Embeddings, similarity, model selection

Day 03 — RAG Basics + Vector Databases

The most important system pattern you'll learn. Retrieval-Augmented Generation solves the core production failure of LLMs: hallucination about facts outside their training data.

Topic What You'll Learn
What Is RAG Architecture, the retrieve-augment-generate loop, when it helps
Chunking Strategies Fixed, semantic, recursive, hierarchical — tradeoffs for each
Retrieval and Augmentation Context assembly, prompt design, handling retrieval failures
RAG Pipeline End-to-End PDF ingestion → embedding → retrieval → grounded answer
RAG vs Fine-Tuning Decision framework — what each solves, when to combine them
Practice Exercises Build a minimal RAG system over a document set
Interview Questions RAG design, failure modes, chunking choices

FAISS is for laptops. Production RAG needs persistence, filtering, and CRUD. Learn the three databases you'll encounter in real stacks.

Topic What You'll Learn
Vector DB Overview Capabilities, managed vs self-hosted, pricing comparison
ChromaDB PersistentClient, collections, metadata filtering operators
Pinecone Serverless indexes, namespaces, sparse-dense hybrid
Qdrant Self-hosted with Docker, payload filtering, on-disk indexing
Indexing and Filtering HNSW parameters, metadata filter operators, performance tuning
Hybrid Search BM25 + dense, Reciprocal Rank Fusion, when sparse retrieval wins
Practice Exercises Port a FAISS index to ChromaDB, add metadata filtering
Interview Questions DB selection, indexing tradeoffs, filtering gotchas

Day 04 — Evaluation + Responsible AI

Shipping without evaluation is shipping blind. You need to measure faithfulness, relevance, and hallucination rate — and verify that your prompt changes actually improved something.

Topic What You'll Learn
Evaluation Overview Eval types, metrics vs vibes, designing a test set
RAGAS Framework Faithfulness, answer relevancy, context recall, context precision
Hallucination and Faithfulness Why models confabulate, faithfulness scoring, detection approaches
Relevance Metrics Answer relevancy, context relevancy, BERTScore
Human Evaluations Rubric design, inter-rater reliability, calibration
Practice Exercises Run RAGAS on your Day 03 RAG pipeline
Interview Questions Eval strategy, metric choice, LLM-as-judge tradeoffs

Deploying LLMs without safety is like deploying a web server without auth. Your model will face adversarial inputs the moment it's public — build the skills to detect, prevent, and respond.

Topic What You'll Learn
Jailbreaks and Prompt Injection Attack taxonomy, indirect injection, defence strategies
Guardrails Input validation, output checking, multi-stage filtering
Content Filtering OpenAI Moderation API, Presidio PII detection, custom classifiers
Bias and Fairness Demographic auditing, counterfactual testing, mitigation approaches
Practice Exercises Add a guardrail layer to the RAG pipeline from Day 03
Interview Questions Safety architecture, prompt injection mitigations

Day 05 — Hugging Face + Local LLMs

Where the open-source ML world lives. 500,000+ models, 200,000+ datasets, and hosted inference — all behind a consistent Python SDK.

Topic What You'll Learn
Hugging Face Hub Searching models, model cards, gated models, downloading weights
Transformers Library pipeline(), AutoTokenizer, AutoModelForCausalLM, inference loop
Inference API Serverless hosted inference without owning GPU hardware
Spaces Deploying a Gradio demo, forking Spaces, sharing your work
Datasets and Model Cards Loading datasets, understanding model cards, MTEB leaderboard
Practice Exercises Load a fine-tuned model from Hub and run classification
Interview Questions Hub navigation, transformers library patterns

No API costs. No data leaving your machine. No rate limits. Learn to run models locally — and more importantly, when it's actually worth it.

Topic What You'll Learn
Why Run Locally Privacy, latency, cost — the three reasons to go local
Ollama Install, pull models, OpenAI-compatible REST API, model switching
llama.cpp GGUF format, CPU-only inference, Python bindings
Quantization Q4, Q8, NF4 — the quality vs memory tradeoff in numbers
When to Run Locally Decision framework: task, data sensitivity, hardware, cost
Practice Exercises Run Llama 3 with Ollama, benchmark against gpt-4o-mini
Interview Questions Local vs API, quantization tradeoffs, hardware requirements

Prerequisites

  • Python 3.10+ with pip
  • An OpenAI API key (OPENAI_API_KEY) — covers most sessions
  • An Anthropic API key (ANTHROPIC_API_KEY) — used in Day 02 Part 1
  • A Hugging Face account and token (HF_TOKEN) — used in Day 05
pip install openai anthropic chromadb sentence-transformers \
            transformers datasets huggingface_hub ragas \
            pinecone-client qdrant-client pypdf2 tiktoken

Never hardcode API keys

Always load keys from environment variables: os.getenv("OPENAI_API_KEY"). Every code example in this course follows this pattern.


Week 01 Assignment

Five tasks that build on each session:

  1. Make an authenticated API call to both OpenAI and Anthropic and print the response
  2. Build a semantic similarity tool: embed two sets of sentences, compute cosine similarity, rank results
  3. Build a minimal RAG pipeline over a PDF using ChromaDB and text-embedding-3-small
  4. Run RAGAS faithfulness and answer relevancy on your RAG pipeline with at least 10 test cases
  5. Use function calling to extract structured invoice data from three unstructured text samples

Full brief: Week 01 Assignment


What Week 01 builds toward

The skills from this week are the substrate for everything in Week 02. LangChain is just structured API calls. LangGraph is just state machines over prompt chains. Fine-tuning is just gradient descent on the patterns you've already seen. Understand the foundation and Week 02 clicks into place.

Next: Week 02 — Building LLM Applications