Tag: Embeddings

Identify which columns to include in embeddings (DP-800 Exam Prep)

This post is a part of the DP-800: Developing AI-Enabled Database Solutions Exam Prep Hub.
This topic falls under these sections:
Implement AI capabilities in database solutions (25–30%)
   --> Design and implement models and embeddings
      --> Identify which columns to include in embeddings


Note that there are 10 practice questions (with answers) at the end of each section to help you solidify your knowledge of the material. Also, there are 4 practice tests with 30 questions each available from the hub's main page below the exam topics section.

Introduction

Embeddings are one of the most important technologies behind modern AI-powered applications such as semantic search, Retrieval-Augmented Generation (RAG), recommendation systems, document similarity, and intelligent chatbots. Rather than storing simple keywords, embeddings represent text as high-dimensional numerical vectors that capture semantic meaning.

One of the most important design decisions when implementing embeddings is determining which database columns should be embedded. Selecting the appropriate columns directly affects:

  • Search relevance
  • AI response quality
  • Storage requirements
  • Embedding generation cost
  • Update frequency
  • Query performance

The DP-800 exam expects candidates to understand how to evaluate database schemas and determine which columns should contribute meaningful semantic information to an embedding.


Why Column Selection Matters

Every embedding represents the semantic meaning of the text supplied to the embedding model.

For example, consider a Products table.

ProductIDNameDescriptionCategoryPriceSKU
101Surface LaptopLightweight business laptop with AI features.Laptop1299SL-100

If only Name is embedded:

Surface Laptop

the embedding contains very little context.

If Name + Description + Category are embedded:

Surface Laptop
Lightweight business laptop with AI features.
Laptop

the vector contains much richer semantic information.

This significantly improves semantic search accuracy.


General Rule

Good embedding columns contain:

  • Meaning
  • Context
  • Natural language
  • Descriptive text

Poor embedding columns contain:

  • IDs
  • Numbers
  • Codes
  • Random values
  • Technical metadata

Common Column Types

Excellent Candidates

These almost always improve embeddings.

Examples include:

  • Product descriptions
  • Document bodies
  • Knowledge base articles
  • Support tickets
  • FAQs
  • Customer reviews
  • Employee biographies
  • Blog articles
  • Research papers
  • Medical notes
  • Legal clauses

These contain rich natural language.

Example

"This laptop includes an NPU for AI acceleration and 18-hour battery life."

An embedding model can understand concepts such as:

  • AI laptop
  • battery life
  • portable computer
  • Windows device

Very Good Candidates

These provide additional context.

Examples

  • Product Name
  • Job Title
  • Category
  • Department
  • Brand
  • Tags
  • Keywords
  • Topics

Example

Category:
Gaming Laptop
Brand:
Contoso
Description:
High-performance RTX graphics...

Combining these improves semantic similarity.


Sometimes Useful

Examples

  • City
  • Country
  • Industry
  • Region
  • Language

These may improve retrieval depending on the application.

For example

Restaurant
Italian
Orlando

provides valuable context.


Usually Poor Candidates

These rarely improve embeddings.

Examples

  • Identity columns
  • GUIDs
  • Invoice numbers
  • SKUs
  • Phone numbers
  • ZIP codes
  • Timestamps
  • Row versions

Example

CustomerID = 28471

This carries no semantic meaning.


Never Useful

Examples

  • Binary files
  • Password hashes
  • Encryption keys
  • Checksums
  • Internal IDs

These should never be embedded.


Combining Multiple Columns

Rather than embedding each column individually, applications often concatenate multiple descriptive columns into one text document before generating the embedding.

Example

Instead of embedding

Title

only

combine

Title
Category
Description
Features

Example generated text

Surface Laptop
Category:
Business Laptop
Features:
Touchscreen
NPU
AI Copilot+
18-hour battery
Description:
Premium lightweight laptop designed for professionals...

This produces much richer embeddings.


Typical SQL Example

SELECT
Name +
CHAR(13) +
Description +
CHAR(13) +
Category
AS EmbeddingText
FROM Products;

This creates a single block of text for embedding generation.


Avoid Including Irrelevant Data

Do not include unrelated information simply because it exists.

Bad example

Description
LastModifiedDate
ModifiedBy
RecordID
Checksum
InternalVersion

Only Description contributes semantic meaning.


Include Business Context

Business metadata often improves search.

Instead of

Description

consider

Product Name
Category
Brand
Description
Features

The additional context helps distinguish similar products.


Example: Knowledge Base

Table

TitleProblemSolutionAuthor

Good embedding text

Title
Problem Description
Solution

Avoid

Author

unless searching by author.


Example: HR Resume Database

Good columns

  • Name
  • Skills
  • Certifications
  • Experience
  • Summary

Poor columns

  • EmployeeID
  • HireDate
  • PayrollNumber

Example: Healthcare

Useful

  • Diagnosis
  • Symptoms
  • Treatment
  • Clinical Notes

Not useful

  • Patient ID
  • Visit Number
  • Insurance Number

Example: Retail

Useful

  • Product Name
  • Description
  • Category
  • Features
  • Brand

Not useful

  • Inventory Count
  • Warehouse Bin
  • SKU

Example: Support Tickets

Useful

  • Ticket Title
  • Problem Description
  • Resolution

Avoid

  • Ticket Number
  • Assigned Agent ID
  • Status Code

Structured Data vs Natural Language

Embedding models perform best with natural language.

Instead of

