Grounding
Grounding is the practice of anchoring or constraining an AI system’s outputs with relevant information, context, or evidence.
Natural Language Processing in Action, Second Edition
Grounding is the process of anchoring a language model’s generated response in relevant external facts, sources, or user-specific information.
- How it is used
- Anchors chatbot responses in relevant knowledge to address factual and reasoning errors.
- How deep it goes
- Explains grounding through retrieved text and knowledge graphs, including checking generated facts against structured knowledge.
- Examples
- Illustrates unreliable generation with a math tutor that praises an incorrect sequence answer while supplying a different answer.
- What you can do after
- Evaluate and understand how retrieved knowledge or a knowledge graph can help anchor and check generated responses.
Read how Natural Language Processing in Action, Second Edition explains grounding →
Retrieval Augmented Generation, The Foundational Ideas
Grounding is conditioning a generated answer on retrieved evidence so that its claims can be checked against supporting passages.
- How it is used
- Makes generated answers more accurate and their claims checkable against retrieved passages.
- How deep it goes
- Explains passage provenance and graph-extraction offsets, then tests grounding through a compliance regression; it does not establish the two-step graph design’s effectiveness.
- Examples
- Uses a compliance-policy answer that combines clauses, plus a table tracking relevance and faithfulness before and after prompt changes.
- What you can do after
- Apply it via LangExtract source offsets or grounding instructions, then evaluate whether answer claims remain supported.
Read how Retrieval Augmented Generation, The Foundational Ideas explains grounding →
Generative AI in Action
Grounding is the technique of supplying a generative model with relevant external information as context for its response.
- How it is used
- Supplies use-case-specific external information as context for generative responses.
- How deep it goes
- Defines grounding and contrasts small system-message contexts with retrieval for larger datasets.
- Examples
- Illustrates a technical-support system message and code suggestions informed by open files.
- What you can do after
- Apply it via Azure OpenAI chat messages or semantic search to supply relevant context.
Build AI-Enhanced Web Apps
Grounding is the technique of checking generated information against a reliable external corpus to improve factual accuracy.
- How it is used
- Uses external information to verify generated responses and keep RAG answers faithful to supplied documents.
- How deep it goes
- Defines five grounding types and outlines a retrieval-to-response flow, without detailing a general evaluation procedure.
- Examples
- Uses document retrieval, academic source citations, prior product interactions, and token probabilities as examples.
- What you can do after
- Apply grounding in a RAG application to support responses with retrieved document context and assess confidence.
LLMs in Production
Grounding is the practice of supplying a language model with relevant external context so its generation is anchored to available information.
- How it is used
- Reduces hallucination by supplying relevant context for generation.
- How deep it goes
- Defines grounding, clarifies RAG terminology, and identifies multistep retrieval limits without detailing implementation.
- Examples
- Uses a Gal Gadot question to demonstrate why similarity retrieval struggles with multistep questions.
- What you can do after
- Apply grounding by adding necessary context or retrieval results before asking a model to generate an answer.
AI Agents in Action
Grounding is the assessment of how well a prompt or agent profile satisfies criteria for being constrained by relevant information or facts.
- How it is used
- Assesses whether prompt and agent-profile outputs meet task-specific rubric criteria and context.
- How deep it goes
- Defines grounding and describes rubric scoring, consistency, automated evaluation, and aggregation across runs.
- Examples
- Scores recommendations by subject, format, and genre using a five-point alignment scale.
- What you can do after
- Apply it via Prompt flow to score recommendations and compare prompt or profile variations.
AI Agents in Action, Second Edition
Grounding is the process of anchoring a model's responses in relevant external information, data, or context.
- How it is used
- Constrains agent answers to retrieved knowledge and verifies that generated claims remain supported by that context.
- How deep it goes
- Explains retrieval, prompting, citations, and guardrail handling, but stops short of model internals.
- Examples
- Uses a Back to the Future screenplay, retrieved passages, citation prompts, and an output guardrail with a static fallback.
- What you can do after
- Apply it via RAG prompts and guardrails to produce, verify, reject, or retry answers against retrieved evidence.
Read how AI Agents in Action, Second Edition explains grounding →
Building Reliable AI Systems
A technique for anchoring an AI system's outputs in external information or evidence.
- How it is used
- Reduces hallucination risk by anchoring AI responses in retrieved evidence or external data.
- How deep it goes
- Explains grounding practices and a function-call workflow, while outlining RAG retrieval without detailing its implementation.
- Examples
- Illustrates grounding with a weather API assistant and legal systems that draw on current case law.
- What you can do after
- Evaluate grounding with adversarial queries and grounding defect rates, while recognizing the need for verification and human review.
Building LLM Applications with DSPy
A method of preparing a language model with substantial information about a task so its responses and instructions reflect that task.
- How it is used
- Improves candidate-instruction relevance by giving a prompt model task code, dataset descriptions, and training examples before costly evaluation.
- How deep it goes
- Describes task inputs and summary-then-generation steps, but does not specify how the summaries are constructed.
- Examples
- Uses flight-booking intent classification and a travel dataset summary mentioning routes, times, fares, and airport information.
- What you can do after
- Apply grounding through MIPROv2 to generate task-specific candidate instructions from source code and dataset summaries.
Read how Building LLM Applications with DSPy explains grounding →
LLM Evaluation and Alignment, The Foundational Ideas
A grounding instruction directs a model to base its response on specified source information rather than unsupported knowledge.
- How it is used
- Constrains generated answers to retrieved documents, especially for claims requiring citations or source-specific attribution.
- How deep it goes
- Defines testable response clauses and diagnostic prompt interventions, but does not detail a complete grounding implementation.
- Examples
- Uses financial numerical claims, source paragraphs, named-entity attribution, hedged language, and explicit document-only prompt constraints.
- What you can do after
- Operate/configure system prompts that require citations, document-only answers, explicit gaps, faithful attribution, and calibrated confidence.
Read how LLM Evaluation and Alignment, The Foundational Ideas explains grounding →
Context Engineering
Grounding is the practice of supplying a model with evidence that supports or constrains its generated response.
- How it is used
- Uses grounding to support generated claims with external evidence rather than relying solely on parametric memory.
- How deep it goes
- Explains context selection and retrieval flow, then identifies failure points from retrieval through generation.
- Examples
- Illustrates grounding with code review comments assessed against diffs and specifications structured for machine verification.
- What you can do after
- Evaluate whether generated claims are supported by supplied context using faithfulness metrics and traces.
Build an Advanced RAG Application (From Scratch)
Grounding is the incorporation of externally retrieved factual information into a model's generated output.
- How it is used
- Grounds LLM responses in retrieved facts for accurate, current, and contextually relevant domain applications.
- How deep it goes
- Explains retrieval-guided generation conceptually but does not detail implementation steps or internal model behavior.
- Examples
- Uses hotel recommendations and academic-paper research as grounding applications.
- What you can do after
- Apply it via retrieval-augmented generation to guide LLM answers with relevant database information.
Read how Build an Advanced RAG Application (From Scratch) explains grounding →
Designing AI Systems
Grounding is the process of connecting an AI application's responses to authoritative external or organizational knowledge.
- How it is used
- Connects AI applications to organizational knowledge so responses reflect policies, products, and procedures rather than plausible guesses.
- How deep it goes
- Explains ingestion, chunking, embeddings, indexed retrieval, storage abstraction, hybrid search, and document replacement, including pgvector internals.
- Examples
- Uses policies, product documentation, support articles, technical manuals, internal wikis, PDFs, HTML articles, and patient-procedure searches.
- What you can do after
- Apply it via platform.data.ingest() and platform.data.search() to maintain indexes and retrieve ranked organizational knowledge.
Also covered in
- Effective Conversational AI
- Machine Learning Platform Engineering
- Knowledge Graphs and LLMs in Action
- AI Agents and Applications
- Transformers in Action
- Digital Twins in Action
- Data Analysis with LLMs
What to know first
- language modelA language model is a computational model that represents patterns in linguistic sequences to assign probabilities, predict, generate, or evaluate language.
- similarity searchSimilarity search is a retrieval technique that finds or ranks items by their similarity to a query, often by comparing feature or vector representations under a similarity or distance measure.
- hallucinationA hallucination is model-generated content that is false, fabricated, or unsupported by relevant evidence but presented as plausible or factual.
- fine-tuningFine-tuning is the continued training of a pretrained model on targeted data or objectives to adapt its parameters or behavior to a task, domain, or use.
Related concepts
- GEPAuses · GEPA (Genetic-Pareto) is a reflective evolutionary optimization method that generates and evaluates candidate prompts using task information and feedback.
- MIPROv2uses · MIPROv2 is a DSPy optimizer that searches for effective instructions and demonstrations for language-model programs using performance feedback and a Bayesian proposal model.
- SIMBAuses · SIMBA is a DSPy prompt optimizer that iteratively evaluates candidate prompts, reflects on execution trajectories, and adds demonstrations or rules to improve performance.
- hallucinationaddresses · A hallucination is model-generated content that is false, fabricated, or unsupported by relevant evidence but presented as plausible or factual.
- retrieval-augmented generationproduced by · Retrieval-augmented generation is a technique that retrieves relevant information from external sources and supplies it as context to a generative model when producing an output.
Questions about grounding
What is grounding?
Grounding is the practice of anchoring or constraining an AI system’s outputs with relevant information, context, or evidence.
Which Manning books explain grounding?
Natural Language Processing in Action, Second Edition, Retrieval Augmented Generation, The Foundational Ideas, Generative AI in Action, Build AI-Enhanced Web Apps, LLMs in Production, AI Agents in Action, AI Agents in Action, Second Edition, Building Reliable AI Systems and 5 more.
What should I know before learning grounding?
Manning books that teach grounding usually introduce language model, similarity search, hallucination and fine-tuning first.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.












