liveBook · Manning

Atomic query

As explained in Retrieval Augmented Generation, The Foundational Ideas

A sub-query is an individual query produced by dividing a larger information need into smaller retrieval or reasoning steps.

A single retrieval call can miss part of a multi-part question. An atomic query isolates one information need so it can be retrieved, answered, and checked without treating the whole request as one search. In LevelRAG, a High-Level Searcher plans these queries before retrieval; Low-Level Searchers execute them. section 11.3.1 section 11.6

Comparing compliance requirements

For “Compare enhanced due diligence requirements for domestic PEPs in the UK versus the EU under the latest 2025 guidance,” the planner asks separately for UK requirements and EU requirements. If a UK document cites FCA guidance FG25/3, it can add a third query for that identifier. The third query is planning based on retrieved evidence, not merely splitting the original sentence. section 11.3.1

The queries move through a verify-and-supplement loop:

  • Assign each query a retrieval task. The illustrated Python representation stores its text, rationale, and a sparse, dense, or web tool choice. section 11.3.3
  • Retrieve documents and answer each atomic query from its own results. Query-specific summaries keep the combined context compact while retaining facts needed for the original answer. section 11.3.1
  • Check whether the summaries together answer the original question. If not, generate queries for missing information; stop when evidence is sufficient or an iteration limit is reached. section 11.3.3
Figure 11.6 Solving the Compliance Scenario: How LevelRAG decomposes a complex query into atomic research tasks.

The compliance diagram shows how one comparison becomes distinct research tasks. section 11.3.1

Listing 11.5 The LevelRAG engine with verify-and-supplement loop.
class LevelRAGEngine:
    def __init__(self, hls: HighLevelSearcher,
                 low_level_searchers: dict, max_iter: int = 3):
        self.hls = hls
        self.searchers = low_level_searchers  #A
        self.max_iter = max_iter
 
    def execute(self, user_query: str) -> List[str]:
        summaries: List[str] = []
        pending = self.hls.decompose(user_query)
        for iteration in range(self.max_iter):
            for atomic in pending:  #B
                searcher = self.searchers.get(
                    atomic.tool, self.searchers['dense'])
                docs = searcher.retrieve(atomic.text)
                summary = self.hls.summarize(atomic, docs)
                summaries.append(
                    f"[{atomic.tool.upper()}] {atomic.rationale}\n{summary}"
                )
            verdict = self.hls.verify(user_query, summaries)  #C
            if verdict.sufficient:
                return summaries
            pending = self.hls.supplement(verdict.missing)  #D
            if not pending:
                break
        return summaries  #E
 

The engine listing shows query dispatch, per-query summarization, and the bounded verification loop. section 11.3.3

Atomic queries cost more than a single-pass search when planning and verification require several model calls. The illustrated implementation routes each query to one chosen searcher; the original LevelRAG approach runs each through all Low-Level Searchers. For simpler questions, a single-pass path or CRAG-style post-retrieval audit may be cheaper. In a composite pipeline, each atomic result can be audited independently and only a weak result sent to fallback search. section 11.3.3 section 11.4 section 11.5.3

How Retrieval Augmented Generation, The Foundational Ideas covers it

How deep it goes
Works through decomposition, routing, summarization, and bounded verification, with Python classes; notes that its single-searcher routing differs from the original design.
Examples
Uses a UK-versus-EU domestic-PEP compliance comparison and a follow-up query derived from a retrieved guidance citation.
What you can do after
Apply it via LevelRAG-style planning to route and summarize separate retrieval tasks, then issue supplemental queries when evidence is incomplete.
How it connects
Connects query decomposition to sparse search, dense search, web search, retrieval verification, and CRAG-style corrective retrieval.

Also explained in

Compare how 2 books explain atomic query →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Retrieval Augmented Generation, The Foundational Ideas. The section links point to the parts of the book it draws on.