Database / ChromaDB Interview Questions
What are embeddings and why are they central to how ChromaDB works?
An embedding is a dense numerical vector — a list of floating-point numbers — that represents the semantic meaning of a piece of data. Text, images, audio, and code can all be converted into embeddings by a neural network (embedding model). Items with similar meanings produce vectors that are close together in the high-dimensional vector space.
ChromaDB stores these vectors alongside the original data and metadata. When you query ChromaDB with a new piece of text, the same embedding model converts it to a vector, and ChromaDB uses an approximate nearest-neighbour (ANN) algorithm to find the stored vectors that are geometrically closest — these correspond to the most semantically relevant stored documents.
# Conceptual illustration # "ChromaDB is a vector database" â [0.12, -0.45, 0.89, ..., 0.03] (384 numbers) # "Vector stores for AI apps" â [0.14, -0.41, 0.91, ..., 0.01] (close!) # "My cat loves tuna fish" â [-0.55, 0.72, -0.11, ..., 0.88] (far away) import chromadb from chromadb.utils import embedding_functions # You can inspect the raw embedding vectors ChromaDB generates client = chromadb.Client() collection = client.create_collection("demo") collection.add(documents=["Hello world"], ids=["1"]) # Get the stored embedding result = collection.get(ids=["1"], include=["embeddings"]) print(len(result["embeddings"][0])) # 384 â length of the default model's vector print(result["embeddings"][0][:5]) # first 5 of 384 floats
| Model | Dimensions | Notes |
|---|---|---|
| all-MiniLM-L6-v2 (default) | 384 | Fast, small, good for English |
| text-embedding-ada-002 (OpenAI) | 1536 | High quality, API call required |
| text-embedding-3-small (OpenAI) | 1536 | Newer, cheaper than ada-002 |
| all-mpnet-base-v2 | 768 | Higher quality than MiniLM, slower |
| CLIP (images) | 512 | Multimodal — text and images same space |
More Related questions...