Learn AI. Do. Grow.
← All modules

Deep dive · module 89 of 100

Vector databases

Understand how vector databases help with searching through your own documents.

After this lesson

You can explain what a vector database does in a RAG system.

In view · How it connects

Search by similarity

  1. An embedding model converts text into a numerical representation.

  2. The search layer compares the query with stored vectors.

  3. The corresponding text segments are retrieved and checked for usability.

Remember: Similarity in meaning is no guarantee that a passage answers the question. Open het volledige schema ↗

What is a vector?

A numerical representation of the meaning of a text.

Vector database

Stores these vectors and can quickly find the most similar pieces of text for a question.

In practice

This is the search layer behind many RAG systems. The quality depends on the embeddings and the chunking.

New practice example

From explanation to a usable result.

A vector index searches for matching meaning, but high similarity is not the same as factual accuracy.

Fictional practice situation

A fictitious knowledge base contains an old regulation and a new supplement for young people. A search query for 'reserving' mainly finds the old document because it contains the most similar words.

View a possible solution

This is how it can be done

Preserve source and version data with fragments. Also search for conditions and supplements, and check the found passages before you create an answer. If necessary, combine text filters with semantic searches.

Why this works

The index helps find candidates. It does not decide which source is authoritative or up to date.

Make it slightly more difficult

Create two almost identical questions, one for adults and one for young people. What extra source information must accompany the second question?

Extra practice, at your own pace. You do not need to submit anything. This does not count towards an automatic assessment.

Your workplace · learning by doing

Make something. See what changes.

Ende, your light pink practice buddy

The fictitious source is included. Only when selecting ‘Let Ende answer’ do you send your assignment to the AI service. Do not use private data.

Checking the AI connection… You can already view the written example.

Your result

No answer yet

Present your assignment to Ende.
Read the answer, change one thing, and compare.

You remain in control

What do you want to improve in your next attempt?

My own check

On this device only. AI answers remain only in this page memory. This is self-review, not a grade.

Why this approach works

The index helps find candidates. It does not decide which source is authoritative or up to date.

A step further

Create two almost identical questions, one for adults and one for young people. What extra source information must accompany the second question?

Try & discover · no obligation

Search in a small document bank

Compare small and larger text pieces. Do you also find the exception in the answer?

Change search settings
2 pieces shown from 7. Size and overlap change what is retrieved together.
7text pieces in the search bank
0words overlap

Found text pieces (maximum three)

  1. Openingsuren2 keywords found
    o'clock. Note the exception: on Friday, the closing is at sixteen o'clock.
  2. Openingsuren1 keywords found
    The fictitious workshop is open Monday to Friday from nine to eighteen
Compare with the full original documents

Openingsuren

The fictitious workshop is open Monday to Friday from nine to eighteen o'clock. Note the exception: on Friday, the closing is at sixteen o'clock. On Saturday and Sunday, the workshop is closed.

Bezoekers

Visitors report to the reception. An appointment is required for a tour. An appointment for a visit does not change the opening hours.

Materiaal

Tools remain in the workshop. Return borrowed equipment on the agreed day. For questions about materials, speak to the manager.

Find the exception yourself: the workshop closes at sixteen o'clock on Friday. Is that information fully present in a found piece? Try 12 words with 4 words overlap.

This example ranks by exact keywords. Real embeddings and vector databases compare numerical representations; these are not performed here. A match is not proof that the entire question has been answered.

This trial works locally with fictitious data and does not count towards your lesson completion. It starts anew with a new lesson or reload.

A prompt to get you started

Briefly explain what a vector database does in a system that provides answers based on own documents.

Apply it

A vector search finds an old passage that strongly resembles the question. A more recent policy version says something else.

Which approach best fits this situation?

  • Always choose the highest similarity score as the truth.
  • Assume that a vector database only contains current facts.
  • Filter for permitted current sources and check which passage supports the answer.

With JavaScript, you can check your approach and receive immediate feedback.

Test your insight

What does a vector database do in a RAG system?

  • It quickly finds the most relevant pieces of text for a question.
  • It trains the language model.
  • It replaces the need for source verification.
Extra practice

Describe in your own words why a vector database is useful when searching through a large number of documents.

It quickly finds the pieces of text that are closest in meaning to the question, instead of just searching on keywords.

A question? I'll help you on your way.

Drag Aldo to move it. Use the arrow keys on Aldo with the keyboard, Enter to save the position and Escape to cancel.