Self-check fact-checking for RAG answers in NeMo Guardrails

Self-check fact-checking in NeMo Guardrails asks your application LLM whether each RAG answer is supported by the retrieved chunks. This page covers the chunk contract, where to enable it, the 0.5 threshold and the token budget problems with reasoning models.

On this page

Self-check fact-checking for RAG answers: what it does and when teams need it

If your assistant answers from retrieved documents, a grounding check should run before the answer reaches a user, because retrieval alone does not stop the model from adding claims the evidence never made. Self-check fact-checking in NeMo Guardrails is one way to run that check. The application's own LLM acts as the judge: it receives the generated answer together with the retrieved evidence and is asked whether the answer is supported. When the judgment fails, the output rail can block the response or the application can flag it. The check is configured in the output rails of your config.yml and depends on the fact-checking prompts shipped with the library, so teams should read the current prompts in the NeMo Guardrails documentation before adopting them.

The decision to use self-check is mostly a decision about cost and control. Every checked answer adds at least one extra LLM call, so latency and token spend grow with traffic, and the judge is the same model family that wrote the answer, which can share its blind spots. Self-check also depends on the quality of the evidence passed to it. If the retriever returns weak or off-topic chunks, the judge has little to verify against. Before choosing it, confirm with your model provider which model will act as judge, what the per-call token cost is for your typical answer length, and whether your data may be sent to that provider at all. For an illustrative assistant with long answers and several chunks per question, the extra calls may dominate response time, which is why teams usually compare it with the other grounding options.

Self-check is most useful when the assistant serves policy, clinical, financial or customer-facing answers where an unsupported claim has a real consequence, and when your team can run the LLM judge inside infrastructure you control. It is less suited to high-volume, low-stakes answers where latency is the main constraint. Plan a test set of questions with known evidence, include answers that should be blocked, and measure how often the judge disagrees with a human reviewer. These results will show whether the check is trustworthy enough for your use case and where you need a different method.

Configuration options and when each fits

This table compares the settings that control how the self-check fact-checking rail runs in a RAG assistant. Read each row as a decision: the option, when it fits, what it costs in latency and model calls, and what to confirm in the config.yml reference for the NeMo Guardrails version you install. The main takeaway is that stricter settings usually mean fewer unsupported answers but more refusals and more judge calls, so tune them against your own test questions.

OptionWhen it fitsLatency and cost trade-offConfirm in config.yml
Global output rail or selected flowsGlobal fits assistants where every answer must be grounded. Selected flows fit when only some intents return retrieved evidence.Global adds a judge call to every answer. Selected flows reduce calls but leave other paths unchecked.Where the rail is attached and whether it runs on all bot responses
Score thresholdHigher thresholds fit regulated answers where an unsupported claim is costly. Lower thresholds fit low-risk answers.Stricter settings block more answers and add false refusals. Looser settings let weakly supported claims through.Default value, score direction and the test set used to choose it
Judge modelThe application LLM fits teams with one model and no extra hosting. A separate judge fits when self-grading proves too lenient.A separate judge adds a model to host and monitor. Sharing the model adds load to the answer path.Which model performs the check and whether it can be set separately
Reasoning model token budgetNeeded when the judge is a reasoning model that spends tokens before it returns a verdict.A low budget can cut off the verdict and block answers. A high budget raises cost and delay per answer.Token limit settings and behavior when the verdict cannot be parsed
Evidence passed to the checkOnly cited chunks fit long contexts. All retrieved chunks fit when answers draw on many sources.Fewer chunks cut tokens but can drop support the answer depends on. More chunks raise cost.How retrieved chunks reach the rail and how many are included
Block or warn on failureBlocking fits customer-facing answers that must be correct. Warnings fit internal assistants under review.Blocking adds user friction and refusals. Warnings keep answers flowing but need active monitoring.Response text returned on failure and logging of flagged answers

Setting up self-check fact-checking in a RAG pipeline