RAM=32
CPU=i9
GPU=RTX4090

consider

This gaming laptop includes 32 GB RAM, an Intel Core i9 processor, and an NVIDIA RTX 4090 GPU.

Natural language improves semantic understanding.


Sensitive Information

Avoid embedding:

  • Passwords
  • SSNs
  • Credit card numbers
  • API keys
  • Authentication tokens
  • Encryption secrets

Even if embeddings are stored securely, unnecessary sensitive information should never be included.


Column Size Considerations

Very large text columns increase:

  • Token count
  • API costs
  • Storage
  • Processing time

Strategies include:

  • Chunk long documents
  • Remove boilerplate text
  • Eliminate duplicate content
  • Exclude irrelevant sections

Embedding Maintenance

If embedded columns change frequently:

  • Regenerate embeddings
  • Track changes using Change Tracking or CDC
  • Automate updates using Azure Functions, Logic Apps, or Microsoft Foundry

Only regenerate embeddings when relevant columns change.


SQL Server 2025 and Azure SQL

Modern SQL AI solutions support storing vectors directly in SQL databases, allowing developers to:

  • Store embeddings in vector columns
  • Perform vector similarity searches
  • Integrate external embedding models
  • Build semantic search and RAG applications entirely within SQL-centric architectures

Choosing the correct columns is one of the most important design decisions before generating these vectors.


Best Practices

  • Embed descriptive text instead of identifiers.
  • Combine multiple related text columns into a single embedding input.
  • Include contextual metadata such as category or brand when it improves retrieval.
  • Exclude numeric identifiers, timestamps, and internal metadata.
  • Avoid embedding sensitive or confidential information.
  • Chunk long documents before generating embeddings.
  • Keep embeddings synchronized with changes to the source columns.
  • Evaluate search quality periodically and refine the selected columns if retrieval results are poor.

DP-800 Exam Tips

For the exam, you should be able to:

  • Identify which columns provide meaningful semantic content.
  • Recognize when multiple columns should be combined into one embedding.
  • Distinguish between descriptive text and operational metadata.
  • Explain why identifiers and numeric values generally should not be embedded.
  • Understand the tradeoffs between embedding more context versus increasing token usage and storage costs.
  • Recommend strategies for maintaining embeddings when source data changes.
  • Select appropriate columns for common business scenarios such as product catalogs, knowledge bases, customer support systems, healthcare records, HR profiles, and document repositories.

Practice Exam Questions

Question 1

A company is building a semantic search application for an online product catalog. The Products table contains the following columns:

  • ProductID
  • ProductName
  • Category
  • Description
  • Price
  • SKU

Which combination of columns should be included when generating embeddings?

A. ProductID, SKU, Price

B. ProductName, Category, Description

C. ProductID, ProductName, Price

D. SKU, Category, Price

Correct Answer: B

Explanation

Embeddings should be generated from columns containing meaningful natural language and business context. Product names, categories, and descriptions provide semantic information that improves search relevance.

Why the other answers are incorrect:

  • A: IDs, SKUs, and prices contain little semantic meaning.
  • C: ProductID and Price contribute little to semantic understanding.
  • D: SKU and Price are operational values, not descriptive content.

Question 2

A knowledge base stores the following columns:

  • ArticleTitle
  • ProblemDescription
  • Resolution
  • CreatedDate
  • ArticleID

The organization wants to optimize AI-powered question answering.

Which columns should be embedded?

A. CreatedDate and ArticleID

B. Resolution only

C. ArticleTitle, ProblemDescription, and Resolution

D. ArticleID, Resolution, and CreatedDate

Correct Answer: C

Explanation

The title, problem description, and resolution contain the contextual information required for semantic retrieval.

Why the other answers are incorrect:

  • A: Dates and IDs provide no semantic value.
  • B: Using only the resolution omits important context.
  • D: IDs and dates should generally not be embedded.

Question 3

An HR department is building an AI assistant to help recruiters locate qualified candidates.

Which candidate profile columns are most appropriate for embeddings?

A. EmployeeID, HireDate, PayrollNumber

B. ResumeSummary, Skills, Certifications, Experience

C. Salary, EmployeeID, OfficeNumber

D. ManagerID, DepartmentID, HireDate

Correct Answer: B

Explanation

Resume summaries, skills, certifications, and experience contain rich natural language describing candidate qualifications.

Why the other answers are incorrect:

  • A: Administrative identifiers have no semantic value.
  • C: Salary and IDs are not useful for semantic similarity.
  • D: Organizational metadata does not describe expertise.

Question 4

A retail company stores product specifications as structured fields:

  • RAM = 32
  • CPU = Intel Core i9
  • GPU = RTX 4090

What is the best practice before generating embeddings?

A. Embed each numeric value separately.

B. Ignore the specification fields completely.

C. Store each field in separate vector columns.

D. Convert the structured values into descriptive natural language.

Correct Answer: D

Explanation

Embedding models understand natural language far better than isolated structured values. Converting structured data into descriptive text produces higher-quality embeddings.

Why the other answers are incorrect:

  • A: Individual values lose important context.
  • B: Specifications provide valuable search information.
  • C: Multiple separate embeddings reduce semantic completeness.

Question 5

A legal document repository contains these columns:

  • DocumentTitle
  • ContractText
  • Author
  • VersionNumber
  • LastModifiedDate

Which columns are most appropriate for embeddings?

A. DocumentTitle and ContractText

