A RAG system serves 10,000 users with highly personalized queries. Each user has a unique profile including preferences, history, and data access permissions. How should user-specific context be architecturally integrated into the retrieval system?
Select an answer to reveal the explanation.
Short Explanation
Here's the deal — metadata-filtered vector search is the most scalable and architecturally clean approach. You store user attributes as chunk metadata and filter retrieval before ranking, then give Claude one compact profile summary.
Full Explanation
Metadata-filtered vector search is the most scalable and architecturally clean approach. User attributes such as role, permission level, and preference tags are stored as metadata on document chunks at indexing time. At query time, the vector search applies metadata filters, such as retrieving only chunks tagged for this user's permission level, before semantic ranking, ensuring Claude only sees permitted, relevant content. The compact profile summary in Claude's context provides personalization signal without overwhelming the context window. The full-profile-in-system-prompt approach doesn't enforce data access controls at the retrieval level — Claude receives unpermitted chunks and must self-filter, which is unreliable and doesn't meet security requirements. The separate-vector-index-per-user approach is operationally infeasible at 10,000 users; index management at that scale is prohibitively complex and expensive. The pre-retrieval query-reformulation approach adds latency and an extra LLM call but doesn't enforce permission filters at the retrieval level.