This sequence adds a self-check fact-checking output rail to a RAG application so that each answer is compared with the retrieved evidence before it reaches the user. It ends with a tested configuration that blocks unsupported answers and passes supported ones, with the test results recorded for review.

  1. Install the library on a supported Python version

    An engineer installs nemoguardrails 0.25.0 from PyPI into a virtual environment running Python 3.11, 3.12 or 3.13, the same environment the RAG service will use. Use the open-source library rather than the NeMo microservice container, because NVIDIA sunset that container as of October 1, 2026 and no longer supports it. The step is done when pip shows version 0.25.0 for the package and a minimal script imports it without error.

  2. Define the application model in config.yml

    The engineer creates a configuration folder with a config.yml that names the application LLM and its provider settings. Version 0.25.0 deprecates the LLMRails class in favor of Guardrails, so new code should use Guardrails and the migration guide should be read before the first build. Self-check fact-checking makes LLM calls of its own, so the model choice affects answer quality, latency and cost. The step is done when a question sent without any rails enabled returns an answer.

  3. Wire the retriever so chunks reach the rail

    Retrieval runs in your application code, not inside the fact-check rail. The code calls the retriever, then passes the returned chunks into the request context that the rails read, so the self-check prompt has evidence to compare with the answer. Confirm the context key name for your version in the NeMo Guardrails documentation. The step is done when logs for a test question show the same chunk text that the rail receives.

  4. Add the fact-checking output rail

    The engineer enables the self-check fact-checking flow in the output rails section of config.yml and keeps the configuration and any Colang files under version control. The rail runs after generation and tests whether the answer is supported by the chunks. Set the threshold and the behavior on failure, such as blocking the answer or returning a fallback message, explicitly rather than relying on defaults. The step is done when the configuration loads with no errors and the diff matches the reviewed baseline.

  5. Test with supported and unsupported answers

    The team builds a small set of questions with known source chunks. Some answers are stated in the evidence, and others add claims the evidence does not contain or contradict it. Each question runs through the full pipeline. Supported answers should pass, and unsupported answers should be blocked or flagged. The step is done when a blocked-answer test fails the build if an unsupported answer gets through.

  6. Review rail logs and tune before release

    The team reviews the rail decisions for the test set and for a sample of staging traffic. They look for false blocks on correct answers and for unsupported claims that passed. Based on the findings, they adjust the threshold, the prompt or the chunk formatting, then rerun the full test set. Confirm that logging captures rail decisions without storing content beyond your data handling policy. The step is done when the results are recorded and a named reviewer signs off.

Where the fact-check sits in the RAG request flow

The request starts with the user question, which passes the input rails before any retrieval happens. The retriever returns chunks, and the generator drafts an answer. The self-check fact-checking output rail then sends the draft and the retrieved chunks to the application LLM, which judges whether the answer is supported. Check two hand-offs closely: which chunks the rail receives, and whether the decision returns to the user as an allow or a block.

Self-check runs as an output rail, judged by the application LLM against retrieved chunks.

Enabling the check only where it matters

Self-check adds an extra LLM call to every answer it covers, so the scope of the rail is a cost and latency decision as much as a safety one. The cards below describe the answer types that usually justify the check, and the ones that rarely do. Your risk assessment and your own test results should set the final scope, not an assumption.

Factual claims from internal documents

Answers that state policy terms, product limits, pricing rules or procedures drawn from retrieved chunks are the core case for self-check. The check asks the application LLM whether each claim is supported by the evidence passed to it. Test it with questions whose answers are known to be absent from your corpus, and confirm that the rail blocks or flags them.

NeMo Guardrails docs

High-risk domains

Answers that drive a customer decision, a payment, a clinical or legal step, or a regulatory statement carry more harm from a wrong fact than a general FAQ. Your risk assessment should name these topics explicitly and map them to the flows where the check runs. Confirm with the business owner which topics count as high risk before you configure the rail.

Answers without retrieved evidence

When retrieval returns no relevant chunks, there is no evidence for self-check to compare against, so the check cannot confirm grounding. These turns usually need a different path, such as a refusal, a fallback message or the hallucination check described in a sibling topic. Decide the behavior for empty retrieval and test it explicitly.

Conversational turns with low value

Greetings, clarifications, thanks and requests to repeat or reformat an earlier answer add an extra LLM call without adding factual risk. Routing these turns around the rail reduces latency and token spend. Verify the routing with a sample of real conversation logs, since a turn that looks conversational can still carry a factual claim.

Scope set by testing

The right scope comes from a written risk assessment and from measured results, not from a default. Run a representative question set with the check on and off, record which answers were blocked or changed, and review false positives with the content owners. Repeat the test after each change to the corpus, the prompts or the model.

Why the 0.5 threshold and reasoning model budgets can block good answers

The 0.5 threshold is a starting point, not a tuned value. Self-check fact-checking turns the application LLM's judgment about whether an answer is supported by the retrieved chunks into a score, and the rail blocks or flags answers that fall below the configured cutoff. Whether 0.5 suits your assistant depends on your own answers, your documents and how much unsupported text your users can tolerate. Build a labeled set from real questions and retrieved context, include answers that are correct but paraphrased, and record the score each one receives before you accept any threshold. Raising the threshold blocks more answers, which increases false blocks on correct but loosely worded responses. Lowering it lets more unsupported claims through, which increases missed errors. Treat each change as a trade-off to measure, and confirm where the threshold is set in your installed version's configuration.