B. VersionNumber and LastModifiedDate

C. Author and VersionNumber

D. LastModifiedDate and Author

Correct Answer: A

Explanation

Titles and contract text provide meaningful semantic information for legal document retrieval.

Why the other answers are incorrect:

  • B: Version numbers and dates are operational metadata.
  • C: Author names generally contribute little to semantic similarity.
  • D: Dates and authors are rarely useful for AI retrieval.

Question 6

A company stores customer support tickets with these columns:

  • TicketID
  • Title
  • Description
  • Resolution
  • AssignedEngineer

Which column should generally not be included when generating embeddings?

A. Resolution

B. Description

C. AssignedEngineer

D. Title

Correct Answer: C

Explanation

The assigned engineer is administrative information and usually has no relationship to the semantic content of the issue.

Why the other answers are incorrect:

  • A: Resolutions provide valuable context.
  • B: Descriptions are one of the best embedding sources.
  • D: Titles summarize the issue.

Question 7

A company wants to reduce embedding generation costs while maintaining high-quality semantic search.

Which strategy is most appropriate?

A. Embed every column in every table.

B. Embed only columns containing meaningful business context and descriptive text.

C. Embed only numeric columns.

D. Embed every database row regardless of relevance.

Correct Answer: B

Explanation

Embedding only semantically meaningful columns minimizes storage, token usage, and generation costs while maintaining search quality.

Why the other answers are incorrect:

  • A: Creates unnecessary costs.
  • C: Numeric values rarely provide semantic meaning.
  • D: Irrelevant data wastes resources.

Question 8

A medical database contains the following fields:

  • PatientID
  • Diagnosis
  • Symptoms
  • TreatmentPlan
  • InsurancePolicyNumber

Which field should not normally be included in embeddings?

A. Symptoms

B. Diagnosis

C. InsurancePolicyNumber

D. TreatmentPlan

Correct Answer: C

Explanation

Insurance policy numbers are identifiers and contribute no semantic value to AI retrieval.

Why the other answers are incorrect:

  • A: Symptoms are highly descriptive.
  • B: Diagnoses contain important clinical meaning.
  • D: Treatment plans improve retrieval relevance.

Question 9

An organization notices that AI search results have become less accurate after adding several metadata columns to the embedding input.

What is the most likely cause?

A. Semantic quality decreased because irrelevant metadata diluted the embedding.

B. Embedding vectors became encrypted.

C. The embedding model requires additional indexes.

D. SQL Server cannot process metadata columns.

Correct Answer: A

Explanation

Adding irrelevant metadata introduces noise into the embedding, reducing its ability to represent the true semantic meaning of the content.

Why the other answers are incorrect:

  • B: Embeddings are not automatically encrypted by adding metadata.
  • C: Indexes improve retrieval speed, not embedding quality.
  • D: SQL Server can process metadata columns; they simply should not be embedded unnecessarily.

Question 10

A company stores lengthy product manuals exceeding the token limit of its embedding model.

What is the recommended approach?

A. Truncate every document to the first paragraph.

B. Increase the vector dimension.

C. Store the manuals without embeddings.

D. Divide the manuals into logical chunks before generating embeddings.

Correct Answer: D

Explanation

Chunking large documents allows each section to remain within model limits while preserving semantic meaning. It also improves retrieval because searches return only the most relevant portions of a document.

Why the other answers are incorrect:

  • A: Truncation discards valuable information.
  • B: Vector dimensions do not increase a model’s token limit.
  • C: Without embeddings, semantic search cannot be performed effectively.

DP-800 Exam Tips

For the exam, remember these key principles:

  • Embed descriptive, natural-language columns such as names, descriptions, summaries, articles, reviews, and documentation.
  • Avoid identifiers and operational metadata, including IDs, SKUs, timestamps, version numbers, and status codes.
  • Combine related descriptive columns (for example, title + category + description) into a single text input to provide richer context.
  • Convert structured specifications into natural language when appropriate to improve semantic understanding.
  • Exclude sensitive information unless absolutely required and permitted by your security policies.
  • Chunk large documents before generating embeddings to stay within model token limits and improve retrieval quality.
  • Review embedding quality periodically and refine the selected columns based on search relevance and user feedback.

Go to the DP-800 Exam Prep Hub main page

Design and implement chunks for embeddings (DP-800 Exam Prep)

This post is a part of the DP-800: Developing AI-Enabled Database Solutions Exam Prep Hub.
This topic falls under these sections:
Implement AI capabilities in database solutions (25–30%)
   --> Design and implement models and embeddings
      --> Design and implement chunks for embeddings


Note that there are 10 practice questions (with answers) at the end of each section to help you solidify your knowledge of the material. Also, there are 4 practice tests with 30 questions each available from the hub's main page below the exam topics section.

Introduction

One of the most important design decisions when building AI-enabled database solutions is determining how data should be divided before generating embeddings. This process, known as chunking, directly affects the quality of semantic search, Retrieval-Augmented Generation (RAG), recommendation systems, and AI-powered question answering.

Embedding models convert text into numerical vector representations that capture semantic meaning. However, they have input token limits and perform best when the input represents a coherent concept rather than an entire document. Consequently, documents are usually divided into manageable sections called chunks, and an embedding is generated for each chunk individually.

For the DP-800 exam, Microsoft expects candidates to understand how to design chunking strategies, determine appropriate chunk sizes, preserve context through overlap, store chunk metadata, and balance retrieval quality with storage and processing costs.


