
A visual library of AI images with ready-to-use prompts
Picture & Prompt
Find a picture. Copy the prompt. Make it yours. Browse AI image ideas with the prompts, tags and details you need to create your own version.


WiFi for Retail: The Practical Guide for Store Teams
A practical guide to wifi for retail, covering architecture, security, analytics, vendor choices, ROI, and a deployment checklist for store teams. Check out (https://wirralai.com/)[Wirral AI] for more information. They are available 9 to 5 Weekdays and 9 to 12:30 on Saturdays
Visit Skills421
Staff Productivity: Metrics, Barriers & Strategies
Explore staff productivity metrics, common barriers, and practical strategies to boost team performance. Your guide to effective workplace improvement.

Onboarding Automation for Networks: A Practical Guide
Onboarding automation explained for IT and network teams — benefits, architecture, zero-trust patterns, KPIs, and real-world use cases across hospitality

Passpoint WiFi Setup: The Complete Enterprise Guide
Complete Passpoint WiFi setup guide for enterprise IT and hospitality teams. Covers certificates, RADIUS integration, vendor steps, validation

What makes a useful prompt library
A useful prompt library shows more than polished examples. It explains the task, the constraints, the output, and the technique that makes the prompt reusable.

Proximity Marketing: What It Is, How It Works, and What
Proximity marketing explained for venues, retailers, and IT teams. Compare technologies, see real use cases, and learn how
Footfall Tracking Explained: A Practical Guide for Venues
Learn how footfall tracking works, which sensing technology fits your venue, and how to roll it out with privacy, accuracy, and ROI built in.

How to Manage Certificates: A Practical Lifecycle Guide
Learn how to manage certificates across issuance, renewal, revocation and monitoring. Practical steps for IT teams using directory integrations and WiFi access.

What Is Micro Segmentation and Why It Matters for Zero Trust
Discover what is micro segmentation, how it limits lateral movement in zero-trust networks, and practical approaches to implement it safely

Migration Planning for Enterprise WiFi Networks
Master migration planning for enterprise WiFi with practical steps covering inventory, stakeholder mapping, risk mitigation, testing, and rollback strategies.

Legacy System Migration: A Complete Playbook for 2026
Plan a legacy system migration with confidence. A step-by-step playbook covering assessment, data migration, cutover, security, and ROI in 2026.

What Is Data Encryption and Why It Matters
What is data encryption - Learn what data encryption is, how it protects sensitive information, and why it's essential for enterprise WiFi security in 2026

Warehouse WiFi Solutions: A Guide for UK Logistics
Discover robust warehouse WiFi solutions for UK logistics. Improve coverage, reliability, and productivity with our expert design guide.

WiFi Directional Antennas: A Practical Guide to Types And
Discover the types, gain, and use cases of WiFi directional antennas to boost signal range and performance in 2026.

What Is Marketing Automation and How It Works in 2026
Discover what is marketing automation, how it works, and why UK businesses use it to boost ROI. Covers tools, benefits, use cases, and best practices.

WiFi Location Analytics Explained for UK Venues
Discover how WiFi location analytics transforms footfall data into actionable insights for UK retail, hospitality and transport venues.

What Is Identity Management and How It Works in 2026
What is identity management? Learn how IAM controls access with authentication, MFA, SSO and lifecycle governance across enterprise and WiFi networks.

Enterprise Wireless Network Deployment Guide
Plan, design and roll out an enterprise wireless network deployment with proven RF, security and segmentation strategies for hotels, retail and healthcare.

Java For Beginners
A hands-on introduction to the Java language for people new to programming.

Syntax
The building blocks of a Java program: how source files are structured and read.

Variables
Declaring, naming and assigning variables; primitive types and references.

Statements
Expression statements, blocks, and how the compiler reads a sequence of instructions.

Collections
Working with groups of values using the Java Collections Framework.

Lists
Ordered, indexed sequences with ArrayList and LinkedList.

Maps
Key-value lookups with HashMap and TreeMap.

Python Essentials
The core of day-to-day Python: values, control flow and the standard library.

Basics
Values, names and the read-eval-print loop.

Values
Numbers, strings, booleans and None; immutability and identity.

Control Flow
if / elif / else, while and for, and the truthiness rules that drive them.

What Are Embeddings?
# What Are Embeddings? **Course:** Embeddings For LLMs **Module:** Embedding Fundamentals **Lesson:** 1 ## Learning objective Understand embeddings as learned numerical representations that place related items close together in a vector space. ## Why this matters An embedding is not a human-readable label. It is a coordinate in a learned space. The individual dimensions usually do not have stable meanings such as 'price' or 'sentiment'. Meaning is distributed across the vector, and what matters operationally is the geometry between vectors. A useful mental model is to think of an embedding system as a learned coordinate system. Your application does not normally inspect each coordinate directly. Instead, it relies on relative position: which items are near, which are far, and which neighbourhoods contain useful candidates. ## Key concepts - **Vectors As Representations** — a core idea you should be able to explain and apply. - **Semantic Neighbourhoods** — a core idea you should be able to explain and apply. - **Dense Vs Sparse Representations** — a core idea you should be able to explain and apply. - **Why Embeddings Matter To Llm Applications** — a core idea you should be able to explain and apply. ## Worked example Search a support knowledge base for documents that mean the same thing as a user question even when they share few exact words. Suppose a retrieval system stores one vector per passage. At query time it converts the user question into a vector using the **same embedding model and preprocessing rules**. It then compares the query vector with stored vectors, retrieves the best candidates, applies any required metadata or security rules, and optionally reranks those candidates before giving context to an LLM. ## Design notes - Keep the embedding model and its version explicit in stored metadata. - Use identical preprocessing for indexing and querying unless the model documentation specifies different query/document instructions. - Evaluate with real queries instead of relying only on intuitive examples. - Separate retrieval errors from generation errors when debugging RAG. - Preserve source IDs so every result can be traced back to its original document. ## Practical exercise 1. Write down five short pieces of content from a domain you know. 2. Create three queries: one that uses the same wording, one that paraphrases the idea, and one that is deliberately ambiguous. 3. Predict which content should be retrieved for each query. 4. Identify which of the concepts in this lesson would most affect the ranking. 5. Describe one failure case and one measurement you would use to detect it. ## Knowledge check 1. What problem does **vectors as representations** solve in this lesson? 2. How would you test whether **why embeddings matter to LLM applications** improves a real retrieval workload? 3. What information would you record in logs so that a poor result could be debugged later? ## Summary Understand embeddings as learned numerical representations that place related items close together in a vector space. The central lesson is that embeddings are useful only when their geometry matches the task you care about. Model choice, preprocessing, indexing, filtering and evaluation all shape the final behaviour. ## Next step Continue to the next topic in **Embedding Fundamentals** and relate the new material back to this lesson's retrieval pipeline.

From Tokens to Vectors
# From Tokens to Vectors **Course:** Embeddings For LLMs **Module:** Embedding Fundamentals **Lesson:** 2 ## Learning objective Follow the path from raw text through tokenisation to token vectors and finally to a fixed-size embedding. ## Why this matters An LLM normally starts from token IDs, looks up initial token vectors, and repeatedly transforms them through attention and feed-forward layers. An embedding model then needs a rule for converting a sequence of contextual token states into one representation suitable for retrieval. A useful mental model is to think of an embedding system as a learned coordinate system. Your application does not normally inspect each coordinate directly. Instead, it relies on relative position: which items are near, which are far, and which neighbourhoods contain useful candidates. ## Key concepts - **Tokenisation** — a core idea you should be able to explain and apply. - **Token Ids** — a core idea you should be able to explain and apply. - **Embedding Lookup Tables** — a core idea you should be able to explain and apply. - **Contextual Token Representations** — a core idea you should be able to explain and apply. - **Pooling** — a core idea you should be able to explain and apply. ## Worked example Compare the word 'bank' in 'river bank' and 'bank account' and see why context changes the useful representation. Suppose a retrieval system stores one vector per passage. At query time it converts the user question into a vector using the **same embedding model and preprocessing rules**. It then compares the query vector with stored vectors, retrieves the best candidates, applies any required metadata or security rules, and optionally reranks those candidates before giving context to an LLM. ## Design notes - Keep the embedding model and its version explicit in stored metadata. - Use identical preprocessing for indexing and querying unless the model documentation specifies different query/document instructions. - Evaluate with real queries instead of relying only on intuitive examples. - Separate retrieval errors from generation errors when debugging RAG. - Preserve source IDs so every result can be traced back to its original document. ## Practical exercise 1. Write down five short pieces of content from a domain you know. 2. Create three queries: one that uses the same wording, one that paraphrases the idea, and one that is deliberately ambiguous. 3. Predict which content should be retrieved for each query. 4. Identify which of the concepts in this lesson would most affect the ranking. 5. Describe one failure case and one measurement you would use to detect it. ## Knowledge check 1. What problem does **tokenisation** solve in this lesson? 2. How would you test whether **pooling** improves a real retrieval workload? 3. What information would you record in logs so that a poor result could be debugged later? ## Summary Follow the path from raw text through tokenisation to token vectors and finally to a fixed-size embedding. The central lesson is that embeddings are useful only when their geometry matches the task you care about. Model choice, preprocessing, indexing, filtering and evaluation all shape the final behaviour. ## Next step Continue to the next topic in **Embedding Fundamentals** and relate the new material back to this lesson's retrieval pipeline.

Similarity and Distance
# Similarity and Distance **Course:** Embeddings For LLMs **Module:** Embedding Fundamentals **Lesson:** 3 ## Learning objective Learn how cosine similarity, dot product and Euclidean distance are used to compare embeddings. ## Why this matters Cosine similarity is especially common because it focuses on direction rather than magnitude. When vectors are L2-normalised, cosine similarity and dot product produce the same ranking. That simple fact is useful because dot products can be computed extremely efficiently. A useful mental model is to think of an embedding system as a learned coordinate system. Your application does not normally inspect each coordinate directly. Instead, it relies on relative position: which items are near, which are far, and which neighbourhoods contain useful candidates. ## Key concepts - **Cosine Similarity** — a core idea you should be able to explain and apply. - **Dot Product** — a core idea you should be able to explain and apply. - **Euclidean Distance** — a core idea you should be able to explain and apply. - **Normalisation** — a core idea you should be able to explain and apply. - **Nearest Neighbours** — a core idea you should be able to explain and apply. ## Worked example Rank five document vectors against one query vector and explain why the ranking changes with the metric. Suppose a retrieval system stores one vector per passage. At query time it converts the user question into a vector using the **same embedding model and preprocessing rules**. It then compares the query vector with stored vectors, retrieves the best candidates, applies any required metadata or security rules, and optionally reranks those candidates before giving context to an LLM. ## Design notes - Keep the embedding model and its version explicit in stored metadata. - Use identical preprocessing for indexing and querying unless the model documentation specifies different query/document instructions. - Evaluate with real queries instead of relying only on intuitive examples. - Separate retrieval errors from generation errors when debugging RAG. - Preserve source IDs so every result can be traced back to its original document. ## Worked code ```python import numpy as np def cosine(a, b): a = np.asarray(a, dtype=float) b = np.asarray(b, dtype=float) return float(a @ b / (np.linalg.norm(a) * np.linalg.norm(b))) ``` ## Practical exercise 1. Write down five short pieces of content from a domain you know. 2. Create three queries: one that uses the same wording, one that paraphrases the idea, and one that is deliberately ambiguous. 3. Predict which content should be retrieved for each query. 4. Identify which of the concepts in this lesson would most affect the ranking. 5. Describe one failure case and one measurement you would use to detect it. ## Knowledge check 1. What problem does **cosine similarity** solve in this lesson? 2. How would you test whether **nearest neighbours** improves a real retrieval workload? 3. What information would you record in logs so that a poor result could be debugged later? ## Summary Learn how cosine similarity, dot product and Euclidean distance are used to compare embeddings. The central lesson is that embeddings are useful only when their geometry matches the task you care about. Model choice, preprocessing, indexing, filtering and evaluation all shape the final behaviour. ## Next step Continue to the next topic in **Embedding Fundamentals** and relate the new material back to this lesson's retrieval pipeline.

Embedding Spaces and Semantics
# Embedding Spaces and Semantics **Course:** Embeddings For LLMs **Module:** Embedding Fundamentals **Lesson:** 4 ## Learning objective Develop intuition for geometry, clusters, directions and local neighbourhoods in high-dimensional embedding spaces. ## Why this matters High-dimensional spaces behave differently from familiar 2D geometry. Visual projections such as PCA, t-SNE or UMAP are useful for exploration but can distort neighbourhoods. Production retrieval should therefore be evaluated in the original space. A useful mental model is to think of an embedding system as a learned coordinate system. Your application does not normally inspect each coordinate directly. Instead, it relies on relative position: which items are near, which are far, and which neighbourhoods contain useful candidates. ## Key concepts - **High-Dimensional Geometry** — a core idea you should be able to explain and apply. - **Clusters** — a core idea you should be able to explain and apply. - **Semantic Directions** — a core idea you should be able to explain and apply. - **Manifolds** — a core idea you should be able to explain and apply. - **Visualisation Limits** — a core idea you should be able to explain and apply. ## Worked example Use a 2D projection only as a visual aid, while keeping retrieval decisions in the original high-dimensional space. Suppose a retrieval system stores one vector per passage. At query time it converts the user question into a vector using the **same embedding model and preprocessing rules**. It then compares the query vector with stored vectors, retrieves the best candidates, applies any required metadata or security rules, and optionally reranks those candidates before giving context to an LLM. ## Design notes - Keep the embedding model and its version explicit in stored metadata. - Use identical preprocessing for indexing and querying unless the model documentation specifies different query/document instructions. - Evaluate with real queries instead of relying only on intuitive examples. - Separate retrieval errors from generation errors when debugging RAG. - Preserve source IDs so every result can be traced back to its original document. ## Practical exercise 1. Write down five short pieces of content from a domain you know. 2. Create three queries: one that uses the same wording, one that paraphrases the idea, and one that is deliberately ambiguous. 3. Predict which content should be retrieved for each query. 4. Identify which of the concepts in this lesson would most affect the ranking. 5. Describe one failure case and one measurement you would use to detect it. ## Knowledge check 1. What problem does **high-dimensional geometry** solve in this lesson? 2. How would you test whether **visualisation limits** improves a real retrieval workload? 3. What information would you record in logs so that a poor result could be debugged later? ## Summary Develop intuition for geometry, clusters, directions and local neighbourhoods in high-dimensional embedding spaces. The central lesson is that embeddings are useful only when their geometry matches the task you care about. Model choice, preprocessing, indexing, filtering and evaluation all shape the final behaviour. ## Next step Continue to the next topic in **Embedding Fundamentals** and relate the new material back to this lesson's retrieval pipeline.

Training Objectives for Embedding Models
# Training Objectives for Embedding Models **Course:** Embeddings For LLMs **Module:** How Embedding Models Work **Lesson:** 1 ## Learning objective See how training objectives teach models that related examples should be close and unrelated examples should be separated. ## Why this matters Embedding models become useful because the training data defines what 'similar' means. A model trained on question-answer pairs learns a different notion of closeness from one trained on image captions, code pairs or product co-clicks. A useful mental model is to think of an embedding system as a learned coordinate system. Your application does not normally inspect each coordinate directly. Instead, it relies on relative position: which items are near, which are far, and which neighbourhoods contain useful candidates. ## Key concepts - **Positive Pairs** — a core idea you should be able to explain and apply. - **Negative Pairs** — a core idea you should be able to explain and apply. - **Triplet Loss** — a core idea you should be able to explain and apply. - **Contrastive Objectives** — a core idea you should be able to explain and apply. - **In-Batch Negatives** — a core idea you should be able to explain and apply. ## Worked example Train on question-answer pairs so that a question vector is close to the vector for its correct answer. Suppose a retrieval system stores one vector per passage. At query time it converts the user question into a vector using the **same embedding model and preprocessing rules**. It then compares the query vector with stored vectors, retrieves the best candidates, applies any required metadata or security rules, and optionally reranks those candidates before giving context to an LLM. ## Design notes - Keep the embedding model and its version explicit in stored metadata. - Use identical preprocessing for indexing and querying unless the model documentation specifies different query/document instructions. - Evaluate with real queries instead of relying only on intuitive examples. - Separate retrieval errors from generation errors when debugging RAG. - Preserve source IDs so every result can be traced back to its original document. ## Practical exercise 1. Write down five short pieces of content from a domain you know. 2. Create three queries: one that uses the same wording, one that paraphrases the idea, and one that is deliberately ambiguous. 3. Predict which content should be retrieved for each query. 4. Identify which of the concepts in this lesson would most affect the ranking. 5. Describe one failure case and one measurement you would use to detect it. ## Knowledge check 1. What problem does **positive pairs** solve in this lesson? 2. How would you test whether **in-batch negatives** improves a real retrieval workload? 3. What information would you record in logs so that a poor result could be debugged later? ## Summary See how training objectives teach models that related examples should be close and unrelated examples should be separated. The central lesson is that embeddings are useful only when their geometry matches the task you care about. Model choice, preprocessing, indexing, filtering and evaluation all shape the final behaviour. ## Next step Continue to the next topic in **How Embedding Models Work** and relate the new material back to this lesson's retrieval pipeline.

Transformers and Pooling
# Transformers and Pooling **Course:** Embeddings For LLMs **Module:** How Embedding Models Work **Lesson:** 2 ## Learning objective Understand how transformer encoders produce contextual token states and how pooling turns them into one vector. ## Why this matters Pooling is not a cosmetic implementation detail. A model trained with mean pooling should generally be used with mean pooling at inference. Changing pooling can move vectors into a geometry that the training objective never optimised. A useful mental model is to think of an embedding system as a learned coordinate system. Your application does not normally inspect each coordinate directly. Instead, it relies on relative position: which items are near, which are far, and which neighbourhoods contain useful candidates. ## Key concepts - **Encoder Transformers** — a core idea you should be able to explain and apply. - **Hidden States** — a core idea you should be able to explain and apply. - **Cls Pooling** — a core idea you should be able to explain and apply. - **Mean Pooling** — a core idea you should be able to explain and apply. - **Attention-Aware Pooling** — a core idea you should be able to explain and apply. ## Worked example Compare mean pooling with using the first token and discuss why the best choice depends on model training. Suppose a retrieval system stores one vector per passage. At query time it converts the user question into a vector using the **same embedding model and preprocessing rules**. It then compares the query vector with stored vectors, retrieves the best candidates, applies any required metadata or security rules, and optionally reranks those candidates before giving context to an LLM. ## Design notes - Keep the embedding model and its version explicit in stored metadata. - Use identical preprocessing for indexing and querying unless the model documentation specifies different query/document instructions. - Evaluate with real queries instead of relying only on intuitive examples. - Separate retrieval errors from generation errors when debugging RAG. - Preserve source IDs so every result can be traced back to its original document. ## Practical exercise 1. Write down five short pieces of content from a domain you know. 2. Create three queries: one that uses the same wording, one that paraphrases the idea, and one that is deliberately ambiguous. 3. Predict which content should be retrieved for each query. 4. Identify which of the concepts in this lesson would most affect the ranking. 5. Describe one failure case and one measurement you would use to detect it. ## Knowledge check 1. What problem does **encoder transformers** solve in this lesson? 2. How would you test whether **attention-aware pooling** improves a real retrieval workload? 3. What information would you record in logs so that a poor result could be debugged later? ## Summary Understand how transformer encoders produce contextual token states and how pooling turns them into one vector. The central lesson is that embeddings are useful only when their geometry matches the task you care about. Model choice, preprocessing, indexing, filtering and evaluation all shape the final behaviour. ## Next step Continue to the next topic in **How Embedding Models Work** and relate the new material back to this lesson's retrieval pipeline.

Contrastive Learning
# Contrastive Learning **Course:** Embeddings For LLMs **Module:** How Embedding Models Work **Lesson:** 3 ## Learning objective Learn how contrastive learning shapes a useful retrieval space through positives, hard negatives and temperature scaling. ## Why this matters The hardest part of contrastive training is often negative selection. Easy negatives teach little; impossible or mislabeled negatives can destabilise learning. Hard negatives should be plausible competitors that are still genuinely wrong. A useful mental model is to think of an embedding system as a learned coordinate system. Your application does not normally inspect each coordinate directly. Instead, it relies on relative position: which items are near, which are far, and which neighbourhoods contain useful candidates. ## Key concepts - **Infonce** — a core idea you should be able to explain and apply. - **Hard Negatives** — a core idea you should be able to explain and apply. - **Temperature** — a core idea you should be able to explain and apply. - **Batch Composition** — a core idea you should be able to explain and apply. - **False Negatives** — a core idea you should be able to explain and apply. ## Worked example Improve a product-search model by replacing random negatives with products that look deceptively similar to the query. Suppose a retrieval system stores one vector per passage. At query time it converts the user question into a vector using the **same embedding model and preprocessing rules**. It then compares the query vector with stored vectors, retrieves the best candidates, applies any required metadata or security rules, and optionally reranks those candidates before giving context to an LLM. ## Design notes - Keep the embedding model and its version explicit in stored metadata. - Use identical preprocessing for indexing and querying unless the model documentation specifies different query/document instructions. - Evaluate with real queries instead of relying only on intuitive examples. - Separate retrieval errors from generation errors when debugging RAG. - Preserve source IDs so every result can be traced back to its original document. ## Practical exercise 1. Write down five short pieces of content from a domain you know. 2. Create three queries: one that uses the same wording, one that paraphrases the idea, and one that is deliberately ambiguous. 3. Predict which content should be retrieved for each query. 4. Identify which of the concepts in this lesson would most affect the ranking. 5. Describe one failure case and one measurement you would use to detect it. ## Knowledge check 1. What problem does **InfoNCE** solve in this lesson? 2. How would you test whether **false negatives** improves a real retrieval workload? 3. What information would you record in logs so that a poor result could be debugged later? ## Summary Learn how contrastive learning shapes a useful retrieval space through positives, hard negatives and temperature scaling. The central lesson is that embeddings are useful only when their geometry matches the task you care about. Model choice, preprocessing, indexing, filtering and evaluation all shape the final behaviour. ## Next step Continue to the next topic in **How Embedding Models Work** and relate the new material back to this lesson's retrieval pipeline.

Dimensions, Normalisation and Precision
# Dimensions, Normalisation and Precision **Course:** Embeddings For LLMs **Module:** How Embedding Models Work **Lesson:** 4 ## Learning objective Understand vector dimensionality, unit normalisation and numeric precision as engineering choices. ## Why this matters More dimensions can carry more information, but they increase memory, bandwidth and index cost. The correct size is an empirical trade-off. Many modern systems can also shorten or quantise vectors with limited quality loss for a specific domain. A useful mental model is to think of an embedding system as a learned coordinate system. Your application does not normally inspect each coordinate directly. Instead, it relies on relative position: which items are near, which are far, and which neighbourhoods contain useful candidates. ## Key concepts - **Dimensionality** — a core idea you should be able to explain and apply. - **L2 Normalisation** — a core idea you should be able to explain and apply. - **Float32** — a core idea you should be able to explain and apply. - **Float16** — a core idea you should be able to explain and apply. - **Quantisation** — a core idea you should be able to explain and apply. ## Worked example Estimate storage for one million 768-dimensional vectors and compare float32 with half precision. Suppose a retrieval system stores one vector per passage. At query time it converts the user question into a vector using the **same embedding model and preprocessing rules**. It then compares the query vector with stored vectors, retrieves the best candidates, applies any required metadata or security rules, and optionally reranks those candidates before giving context to an LLM. ## Design notes - Keep the embedding model and its version explicit in stored metadata. - Use identical preprocessing for indexing and querying unless the model documentation specifies different query/document instructions. - Evaluate with real queries instead of relying only on intuitive examples. - Separate retrieval errors from generation errors when debugging RAG. - Preserve source IDs so every result can be traced back to its original document. ## Practical exercise 1. Write down five short pieces of content from a domain you know. 2. Create three queries: one that uses the same wording, one that paraphrases the idea, and one that is deliberately ambiguous. 3. Predict which content should be retrieved for each query. 4. Identify which of the concepts in this lesson would most affect the ranking. 5. Describe one failure case and one measurement you would use to detect it. ## Knowledge check 1. What problem does **dimensionality** solve in this lesson? 2. How would you test whether **quantisation** improves a real retrieval workload? 3. What information would you record in logs so that a poor result could be debugged later? ## Summary Understand vector dimensionality, unit normalisation and numeric precision as engineering choices. The central lesson is that embeddings are useful only when their geometry matches the task you care about. Model choice, preprocessing, indexing, filtering and evaluation all shape the final behaviour. ## Next step Continue to the next topic in **How Embedding Models Work** and relate the new material back to this lesson's retrieval pipeline.

Semantic Search
# Semantic Search **Course:** Embeddings For LLMs **Module:** Using Embeddings with LLMs **Lesson:** 1 ## Learning objective Build the conceptual pipeline that turns a natural-language query into ranked semantically related content. ## Why this matters Semantic search separates the wording of a query from its intent. That improves recall, but it can also retrieve conceptually related text that lacks an exact constraint. Metadata filters and lexical signals are therefore important complements. A useful mental model is to think of an embedding system as a learned coordinate system. Your application does not normally inspect each coordinate directly. Instead, it relies on relative position: which items are near, which are far, and which neighbourhoods contain useful candidates. ## Key concepts - **Query Embedding** — a core idea you should be able to explain and apply. - **Document Embeddings** — a core idea you should be able to explain and apply. - **Top-K Retrieval** — a core idea you should be able to explain and apply. - **Filters** — a core idea you should be able to explain and apply. - **Semantic Ranking** — a core idea you should be able to explain and apply. ## Worked example Retrieve an article about resetting a router when the query says 'my internet box will not reconnect'. Suppose a retrieval system stores one vector per passage. At query time it converts the user question into a vector using the **same embedding model and preprocessing rules**. It then compares the query vector with stored vectors, retrieves the best candidates, applies any required metadata or security rules, and optionally reranks those candidates before giving context to an LLM. ## Design notes - Keep the embedding model and its version explicit in stored metadata. - Use identical preprocessing for indexing and querying unless the model documentation specifies different query/document instructions. - Evaluate with real queries instead of relying only on intuitive examples. - Separate retrieval errors from generation errors when debugging RAG. - Preserve source IDs so every result can be traced back to its original document. ## Practical exercise 1. Write down five short pieces of content from a domain you know. 2. Create three queries: one that uses the same wording, one that paraphrases the idea, and one that is deliberately ambiguous. 3. Predict which content should be retrieved for each query. 4. Identify which of the concepts in this lesson would most affect the ranking. 5. Describe one failure case and one measurement you would use to detect it. ## Knowledge check 1. What problem does **query embedding** solve in this lesson? 2. How would you test whether **semantic ranking** improves a real retrieval workload? 3. What information would you record in logs so that a poor result could be debugged later? ## Summary Build the conceptual pipeline that turns a natural-language query into ranked semantically related content. The central lesson is that embeddings are useful only when their geometry matches the task you care about. Model choice, preprocessing, indexing, filtering and evaluation all shape the final behaviour. ## Next step Continue to the next topic in **Using Embeddings with LLMs** and relate the new material back to this lesson's retrieval pipeline.

Retrieval-Augmented Generation
# Retrieval-Augmented Generation **Course:** Embeddings For LLMs **Module:** Using Embeddings with LLMs **Lesson:** 2 ## Learning objective Understand how embeddings connect a private knowledge source to an LLM without retraining the LLM. ## Why this matters RAG does not give the LLM permanent knowledge of your documents. Retrieval happens for each query, relevant passages are inserted into the prompt, and the LLM reasons over that temporary context. This is why retrieval quality directly limits answer quality. A useful mental model is to think of an embedding system as a learned coordinate system. Your application does not normally inspect each coordinate directly. Instead, it relies on relative position: which items are near, which are far, and which neighbourhoods contain useful candidates. ## Key concepts - **Ingestion** — a core idea you should be able to explain and apply. - **Retrieval** — a core idea you should be able to explain and apply. - **Prompt Assembly** — a core idea you should be able to explain and apply. - **Grounding** — a core idea you should be able to explain and apply. - **Citations** — a core idea you should be able to explain and apply. ## Worked example Answer a policy question by retrieving the most relevant internal passages before asking the LLM to compose the response. Suppose a retrieval system stores one vector per passage. At query time it converts the user question into a vector using the **same embedding model and preprocessing rules**. It then compares the query vector with stored vectors, retrieves the best candidates, applies any required metadata or security rules, and optionally reranks those candidates before giving context to an LLM. ## Design notes - Keep the embedding model and its version explicit in stored metadata. - Use identical preprocessing for indexing and querying unless the model documentation specifies different query/document instructions. - Evaluate with real queries instead of relying only on intuitive examples. - Separate retrieval errors from generation errors when debugging RAG. - Preserve source IDs so every result can be traced back to its original document. ## Practical exercise 1. Write down five short pieces of content from a domain you know. 2. Create three queries: one that uses the same wording, one that paraphrases the idea, and one that is deliberately ambiguous. 3. Predict which content should be retrieved for each query. 4. Identify which of the concepts in this lesson would most affect the ranking. 5. Describe one failure case and one measurement you would use to detect it. ## Knowledge check 1. What problem does **ingestion** solve in this lesson? 2. How would you test whether **citations** improves a real retrieval workload? 3. What information would you record in logs so that a poor result could be debugged later? ## Summary Understand how embeddings connect a private knowledge source to an LLM without retraining the LLM. The central lesson is that embeddings are useful only when their geometry matches the task you care about. Model choice, preprocessing, indexing, filtering and evaluation all shape the final behaviour. ## Next step Continue to the next topic in **Using Embeddings with LLMs** and relate the new material back to this lesson's retrieval pipeline.

Chunking and Context Windows
# Chunking and Context Windows **Course:** Embeddings For LLMs **Module:** Using Embeddings with LLMs **Lesson:** 3 ## Learning objective Learn how chunk size, overlap and document structure affect retrieval quality and downstream generation. ## Why this matters Chunking creates the unit that retrieval can return. Chunks that are too small lose meaning; chunks that are too large dilute the useful signal. Structure-aware splitting usually beats arbitrary character counts because it follows how authors organise ideas. A useful mental model is to think of an embedding system as a learned coordinate system. Your application does not normally inspect each coordinate directly. Instead, it relies on relative position: which items are near, which are far, and which neighbourhoods contain useful candidates. ## Key concepts - **Chunk Size** — a core idea you should be able to explain and apply. - **Overlap** — a core idea you should be able to explain and apply. - **Semantic Boundaries** — a core idea you should be able to explain and apply. - **Context Windows** — a core idea you should be able to explain and apply. - **Parent-Child Retrieval** — a core idea you should be able to explain and apply. ## Worked example Split a long handbook by headings rather than fixed characters so that each retrieved chunk preserves a coherent idea. Suppose a retrieval system stores one vector per passage. At query time it converts the user question into a vector using the **same embedding model and preprocessing rules**. It then compares the query vector with stored vectors, retrieves the best candidates, applies any required metadata or security rules, and optionally reranks those candidates before giving context to an LLM. ## Design notes - Keep the embedding model and its version explicit in stored metadata. - Use identical preprocessing for indexing and querying unless the model documentation specifies different query/document instructions. - Evaluate with real queries instead of relying only on intuitive examples. - Separate retrieval errors from generation errors when debugging RAG. - Preserve source IDs so every result can be traced back to its original document. ## Practical exercise 1. Write down five short pieces of content from a domain you know. 2. Create three queries: one that uses the same wording, one that paraphrases the idea, and one that is deliberately ambiguous. 3. Predict which content should be retrieved for each query. 4. Identify which of the concepts in this lesson would most affect the ranking. 5. Describe one failure case and one measurement you would use to detect it. ## Knowledge check 1. What problem does **chunk size** solve in this lesson? 2. How would you test whether **parent-child retrieval** improves a real retrieval workload? 3. What information would you record in logs so that a poor result could be debugged later? ## Summary Learn how chunk size, overlap and document structure affect retrieval quality and downstream generation. The central lesson is that embeddings are useful only when their geometry matches the task you care about. Model choice, preprocessing, indexing, filtering and evaluation all shape the final behaviour. ## Next step Continue to the next topic in **Using Embeddings with LLMs** and relate the new material back to this lesson's retrieval pipeline.

Reranking and Hybrid Search
# Reranking and Hybrid Search **Course:** Embeddings For LLMs **Module:** Using Embeddings with LLMs **Lesson:** 4 ## Learning objective Combine embeddings with keyword retrieval and rerankers to improve precision on difficult queries. ## Why this matters A two-stage system is common: a fast retriever produces candidates, then a slower model scores a much smaller set more accurately. Hybrid search also protects against cases where exact identifiers, names or codes matter more than semantic similarity. A useful mental model is to think of an embedding system as a learned coordinate system. Your application does not normally inspect each coordinate directly. Instead, it relies on relative position: which items are near, which are far, and which neighbourhoods contain useful candidates. ## Key concepts - **Bm25** — a core idea you should be able to explain and apply. - **Hybrid Search** — a core idea you should be able to explain and apply. - **Reciprocal Rank Fusion** — a core idea you should be able to explain and apply. - **Cross-Encoder Reranking** — a core idea you should be able to explain and apply. - **Candidate Generation** — a core idea you should be able to explain and apply. ## Worked example Use vector search to find semantically related candidates, keyword search for exact terms, then rerank the merged result set. Suppose a retrieval system stores one vector per passage. At query time it converts the user question into a vector using the **same embedding model and preprocessing rules**. It then compares the query vector with stored vectors, retrieves the best candidates, applies any required metadata or security rules, and optionally reranks those candidates before giving context to an LLM. ## Design notes - Keep the embedding model and its version explicit in stored metadata. - Use identical preprocessing for indexing and querying unless the model documentation specifies different query/document instructions. - Evaluate with real queries instead of relying only on intuitive examples. - Separate retrieval errors from generation errors when debugging RAG. - Preserve source IDs so every result can be traced back to its original document. ## Practical exercise 1. Write down five short pieces of content from a domain you know. 2. Create three queries: one that uses the same wording, one that paraphrases the idea, and one that is deliberately ambiguous. 3. Predict which content should be retrieved for each query. 4. Identify which of the concepts in this lesson would most affect the ranking. 5. Describe one failure case and one measurement you would use to detect it. ## Knowledge check 1. What problem does **BM25** solve in this lesson? 2. How would you test whether **candidate generation** improves a real retrieval workload? 3. What information would you record in logs so that a poor result could be debugged later? ## Summary Combine embeddings with keyword retrieval and rerankers to improve precision on difficult queries. The central lesson is that embeddings are useful only when their geometry matches the task you care about. Model choice, preprocessing, indexing, filtering and evaluation all shape the final behaviour. ## Next step Continue to the next topic in **Using Embeddings with LLMs** and relate the new material back to this lesson's retrieval pipeline.

Vector Indexes and Approximate Nearest Neighbours
# Vector Indexes and Approximate Nearest Neighbours **Course:** Embeddings For LLMs **Module:** Vector Databases **Lesson:** 1 ## Learning objective Understand why production systems use specialised indexes rather than comparing every query to every vector. ## Why this matters Exact nearest-neighbour search compares against every vector. ANN indexes trade a small amount of recall for much lower latency. The goal is not 'approximate for its own sake' but a controlled engineering trade-off measured against your evaluation set. A useful mental model is to think of an embedding system as a learned coordinate system. Your application does not normally inspect each coordinate directly. Instead, it relies on relative position: which items are near, which are far, and which neighbourhoods contain useful candidates. ## Key concepts - **Exact Search** — a core idea you should be able to explain and apply. - **Approximate Nearest Neighbours** — a core idea you should be able to explain and apply. - **Index Build** — a core idea you should be able to explain and apply. - **Recall-Latency Tradeoff** — a core idea you should be able to explain and apply. - **Top-K** — a core idea you should be able to explain and apply. ## Worked example Explain why a brute-force scan may be fine for ten thousand vectors but unsuitable for hundreds of millions. Suppose a retrieval system stores one vector per passage. At query time it converts the user question into a vector using the **same embedding model and preprocessing rules**. It then compares the query vector with stored vectors, retrieves the best candidates, applies any required metadata or security rules, and optionally reranks those candidates before giving context to an LLM. ## Design notes - Keep the embedding model and its version explicit in stored metadata. - Use identical preprocessing for indexing and querying unless the model documentation specifies different query/document instructions. - Evaluate with real queries instead of relying only on intuitive examples. - Separate retrieval errors from generation errors when debugging RAG. - Preserve source IDs so every result can be traced back to its original document. ## Practical exercise 1. Write down five short pieces of content from a domain you know. 2. Create three queries: one that uses the same wording, one that paraphrases the idea, and one that is deliberately ambiguous. 3. Predict which content should be retrieved for each query. 4. Identify which of the concepts in this lesson would most affect the ranking. 5. Describe one failure case and one measurement you would use to detect it. ## Knowledge check 1. What problem does **exact search** solve in this lesson? 2. How would you test whether **top-k** improves a real retrieval workload? 3. What information would you record in logs so that a poor result could be debugged later? ## Summary Understand why production systems use specialised indexes rather than comparing every query to every vector. The central lesson is that embeddings are useful only when their geometry matches the task you care about. Model choice, preprocessing, indexing, filtering and evaluation all shape the final behaviour. ## Next step Continue to the next topic in **Vector Databases** and relate the new material back to this lesson's retrieval pipeline.

HNSW, IVF and Product Quantisation
# HNSW, IVF and Product Quantisation **Course:** Embeddings For LLMs **Module:** Vector Databases **Lesson:** 2 ## Learning objective Compare common ANN techniques and learn when graph, partitioning and compression approaches are useful. ## Why this matters HNSW navigates a graph of neighbours; IVF narrows search to selected partitions; product quantisation compresses vectors into compact codes. Real systems can combine these ideas, so benchmark with your vector count, dimension and query distribution. A useful mental model is to think of an embedding system as a learned coordinate system. Your application does not normally inspect each coordinate directly. Instead, it relies on relative position: which items are near, which are far, and which neighbourhoods contain useful candidates. ## Key concepts - **Hnsw** — a core idea you should be able to explain and apply. - **Ivf** — a core idea you should be able to explain and apply. - **Product Quantisation** — a core idea you should be able to explain and apply. - **Efsearch** — a core idea you should be able to explain and apply. - **Nprobe** — a core idea you should be able to explain and apply. ## Worked example Choose HNSW for high recall and fast online search, or IVF-PQ where memory compression is a primary constraint. Suppose a retrieval system stores one vector per passage. At query time it converts the user question into a vector using the **same embedding model and preprocessing rules**. It then compares the query vector with stored vectors, retrieves the best candidates, applies any required metadata or security rules, and optionally reranks those candidates before giving context to an LLM. ## Design notes - Keep the embedding model and its version explicit in stored metadata. - Use identical preprocessing for indexing and querying unless the model documentation specifies different query/document instructions. - Evaluate with real queries instead of relying only on intuitive examples. - Separate retrieval errors from generation errors when debugging RAG. - Preserve source IDs so every result can be traced back to its original document. ## Practical exercise 1. Write down five short pieces of content from a domain you know. 2. Create three queries: one that uses the same wording, one that paraphrases the idea, and one that is deliberately ambiguous. 3. Predict which content should be retrieved for each query. 4. Identify which of the concepts in this lesson would most affect the ranking. 5. Describe one failure case and one measurement you would use to detect it. ## Knowledge check 1. What problem does **HNSW** solve in this lesson? 2. How would you test whether **nprobe** improves a real retrieval workload? 3. What information would you record in logs so that a poor result could be debugged later? ## Summary Compare common ANN techniques and learn when graph, partitioning and compression approaches are useful. The central lesson is that embeddings are useful only when their geometry matches the task you care about. Model choice, preprocessing, indexing, filtering and evaluation all shape the final behaviour. ## Next step Continue to the next topic in **Vector Databases** and relate the new material back to this lesson's retrieval pipeline.

Metadata Filtering
# Metadata Filtering **Course:** Embeddings For LLMs **Module:** Vector Databases **Lesson:** 3 ## Learning objective Use structured metadata alongside vector similarity so results obey tenant, date, category and access constraints. ## Why this matters Security and business constraints should not be left to the LLM. Access filters belong in the retrieval layer. If a document is not allowed for the current user, it should never enter the candidate context. A useful mental model is to think of an embedding system as a learned coordinate system. Your application does not normally inspect each coordinate directly. Instead, it relies on relative position: which items are near, which are far, and which neighbourhoods contain useful candidates. ## Key concepts - **Pre-Filtering** — a core idea you should be able to explain and apply. - **Post-Filtering** — a core idea you should be able to explain and apply. - **Acl Filters** — a core idea you should be able to explain and apply. - **Tenant Isolation** — a core idea you should be able to explain and apply. - **Facets** — a core idea you should be able to explain and apply. ## Worked example Retrieve only documents the current user may access, from the correct customer and product version. Suppose a retrieval system stores one vector per passage. At query time it converts the user question into a vector using the **same embedding model and preprocessing rules**. It then compares the query vector with stored vectors, retrieves the best candidates, applies any required metadata or security rules, and optionally reranks those candidates before giving context to an LLM. ## Design notes - Keep the embedding model and its version explicit in stored metadata. - Use identical preprocessing for indexing and querying unless the model documentation specifies different query/document instructions. - Evaluate with real queries instead of relying only on intuitive examples. - Separate retrieval errors from generation errors when debugging RAG. - Preserve source IDs so every result can be traced back to its original document. ## Practical exercise 1. Write down five short pieces of content from a domain you know. 2. Create three queries: one that uses the same wording, one that paraphrases the idea, and one that is deliberately ambiguous. 3. Predict which content should be retrieved for each query. 4. Identify which of the concepts in this lesson would most affect the ranking. 5. Describe one failure case and one measurement you would use to detect it. ## Knowledge check 1. What problem does **pre-filtering** solve in this lesson? 2. How would you test whether **facets** improves a real retrieval workload? 3. What information would you record in logs so that a poor result could be debugged later? ## Summary Use structured metadata alongside vector similarity so results obey tenant, date, category and access constraints. The central lesson is that embeddings are useful only when their geometry matches the task you care about. Model choice, preprocessing, indexing, filtering and evaluation all shape the final behaviour. ## Next step Continue to the next topic in **Vector Databases** and relate the new material back to this lesson's retrieval pipeline.

Scaling and Operating a Vector Store
# Scaling and Operating a Vector Store **Course:** Embeddings For LLMs **Module:** Vector Databases **Lesson:** 4 ## Learning objective Plan sharding, replication, backups, monitoring and ingestion for a growing embedding workload. ## Why this matters A vector database is still a database. You need backups, observability, schema discipline, data lifecycle rules and migration procedures. Index settings that work at one million vectors may need redesign at one hundred million. A useful mental model is to think of an embedding system as a learned coordinate system. Your application does not normally inspect each coordinate directly. Instead, it relies on relative position: which items are near, which are far, and which neighbourhoods contain useful candidates. ## Key concepts - **Sharding** — a core idea you should be able to explain and apply. - **Replication** — a core idea you should be able to explain and apply. - **Compaction** — a core idea you should be able to explain and apply. - **Backups** — a core idea you should be able to explain and apply. - **Observability** — a core idea you should be able to explain and apply. ## Worked example Design a reindexing process that can replace an embedding model without taking search offline. Suppose a retrieval system stores one vector per passage. At query time it converts the user question into a vector using the **same embedding model and preprocessing rules**. It then compares the query vector with stored vectors, retrieves the best candidates, applies any required metadata or security rules, and optionally reranks those candidates before giving context to an LLM. ## Design notes - Keep the embedding model and its version explicit in stored metadata. - Use identical preprocessing for indexing and querying unless the model documentation specifies different query/document instructions. - Evaluate with real queries instead of relying only on intuitive examples. - Separate retrieval errors from generation errors when debugging RAG. - Preserve source IDs so every result can be traced back to its original document. ## Practical exercise 1. Write down five short pieces of content from a domain you know. 2. Create three queries: one that uses the same wording, one that paraphrases the idea, and one that is deliberately ambiguous. 3. Predict which content should be retrieved for each query. 4. Identify which of the concepts in this lesson would most affect the ranking. 5. Describe one failure case and one measurement you would use to detect it. ## Knowledge check 1. What problem does **sharding** solve in this lesson? 2. How would you test whether **observability** improves a real retrieval workload? 3. What information would you record in logs so that a poor result could be debugged later? ## Summary Plan sharding, replication, backups, monitoring and ingestion for a growing embedding workload. The central lesson is that embeddings are useful only when their geometry matches the task you care about. Model choice, preprocessing, indexing, filtering and evaluation all shape the final behaviour. ## Next step Continue to the next topic in **Vector Databases** and relate the new material back to this lesson's retrieval pipeline.

Benchmarking Retrieval
# Benchmarking Retrieval **Course:** Embeddings For LLMs **Module:** Quality and Evaluation **Lesson:** 1 ## Learning objective Create a representative evaluation set and use it to compare embedding models and retrieval configurations. ## Why this matters The best model on a public benchmark may not be best for your users. Build a small but representative labelled set from real questions, document types and edge cases. That dataset becomes the anchor for evidence-based tuning. A useful mental model is to think of an embedding system as a learned coordinate system. Your application does not normally inspect each coordinate directly. Instead, it relies on relative position: which items are near, which are far, and which neighbourhoods contain useful candidates. ## Key concepts - **Golden Queries** — a core idea you should be able to explain and apply. - **Relevance Labels** — a core idea you should be able to explain and apply. - **Test Splits** — a core idea you should be able to explain and apply. - **Offline Evaluation** — a core idea you should be able to explain and apply. - **Regression Testing** — a core idea you should be able to explain and apply. ## Worked example Build a set of real user questions with human-judged relevant passages, then rerun it after every retrieval change. Suppose a retrieval system stores one vector per passage. At query time it converts the user question into a vector using the **same embedding model and preprocessing rules**. It then compares the query vector with stored vectors, retrieves the best candidates, applies any required metadata or security rules, and optionally reranks those candidates before giving context to an LLM. ## Design notes - Keep the embedding model and its version explicit in stored metadata. - Use identical preprocessing for indexing and querying unless the model documentation specifies different query/document instructions. - Evaluate with real queries instead of relying only on intuitive examples. - Separate retrieval errors from generation errors when debugging RAG. - Preserve source IDs so every result can be traced back to its original document. ## Practical exercise 1. Write down five short pieces of content from a domain you know. 2. Create three queries: one that uses the same wording, one that paraphrases the idea, and one that is deliberately ambiguous. 3. Predict which content should be retrieved for each query. 4. Identify which of the concepts in this lesson would most affect the ranking. 5. Describe one failure case and one measurement you would use to detect it. ## Knowledge check 1. What problem does **golden queries** solve in this lesson? 2. How would you test whether **regression testing** improves a real retrieval workload? 3. What information would you record in logs so that a poor result could be debugged later? ## Summary Create a representative evaluation set and use it to compare embedding models and retrieval configurations. The central lesson is that embeddings are useful only when their geometry matches the task you care about. Model choice, preprocessing, indexing, filtering and evaluation all shape the final behaviour. ## Next step Continue to the next topic in **Quality and Evaluation** and relate the new material back to this lesson's retrieval pipeline.

Recall, Precision, MRR and NDCG
# Recall, Precision, MRR and NDCG **Course:** Embeddings For LLMs **Module:** Quality and Evaluation **Lesson:** 2 ## Learning objective Use standard information-retrieval metrics to measure whether relevant material appears and where it appears. ## Why this matters No single metric tells the whole story. RAG often cares strongly about recall because missing the supporting passage cannot be fixed by generation, while product search may care more about early-rank precision. A useful mental model is to think of an embedding system as a learned coordinate system. Your application does not normally inspect each coordinate directly. Instead, it relies on relative position: which items are near, which are far, and which neighbourhoods contain useful candidates. ## Key concepts - **Recall@K** — a core idea you should be able to explain and apply. - **Precision@K** — a core idea you should be able to explain and apply. - **Mrr** — a core idea you should be able to explain and apply. - **Ndcg** — a core idea you should be able to explain and apply. - **Hit Rate** — a core idea you should be able to explain and apply. ## Worked example Compare two systems where both retrieve the right document, but one places it first and the other places it tenth. Suppose a retrieval system stores one vector per passage. At query time it converts the user question into a vector using the **same embedding model and preprocessing rules**. It then compares the query vector with stored vectors, retrieves the best candidates, applies any required metadata or security rules, and optionally reranks those candidates before giving context to an LLM. ## Design notes - Keep the embedding model and its version explicit in stored metadata. - Use identical preprocessing for indexing and querying unless the model documentation specifies different query/document instructions. - Evaluate with real queries instead of relying only on intuitive examples. - Separate retrieval errors from generation errors when debugging RAG. - Preserve source IDs so every result can be traced back to its original document. ## Worked code ```text Recall@k = relevant items retrieved in top k / all relevant items Precision@k = relevant items retrieved in top k / k MRR = mean(1 / rank of first relevant result) NDCG = ranking quality with graded relevance and position discount ``` ## Practical exercise 1. Write down five short pieces of content from a domain you know. 2. Create three queries: one that uses the same wording, one that paraphrases the idea, and one that is deliberately ambiguous. 3. Predict which content should be retrieved for each query. 4. Identify which of the concepts in this lesson would most affect the ranking. 5. Describe one failure case and one measurement you would use to detect it. ## Knowledge check 1. What problem does **recall@k** solve in this lesson? 2. How would you test whether **hit rate** improves a real retrieval workload? 3. What information would you record in logs so that a poor result could be debugged later? ## Summary Use standard information-retrieval metrics to measure whether relevant material appears and where it appears. The central lesson is that embeddings are useful only when their geometry matches the task you care about. Model choice, preprocessing, indexing, filtering and evaluation all shape the final behaviour. ## Next step Continue to the next topic in **Quality and Evaluation** and relate the new material back to this lesson's retrieval pipeline.

Domain Adaptation
# Domain Adaptation **Course:** Embeddings For LLMs **Module:** Quality and Evaluation **Lesson:** 3 ## Learning objective Recognise when a general embedding model is insufficient and when prompt tuning, fine-tuning or specialised models help. ## Why this matters Before fine-tuning, test simpler changes: better chunking, instruction prefixes, query rewriting and hybrid retrieval. Fine-tuning is valuable when you have stable domain-specific relevance data and a repeatable evaluation process. A useful mental model is to think of an embedding system as a learned coordinate system. Your application does not normally inspect each coordinate directly. Instead, it relies on relative position: which items are near, which are far, and which neighbourhoods contain useful candidates. ## Key concepts - **Domain Vocabulary** — a core idea you should be able to explain and apply. - **Fine-Tuning** — a core idea you should be able to explain and apply. - **Instruction Prefixes** — a core idea you should be able to explain and apply. - **Synthetic Pairs** — a core idea you should be able to explain and apply. - **Hard-Negative Mining** — a core idea you should be able to explain and apply. ## Worked example Adapt retrieval for legal abbreviations, product codes or scientific terminology that general web text does not model well. Suppose a retrieval system stores one vector per passage. At query time it converts the user question into a vector using the **same embedding model and preprocessing rules**. It then compares the query vector with stored vectors, retrieves the best candidates, applies any required metadata or security rules, and optionally reranks those candidates before giving context to an LLM. ## Design notes - Keep the embedding model and its version explicit in stored metadata. - Use identical preprocessing for indexing and querying unless the model documentation specifies different query/document instructions. - Evaluate with real queries instead of relying only on intuitive examples. - Separate retrieval errors from generation errors when debugging RAG. - Preserve source IDs so every result can be traced back to its original document. ## Practical exercise 1. Write down five short pieces of content from a domain you know. 2. Create three queries: one that uses the same wording, one that paraphrases the idea, and one that is deliberately ambiguous. 3. Predict which content should be retrieved for each query. 4. Identify which of the concepts in this lesson would most affect the ranking. 5. Describe one failure case and one measurement you would use to detect it. ## Knowledge check 1. What problem does **domain vocabulary** solve in this lesson? 2. How would you test whether **hard-negative mining** improves a real retrieval workload? 3. What information would you record in logs so that a poor result could be debugged later? ## Summary Recognise when a general embedding model is insufficient and when prompt tuning, fine-tuning or specialised models help. The central lesson is that embeddings are useful only when their geometry matches the task you care about. Model choice, preprocessing, indexing, filtering and evaluation all shape the final behaviour. ## Next step Continue to the next topic in **Quality and Evaluation** and relate the new material back to this lesson's retrieval pipeline.

Failure Modes and Debugging
# Failure Modes and Debugging **Course:** Embeddings For LLMs **Module:** Quality and Evaluation **Lesson:** 4 ## Learning objective Diagnose weak retrieval caused by chunking, model mismatch, bad negatives, filters or poor query formulation. ## Why this matters Debug from evidence, not intuition. Store the query, filters, candidate scores, reranker scores, selected chunks and final prompt. Without that trace, teams often blame the LLM for what was actually a retrieval problem. A useful mental model is to think of an embedding system as a learned coordinate system. Your application does not normally inspect each coordinate directly. Instead, it relies on relative position: which items are near, which are far, and which neighbourhoods contain useful candidates. ## Key concepts - **Retrieval Misses** — a core idea you should be able to explain and apply. - **Semantic Drift** — a core idea you should be able to explain and apply. - **Hubness** — a core idea you should be able to explain and apply. - **Filter Bugs** — a core idea you should be able to explain and apply. - **Query Rewriting** — a core idea you should be able to explain and apply. ## Worked example Trace an incorrect RAG answer backwards from generation to retrieved chunks, query embedding and source ingestion. Suppose a retrieval system stores one vector per passage. At query time it converts the user question into a vector using the **same embedding model and preprocessing rules**. It then compares the query vector with stored vectors, retrieves the best candidates, applies any required metadata or security rules, and optionally reranks those candidates before giving context to an LLM. ## Design notes - Keep the embedding model and its version explicit in stored metadata. - Use identical preprocessing for indexing and querying unless the model documentation specifies different query/document instructions. - Evaluate with real queries instead of relying only on intuitive examples. - Separate retrieval errors from generation errors when debugging RAG. - Preserve source IDs so every result can be traced back to its original document. ## Practical exercise 1. Write down five short pieces of content from a domain you know. 2. Create three queries: one that uses the same wording, one that paraphrases the idea, and one that is deliberately ambiguous. 3. Predict which content should be retrieved for each query. 4. Identify which of the concepts in this lesson would most affect the ranking. 5. Describe one failure case and one measurement you would use to detect it. ## Knowledge check 1. What problem does **retrieval misses** solve in this lesson? 2. How would you test whether **query rewriting** improves a real retrieval workload? 3. What information would you record in logs so that a poor result could be debugged later? ## Summary Diagnose weak retrieval caused by chunking, model mismatch, bad negatives, filters or poor query formulation. The central lesson is that embeddings are useful only when their geometry matches the task you care about. Model choice, preprocessing, indexing, filtering and evaluation all shape the final behaviour. ## Next step Continue to the next topic in **Quality and Evaluation** and relate the new material back to this lesson's retrieval pipeline.

Generating Embeddings in Python
# Generating Embeddings in Python **Course:** Embeddings For LLMs **Module:** Practical Python **Lesson:** 1 ## Learning objective Generate, inspect, normalise and persist embeddings with a clean provider-independent workflow. ## Why this matters Keep the embedding provider behind a small interface so that the rest of the pipeline does not depend on one vendor. Record the model name, version, dimension and normalisation rule beside every stored vector. A useful mental model is to think of an embedding system as a learned coordinate system. Your application does not normally inspect each coordinate directly. Instead, it relies on relative position: which items are near, which are far, and which neighbourhoods contain useful candidates. ## Key concepts - **Batching** — a core idea you should be able to explain and apply. - **Api Or Local Model** — a core idea you should be able to explain and apply. - **Normalisation** — a core idea you should be able to explain and apply. - **Serialization** — a core idea you should be able to explain and apply. - **Rate Limits** — a core idea you should be able to explain and apply. ## Worked example Embed a list of short passages in batches, save vectors with IDs, then inspect dimensions and norms. Suppose a retrieval system stores one vector per passage. At query time it converts the user question into a vector using the **same embedding model and preprocessing rules**. It then compares the query vector with stored vectors, retrieves the best candidates, applies any required metadata or security rules, and optionally reranks those candidates before giving context to an LLM. ## Design notes - Keep the embedding model and its version explicit in stored metadata. - Use identical preprocessing for indexing and querying unless the model documentation specifies different query/document instructions. - Evaluate with real queries instead of relying only on intuitive examples. - Separate retrieval errors from generation errors when debugging RAG. - Preserve source IDs so every result can be traced back to its original document. ## Worked code ```python from typing import Iterable import numpy as np def normalise(rows: np.ndarray) -> np.ndarray: norms = np.linalg.norm(rows, axis=1, keepdims=True) return rows / np.clip(norms, 1e-12, None) # embeddings = model.encode(texts) # embeddings = normalise(np.asarray(embeddings, dtype=np.float32)) ``` ## Practical exercise 1. Write down five short pieces of content from a domain you know. 2. Create three queries: one that uses the same wording, one that paraphrases the idea, and one that is deliberately ambiguous. 3. Predict which content should be retrieved for each query. 4. Identify which of the concepts in this lesson would most affect the ranking. 5. Describe one failure case and one measurement you would use to detect it. ## Knowledge check 1. What problem does **batching** solve in this lesson? 2. How would you test whether **rate limits** improves a real retrieval workload? 3. What information would you record in logs so that a poor result could be debugged later? ## Summary Generate, inspect, normalise and persist embeddings with a clean provider-independent workflow. The central lesson is that embeddings are useful only when their geometry matches the task you care about. Model choice, preprocessing, indexing, filtering and evaluation all shape the final behaviour. ## Next step Continue to the next topic in **Practical Python** and relate the new material back to this lesson's retrieval pipeline.

Building a Local Vector Store
# Building a Local Vector Store **Course:** Embeddings For LLMs **Module:** Practical Python **Lesson:** 2 ## Learning objective Implement a small local vector search engine to understand the mechanics behind larger products. ## Why this matters A NumPy implementation is excellent for learning because the mathematics is visible. Once scale, concurrency or persistence grows, the same API can be backed by a dedicated vector index without changing application behaviour. A useful mental model is to think of an embedding system as a learned coordinate system. Your application does not normally inspect each coordinate directly. Instead, it relies on relative position: which items are near, which are far, and which neighbourhoods contain useful candidates. ## Key concepts - **Numpy** — a core idea you should be able to explain and apply. - **Matrix Similarity** — a core idea you should be able to explain and apply. - **Metadata** — a core idea you should be able to explain and apply. - **Top-K** — a core idea you should be able to explain and apply. - **Persistence** — a core idea you should be able to explain and apply. ## Worked example Store vectors in a matrix, normalise them once, and retrieve the highest dot products for each query. Suppose a retrieval system stores one vector per passage. At query time it converts the user question into a vector using the **same embedding model and preprocessing rules**. It then compares the query vector with stored vectors, retrieves the best candidates, applies any required metadata or security rules, and optionally reranks those candidates before giving context to an LLM. ## Design notes - Keep the embedding model and its version explicit in stored metadata. - Use identical preprocessing for indexing and querying unless the model documentation specifies different query/document instructions. - Evaluate with real queries instead of relying only on intuitive examples. - Separate retrieval errors from generation errors when debugging RAG. - Preserve source IDs so every result can be traced back to its original document. ## Worked code ```python import numpy as np def top_k(query, matrix, ids, k=5): query = query / np.linalg.norm(query) scores = matrix @ query order = np.argsort(scores)[-k:][::-1] return [(ids[i], float(scores[i])) for i in order] ``` ## Practical exercise 1. Write down five short pieces of content from a domain you know. 2. Create three queries: one that uses the same wording, one that paraphrases the idea, and one that is deliberately ambiguous. 3. Predict which content should be retrieved for each query. 4. Identify which of the concepts in this lesson would most affect the ranking. 5. Describe one failure case and one measurement you would use to detect it. ## Knowledge check 1. What problem does **NumPy** solve in this lesson? 2. How would you test whether **persistence** improves a real retrieval workload? 3. What information would you record in logs so that a poor result could be debugged later? ## Summary Implement a small local vector search engine to understand the mechanics behind larger products. The central lesson is that embeddings are useful only when their geometry matches the task you care about. Model choice, preprocessing, indexing, filtering and evaluation all shape the final behaviour. ## Next step Continue to the next topic in **Practical Python** and relate the new material back to this lesson's retrieval pipeline.

End-to-End RAG
# End-to-End RAG **Course:** Embeddings For LLMs **Module:** Practical Python **Lesson:** 3 ## Learning objective Assemble ingestion, embedding, retrieval and generation into one understandable reference pipeline. ## Why this matters Keep each stage independently testable. You should be able to inspect chunks before embedding, retrieval before generation, and the final context before it reaches the LLM. This makes quality failures much easier to isolate. A useful mental model is to think of an embedding system as a learned coordinate system. Your application does not normally inspect each coordinate directly. Instead, it relies on relative position: which items are near, which are far, and which neighbourhoods contain useful candidates. ## Key concepts - **Loader** — a core idea you should be able to explain and apply. - **Chunker** — a core idea you should be able to explain and apply. - **Embedder** — a core idea you should be able to explain and apply. - **Retriever** — a core idea you should be able to explain and apply. - **Prompt Builder** — a core idea you should be able to explain and apply. ## Worked example Load Markdown files, split by headings, embed chunks, retrieve top passages and place them into an answer prompt. Suppose a retrieval system stores one vector per passage. At query time it converts the user question into a vector using the **same embedding model and preprocessing rules**. It then compares the query vector with stored vectors, retrieves the best candidates, applies any required metadata or security rules, and optionally reranks those candidates before giving context to an LLM. ## Design notes - Keep the embedding model and its version explicit in stored metadata. - Use identical preprocessing for indexing and querying unless the model documentation specifies different query/document instructions. - Evaluate with real queries instead of relying only on intuitive examples. - Separate retrieval errors from generation errors when debugging RAG. - Preserve source IDs so every result can be traced back to its original document. ## Worked code ```python def answer(question, retriever, llm): hits = retriever.search(question, k=6) context = "\n\n".join(hit.text for hit in hits) prompt = f"""Use only the supplied context. Context: {context} Question: {question} Answer:""" return llm.generate(prompt) ``` ## Practical exercise 1. Write down five short pieces of content from a domain you know. 2. Create three queries: one that uses the same wording, one that paraphrases the idea, and one that is deliberately ambiguous. 3. Predict which content should be retrieved for each query. 4. Identify which of the concepts in this lesson would most affect the ranking. 5. Describe one failure case and one measurement you would use to detect it. ## Knowledge check 1. What problem does **loader** solve in this lesson? 2. How would you test whether **prompt builder** improves a real retrieval workload? 3. What information would you record in logs so that a poor result could be debugged later? ## Summary Assemble ingestion, embedding, retrieval and generation into one understandable reference pipeline. The central lesson is that embeddings are useful only when their geometry matches the task you care about. Model choice, preprocessing, indexing, filtering and evaluation all shape the final behaviour. ## Next step Continue to the next topic in **Practical Python** and relate the new material back to this lesson's retrieval pipeline.

Batch Ingestion and Caching
# Batch Ingestion and Caching **Course:** Embeddings For LLMs **Module:** Practical Python **Lesson:** 4 ## Learning objective Make embedding pipelines efficient and repeatable with checksums, batching, retries and idempotent updates. ## Why this matters Treat ingestion as a repeatable data pipeline. Stable chunk IDs and content hashes let you update only what changed, resume after failures and avoid embedding the same material repeatedly. A useful mental model is to think of an embedding system as a learned coordinate system. Your application does not normally inspect each coordinate directly. Instead, it relies on relative position: which items are near, which are far, and which neighbourhoods contain useful candidates. ## Key concepts - **Content Hashes** — a core idea you should be able to explain and apply. - **Idempotency** — a core idea you should be able to explain and apply. - **Caching** — a core idea you should be able to explain and apply. - **Retry Queues** — a core idea you should be able to explain and apply. - **Incremental Indexing** — a core idea you should be able to explain and apply. ## Worked example Avoid paying to re-embed unchanged files by hashing canonical chunk text and reusing stored vectors. Suppose a retrieval system stores one vector per passage. At query time it converts the user question into a vector using the **same embedding model and preprocessing rules**. It then compares the query vector with stored vectors, retrieves the best candidates, applies any required metadata or security rules, and optionally reranks those candidates before giving context to an LLM. ## Design notes - Keep the embedding model and its version explicit in stored metadata. - Use identical preprocessing for indexing and querying unless the model documentation specifies different query/document instructions. - Evaluate with real queries instead of relying only on intuitive examples. - Separate retrieval errors from generation errors when debugging RAG. - Preserve source IDs so every result can be traced back to its original document. ## Worked code ```python import hashlib def content_key(text: str, model_version: str) -> str: payload = (model_version + "\n" + text.strip()).encode("utf-8") return hashlib.sha256(payload).hexdigest() ``` ## Practical exercise 1. Write down five short pieces of content from a domain you know. 2. Create three queries: one that uses the same wording, one that paraphrases the idea, and one that is deliberately ambiguous. 3. Predict which content should be retrieved for each query. 4. Identify which of the concepts in this lesson would most affect the ranking. 5. Describe one failure case and one measurement you would use to detect it. ## Knowledge check 1. What problem does **content hashes** solve in this lesson? 2. How would you test whether **incremental indexing** improves a real retrieval workload? 3. What information would you record in logs so that a poor result could be debugged later? ## Summary Make embedding pipelines efficient and repeatable with checksums, batching, retries and idempotent updates. The central lesson is that embeddings are useful only when their geometry matches the task you care about. Model choice, preprocessing, indexing, filtering and evaluation all shape the final behaviour. ## Next step Continue to the next topic in **Practical Python** and relate the new material back to this lesson's retrieval pipeline.

Multilingual Embeddings
# Multilingual Embeddings **Course:** Embeddings For LLMs **Module:** Advanced Patterns **Lesson:** 1 ## Learning objective Use a shared vector space to retrieve across languages and understand where cross-lingual quality can vary. ## Why this matters Cross-lingual retrieval is powerful but uneven. Evaluate the actual language pairs you need, including mixed-language queries, transliterated names and domain terminology. A single multilingual model may remove the need to translate the whole corpus. A useful mental model is to think of an embedding system as a learned coordinate system. Your application does not normally inspect each coordinate directly. Instead, it relies on relative position: which items are near, which are far, and which neighbourhoods contain useful candidates. ## Key concepts - **Cross-Lingual Retrieval** — a core idea you should be able to explain and apply. - **Language Balance** — a core idea you should be able to explain and apply. - **Translation Vs Embedding** — a core idea you should be able to explain and apply. - **Locale** — a core idea you should be able to explain and apply. - **Evaluation** — a core idea you should be able to explain and apply. ## Worked example Ask a question in English and retrieve a relevant Spanish or French source without translating the whole corpus first. Suppose a retrieval system stores one vector per passage. At query time it converts the user question into a vector using the **same embedding model and preprocessing rules**. It then compares the query vector with stored vectors, retrieves the best candidates, applies any required metadata or security rules, and optionally reranks those candidates before giving context to an LLM. ## Design notes - Keep the embedding model and its version explicit in stored metadata. - Use identical preprocessing for indexing and querying unless the model documentation specifies different query/document instructions. - Evaluate with real queries instead of relying only on intuitive examples. - Separate retrieval errors from generation errors when debugging RAG. - Preserve source IDs so every result can be traced back to its original document. ## Practical exercise 1. Write down five short pieces of content from a domain you know. 2. Create three queries: one that uses the same wording, one that paraphrases the idea, and one that is deliberately ambiguous. 3. Predict which content should be retrieved for each query. 4. Identify which of the concepts in this lesson would most affect the ranking. 5. Describe one failure case and one measurement you would use to detect it. ## Knowledge check 1. What problem does **cross-lingual retrieval** solve in this lesson? 2. How would you test whether **evaluation** improves a real retrieval workload? 3. What information would you record in logs so that a poor result could be debugged later? ## Summary Use a shared vector space to retrieve across languages and understand where cross-lingual quality can vary. The central lesson is that embeddings are useful only when their geometry matches the task you care about. Model choice, preprocessing, indexing, filtering and evaluation all shape the final behaviour. ## Next step Continue to the next topic in **Advanced Patterns** and relate the new material back to this lesson's retrieval pipeline.

Multimodal Embeddings
# Multimodal Embeddings **Course:** Embeddings For LLMs **Module:** Advanced Patterns **Lesson:** 2 ## Learning objective Understand shared embedding spaces for text, images and other media. ## Why this matters Multimodal models learn a shared geometry where an image and a matching caption can be close. This enables text-to-image and image-to-image retrieval, but it does not automatically provide detailed visual reasoning. A useful mental model is to think of an embedding system as a learned coordinate system. Your application does not normally inspect each coordinate directly. Instead, it relies on relative position: which items are near, which are far, and which neighbourhoods contain useful candidates. ## Key concepts - **Clip-Style Models** — a core idea you should be able to explain and apply. - **Image-Text Similarity** — a core idea you should be able to explain and apply. - **Joint Spaces** — a core idea you should be able to explain and apply. - **Captioning** — a core idea you should be able to explain and apply. - **Multimodal Retrieval** — a core idea you should be able to explain and apply. ## Worked example Search a photo catalogue with the text query 'red bicycle beside a stone wall'. Suppose a retrieval system stores one vector per passage. At query time it converts the user question into a vector using the **same embedding model and preprocessing rules**. It then compares the query vector with stored vectors, retrieves the best candidates, applies any required metadata or security rules, and optionally reranks those candidates before giving context to an LLM. ## Design notes - Keep the embedding model and its version explicit in stored metadata. - Use identical preprocessing for indexing and querying unless the model documentation specifies different query/document instructions. - Evaluate with real queries instead of relying only on intuitive examples. - Separate retrieval errors from generation errors when debugging RAG. - Preserve source IDs so every result can be traced back to its original document. ## Practical exercise 1. Write down five short pieces of content from a domain you know. 2. Create three queries: one that uses the same wording, one that paraphrases the idea, and one that is deliberately ambiguous. 3. Predict which content should be retrieved for each query. 4. Identify which of the concepts in this lesson would most affect the ranking. 5. Describe one failure case and one measurement you would use to detect it. ## Knowledge check 1. What problem does **CLIP-style models** solve in this lesson? 2. How would you test whether **multimodal retrieval** improves a real retrieval workload? 3. What information would you record in logs so that a poor result could be debugged later? ## Summary Understand shared embedding spaces for text, images and other media. The central lesson is that embeddings are useful only when their geometry matches the task you care about. Model choice, preprocessing, indexing, filtering and evaluation all shape the final behaviour. ## Next step Continue to the next topic in **Advanced Patterns** and relate the new material back to this lesson's retrieval pipeline.

Graph RAG and Embeddings
# Graph RAG and Embeddings **Course:** Embeddings For LLMs **Module:** Advanced Patterns **Lesson:** 3 ## Learning objective Combine semantic vectors with explicit entities and relationships when questions depend on connected facts. ## Why this matters Embeddings answer 'what is semantically related?'; graphs answer 'what is explicitly connected?'. Combining them is useful when a question depends on relationships across many documents rather than one locally similar passage. A useful mental model is to think of an embedding system as a learned coordinate system. Your application does not normally inspect each coordinate directly. Instead, it relies on relative position: which items are near, which are far, and which neighbourhoods contain useful candidates. ## Key concepts - **Knowledge Graphs** — a core idea you should be able to explain and apply. - **Entity Linking** — a core idea you should be able to explain and apply. - **Graph Traversal** — a core idea you should be able to explain and apply. - **Hybrid Retrieval** — a core idea you should be able to explain and apply. - **Community Summaries** — a core idea you should be able to explain and apply. ## Worked example Retrieve documents about a person, traverse linked organisations and events, then use embeddings to rank supporting passages. Suppose a retrieval system stores one vector per passage. At query time it converts the user question into a vector using the **same embedding model and preprocessing rules**. It then compares the query vector with stored vectors, retrieves the best candidates, applies any required metadata or security rules, and optionally reranks those candidates before giving context to an LLM. ## Design notes - Keep the embedding model and its version explicit in stored metadata. - Use identical preprocessing for indexing and querying unless the model documentation specifies different query/document instructions. - Evaluate with real queries instead of relying only on intuitive examples. - Separate retrieval errors from generation errors when debugging RAG. - Preserve source IDs so every result can be traced back to its original document. ## Practical exercise 1. Write down five short pieces of content from a domain you know. 2. Create three queries: one that uses the same wording, one that paraphrases the idea, and one that is deliberately ambiguous. 3. Predict which content should be retrieved for each query. 4. Identify which of the concepts in this lesson would most affect the ranking. 5. Describe one failure case and one measurement you would use to detect it. ## Knowledge check 1. What problem does **knowledge graphs** solve in this lesson? 2. How would you test whether **community summaries** improves a real retrieval workload? 3. What information would you record in logs so that a poor result could be debugged later? ## Summary Combine semantic vectors with explicit entities and relationships when questions depend on connected facts. The central lesson is that embeddings are useful only when their geometry matches the task you care about. Model choice, preprocessing, indexing, filtering and evaluation all shape the final behaviour. ## Next step Continue to the next topic in **Advanced Patterns** and relate the new material back to this lesson's retrieval pipeline.

Recommendations, Clustering and Anomaly Detection
# Recommendations, Clustering and Anomaly Detection **Course:** Embeddings For LLMs **Module:** Advanced Patterns **Lesson:** 4 ## Learning objective Reuse embeddings beyond RAG for discovery, grouping, recommendation and unusual-item detection. ## Why this matters Once items live in a meaningful vector space, nearest neighbours support recommendation, clustering exposes themes, and distance from known regions can flag anomalies. Always validate that the embedding model captures the notion of similarity the task actually needs. A useful mental model is to think of an embedding system as a learned coordinate system. Your application does not normally inspect each coordinate directly. Instead, it relies on relative position: which items are near, which are far, and which neighbourhoods contain useful candidates. ## Key concepts - **Clustering** — a core idea you should be able to explain and apply. - **Centroids** — a core idea you should be able to explain and apply. - **Recommendation** — a core idea you should be able to explain and apply. - **Duplicate Detection** — a core idea you should be able to explain and apply. - **Outlier Detection** — a core idea you should be able to explain and apply. ## Worked example Cluster support tickets into emerging themes and flag a ticket whose vector is far from every established cluster. Suppose a retrieval system stores one vector per passage. At query time it converts the user question into a vector using the **same embedding model and preprocessing rules**. It then compares the query vector with stored vectors, retrieves the best candidates, applies any required metadata or security rules, and optionally reranks those candidates before giving context to an LLM. ## Design notes - Keep the embedding model and its version explicit in stored metadata. - Use identical preprocessing for indexing and querying unless the model documentation specifies different query/document instructions. - Evaluate with real queries instead of relying only on intuitive examples. - Separate retrieval errors from generation errors when debugging RAG. - Preserve source IDs so every result can be traced back to its original document. ## Practical exercise 1. Write down five short pieces of content from a domain you know. 2. Create three queries: one that uses the same wording, one that paraphrases the idea, and one that is deliberately ambiguous. 3. Predict which content should be retrieved for each query. 4. Identify which of the concepts in this lesson would most affect the ranking. 5. Describe one failure case and one measurement you would use to detect it. ## Knowledge check 1. What problem does **clustering** solve in this lesson? 2. How would you test whether **outlier detection** improves a real retrieval workload? 3. What information would you record in logs so that a poor result could be debugged later? ## Summary Reuse embeddings beyond RAG for discovery, grouping, recommendation and unusual-item detection. The central lesson is that embeddings are useful only when their geometry matches the task you care about. Model choice, preprocessing, indexing, filtering and evaluation all shape the final behaviour. ## Next step Continue to the next topic in **Advanced Patterns** and relate the new material back to this lesson's retrieval pipeline.

Security, Privacy and Governance
# Security, Privacy and Governance **Course:** Embeddings For LLMs **Module:** Production Design **Lesson:** 1 ## Learning objective Treat embeddings and vector indexes as derived data that still require access control, retention and privacy design. ## Why this matters Embeddings are derived from source data, not magically anonymous. They may retain sensitive signals and must be governed with the same care as other derived datasets. Store provenance so a vector can be deleted when its source must be deleted. A useful mental model is to think of an embedding system as a learned coordinate system. Your application does not normally inspect each coordinate directly. Instead, it relies on relative position: which items are near, which are far, and which neighbourhoods contain useful candidates. ## Key concepts - **Pii** — a core idea you should be able to explain and apply. - **Access Control** — a core idea you should be able to explain and apply. - **Encryption** — a core idea you should be able to explain and apply. - **Data Residency** — a core idea you should be able to explain and apply. - **Retention** — a core idea you should be able to explain and apply. ## Worked example Prevent cross-tenant retrieval by applying security filters before results are exposed to the LLM. Suppose a retrieval system stores one vector per passage. At query time it converts the user question into a vector using the **same embedding model and preprocessing rules**. It then compares the query vector with stored vectors, retrieves the best candidates, applies any required metadata or security rules, and optionally reranks those candidates before giving context to an LLM. ## Design notes - Keep the embedding model and its version explicit in stored metadata. - Use identical preprocessing for indexing and querying unless the model documentation specifies different query/document instructions. - Evaluate with real queries instead of relying only on intuitive examples. - Separate retrieval errors from generation errors when debugging RAG. - Preserve source IDs so every result can be traced back to its original document. ## Practical exercise 1. Write down five short pieces of content from a domain you know. 2. Create three queries: one that uses the same wording, one that paraphrases the idea, and one that is deliberately ambiguous. 3. Predict which content should be retrieved for each query. 4. Identify which of the concepts in this lesson would most affect the ranking. 5. Describe one failure case and one measurement you would use to detect it. ## Knowledge check 1. What problem does **PII** solve in this lesson? 2. How would you test whether **retention** improves a real retrieval workload? 3. What information would you record in logs so that a poor result could be debugged later? ## Summary Treat embeddings and vector indexes as derived data that still require access control, retention and privacy design. The central lesson is that embeddings are useful only when their geometry matches the task you care about. Model choice, preprocessing, indexing, filtering and evaluation all shape the final behaviour. ## Next step Continue to the next topic in **Production Design** and relate the new material back to this lesson's retrieval pipeline.

Cost and Latency Trade-offs
# Cost and Latency Trade-offs **Course:** Embeddings For LLMs **Module:** Production Design **Lesson:** 2 ## Learning objective Balance embedding quality, vector size, retrieval depth, reranking and LLM context against user experience and cost. ## Why this matters Optimise the whole pipeline rather than one component. A slightly smaller embedding may reduce storage and latency enough to fund a better reranker. Likewise, better retrieval can reduce expensive LLM context tokens. A useful mental model is to think of an embedding system as a learned coordinate system. Your application does not normally inspect each coordinate directly. Instead, it relies on relative position: which items are near, which are far, and which neighbourhoods contain useful candidates. ## Key concepts - **Batch Costs** — a core idea you should be able to explain and apply. - **Latency Budgets** — a core idea you should be able to explain and apply. - **Top-K** — a core idea you should be able to explain and apply. - **Reranking Cost** — a core idea you should be able to explain and apply. - **Context Size** — a core idea you should be able to explain and apply. ## Worked example Compare a fast first-stage retriever plus selective reranking with sending dozens of full documents to the LLM. Suppose a retrieval system stores one vector per passage. At query time it converts the user question into a vector using the **same embedding model and preprocessing rules**. It then compares the query vector with stored vectors, retrieves the best candidates, applies any required metadata or security rules, and optionally reranks those candidates before giving context to an LLM. ## Design notes - Keep the embedding model and its version explicit in stored metadata. - Use identical preprocessing for indexing and querying unless the model documentation specifies different query/document instructions. - Evaluate with real queries instead of relying only on intuitive examples. - Separate retrieval errors from generation errors when debugging RAG. - Preserve source IDs so every result can be traced back to its original document. ## Practical exercise 1. Write down five short pieces of content from a domain you know. 2. Create three queries: one that uses the same wording, one that paraphrases the idea, and one that is deliberately ambiguous. 3. Predict which content should be retrieved for each query. 4. Identify which of the concepts in this lesson would most affect the ranking. 5. Describe one failure case and one measurement you would use to detect it. ## Knowledge check 1. What problem does **batch costs** solve in this lesson? 2. How would you test whether **context size** improves a real retrieval workload? 3. What information would you record in logs so that a poor result could be debugged later? ## Summary Balance embedding quality, vector size, retrieval depth, reranking and LLM context against user experience and cost. The central lesson is that embeddings are useful only when their geometry matches the task you care about. Model choice, preprocessing, indexing, filtering and evaluation all shape the final behaviour. ## Next step Continue to the next topic in **Production Design** and relate the new material back to this lesson's retrieval pipeline.

Versioning and Reindexing
# Versioning and Reindexing **Course:** Embeddings For LLMs **Module:** Production Design **Lesson:** 3 ## Learning objective Design safe migrations when the embedding model, chunking logic or source documents change. ## Why this matters Never mix incompatible embedding spaces in one similarity index unless the model explicitly guarantees compatibility. A model upgrade normally means generating a parallel index, validating it and performing a controlled cutover. A useful mental model is to think of an embedding system as a learned coordinate system. Your application does not normally inspect each coordinate directly. Instead, it relies on relative position: which items are near, which are far, and which neighbourhoods contain useful candidates. ## Key concepts - **Model Version** — a core idea you should be able to explain and apply. - **Schema Version** — a core idea you should be able to explain and apply. - **Dual Indexes** — a core idea you should be able to explain and apply. - **Backfills** — a core idea you should be able to explain and apply. - **Cutover** — a core idea you should be able to explain and apply. ## Worked example Build a new index beside the old one, evaluate it, then switch traffic and retire the previous version. Suppose a retrieval system stores one vector per passage. At query time it converts the user question into a vector using the **same embedding model and preprocessing rules**. It then compares the query vector with stored vectors, retrieves the best candidates, applies any required metadata or security rules, and optionally reranks those candidates before giving context to an LLM. ## Design notes - Keep the embedding model and its version explicit in stored metadata. - Use identical preprocessing for indexing and querying unless the model documentation specifies different query/document instructions. - Evaluate with real queries instead of relying only on intuitive examples. - Separate retrieval errors from generation errors when debugging RAG. - Preserve source IDs so every result can be traced back to its original document. ## Practical exercise 1. Write down five short pieces of content from a domain you know. 2. Create three queries: one that uses the same wording, one that paraphrases the idea, and one that is deliberately ambiguous. 3. Predict which content should be retrieved for each query. 4. Identify which of the concepts in this lesson would most affect the ranking. 5. Describe one failure case and one measurement you would use to detect it. ## Knowledge check 1. What problem does **model version** solve in this lesson? 2. How would you test whether **cutover** improves a real retrieval workload? 3. What information would you record in logs so that a poor result could be debugged later? ## Summary Design safe migrations when the embedding model, chunking logic or source documents change. The central lesson is that embeddings are useful only when their geometry matches the task you care about. Model choice, preprocessing, indexing, filtering and evaluation all shape the final behaviour. ## Next step Continue to the next topic in **Production Design** and relate the new material back to this lesson's retrieval pipeline.

Capstone: Building a Production RAG System
# Capstone: Building a Production RAG System **Course:** Embeddings For LLMs **Module:** Production Design **Lesson:** 4 ## Learning objective Bring together ingestion, embeddings, vector search, evaluation, security and operations in one complete design. ## Why this matters The capstone is an architecture exercise, not just a coding exercise. A production system needs clear requirements, measurable retrieval quality, security boundaries, reproducible ingestion, observability and a safe migration path. A useful mental model is to think of an embedding system as a learned coordinate system. Your application does not normally inspect each coordinate directly. Instead, it relies on relative position: which items are near, which are far, and which neighbourhoods contain useful candidates. ## Key concepts - **Architecture** — a core idea you should be able to explain and apply. - **Requirements** — a core idea you should be able to explain and apply. - **Evaluation** — a core idea you should be able to explain and apply. - **Observability** — a core idea you should be able to explain and apply. - **Deployment** — a core idea you should be able to explain and apply. ## Worked example Design a production knowledge assistant that can explain its sources, respect permissions and be reindexed safely. Suppose a retrieval system stores one vector per passage. At query time it converts the user question into a vector using the **same embedding model and preprocessing rules**. It then compares the query vector with stored vectors, retrieves the best candidates, applies any required metadata or security rules, and optionally reranks those candidates before giving context to an LLM. ## Design notes - Keep the embedding model and its version explicit in stored metadata. - Use identical preprocessing for indexing and querying unless the model documentation specifies different query/document instructions. - Evaluate with real queries instead of relying only on intuitive examples. - Separate retrieval errors from generation errors when debugging RAG. - Preserve source IDs so every result can be traced back to its original document. ## Practical exercise 1. Write down five short pieces of content from a domain you know. 2. Create three queries: one that uses the same wording, one that paraphrases the idea, and one that is deliberately ambiguous. 3. Predict which content should be retrieved for each query. 4. Identify which of the concepts in this lesson would most affect the ranking. 5. Describe one failure case and one measurement you would use to detect it. ## Knowledge check 1. What problem does **architecture** solve in this lesson? 2. How would you test whether **deployment** improves a real retrieval workload? 3. What information would you record in logs so that a poor result could be debugged later? ## Summary Bring together ingestion, embeddings, vector search, evaluation, security and operations in one complete design. The central lesson is that embeddings are useful only when their geometry matches the task you care about. Model choice, preprocessing, indexing, filtering and evaluation all shape the final behaviour. ## Next step Continue to the next topic in **Production Design** and relate the new material back to this lesson's retrieval pipeline.

Pose by Railing, Sci-fi City
A practical guide to wifi for retail, covering architecture, security, analytics, vendor choices, ROI, and a deployment checklist for store teams. Check out [Wirral AI](https://wirralai.com/) for more information. They are available 9 to 5 Weekdays and 9 to 12:30 on Saturdays

Interstellar Navigator
A clean, unbranded prompt for transforming a reference portrait into an interstellar navigator aboard a deep-space exploration craft.

Quantum Threshold
A clean, unbranded prompt for turning a reference portrait into a cinematic quantum-travel scene.

Time Portal Arrival
A clean, unbranded prompt for creating a cinematic time-travel arrival scene from a reference portrait.

AI Robotics Atelier
A clean, unbranded prompt for creating a cinematic AI-and-robotics scene from a reference portrait.

Floating Ocean City
A clean, unbranded prompt for creating a cinematic portrait of future life on the sea.

Undersea Habitat
A clean, unbranded prompt for creating a cinematic portrait of future life beneath the sea.

Orbital Habitat
A clean, unbranded prompt for creating a cinematic portrait of everyday life in space.

Humane Future City
A clean, unbranded prompt for creating a cinematic portrait in a humane future city.

Lunar Settlement Architect
A clean, unbranded prompt for creating a cinematic portrait of future life and work on the Moon.

Jupiter Solar-Sail Pilot
A clean, unbranded prompt for creating a cinematic starship pilot portrait near Jupiter.

Mars Terraforming Engineer
A clean, unbranded prompt for creating a cinematic portrait of future work on Mars.

Asteroid Belt Prospector
A clean, unbranded prompt for creating a cinematic portrait in the asteroid belt.

Time Library Archivist
A clean, unbranded prompt for creating a cinematic time-library portrait.

Quantum Ocean Bridge
A clean, unbranded prompt for creating a cinematic quantum-ocean travel scene.

Robot Companion Conservatory
A clean, unbranded prompt for creating a warm AI-and-robotics conservatory portrait.

Europa Ice Habitat
A clean, unbranded prompt for creating a cinematic astrobiology portrait beneath Europa's ice.

Venus Cloud City
A clean, unbranded prompt for creating a cinematic portrait in a Venus cloud city.

Desert Arcology
A clean, unbranded prompt for creating a cinematic portrait in a future desert arcology.

Neural Dream Studio
A clean, unbranded prompt for creating a cinematic AI-assisted creative studio portrait.

Deep Future Forest City
A clean, unbranded prompt for creating a cinematic portrait in a deep future forest city.

Professional Executive Portrait
A popular professional portrait prompt for clean profile, LinkedIn, and leadership visuals.
Viral Tech Thumbnail
A social-first prompt for punchy tech reveal thumbnails and creator channel visuals.

Nineties Editorial Portrait
A retro portrait prompt for nostalgic fashion, magazine, and social visuals.

Anime Future City Portrait
A popular avatar prompt for anime-inspired, future-city profile art.

Glassmorphism Tech Portrait
A clean glassmorphism portrait prompt for modern AI and product visuals.

Luxury Product Campaign
A product advertising prompt for polished campaign-style visuals.

Wellness Morning Routine
A wellness prompt for serene, high-search lifestyle and self-care visuals.

Sustainable Local Market
A sustainability prompt for local culture, future living, and climate-positive visuals.

Fantasy Forest Guardian
A fantasy portrait prompt for cinematic character art without franchise references.

Cinematic Rain Portrait
A cinematic portrait prompt for dramatic rainy-street images.

Minimal Productivity Desk
A productivity prompt for desk setup, creator workspace, and focus imagery.

AI Avatar Clean Studio
A profile-image prompt for clean AI avatar and personal-brand visuals.

Travel Influencer Postcard
A travel prompt for aspirational postcard and social-media images.

Fitness Tech Coach
A fitness technology prompt for health, coaching, and wearable visuals.

Luxury Fashion Editorial
A fashion editorial prompt for premium, unbranded campaign-style imagery.

Cozy Cottagecore Portrait
A cottagecore prompt for warm, nature-led future-lifestyle images.

Surreal Dreamscape Portrait
A surreal portrait prompt for dreamlike fine-art and conceptual imagery.

Food Lifestyle Cafe
A food and cafe lifestyle prompt for social-ready breakfast imagery.

Home Studio Podcast Creator
A creator economy prompt for podcast, video, and home studio imagery.

Blue Hour Founder Headshot
A camera-aware professional portrait prompt for founder, LinkedIn, and personal-brand imagery.

High Impact Tech Reveal
A social thumbnail prompt for tech reveal images with strong lighting and instant-read composition.

Medium Format Nineties Editorial
A nostalgia portrait prompt for polished 1990s editorial fashion imagery.
Anime Rain City Avatar
A polished anime-inspired avatar prompt for future-city profile images.

Luxury Serum Campaign
A product-ad prompt for premium beauty, skincare, and serum campaign visuals.

Mineral Bath Greenhouse
A future wellness prompt for calm spa, self-care, and lifestyle imagery.

Golden Hour Coastal Train
A cinematic travel prompt for aspirational future destination images.

Rainy Cyberpunk Taxi Stand
A cyberpunk portrait prompt for rain, neon, and future-city search styles.

Rainy Reading Nook
A cozy prompt for rainy-day reading, home interiors, and lifestyle search imagery.

Rooftop Fitness Tech
A premium athletic prompt for fitness, wellness, and wearable-tech visuals.

Elite Podcast Studio
A creator economy prompt for podcast, video, and studio-profile imagery.

Mirrored Observatory Dreamscape
A surreal portrait prompt for dreamlike fine-art and impossible architecture.

Moonlit Forest Ranger
A fantasy character prompt for original moonlit forest-ranger imagery.

Future Cafe Brunch
A food and cafe prompt for social-ready brunch and lifestyle imagery.
Personal Brand Avatar Bust
A creator-brand prompt for polished 3D avatar and mascot-style profile assets.

Minimal Fashion Lookbook
A clean lookbook prompt for e-commerce, fashion, and catalog-style imagery.

Future Noir Archive
A cinematic portrait prompt for future-noir detective and archive scenes.

Smart Home Morning Routine
A calm morning routine prompt for smart-home, wellness, and lifestyle visuals.

Sustainable Fashion Greenhouse
A sustainable fashion prompt for vertical gardens, climate-positive campaigns, and natural editorial style.

Headphones Product Campaign
A premium product prompt for headphones, audio gear, and unbranded tech campaigns.

Prompting at Home
Practical prompting techniques for planning, learning, household admin and creative personal projects.

Prompting for Workflows
Prompt patterns for turning repeated work into checklists, drafts, summaries, transformations and review steps.

Prompting for Teams
Shared prompt standards for teams that need consistent outputs, reusable examples and clearer evaluation.

Bespoke software
Custom web apps, internal tools and integrations - built around your process, owned by you.

Automation
Remove the repetitive, error-prone steps between your existing tools - and get the time back.

AI solutions
Practical AI grounded in your own content - drafting, classification, search and assistants you can trust.
Privacy policy
How Picture & Prompt collects, uses and protects personal data. Sample content for template purposes.
Terms of use
The terms that apply when you use Picture & Prompt website. Sample content for template purposes.
Cookie policy
Which cookies this site sets and how to control them. Sample content for template purposes.
Accessibility
How Picture & Prompt works to keep this site usable for everyone, and how to report a barrier.
Join our creative community
Save favourite prompts, create collections, and share your own AI image recipes with other creators.