Prev Next

AI / LlamaIndex Interview Questions

How would you architect a multi-tenant LlamaIndex application with metadata filtering per tenant?

A multi-tenant RAG application needs to guarantee that one customer's query never surfaces another customer's data, and the architecture choice comes down to how strict that isolation needs to be versus how much operational overhead you can take on.

  1. Shared index, metadata-scoped. Every Node is tagged with a tenant_id field at ingestion time. At query time, a MetadataFilters exact-match filter on tenant_id is attached to the retriever so similarity search only ever considers that tenant's Nodes. This is the most storage-efficient approach and scales well operationally, since there's only one index to manage, but it relies on the filter being applied correctly on every single query path with no exceptions.
  2. Isolated indices or collections per tenant. Each tenant gets a fully separate vector store collection or index. This gives stronger isolation, since a bug in filter logic can't leak across tenants, but it multiplies operational overhead: more indices to provision, monitor, and keep in sync, and it can be less efficient for a very large number of small tenants.

A common middle ground is metadata-scoped filtering within a shared index for the majority of tenants, reserved for cases with genuinely strict compliance or data-residency requirements to isolated indices instead, and in either case enforcing the tenant scope at the lowest possible layer, such as a wrapper around retriever construction, so no code path can accidentally construct a query engine without it.

The shared-index, metadata-filtered approach to multi-tenancy trades off:
Isolated indices per tenant provide stronger isolation but mainly cost you:

More Related questions...

What is LlamaIndex? What is the purpose of LlamaIndex in a RAG pipeline? What are Documents and Nodes in LlamaIndex? What is a VectorStoreIndex? What are the types of indices in LlamaIndex? What is a query engine in LlamaIndex? What is a retriever in LlamaIndex? What is a response synthesizer? What is Settings in LlamaIndex? What is a node parser or text splitter in LlamaIndex? How do you use SimpleDirectoryReader? What is LlamaHub? Describe the ingestion pipeline in LlamaIndex? What is a chat engine in LlamaIndex? What are the response modes available in LlamaIndex query engines? What is the difference between VectorStoreIndex and SummaryIndex? How does similarity_top_k affect retrieval? What is the difference between a query engine and a chat engine? How do node postprocessors work in LlamaIndex? Why should you use metadata filtering in retrieval? What is the difference between refine and compact response modes? How does the SubQuestionQueryEngine work? What is a RouterQueryEngine and when would you use it? Why is chunk size important in LlamaIndex? How do you persist and reload an index in LlamaIndex? What is the difference between LlamaIndex and LangChain? How does the SentenceWindowNodeParser improve retrieval quality? When should you use auto-merging retrieval? What is HyDE and how does it help retrieval? How do you integrate a custom vector store like Pinecone or Chroma with LlamaIndex? What is the difference between ReActAgent and FunctionCallingAgent? How does LlamaIndex support structured data querying such as SQL? Why use CohereRerank or LLMRerank as a node postprocessor? What is the role of the CallbackManager in LlamaIndex? How do you evaluate a LlamaIndex RAG pipeline for faithfulness? Explain the execution flow of a query in a VectorStoreIndex-based query engine? Explain the internal working of the IngestionPipeline caching mechanism? Explain the lifecycle of a Node from Document to retrieval? What is the difference between PropertyGraphIndex and KnowledgeGraphIndex? How can you optimize token usage and cost in a large-scale LlamaIndex deployment? Explain the internal working of AgentWorkflow and event-driven workflows in LlamaIndex? How do you troubleshoot poor retrieval relevance in a LlamaIndex application? What happens internally when you call index.as_query_engine()? How does LlamaIndex handle asynchronous querying at scale? Explain the difference between the low-level composition API and the high-level API in LlamaIndex? Why doesn't increasing similarity_top_k always improve answer quality? How do you design a hybrid search system combining vector and keyword retrieval in LlamaIndex? Explain the internal working of tree_summarize response synthesis? How would you architect a multi-tenant LlamaIndex application with metadata filtering per tenant? Which is better and why: sentence-window retrieval vs auto-merging retrieval for long documents?
Show more question and Answers...


Comments & Discussions