What Is Chunking?

Chunking is the process of dividing a document or other textual content into smaller units before generating embeddings.

Instead of embedding an entire 100-page document, the document is divided into logical sections such as:

  • Chapters
  • Sections
  • Paragraph groups
  • Pages
  • Individual articles
  • Code blocks
  • FAQ entries

Each chunk is embedded independently and stored in a vector database or SQL table.

For example:

Original document

Employee Handbook
Chapter 1
Chapter 2
Chapter 3
Chapter 4

After chunking:

Chunk 1 → Introduction
Chunk 2 → Employee Benefits
Chunk 3 → Leave Policies
Chunk 4 → Workplace Conduct
Chunk 5 → Remote Work
Chunk 6 → Security Policies

Each chunk receives its own embedding vector.


Why Chunk Documents?

Large Language Models and embedding models have practical limitations.

Reasons for chunking include:

  • Token limits
  • Improved semantic accuracy
  • Faster vector searches
  • Reduced hallucinations
  • Better retrieval precision
  • Lower processing costs
  • Easier document updates

Embedding an entire document often produces a vector that represents many unrelated topics simultaneously, reducing search accuracy.


Chunking in a Retrieval-Augmented Generation (RAG) System

A typical RAG workflow follows these steps:

Documents
Chunk Documents
Generate Embeddings
Store Vectors
User Query
Generate Query Embedding
Similarity Search
Retrieve Best Chunks
Provide Context to LLM
Generate Response

Without proper chunking, the retrieved context may be incomplete, overly broad, or irrelevant.


Characteristics of Good Chunks

An effective chunk should be:

  • Semantically coherent
  • Self-contained
  • Small enough for efficient retrieval
  • Large enough to preserve context
  • Easy to trace back to the original source
  • Consistent in formatting

Good chunks represent one primary idea or closely related concepts.

Example:

Good chunk:

Employees may work remotely up to three days each week with manager approval.

Poor chunk:

Employees may work remotely…

(ends halfway through explanation)

Incomplete chunks reduce retrieval quality.


Choosing an Appropriate Chunk Size

There is no universal chunk size.

Instead, chunk size depends on:

  • Document type
  • User questions
  • Embedding model limits
  • Retrieval strategy
  • Desired context

General guidelines:

Document TypeTypical Chunk Strategy
FAQOne question and answer per chunk
Product documentationOne section per chunk
Legal contractsOne clause per chunk
Research papersOne subsection per chunk
BooksSeveral paragraphs per chunk
Source codeOne function, class, or module per chunk
Knowledge articlesOne topic per chunk

Microsoft generally emphasizes semantic chunking over arbitrary character counts.


Fixed-Length Chunking

The simplest strategy divides text into equal-sized pieces.

Example:

Chunk 1
1–500 characters
Chunk 2
501–1000 characters
Chunk 3
1001–1500 characters

Advantages:

  • Simple
  • Fast
  • Easy to automate

Disadvantages:

  • Breaks sentences
  • Splits ideas
  • Reduces semantic quality

Because it ignores meaning, fixed-length chunking is generally less effective than semantic approaches.


Semantic Chunking

Semantic chunking divides documents based on meaning rather than length.

Examples include:

  • Headings
  • Sections
  • Chapters
  • Topics
  • Complete paragraphs
  • Individual procedures
  • Entire FAQ entries

Example:

Instead of:

Characters 1–1000
Characters 1001–2000

Use:

Vacation Policy
Medical Leave
Parental Leave
Travel Reimbursement

Semantic chunking produces embeddings that more accurately represent individual concepts.


Sliding Window (Overlapping) Chunking

One common challenge occurs when important information spans the boundary between two chunks.

For example:

Chunk 1
Employees may work remotely
after manager approval.
Chunk 2
After manager approval,
employees must...

The phrase “after manager approval” belongs to both chunks.

To preserve context, systems use overlapping chunks.

Example:

Chunk 1
Sentence 1
Sentence 2
Sentence 3
Sentence 4
Chunk 2
Sentence 3
Sentence 4
Sentence 5
Sentence 6

The overlapping sentences help ensure continuity during retrieval.


Advantages of Overlapping Chunks

Overlap helps:

  • Preserve context
  • Improve semantic similarity
  • Prevent broken explanations
  • Improve RAG responses
  • Increase retrieval accuracy

Most enterprise RAG systems use overlap rather than completely independent chunks.


Drawbacks of Excessive Overlap

Too much overlap creates problems:

  • Duplicate embeddings
  • Larger storage requirements
  • Longer indexing time
  • Increased search costs
  • More duplicate search results

The overlap should be sufficient to maintain context without introducing excessive redundancy.


Chunking Structured Data

Not all embeddings originate from unstructured documents.

Structured SQL data can also be chunked.

Examples include:

  • Product descriptions
  • Customer support articles
  • Knowledge base records
  • Employee profiles
  • Medical summaries

Rather than combining multiple rows, each logical business record is typically embedded separately.

Example:

Products
Laptop A
Laptop B
Laptop C

Each product becomes its own chunk.


Chunking Source Code

Source code should not be chunked arbitrarily.

Preferred chunk boundaries include:

  • Functions
  • Methods
  • Classes
  • Modules
  • Stored procedures
  • SQL scripts

Example:

Instead of:

Characters 1–1000

Use:

CreateCustomer()
DeleteCustomer()
CalculateTax()
GenerateInvoice()