Reasoning models add a second failure mode. Many of them spend part of their output budget on hidden reasoning tokens before writing a verdict. If the judge call's token limit is reached during that reasoning, the response can arrive empty or truncated, with no usable score. Your application may then treat the missing verdict as unsupported and block an answer that the evidence actually supports. Check how the installed NeMo Guardrails version handles empty, malformed or truncated judge output, including whether it raises an error, returns a default score or passes the answer through, and make sure your application's handling of that outcome matches your policy. Then set the judge's output budget with reasoning tokens in mind, and log the raw judge output on blocked answers so the team can tell a weak answer from a starved judge.

Security and operational considerations

Self-check fact-checking adds an LLM call to every answer it inspects, and that call sends retrieved content and user text to a model. The cards below cover where that data goes, how attackers can influence the judge, what gets logged, what the check costs in latency, and how to keep it working after changes.

Data follows the application LLM endpoint

The answer, the retrieved chunks and the user question are all sent to the application LLM for the fact-check. Data handling is therefore set by that model's endpoint, not by NeMo Guardrails itself. Confirm whether the endpoint is self-hosted, hosted by a vendor under contract, or in a region your policies allow, and confirm the retention and training terms for that endpoint before you enable the rail on sensitive content.

NeMo Guardrails docs

Retrieved content can steer the judge

The judge prompt contains retrieved chunks, and those chunks may hold text written by someone other than your team, such as uploaded documents or web pages. Instructions hidden in a chunk can try to make the judge approve an unsupported answer. Test this with planted injection strings in your knowledge base, and keep the judge prompt structured so evidence is clearly marked as data to compare, not instructions to follow.

Blocked answers may hold sensitive text

When the rail blocks an answer, the logs and traces may capture the question, the chunks and the rejected answer together. Those fields often contain personal data or confidential source material from the knowledge base. Decide which fields are logged, set a retention period in your logging stack, and restrict who can read blocked-answer records before the rail goes live.

Latency and cost grow per checked answer

Each checked answer adds one more model call, so response time and token spend increase in proportion to the number of answers the rail inspects. Scope the check to the answer types that need it, and measure p95 latency and token use with realistic traffic. Ask your model provider or platform team for the expected cost per call at your context size, since chunk count drives the judge prompt length.

Regression tests after each change

A change to the application model, the judge prompt, the threshold or the retrieval settings can shift how often answers are blocked, and the shift is easy to miss in production. Keep a fixed set of grounded and ungrounded question and answer pairs, run them after every change, and record the block and pass rates. Treat any unexpected change in those rates as a release blocker until someone has reviewed it.

Questions teams ask before enabling self-check fact-checking

What drives the cost of running self-check fact-checking on RAG answers?

The main cost is extra LLM calls. Self-check fact-checking sends each candidate answer, together with its retrieved evidence, to the application LLM for a verdict, so every checked answer adds a call on top of generation. Those calls recur with traffic, and a reasoning model adds more tokens per check. Engineering time is one-time: designing the chunk contract, writing the rail configuration and building a labeled answer set for testing. Ask any partner to split its quote into build effort and the recurring cost of model calls in your environment, and to state which model the check uses and how often it runs. Enabling the check only on the answer types where errors matter is the most direct way to keep the recurring cost in proportion.

How long does a first working self-check setup take?

The duration depends mostly on how clean your retrieval output already is and how many answer types need checking. A team with a stable retriever that already returns discrete, identifiable chunks will move faster than one whose pipeline mixes raw documents, summaries and metadata. The main work items are defining the chunk contract, wiring the retrieved evidence into the rails, setting the threshold, and testing against a labeled answer set that shows where the check passes correct answers and where it blocks them. No duration is given here because none is supplied for this topic. Ask for a written timeline that names the scope, the number of answer types and the test set size, and confirm it against your own pipeline before work starts.

What does the team need to provide before setup starts?

Three inputs shape the work. First, a sample of real questions and the answers your assistant produces, ideally with reviewers' labels on which answers are supported by their evidence. Second, a risk scope: which answer types, customer segments or topics must be checked, and what happens when a check fails (block, warn or fall back). Third, model access: credentials and capacity for the application LLM that will act as the judge, with confirmed rate limits and data handling terms. Teams should also be ready to share the retriever's output format and to confirm that the LLM endpoint is approved for the data in the retrieved chunks.

Can an internal team set up self-check fact-checking alone?

Yes, if the team has Python engineers who can run NeMo Guardrails and someone who owns the retrieval pipeline and the labeled test set. The library is open source under Apache 2.0 and runs with Python 3.11, 3.12 or 3.13, so the build itself does not need a license purchase. The harder parts are judgment calls: which chunk boundaries count as evidence, where the threshold should sit for your risk tolerance, and how to read false blocks. A partner can help with these decisions and with independent testing, but a team that keeps the chunk contract and test set in-house will be able to maintain the setup afterward. Confirm whether your internal team has the Colang and retrieval experience needed before deciding.

