Tokens, embeddings, and vector databases are three related but different concepts used in modern AI applications. A token is a unit processed by a language model; an embedding is a numerical representation of content; and a vector database stores and searches those representations to retrieve semantically related information.
What is a token?
Language models do not process text exactly as humans see words on a page. A tokenizer splits input into tokens, which may represent whole words, parts of words, punctuation, or other text units. Token counts affect context-window usage, request limits, latency, and cost. One word is not always one token, and tokenization differs across models.
What is an embedding?
An embedding model converts content such as a sentence, paragraph, or image into a vector: a list of numerical values. The vector represents aspects of the content in a space where similar items can be compared mathematically. Texts with related meaning may have vectors that are close under a chosen similarity measure, even when they do not share the same keywords.
What does a vector database do?
A vector database stores embeddings and supports similarity search. An application converts a user’s query into an embedding, searches for nearby vectors, and retrieves the associated content or metadata. The vector store is not the language model and does not itself generate the final natural-language answer.
How these pieces fit into RAG
- Ingest source documents from a data source.
- Split documents into manageable chunks.
- Convert each chunk into an embedding using an embedding model.
- Store the vectors and their source references in a vector index.
- At query time, embed the user’s question and search for similar chunks.
- Pass retrieved context to a foundation model to generate a grounded response.
Amazon Bedrock Knowledge Bases can manage much of this ingestion and retrieval workflow. Chunking strategy matters: small chunks can improve precision, while larger or hierarchical chunks can preserve broader context. The right choice depends on document structure and the question types users ask.
Semantic search vs. keyword search
| Search type | How it matches | Example |
|---|---|---|
| Keyword search | Matches terms and indexed text | Search for the exact phrase “refund policy” |
| Vector similarity search | Compares embeddings for semantic similarity | Search “Can I get my money back?” and retrieve a refund-policy passage |
| Hybrid search | Combines keyword and vector signals | Use both exact product codes and semantic intent |
Exam traps
- A token is a unit of model input/output, not a vector.
- An embedding is a numerical representation, not the original text and not a generated answer.
- A vector database stores and retrieves vectors; a foundation model generates responses.
- RAG retrieves external context at inference time. It does not require retraining the foundation model whenever documents change.
- Retrieval quality depends on chunking, embedding choice, metadata, indexing, and query design.
Test yourself
Question 1
An application must represent document chunks as numerical vectors so it can retrieve semantically similar passages. Which component creates those representations?
- Tokenizer only
- Embedding model
- Load balancer
- Speech synthesizer
Reveal answer
Correct answer: B. An embedding model converts content into numerical vectors.
Question 2
At query time, which component is responsible for storing vectors and finding similar vectors for a query embedding?
- Vector database or vector index
- Tokenizer
- Foundation model alone
- IAM policy
Reveal answer
Correct answer: A. The vector store indexes embeddings and performs similarity retrieval.
Key takeaway
Keep the sequence clear: tokenize text for model processing; create embeddings to represent meaning numerically; store and search those vectors in a vector index; then use retrieved context in RAG to support generation.
Related AWS topics
Amazon Bedrock Knowledge Bases · RAG vs. Fine-Tuning · Amazon OpenSearch Service
✦ CloudExamPro Premium
Ready for the AWS Certified AI Practitioner (AIF-C01)?
Move beyond memorizing terms. Practice with realistic, scenario-based questions and detailed explanations that help you understand the AWS AI services and concepts behind each answer.
Original practice questions. No dumps. No shortcuts.