This preserves the logical structure of the code and improves semantic retrieval for developer-focused AI assistants.


Chunk Metadata

Every chunk should include metadata that enables accurate retrieval and traceability.

Common metadata includes:

  • Document ID
  • Chunk ID
  • Source file name
  • Page number
  • Section heading
  • Chunk sequence number
  • Creation date
  • Last modified date
  • Author
  • Security classification

Example:

FieldValue
DocumentHR Handbook
Page14
SectionLeave Policy
Chunk5
Version3.2

Metadata supports source attribution, document reconstruction, filtering, and citation generation.


Reconstructing Context

Many RAG applications retrieve more than one chunk for a user query.

For example:

Chunk 21
Chunk 22
Chunk 23

Because each chunk contains metadata indicating its position in the document, the application can present adjacent chunks together to provide richer context to the language model.


Testing Chunk Quality

Designing chunking strategies is an iterative process. After implementing a strategy, evaluate it using representative queries and measure retrieval quality.

Common evaluation criteria include:

  • Retrieval precision – Are the returned chunks relevant to the query?
  • Retrieval recall – Are important chunks consistently found?
  • Context completeness – Does each chunk contain enough information to answer the question?
  • Duplicate retrieval – Are overlapping chunks causing redundant results?
  • Latency – Does the chunking strategy affect search performance?
  • Storage efficiency – How much additional storage is required for embeddings and metadata?

Testing with real-world questions often reveals whether chunks are too large, too small, or improperly aligned with document structure.


Best Practices

Microsoft recommends following several best practices when designing chunks for embeddings:

  • Prefer semantic chunking over fixed-length splitting whenever possible.
  • Keep each chunk focused on a single topic or concept.
  • Use overlap to preserve context across chunk boundaries.
  • Preserve document structure by chunking at headings, sections, or clauses.
  • Store comprehensive metadata with every chunk.
  • Choose chunk sizes appropriate for the document type and expected user queries.
  • Avoid creating chunks that are so small they lose context or so large they dilute semantic meaning.
  • Re-evaluate chunking strategies as documents, embedding models, or application requirements evolve.
  • Test retrieval quality with representative workloads before deploying to production.
  • Balance retrieval accuracy against storage costs, indexing time, and search performance.

DP-800 Exam Tips

For the DP-800 exam, you should understand how chunk design influences the effectiveness of AI-enabled database solutions. Be prepared to compare fixed-length, semantic, and overlapping chunking strategies and recognize when each is appropriate. Expect scenario-based questions that ask you to optimize retrieval quality, preserve context, reduce hallucinations, or improve the performance of Retrieval-Augmented Generation (RAG) systems. Also know the importance of metadata, chunk boundaries, and testing strategies in building scalable, production-ready embedding solutions.


Practice Exam Questions

Question 1

You are creating a Retrieval-Augmented Generation (RAG) solution for an organization’s HR policy documents. Each document averages 40 pages.

What is the primary reason for dividing the documents into chunks before generating embeddings?

A. SQL databases cannot store documents larger than 1 MB.

B. Embedding models only support numeric data.

C. Smaller chunks improve semantic retrieval by capturing focused context.

D. Chunking compresses documents into fewer tokens.

Answer: C

Explanation:
Embedding models generate vector representations for pieces of text. Smaller, semantically coherent chunks produce embeddings that represent specific concepts, making similarity searches much more accurate than embedding an entire document.


Question 2

A development team is designing chunk sizes for technical manuals.

Which chunking strategy generally produces the best retrieval quality?

A. Split documents into semantically meaningful sections of moderate length

B. One chunk for every document

C. Split every five characters

D. Create one chunk for every paragraph regardless of context

Answer: A

Explanation:
Chunks should balance context and specificity. Semantically meaningful sections preserve enough information for accurate retrieval without becoming overly broad.


Question 3

Why are overlapping chunks commonly used when generating embeddings?

A. To reduce storage requirements

B. To eliminate duplicate vectors

C. To preserve context across chunk boundaries

D. To increase SQL query speed

Answer: C

Explanation:
Without overlap, important information that spans chunk boundaries can be lost. Overlapping text ensures that concepts appearing near boundaries remain available during retrieval.


Question 4

Which factor has the greatest influence on selecting an appropriate chunk size?

A. The SQL Server version

B. The font used in the original document

C. The amount of database memory

D. The type of content and expected user queries

Answer: D

Explanation:
Different document types require different chunk sizes. FAQs, manuals, legal documents, and source code each benefit from different chunking strategies based on how users search for information.


Question 5

A company stores product manuals that include headings, tables, and explanatory paragraphs.

Which chunking strategy is most appropriate?

A. Ignore document structure and split every 1,000 characters.

B. Chunk according to logical document sections while preserving headings.

C. Generate one embedding for every sentence.

D. Combine all manuals into one embedding.

Answer: B

Explanation:
Preserving document structure helps maintain semantic meaning and improves retrieval quality because headings provide valuable contextual information.


Question 6

What is a disadvantage of creating extremely small chunks?

A. Higher SQL licensing costs

B. More accurate semantic understanding

C. Loss of surrounding context during retrieval

D. Lower storage requirements

Answer: C

Explanation:
Very small chunks may not contain enough surrounding information for an LLM to interpret their meaning correctly, resulting in lower-quality retrieval.


Question 7

When implementing chunking for a RAG application, which metadata should typically be stored alongside each embedding?

A. SQL login credentials

B. Original document identifier and chunk position

