Embeddings and Vector Database Interview Questions (2026)
Common interview questions on embeddings, vector databases, ANN search, and RAG for Indian fresher AI/ML roles in 2026, with model answers.
Interviewers for AI/ML fresher roles in 2026 now routinely ask about embeddings and vector databases, particularly in RAG-context follow-ups after the standard “what is a language model” question.
This article covers the conceptual framing, the technical questions that separate prepared candidates, and a template for structuring answers, all calibrated for the Indian fresher placement round, not the senior engineering bar.
What an Embedding Is (and How to Explain It in 60 Seconds)
The interview answer that works:
- Define the input: “An embedding is a dense numerical vector representation of data — text, image, audio, or code.”
- Define the geometry: “Similar items end up close together in vector space. So ‘cat’ and ‘kitten’ will have a smaller cosine distance than ‘cat’ and ‘database’.”
- Connect to utility: “This lets computers measure semantic similarity mathematically, which is what makes semantic search, recommendation systems, and RAG pipelines possible.”
That three-part answer covers what, why, and where it matters. According to Pinecone’s vector embedding documentation, an embedding model maps each input to a fixed-length vector (typically 384 to 1,536 dimensions) where geometric distance reflects semantic similarity.
A common follow-up is: how is an embedding different from one-hot encoding or TF-IDF?
- One-hot encoding assigns a binary 0/1 vector with one active dimension per vocabulary word. A 50,000-word vocabulary gives a 50,000-dimensional sparse vector. No two words are inherently similar.
- TF-IDF weights words by frequency in a document versus the corpus. Better than one-hot, but still treats each word as independent.
- Embeddings are dense (typically 256 to 1,536 dimensions), learned from context, and capture semantic relationships. “King” minus “Man” plus “Woman” equals “Queen” is the canonical demonstration of why learned embeddings are qualitatively different.
Word-level embeddings (Word2Vec, GloVe) gave way to sentence-level and then document-level embeddings as transformer-based models became standard. For interviews, knowing the generation of the model matters less than knowing what problem dense representations solve.
Why Vector Databases Exist — and What They Replace
A SQL database can store embeddings as arrays. What it cannot do efficiently is answer the question: which of these 10 million vectors is closest to this query vector? A full scan of 10 million 512-dimensional vectors on a standard SQL scan would take seconds per query. At production load, that is unusable.
Vector databases solve this with approximate nearest-neighbour (ANN) indexing. Instead of comparing the query against every vector, the index structures the space so only a fraction of vectors need to be checked, with a small precision trade-off.
The interview framing that works: “A vector database is a system optimised for similarity search over high-dimensional vectors. It uses ANN indexes to return near-neighbours in milliseconds without scanning the full collection.”
The key distinction from a SQL database:
| Property | SQL database | Vector database |
|---|---|---|
| Query type | Exact match, range, join | Nearest-neighbour, semantic similarity |
| Data type | Structured rows | High-dimensional vectors |
| Index type | B-tree, hash | HNSW, IVF, PQ |
| Search result | Exact | Approximate (configurable recall) |
| Typical use | Transactions, analytics | Semantic search, RAG, recommendations |
The Technical Questions That Trip Up Freshers
This section covers the four questions that freshers who studied the basics tend to get wrong, along with the answer frame for each.
HNSW vs IVF
Both are ANN index types. The Milvus vector index documentation describes the core distinction:
- HNSW (Hierarchical Navigable Small World): A graph-based index. Query traverses multiple layers of the graph, pruning search space at each level. Typically gives high recall and low latency. Memory-heavy because the graph structure is stored in RAM.
- IVF (Inverted File Index): A clustering-based index. Vectors are partitioned into clusters (Voronoi cells). At query time, only the nearest clusters are searched. More memory-efficient at very large scale, but recall depends on how many clusters are probed.
Interview answer frame: “HNSW is better when you need high recall at low latency and can afford the RAM footprint. IVF scales better for very large collections where memory is the bottleneck. In practice, Pinecone and most managed vector databases use HNSW or hybrid variants by default.”
Cosine similarity vs dot product vs Euclidean distance
- Cosine similarity: measures the angle between two vectors, range -1 to 1. Direction only, not magnitude.
- Dot product: measures both angle and magnitude. Equal to cosine similarity when vectors are unit-normalised.
- Euclidean (L2) distance: the straight-line distance between two points in vector space.
For most embedding models, cosine similarity or dot product on normalised vectors is the standard. Euclidean distance is used in some specialised applications such as k-means clustering and FAISS flat index variants.
Hybrid search
Pure vector search retrieves semantically similar results. It can fail when the query contains a rare proper noun (“Infosys Q3 2024 press release”) or an exact identifier (“order ID 48291”). BM25 keyword search handles exact terms well but misses paraphrases.
Hybrid search runs both retrieval paths and combines the ranked lists, typically via Reciprocal Rank Fusion (RRF) or a learned reranker. Weaviate and Elasticsearch both support hybrid search natively. Interviewers ask about it because it shows you understand where vector search breaks down, not just where it works.
Chunking strategy
Before embedding a document into a vector database, it must be split into passages. Common strategies:
- Fixed-size chunking: split every N tokens. Fast, simple, may break sentences.
- Sentence-based chunking: split at sentence boundaries, optionally with overlap. Cleaner but variable size.
- Semantic chunking: split when topic changes. Expensive but better recall for long documents.
The interview follow-up: “How would you choose chunk size for a 50-page document?” A solid answer names the trade-off: smaller chunks improve precision but may lose context; larger chunks preserve context but dilute the embedding. A practical starting point is 256 to 512 tokens with 10 to 20 percent overlap.
RAG Pipeline Questions — What Freshers Need to Know
RAG (Retrieval-Augmented Generation) connects a vector database to a language model. The pipeline has six stages:
- Chunk: split the source documents into passages.
- Embed: encode each chunk with an embedding model.
- Index: store vectors in a vector database with ANN indexing.
- Retrieve: at query time, embed the question and find the top-K nearest chunks.
- Rerank (optional): re-score the top-K chunks with a cross-encoder or BM25 reranker for precision.
- Generate: pass the retrieved context to an LLM and produce an answer grounded in that context.
Fresher interviewers typically ask: “When would you use RAG instead of fine-tuning?” The answer involves at least three factors: how frequently the knowledge base changes, whether source citations are required, and how large the domain data is. For dynamic knowledge bases (a company’s internal document store updated weekly, for instance), RAG is clearly better because fine-tuning on updated data requires expensive retraining cycles.
Common failure modes that appear in interviews:
- Retrieval returns irrelevant chunks because the embedding model wasn’t trained on domain-specific text. Fix: use a domain-adapted embedding model or add metadata filters.
- LLM hallucination despite retrieval because the retrieved chunks don’t contain the answer and the LLM generates anyway. Fix: add a confidence gate or “I don’t know” fallback when retrieval score is below threshold.
- Stale index because documents were updated but the index wasn’t refreshed. Fix: incremental indexing strategy.
Understanding where RAG pipelines fail is more interview-valuable than listing the stages. Any candidate who read a blog post can list the stages. The failure-mode question separates candidates who have thought about production from those who memorised the architecture.
The 2026 AI roadmap for Indian engineering students covers which project types to build to demonstrate RAG fluency before interviews, which is useful context if you’re mapping this topic to your own prep timeline.
How to Frame Your Answers
Four-part answer structure that works across every question in this topic:
- State the concept in one sentence. Don’t open with a list of synonyms or a history lesson.
- Give the mechanism. How does it work, technically? One to two sentences.
- Name a trade-off or limitation. This signals depth over rote recall.
- Connect to a use case or a project. One sentence. Grounds the abstract in the practical.
Example application: “What is HNSW?”
- Concept: “HNSW is a graph-based index for approximate nearest-neighbour search.”
- Mechanism: “It builds a hierarchical graph of vectors. Queries traverse from coarse layers to fine layers, pruning the search space at each step.”
- Trade-off: “The trade-off is memory: the graph structure must sit in RAM, so very large collections can be expensive to index this way.”
- Use case: “In my RAG project, I used FAISS with an HNSW index because the collection was 50,000 vectors and recall was more important than memory.”
If you don’t have a project story yet, the walk-me-through-your-ai-project answer guide covers how to build and narrate one before your placement round. And if the interviewer extends the conversation into system design (‘how would you scale this retrieval layer?’), the ML system design interview guide covers the same four-step framework applied to scale problems.
Transformer-based embedding models (BERT, sentence-transformers, OpenAI’s text-embedding series) are the infrastructure behind every modern embedding pipeline. If you need to explain how those models produce embeddings (or when the interviewer follows up with ‘how does the embedding model itself work?’), the transformer interview explanation guide gives you the 90-second answer for that question.
Primary sources
Frequently asked questions
Do I need to know a vector database for a fresher AI role in India?
Not for every role. Service-tier tracks at large IT firms typically don't ask this. For AI-track, data-science, or GenAI roles at product companies, vector database questions appear in roughly half of technical rounds per 2025-2026 interview feedback. If the JD mentions RAG, semantic search, or LLM integration, prepare this topic.
What is the difference between FAISS, Pinecone, and Weaviate in an interview?
FAISS is a local similarity-search library, best for prototypes and custom retrieval stacks. Pinecone is a managed cloud vector database for production workloads with minimal ops. Weaviate is an open-source vector database with built-in hybrid search, metadata filtering, and multi-modal support. In interviews, name the trade-off, not just the tools.
How is cosine similarity different from dot product similarity?
Cosine similarity measures the angle between two vectors, ignoring magnitude. Dot product measures both angle and magnitude. If vectors are normalised to unit length, the two metrics give identical rankings. Most embedding models output normalised vectors, so the practical difference only shows up with unnormalised embeddings.
What does approximate mean in approximate nearest-neighbour search?
ANN search trades a small accuracy loss for a large speed gain. Instead of comparing a query vector against every stored vector, ANN algorithms like HNSW or IVF use index structures to prune the search space. In practice, recall at 95 to 99 percent is achievable at 10 to 100 times the throughput of brute-force search.
When does RAG outperform fine-tuning for a given use case?
RAG works better when the knowledge base changes frequently, when you need source citations, or when the domain data is too large to fine-tune on. Fine-tuning is better when you need to alter the model's style or reasoning pattern deeply, or when retrieval latency cannot be added to the inference path. Most fresher interviewers ask this as an open trade-off question, not a trick question.
What is chunking in a RAG pipeline?
Chunking splits a long document into smaller passages before embedding each passage separately. Chunk size and overlap are the key parameters. Smaller chunks give higher retrieval precision but may lack context; larger chunks capture more context but dilute the embedding signal. A common fresher-interview follow-up is: how would you choose chunk size for a 50-page legal document?
More from FACE Prep
Keep reading on the topics that matter for your placements.