How does self-check fact-checking differ from AlignScore, Lynx and Cleanlab?

Self-check uses the application LLM itself to judge whether an answer is supported by the retrieved chunks, so it needs no separate model service. AlignScore runs a dedicated factual consistency model that you host on your own infrastructure, which usually trades extra hosting for different latency and cost characteristics. Patronus Lynx is an open model you self-host, typically on vLLM, for RAG hallucination detection, and it brings GPU sizing decisions. Cleanlab provides a trustworthiness score as an output rail, and its API sends data outside your environment unless you change the setup. The right choice depends on latency, hosting, accuracy and where data may flow. See the sibling topic comparing fact-checking methods before selecting one.

What should I check before the check goes into production?

Test it against a labeled answer set that includes both correct and incorrect answers, and measure how often it blocks answers that are supported by evidence. Confirm the chunk contract is applied consistently, so the check receives the same evidence the answer was generated from. Review how the rail behaves when retrieval returns nothing or when the judge model times out, because those cases often fail silently. Log each check's verdict and the chunks it used so reviewers can trace a blocked answer. Confirm the threshold with the people who own the risk, and repeat the test whenever the model, prompt or retriever changes.

Does self-check fact-checking satisfy a compliance requirement on its own?

No. A fact-check rail is one control within a wider set of evidence, and it does not by itself meet any framework's requirement. It can support your evidence by showing that answers were checked against retrieved sources, that the threshold was set and reviewed, and that blocked answers were logged. Independent auditors and certification bodies decide whether your controls are adequate. DeployOpen prepares systems, controls and evidence for compliance assessments but does not issue audit reports or certifications. Ask your compliance team which evidence they need before you define the logs and test records.

Official NeMo Guardrails sources for this check

Before you copy any configuration key, prompt name or action signature from this page, read the NeMo Guardrails documentation for the exact release you have installed. The self-check fact-checking rail depends on how the library names its built-in prompts, how it reads the retrieved evidence passed into the rails, and which settings it exposes for the application LLM. These details change between releases, so a value that worked in one version can silently do nothing in another. Record the version you pinned in your environment, then check each setting against the documentation for that version.

The GitHub repository is the second place to confirm behavior. Its README covers the supported Python versions, the Python API and guardrails server, and the list of built-in checks, while its releases page shows what changed in each version. Read the release notes for every version between your current pin and your target before an upgrade, because deprecations, such as the planned removal of the LLMRails class in favor of Guardrails, affect how your RAG wrapper is written. If the configuration you are reviewing came from a Colang 1.0 project, use NVIDIA's migration guide and the nemoguardrails convert tool, then review the converted files by hand, since NVIDIA states that converted configurations still need manual review.

If you run NeMo Guardrails through the NVIDIA microservice rather than the open-source library, treat the documentation for that deployment as a separate source. NVIDIA has sunset the NeMo Guardrails microservice, so confirm with your NVIDIA account team which product line your organization should plan around before you invest in configuration work. Keep a short internal record of the sources you used, the release you tested and the date you checked them, so that the people who review the fact-checking configuration later can see which documentation the settings were taken from.

How DeployOpen works on this

DeployOpen plans, builds and hands over self-check fact-checking for RAG answers in NeMo Guardrails inside infrastructure you control. The work starts with a written scope that names the retrieval path, the rails and the evidence your reviewers need, then moves through configuration, testing and documentation.

How we scope

  • Map which RAG answers need self-check and which can skip it, based on your risk classes and retrieval paths
  • Confirm which chunks reach the check and how the evidence contract is passed from your retriever
  • Agree the threshold, blocking or warning behavior and model budget in writing before build starts

How we build

  • Configure the self-check fact-checking rail in config.yml with Colang flows for your answer types
  • Wire the application LLM and retrieved chunks into the check and test the evidence contract end to end
  • Test threshold behavior with grounded, partly grounded and ungrounded answers, and measure added latency

How we hand over

  • Deliver configuration files, actions, container or server setup and runbooks in your own repositories
  • Document the evidence each check logs, how blocked answers are reviewed and how to tune the threshold
  • Walk your engineers and reviewers through the test results and the open risks in the written scope

How we support

  • Plan upgrades against the NeMo Guardrails release notes, including Colang and LLMRails changes
  • Offer ongoing support, upgrades and continuous testing as a retainer after the fixed-scope delivery
  • Confirm with your team how model hosting, versions and access controls will be reviewed over time

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.