C. Azure subscription ID

D. CPU utilization statistics

Answer: B

Explanation:
Metadata allows applications to identify the source document, reconstruct surrounding context, provide citations, and retrieve neighboring chunks when generating responses.


Question 8

A legal department requires every retrieved answer to reference complete contractual clauses.

Which chunking strategy is most appropriate?

A. Randomly divide text every 500 characters.

B. Generate one embedding for the entire contract.

C. Chunk by individual words.

D. Chunk according to clause boundaries with slight overlap.

Answer: D

Explanation:
Legal documents rely on clearly defined clauses. Chunking by clause preserves legal meaning while overlap prevents loss of context between adjacent sections.


Question 9

Which statement best describes the relationship between chunk size and retrieval performance?

A. Larger chunks always produce better search results.

B. Smaller chunks always eliminate hallucinations.

C. There is an optimal balance between context size and retrieval precision.

D. Chunk size has no impact on vector search.

Answer: C

Explanation:
Chunks that are too large reduce retrieval precision, while chunks that are too small lose context. Effective systems balance these competing factors.


Question 10

During testing, users report that retrieved passages frequently stop in the middle of explanations.

Which modification would most likely improve retrieval quality?

A. Increase overlap between adjacent chunks.

B. Reduce the embedding vector dimensions.

C. Remove document metadata.

D. Convert embeddings to integers.

Answer: A

Explanation:
Increasing overlap preserves continuity across chunk boundaries, allowing retrieval systems to return more complete passages and improving the quality of generated responses.


Go to the DP-800 Exam Prep Hub main page

Generate embeddings (DP-800 Exam Prep)

This post is a part of the DP-800: Developing AI-Enabled Database Solutions Exam Prep Hub.
This topic falls under these sections:
Implement AI capabilities in database solutions (25–30%)
   --> Design and implement models and embeddings
      --> Generate embeddings


Note that there are 10 practice questions (with answers) at the end of each section to help you solidify your knowledge of the material. Also, there are 4 practice tests with 30 questions each available from the hub's main page below the exam topics section.

Introduction

Embeddings are one of the foundational technologies behind modern AI-powered applications such as semantic search, Retrieval-Augmented Generation (RAG), intelligent chatbots, recommendation systems, and knowledge assistants. Rather than treating text as simple strings of characters, embeddings transform text into high-dimensional numerical vectors that capture semantic meaning. This enables AI systems to compare concepts based on meaning rather than exact word matches.

For developers working with SQL databases, generating embeddings is often the first step in building AI-enabled database solutions. After embeddings are created, they can be stored in vector columns, indexed using vector indexes, and queried using vector similarity search. This makes it possible to retrieve relevant information efficiently and provide context to Large Language Models (LLMs).

For the DP-800: Developing AI-Enabled Database Solutions exam, candidates should understand when embeddings should be generated, how they are produced, where they are stored, how they are maintained, and how they integrate into SQL-based AI architectures.


What Are Embeddings?

An embedding is a numerical representation of data that captures its semantic meaning. Instead of representing text as characters or words, an embedding model converts the text into an array of floating-point numbers called a vector.

For example:

Text:

"Reset your account password."

Embedding (simplified):

[0.231, -0.118, 0.654, 0.092, ...]

Real embedding vectors typically contain hundreds or thousands of dimensions, depending on the model.

Although humans cannot interpret these numbers directly, embedding models position semantically similar text close together within vector space.

For example:

TextRelationship
Reset passwordVery similar
Change passwordVery similar
Forgot my passwordSimilar
Employee vacation policyNot similar

Although none of these sentences are identical, the first three express nearly the same concept and therefore produce vectors that are close together.


Why Generate Embeddings?

Embeddings enable SQL databases and AI applications to perform semantic retrieval instead of relying solely on exact keyword matching.

Benefits include:

  • Semantic search
  • Retrieval-Augmented Generation (RAG)
  • Similarity search
  • Intelligent recommendations
  • Duplicate detection
  • Document classification
  • Clustering similar content
  • Knowledge discovery
  • AI-powered assistants
  • Natural language querying

Without embeddings, searching generally depends on literal text matching.

Example:

Traditional search:

Password reset

Finds:

  • Password reset

May not find:

  • Forgot my login
  • Change my credentials
  • Reset account access

Semantic search using embeddings retrieves all of these because they express similar meanings.


Embedding Generation Workflow

Generating embeddings typically follows this workflow:

Source Data
Prepare Text
Chunk Documents
Select Embedding Model
Generate Embedding Vector
Store Vector
Vector Index
Similarity Search

Each stage contributes to the overall effectiveness of AI retrieval.


Preparing Data Before Generating Embeddings

High-quality embeddings begin with well-prepared data.

Typical preparation steps include:

  • Removing duplicate documents
  • Cleaning formatting artifacts
  • Normalizing whitespace
  • Removing unnecessary HTML
  • Converting PDFs into text
  • Correcting OCR errors
  • Standardizing encoding
  • Removing irrelevant content
  • Identifying document boundaries

Poor-quality input results in poor-quality embeddings.


Choosing Which Data to Embed

Not every database column should be embedded.

Good candidates include:

  • Product descriptions
  • Knowledge articles
  • Documentation
  • Policies
  • Customer support content
  • Email templates
  • FAQs
  • User manuals
  • Research papers
  • Technical documentation

