AI / LlamaIndex Interview Questions
How does the SubQuestionQueryEngine work?
SubQuestionQueryEngine is designed for complex questions that really require pulling information from multiple sources or multiple angles of the same source, something a single retrieval pass often can't answer well.
Given a query, it first uses an LLM to break the question into smaller sub-questions, each targeted at one of the underlying query engine tools it was configured with. For example, "Compare Q1 and Q2 revenue" might be split into "What was Q1 revenue?" and "What was Q2 revenue?", each routed to the relevant document's query engine.
Each sub-question is answered independently, and the final step synthesizes those sub-answers into one coherent response to the original question. This is especially useful for comparison or multi-document questions where a single embedding search over everything at once would blur the distinct pieces of information together.
More Related questions...