Skip to content
mentoor

Topic 2 of 5 · 4 min read

Splitting multi-part questions into sub-queries

Goal: Decompose a comparison or multi-hop question into sub-queries and identify which sub-answer a wrong final answer came from.

When one question needs several facts, retrieve each fact with its own query and merge the evidence, instead of hoping one search finds everything. A single query vector sits near one topic, so it pulls chunks about one half of the question and misses the other.

Check yourself · 1 of 3

Which question most clearly needs decomposition into sub-queries?

Choose one answer

Why it matters

Two shapes of question break one-shot retrieval.

  • Comparison: "How does the Basic plan's storage limit compare to Enterprise?" The best chunks live on two different pages.
  • Multi-hop: "Who manages the team that owns the billing service?" You must first find the owning team, then find that team's manager. The second query cannot be written until the first has an answer.

Research on compositional questions shows models often know each fact but fail to combine them; asking the intermediate questions explicitly narrows that gap (see the Self-Ask paper in the references).

How to do it

  1. Detect. Ask a model, with structured output, whether the question has more than one information need. Most do not, so the default is no split.
  2. Plan sub-queries. For a comparison, the sub-queries are independent and can run in parallel. For a multi-hop question they are sequential: each later query is written from earlier results.
  3. Retrieve per sub-query, keeping the chunks grouped under the sub-question that found them.
  4. Merge. Give the final model the sub-questions with their evidence, labelled, and ask it to answer only from them.
  5. Cap it. Set a maximum number of sub-queries and hops, such as three, so a vague question cannot spin.

Before and after

Weak: one query for the whole comparison.

Query: storage limit Basic versus Enterprise plan
Result: 5 chunks about Basic, 0 about Enterprise
Answer: "Enterprise offers more storage" (no number, guessed)

Fixed: two sub-queries.

{
  "sub_queries": [
    "Basic plan storage limit",
    "Enterprise plan storage limit"
  ],
  "mode": "parallel"
}

Each retrieval returns its own plan page, and the answer cites both numbers.

What goes wrong

  • Over-splitting a simple question adds latency and cost for no benefit.
  • A bad first hop poisons every later one. If the owning team is wrong, the manager is wrong, and the final answer looks well-sourced. Log each hop so you can find the failing sub-answer.
  • Merged context too large: many chunks per sub-query crowd the prompt. Keep the top few per sub-query.
  • Sub-queries lose the constraint (the region, the year) that applied to the original question. Carry shared constraints into each one.

Examples

Comparison

Question: "Is the 2025 parental leave longer than 2024?" Sub-queries: "parental leave duration 2025 policy" and "parental leave duration 2024 policy". They are independent, so both run at once.

Multi-hop with a bad first hop

Question: "Which region does the invoices service's on-call lead work in?" Hop 1 finds the owning team as Payments (wrong: invoices belongs to Billing). Hop 2 correctly finds Payments' on-call lead and region. The final answer is well cited and wrong; only the hop log shows where it broke.

Key points

  • One query vector points at one topic, so a comparison or multi-hop question retrieves only one side of what it needs.
  • Comparisons give independent sub-queries that can run in parallel; multi-hop questions give sequential ones.
  • Detect first and default to no split; most questions are single-need and splitting adds latency and cost.
  • Keep evidence grouped under the sub-question that retrieved it, so a wrong answer can be traced to one hop.
  • Cap sub-queries and hops, and carry shared constraints such as region and year into each sub-query.

Common mistakes

  • Splitting every question, which doubles latency on simple lookups.
  • Running multi-hop sub-queries in parallel, although the second needs the first answer.
  • Dropping the original constraints (year, region) from the sub-queries.
  • Not logging each sub-query and its evidence, so a wrong final answer cannot be traced.

Check yourself · 2 of 3

For "Who leads the team that owns the search service?", how should the sub-queries run?

Choose one answer

Check yourself · 3 of 3

A multi-hop answer is wrong but cites real documents. The hop log shows hop 1 returned the wrong team. What is the right fix?

Choose one answer

Practice items, not counted towards your mastery.

Start here

More for this topic