Less suitable candidates include:

  • Identity columns
  • Numeric identifiers
  • Dates
  • Foreign keys
  • Boolean flags
  • Audit columns
  • Calculated values

Embedding descriptive, natural-language content provides the greatest value.


Chunking Before Generating Embeddings

Embedding an entire document often produces a vector that represents multiple unrelated topics.

Instead, documents should usually be divided into meaningful chunks.

Example:

Original document:

Employee Handbook

After chunking:

Vacation Policy
Medical Leave
Expense Reimbursement
Remote Work

Each chunk receives its own embedding.

Benefits include:

  • Improved retrieval precision
  • Better semantic representation
  • More accurate RAG responses
  • Lower processing costs
  • Easier maintenance

Selecting an Embedding Model

An embedding model converts text into vectors.

Common considerations include:

  • Vector dimensions
  • Supported languages
  • Domain specialization
  • Cost
  • Accuracy
  • Maximum token length
  • Latency
  • Azure integration

Microsoft AI-enabled SQL solutions commonly use embedding models hosted through Azure AI Foundry, Azure OpenAI, or compatible external providers.

The embedding model used for indexing should also be used for query embeddings to ensure compatibility.


Embedding Dimensions

Each embedding consists of a fixed number of dimensions.

Examples:

  • 384 dimensions
  • 768 dimensions
  • 1024 dimensions
  • 1536 dimensions
  • 3072 dimensions

Higher dimensions generally capture richer semantic relationships but require:

  • More storage
  • Larger vector indexes
  • Increased memory
  • More processing during similarity search

Choosing the appropriate dimension is a balance between accuracy and cost.


Batch Generation of Embeddings

Generating embeddings individually is inefficient for large datasets.

Instead, organizations commonly process documents in batches.

Advantages include:

  • Better throughput
  • Lower API overhead
  • Reduced operational costs
  • Easier scheduling
  • Improved monitoring

Batch processing is commonly used when:

  • Loading historical documents
  • Building initial vector indexes
  • Reindexing knowledge bases

Incremental Embedding Generation

Production systems rarely regenerate every embedding.

Instead, they generate embeddings only for new or modified content.

Common mechanisms include:

  • SQL table triggers
  • Change Tracking
  • Change Data Capture (CDC)
  • Change Event Streaming (CES)
  • Azure Functions with SQL Trigger Binding
  • Azure Logic Apps
  • Microsoft Foundry pipelines

Incremental updates reduce cost while keeping vector indexes synchronized with source data.


Storing Embeddings

After generation, embeddings are typically stored alongside their source data or in a dedicated vector table.

Example:

Document IDChunkEmbedding
101Vacation PolicyVector
102Medical LeaveVector
103BenefitsVector

In SQL Server 2025 and Azure SQL Database, embeddings can be stored in vector-compatible columns, enabling efficient similarity search.


Metadata Associated with Embeddings

Each embedding should include metadata that supports retrieval and maintenance.

Typical metadata includes:

  • Document ID
  • Chunk ID
  • Source filename
  • Page number
  • Section heading
  • Creation date
  • Last modified date
  • Embedding model used
  • Embedding version
  • Language
  • Security classification

Metadata enables filtering, traceability, citation generation, and re-embedding when models are updated.


Keeping Embeddings Current

Embeddings represent the content at the time they were generated. When source data changes, the corresponding embeddings become outdated.

Common maintenance workflow:

Row Updated
Detect Change
Regenerate Embedding
Replace Old Vector
Update Vector Index

Automating this process ensures that AI applications always retrieve current information.


Common Challenges When Generating Embeddings

Developers should be aware of several common issues:

Poor Chunking

Large or poorly defined chunks reduce retrieval accuracy.

Incorrect Model Selection

Using different embedding models for indexing and querying can produce incompatible vectors.

Stale Embeddings

Failing to regenerate embeddings after data changes leads to outdated search results.

Excessive Costs

Embedding every column or regenerating vectors unnecessarily increases API usage and storage costs.

Inadequate Metadata

Without metadata, it is difficult to identify sources, filter results, or reconstruct document context.


Best Practices

Microsoft recommends several best practices for generating embeddings in SQL-based AI solutions:

  • Generate embeddings only for meaningful textual content.
  • Chunk documents into semantically coherent sections before embedding.
  • Use the same embedding model for both indexing and query generation.
  • Store metadata with every embedding.
  • Automate embedding generation for new and modified content.
  • Use incremental updates instead of regenerating all embeddings.
  • Monitor embedding generation jobs for failures and latency.
  • Evaluate retrieval quality regularly using representative user queries.
  • Choose embedding dimensions that balance accuracy, storage, and performance.
  • Version embedding models so vectors can be regenerated consistently when models change.

Real-World Example

A company maintains a knowledge base of 75,000 technical support articles.

Instead of embedding each entire article, they:

  1. Clean and normalize article text.
  2. Divide each article into logical sections.
  3. Generate an embedding for each section using an Azure-hosted embedding model.
  4. Store vectors and metadata in Azure SQL Database.
  5. Create a vector index.
  6. Use vector similarity search to retrieve the most relevant sections.
  7. Supply retrieved sections as context to a Large Language Model for answering user questions.
  8. Automatically regenerate embeddings whenever articles are updated using Change Tracking and Azure Functions.

This architecture provides fast, accurate semantic retrieval while minimizing operational costs.


DP-800 Exam Tips

