Q1
Why does fixed-size character chunking break RAG accuracy on financial PDFs, and how do layout-aware / semantic chunking and parent-document retrieval fix it?
Blind 500-character cuts slice tables, headers, and numbers mid-row, destroying context. Extracting markdown/table structures cleanly, embedding concise child chunks, and returning wider parent window sections preserves factual integrity.
Q2
Why can pure dense vector cosine similarity miss exact product SKUs, error codes (ERR_409), or person names—and how does Hybrid Search fix it?
Dense embeddings capture semantic paraphrases well but blur exact alphanumeric tokens. Combining BM25 lexical keyword matching with dense embeddings via Reciprocal Rank Fusion (RRF) captures both semantic meaning and exact identifiers.
Q3
What is 'Lost in the Middle' inside long-context LLMs—and why shouldn't you blindly stuff 50 retrieved chunks into a 128k prompt?
Attention quality degrades for facts buried in the middle of huge prompts while inflating latency and token bills. Retrieve top 20 candidates quickly, apply a Cross-Encoder reranker (Cohere / BGE-Reranker), and pass only the crisp top 4–6 chunks.
Q4
How does KV-Cache grow during autoregressive Transformer decoding—and why does PagedAttention (vLLM) boost serving throughput?
Each generated token attends to all prior Key/Value tensors; contiguous pre-allocation wastes huge GPU VRAM on variable-length prompts. PagedAttention manages KV-Cache in non-contiguous memory blocks like OS virtual memory, enabling higher concurrent batch sizes.
Q5
Why does prompting 'Return ONLY valid JSON without markdown' still break in production ~2% of the time—and what guarantees 100% schema compliance?
Prompt instructions are soft probabilities. Enforce Constrained Decoding / Structured Outputs (JSON Schema finite-state-machine token masking at logit sampling time) so illegal non-schema tokens have probability zero.
Q6
How do you defend an enterprise RAG chatbot against Indirect Prompt Injection hidden inside retrieved web pages or resumes?
Never mix untrusted retrieved documents into system instructions, constrain tool permissions strictly to the user's RBAC scope, validate outbound URLs/arguments programmatically, and require human confirmation for destructive tool actions.
Q7
When building multi-agent systems (CrewAI / LangGraph), why can naive cyclic agent loops burn thousands of tokens infinitely?
Two agents passing unresolved critiques back and forth loop forever without explicit max-step guards (recursion_limit), state termination predicates, and deterministic tool retry caps.
Q8
How do you evaluate a RAG pipeline objectively beyond 'looks good' vibes (RAGAS / LLM-as-a-Judge)?
Measure Retrieval Recall / Precision separately from Faithfulness (grounded strictly in retrieved chunks, zero hallucinated claims) and Answer Relevance against a curated golden Q&A benchmark.
Q9
When should you choose Fine-Tuning (LoRA/QLoRA) vs RAG vs Prompt Engineering?
Use Prompting for logic/formatting, RAG for dynamic/proprietary/citable knowledge that updates frequently, and LoRA Fine-Tuning when teaching specialized domain tone, strict compact behavior, or distilling smaller fast models.
Q10
Why does setting temperature = 0 still occasionally produce slightly non-deterministic outputs across API calls?
Floating-point non-associativity in GPU parallel reductions and Mixture-of-Experts (MoE) routing batch dynamics across concurrent server requests can still flip near-tied top logits slightly.