Skip to the page

Retrieval-augmented generation · senior

Access control, fresh versions and Indian languages in RAG

RAG must show each user only what they may see, answer from the right version of a document, and work for Hindi and Hinglish questions. All three need metadata and checks in code, not prompt rules.

The notes

What you must know

  • Access control: store access metadata (groups, roles, owner) on every chunk at ingestion and filter in the retrieval query with the user's groups from the identity system, never from the prompt.
  • Prompt instructions are not security. The model repeats what it is given and an injection can talk it into anything. Never retrieve what the user cannot open. Very sensitive content goes in a separate index or tenant.
  • Keep permissions fresh by syncing group membership from the source on a schedule, and run ingestion with the minimum rights.
  • Versions: put document id, version, effective-from and effective-to dates and status on every chunk, and filter on the version that applies. Some customers need the old version, chosen by their policy start date.
  • Ingestion is an upsert by stable document id. Deletes must reach the vector index, the keyword index and any answer cache. Watch freshness with metrics and alerts.
  • Hindi and Hinglish: measure by detected language and script first. Options are a multilingual embedding model, rewriting the query into English before retrieval, or both merged with RRF.
  • Roman-script Hinglish has no fixed spelling and mixes English words, and many embedding models handle it badly. Query rewriting helps most. BM25 still catches the English terms inside Hinglish.
  • Replies in the wrong language: say the reply language near the end of the prompt, keep the user's original question in the prompt, and add Hinglish examples.

The red pen

Common traps: mistake → fix

  • Mistake: Tell the bot not to share HR documents

    Fix: filter by permission in the retrieval query.

  • Mistake: Re-uploading a file replaces the old answers

    Fix: old chunks stay until you delete them from every index and cache.

  • Mistake: One English embedding setup serves Hindi users

    Fix: measure by language and test Hinglish separately.

Easy to hard

Questions interviewers ask, easy to hard

  1. An intern saw salary data in the HR bot. What happened?
  2. The bot quotes last year's policy. How do you fix it?
  3. How do you handle effective dates in RAG?
  4. Retrieval misses Hinglish questions. What do you try?
  5. Hindi users get English answers. Why?

Explain it out loud

Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.

Practise by voice

Your first interview is free

Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.

Start your free interview