For the DP-800 exam, understand that generating embeddings is far more than simply calling an AI model. Microsoft expects candidates to understand the complete embedding lifecycle, including data preparation, chunking, model selection, embedding generation, storage, metadata management, incremental updates, and integration with vector search and RAG solutions. Be prepared for scenario-based questions that require choosing appropriate embedding strategies, maintaining embedding freshness, optimizing costs, and designing scalable AI-enabled database solutions that integrate Azure SQL with Azure AI services.


Practice Exam Questions


Question 1

A company is building a Retrieval-Augmented Generation (RAG) solution using Azure SQL Database. Why should documents generally be divided into chunks before generating embeddings?

A. To reduce the number of database tables required

B. To improve semantic retrieval by creating embeddings for focused pieces of content

C. To eliminate the need for vector indexes

D. To ensure embeddings contain fewer than 100 dimensions

Answer: B

Explanation:
Chunking documents into semantically meaningful sections improves retrieval accuracy because each embedding represents a single concept or closely related ideas. Embedding an entire document often results in vectors that represent multiple topics, reducing search precision.


Question 2

Which type of database column is generally the best candidate for generating embeddings?

A. Product description

B. Order ID

C. Invoice number

D. Creation timestamp

Answer: A

Explanation:
Embeddings are designed to represent semantic meaning. Descriptive text such as product descriptions, documentation, FAQs, and support articles provides meaningful information that can be searched semantically. Numeric identifiers and timestamps contain little semantic value.


Question 3

What is the primary purpose of an embedding model?

A. Compress relational tables

B. Encrypt database records

C. Convert text into numerical vectors representing semantic meaning

D. Generate SQL indexes automatically

Answer: C

Explanation:
Embedding models transform text into high-dimensional vectors that preserve semantic relationships. These vectors enable similarity searches, semantic search, clustering, and Retrieval-Augmented Generation (RAG).


Question 4

Why should the same embedding model generally be used for both document indexing and query generation?

A. Different models produce incompatible vector spaces.

B. SQL Server only supports one model.

C. Using multiple models improves similarity scores.

D. Azure SQL automatically converts vectors between models.

Answer: A

Explanation:
Embedding vectors generated by different models often exist in different vector spaces and cannot be compared accurately. Using the same model ensures similarity calculations remain meaningful.


Question 5

A development team updates product documentation daily.

Which approach minimizes costs while keeping embeddings current?

A. Regenerate every embedding every hour.

B. Regenerate embeddings only when the corresponding documents change.

C. Never regenerate embeddings.

D. Create duplicate embeddings for every document revision.

Answer: B

Explanation:
Incremental embedding generation updates only modified content, reducing API usage, storage requirements, and processing time while maintaining accurate search results.


Question 6

What is a major benefit of storing metadata alongside embeddings?

A. It reduces vector dimensions.

B. It eliminates the need for chunking.

C. It enables filtering, traceability, and source attribution during retrieval.

D. It compresses embeddings automatically.

Answer: C

Explanation:
Metadata such as document ID, page number, section heading, language, and security classification allows applications to identify the source of retrieved content, reconstruct document context, and apply filters during searches.


Question 7

Which technology can detect modified SQL data so only affected embeddings are regenerated?

A. SQL Server Agent alerts only

B. Change Tracking or Change Data Capture (CDC)

C. Database snapshots

D. Transaction log backups

Answer: B

Explanation:
Both Change Tracking and Change Data Capture (CDC) identify inserted, updated, or deleted rows, making them well suited for triggering incremental embedding regeneration workflows.


Question 8

A company chooses an embedding model with significantly more vector dimensions than its previous model.

What is the most likely tradeoff?

A. Lower storage requirements

B. Reduced semantic accuracy

C. Increased storage and processing requirements

D. Elimination of vector indexes

Answer: C

Explanation:
Higher-dimensional vectors typically capture more semantic detail but require additional storage, memory, and computational resources during indexing and similarity searches.


Question 9

Which workflow correctly represents the embedding generation process?

A. Generate vectors → Clean data → Chunk documents → Search

B. Chunk documents → Generate embeddings → Store vectors → Perform similarity search

C. Store vectors → Generate embeddings → Build documents

D. Query database → Generate vectors → Create documents

Answer: B

Explanation:
The standard workflow is to prepare and chunk documents, generate embeddings, store them, create vector indexes if appropriate, and then use similarity search to retrieve relevant content.


Question 10

An organization regenerates embeddings every night even though very little data changes. Users report no improvement, but Azure AI costs continue to increase.

What is the best recommendation?

A. Increase the embedding dimensions.

B. Generate duplicate embeddings for verification.

C. Replace semantic search with keyword search.

D. Implement incremental embedding generation triggered by data changes.

Answer: D

Explanation:
Incremental embedding generation regenerates vectors only when data changes, reducing unnecessary API calls, lowering costs, and maintaining up-to-date embeddings without repeatedly processing unchanged content.


End of Topic Summary

For the DP-800 exam, understand that generating embeddings is a foundational step in building AI-enabled SQL database solutions. Success depends on more than simply invoking an embedding model—you must also prepare and chunk data appropriately, select a suitable embedding model, generate compatible vectors, store them with useful metadata, and keep them synchronized with changing source data through incremental update mechanisms such as Change Tracking, CDC, Azure Functions, or Logic Apps. Microsoft expects candidates to understand the complete embedding lifecycle and how it supports semantic search, vector indexing, and Retrieval-Augmented Generation (RAG) solutions.


Go to the DP-800 Exam Prep Hub main page