How the Cleanlab trustworthiness score works as an output rail in NeMo Guardrails
A team whose RAG assistant must answer only from retrieved evidence can attach Cleanlab's trustworthiness score to NeMo Guardrails as an output rail, so each generated answer is scored before it reaches a user. The score is a check on the answer, not on the retrieved chunks, which makes it a different control from retrieval rails and from grounding checks that compare an answer with its sources. NeMo Guardrails provides five rail types: input rails, dialog rails, retrieval rails for RAG chunks, execution rails for custom actions and tools, and output rails. Output rails sit at the end of the flow, after the application's model has produced a response, which is why they suit a score that needs the finished answer as its input.
A team would choose a third-party scoring service in this position when it wants a trustworthiness signal trained and maintained outside its own pipeline, and when it can accept that the answer text, and possibly the question and context, leave its environment for scoring. The decision turns on data handling and on who owns the threshold. Before adopting the integration, confirm in the current NeMo Guardrails documentation which Cleanlab integration is supported in your release, how it is declared in the configuration, and which action or rail name it uses. The exact integration steps and configuration keys must be confirmed there, because they change between releases and this section does not restate them.
For a regulated deployment, the practical first step is to write down what the scorer receives and what it returns, then decide whether the same signal can be produced by a self-hosted check. Ask the vendor for its data retention terms and whether the request is logged. Plan the rail's behavior for low scores, such as blocking, warning or returning a fallback response, and test each path against a set of known good and known unsupported answers before the rail goes into production.
Request flow from retrieval to the output rail decision
The flow starts with the user question passing through the retrieval rails, then the application LLM drafts an answer from the retrieved chunks. The output rail sends the draft and its context to either Cleanlab's hosted API or a self-hosted check, and the score decides whether the answer passes or is blocked. The subgraph marks where data leaves the client network when the hosted API is used, so teams can confirm which fields cross that boundary before choosing an option.
Output rail decision path with the hosted API boundary marked.
What the score measures and how the rail acts on it
A trustworthiness score from Cleanlab is a single number that an external service returns for one model response. It estimates how likely the response is to be reliable, given the question and the context it was produced from. NeMo Guardrails does not calculate this number itself. The output rail sends the response to the service, reads the returned value, and compares it with a threshold you set. The threshold turns a continuous score into a binary decision: at or above the threshold the answer passes, and below it the rail triggers its block behavior. Because the decision depends entirely on that comparison, the threshold is the setting most worth testing against your own question set before any user sees the assistant.
The rail runs after the application model has generated its answer and before that answer is returned to the user. This placement means the score judges the final text, including any content the earlier rails allowed through, and it adds a network call to the response path. Your team must decide what happens when the rail blocks. The options are a refusal message, a fallback message that points the user to a human or a known source, or a logged block with the original answer withheld. Each option needs a defined owner, a user-facing wording approved by legal or support, and a log entry that records the score, the threshold and the request identifier so that blocked answers can be reviewed later.
Confirm the score range, its interpretation and any recommended starting threshold in Cleanlab's own documentation, and confirm how the NeMo Guardrails configuration expects the threshold and the Cleanlab credentials to be declared in the version you deploy. Check the NeMo Guardrails documentation for the current output rail syntax, since configuration keys change between releases. Record the values you confirm in the design document, because the threshold will be questioned in any later review and the vendor's guidance may change.
Hosted Cleanlab API or self-hosted checks: choosing the data path
With the hosted Cleanlab API, the rail sends data from your application to a service operated by Cleanlab. The data path leaves your network, so what is sent, where it is processed and how long it is kept must be settled before the rail reaches production. Do not rely on examples in community posts for the payload.
- Data sent: Expect the user question, the retrieved chunks and the generated answer to be part of the request, since a trustworthiness score needs the answer and its context. Confirm the exact fields and whether any metadata is added.
- Processing location: Confirm the region and infrastructure where each request is handled, and whether any subprocessors are involved.
- Retention and training: Confirm whether requests are logged, how long they are kept, and whether they are used to train or improve Cleanlab models.
- Contract terms: Your data processing terms should name Cleanlab as a processor, cover the categories of personal data that may appear in prompts and chunks, and set deletion and breach notification obligations.
- Latency and availability: Each call adds a network round trip and depends on the vendor's uptime, which affects the answer path in streaming applications.
Ask Cleanlab for the payload specification, retention schedule and processing agreement in writing before you enable the rail on regulated data.
Self-hosted checks such as AlignScore, Patronus Lynx or the self-check rail run inside your infrastructure. They receive the same question, chunks and answer, but the recipient is a component you deploy and operate, so the data path is set by your architecture and your own controls.
- Data sent: Nothing leaves your network unless a component you chose makes an outbound call. The check receives the question, chunks and answer, but the destination is a model server or application you run.
- Processing location: Each component runs on hosts you select, such as a model server on your GPU nodes or an application LLM endpoint you already approved. Record each location in your data flow diagram.
- Self-check caveat: The self-check rail calls the application LLM, so its data goes to whichever model endpoint that LLM uses. If that endpoint is a hosted provider, the data path is hosted even though the rail itself is open source.
- Retention: You control logs, caches and model server request logging. Apply the same retention schedule as application logs, and confirm that each check's own logging is disabled or scoped to what you need.
- Operations: You own patching, capacity planning and model updates. These costs recur and belong in any comparison with hosted fees.
Confirm which endpoint each check calls and where its logs are written before you sign off the data flow.
In air-gapped networks, or where outbound traffic to third-party APIs is blocked, the hosted option is usually unavailable by design. The decision shifts from which vendor to trust to which checks can run entirely inside the enclave and how required models reach it through your approved change process.
- Egress controls: A hosted call needs an approved outbound path, a documented exception and matching firewall rules. Many security teams will not approve that for regulated data without a formal risk acceptance.
- Model delivery: Self-hosted checks need model weights and dependencies moved in through your transfer process, scanned and recorded with versions. Agree this process with your security team before the design is fixed.
- Evidence: Auditors will ask for the data flow, the processing agreement or the documented reason none applies, and the change history for each model. Keep those records alongside the rail configuration.
- Model capacity: A self-check still needs an application model endpoint inside the enclave, so confirm that capacity covers the extra calls each answer triggers.
- Regulatory review: Involve privacy and compliance teams early. Whether personal data may reach a third party depends on your jurisdiction and sector, so treat it as a decision for counsel and your compliance function before any technical default is set.
Ask your security and privacy teams to confirm in writing which network paths and third-party terms are acceptable before the hosted option is considered.
Configuration options for a Cleanlab output rail and when each fits
This table compares the decisions a team makes when adding a Cleanlab trustworthiness check as an output rail in NeMo Guardrails. Read each row as a choice with a condition under which it fits and a cost it creates. Confirm exact configuration key names against the NeMo Guardrails configuration reference for the version you run, since the names are not set out here.
| Decision | Options | When it fits | Trade-off it creates |
|---|---|---|---|
| Position in the output rail chain | Run the Cleanlab rail before or after other output rails such as self-check output or content safety | Place it after cheaper or policy checks so the external or heavier scorer runs only on answers that already passed | Earlier rails that block a response stop the chain, so the Cleanlab score is never recorded for those answers |
| Threshold value and owner | A single fixed cutoff set by the application team, or a cutoff agreed with risk and product owners | Use a documented cutoff tied to a test set of known good and bad answers, and reassess it after model or prompt changes | A low cutoff lets unsupported answers through, a high one blocks correct answers and pushes users to fallback responses |
| Block versus warn behavior | Block the response, or log a warning and return the answer | Block in customer-facing or regulated flows where an unsupported answer causes harm; warn during evaluation or pilots | Blocking protects users but raises refusal rates; warning keeps answers flowing but depends on someone reviewing the logs |
| Retrieved context passed to the scorer | The full retrieved chunks, a filtered subset, or only the generated answer | Pass the same chunks the generator used when the goal is to check grounding in the retrieved evidence | Passing more context raises input size and cost per call; passing less can hide support that the answer actually relied on |
| Scorer location | Cleanlab's hosted API or a self-hosted check you run in your own infrastructure | Choose the hosted API for quick evaluation where sending answers and context outside your environment is approved; choose self-hosted where data must stay in your network | The hosted option sends answer and context data to a third party; self-hosted places operating, patching and capacity work on your team |
| Score logging for audit | Log only blocked events, or log every score with the threshold, model version and chunk identifiers | Log every score where an assessor may ask how a given answer was checked, and retain logs under your own retention policy | Full logging adds storage and may capture personal data in answers or context, so it needs the same controls as other application logs |
Setting up the Cleanlab trustworthiness output rail in NeMo Guardrails
This sequence takes a team from a clean Python environment to a NeMo Guardrails configuration that scores model answers with Cleanlab before they reach users. Each step ends with a check so the platform owner can confirm the rail runs, blocks unsupported answers and leaves an audit trail.
Confirm the Python version and install
The engineer creates a clean virtual environment and confirms the interpreter is Python 3.11, 3.12 or 3.13, the versions NeMo Guardrails 0.25.0 supports. They then install the
nemoguardrailspackage pinned to 0.25.0 from PyPI. The step is complete whenpython --versionreports a supported version andpip show nemoguardrailsreports 0.25.0 under the Apache-2.0 license.Create the configuration folder
The engineer creates one folder that holds
config.yml, any optional Python actions and the Colang files. Colang 1.0 is the default, so the team uses it unless it has decided to adopt Colang 2.x. New code should use the Guardrails class, because LLMRails is deprecated in 0.25.0 and removal is planned no earlier than 0.27.0. The check is that the folder loads in Python without configuration errors.Register Cleanlab credentials outside the config
The engineer adds the Cleanlab API key through an environment variable or the team's secrets manager, not in
config.ymlor any Colang file. Confirm the exact variable name in the Cleanlab integration documentation for your NeMo Guardrails version. Keep the key out of version control and out of logs. The check is that the configuration loads and the key never appears in the folder or in startup output.Add the Cleanlab output rail and threshold
The engineer adds the Cleanlab trustworthiness check to the output rails in
config.ymland sets the score threshold explicitly, using the default and range described in the current Cleanlab documentation. Record who approved the value and why. Because the scored text is sent to Cleanlab's hosted API, also confirm that data terms match your policy. The check is that the configuration validates and a test call shows the output rail executing.Test with known good and unsupported answers
The team builds a small test set of answers that the retrieved context supports and answers that it does not, written as illustrative examples for the application's domain. The engineer runs each one through the configured rails and records the score and outcome. Good answers should pass and unsupported answers should be blocked or flagged. The check is a saved results table. If the threshold separates the two groups poorly, the team adjusts it in the previous step and reruns the set.
Run the server or Python API
The platform engineer chooses how the application calls the rails. The guardrails server loads the configuration folder and exposes an HTTP API, and a Dockerfile is provided to build a server image. The Python API suits an application that embeds the rails directly. Start the chosen option and send one good and one blocked request. The check is that the health endpoint responds and each request returns the expected passed or blocked result.
Review logs and blocked responses
The engineer turns on logging for the rails and traces one blocked request from input to output, confirming that the Cleanlab rail ran and that its score was recorded. The security or compliance lead reviews what the logs contain and confirms that prompts, answers and retrieved content are stored only as the data policy allows. Check the NeMo Guardrails documentation for current logging options. The step is complete when that trace can be reproduced and explained to a reviewer.
Security and operational risks when a third-party score sits in the answer path
A Cleanlab trustworthiness score in the output rail puts an external service between the model's answer and the user. The cards below cover the decisions a team must make before that call goes live, from key handling and data exposure to timeouts, threshold drift, logging and vendor terms.
Scoring API key handling
The rail needs a Cleanlab credential at runtime, so the key must be injected through your secrets store rather than written into config.yml or committed to a repository. Confirm who can read the key, how it rotates without a restart, and whether the key scope is limited to the scoring function. Check that the guardrails server logs never echo the environment variable or request headers.
Data exposure of questions and documents
Each call to an external scorer sends the user question, the generated answer and, for a RAG check, the retrieved documents to a third party. Map which fields leave your network, whether personal data or regulated records appear in them, and whether any field can be redacted before the call. Where the content cannot leave your boundary, the self-hosted checks become the only viable option.
Timeout and failure behavior
If the external service is slow or unreachable, the answer path waits or fails, and users see either delay or a blocked response. Decide in advance whether the rail fails open, fails closed or falls back to another check, and set the request timeout to match your latency budget. Test this with the scorer blocked at the network layer, not only with a clean error response.
Threshold drift after changes
A threshold chosen for one model or prompt can pass or block a different share of answers after an upgrade, a prompt edit or a retrieval change. Record the threshold with the configuration version, and rerun a fixed evaluation set after every change to the generator, the prompt or the scorer version. Treat a shift in blocked answers as a change that needs review before release.
Audit logging of scores and decisions
A reviewer will ask why a given answer was blocked or released, so each decision needs a record linking the question, the score, the threshold and the outcome. Decide which fields are stored, where they live, and how long they are kept, and make sure logs do not duplicate raw documents unnecessarily. Confirm that the score returned by the service is captured with the version of the scoring model in use.
Vendor data processing terms
Before sending content to Cleanlab, obtain the terms that govern retention, use of submitted data for training, sub-processors and the location of processing. Ask for these in writing and compare them against your own data classification and contracts with customers. Repeat the review whenever the vendor updates its terms or you change the API endpoint.
What to confirm before you rely on the score in production
A trustworthiness score is only useful once your team has measured it on your own documents and failure cases. Run the Cleanlab check against a labeled set drawn from your knowledge base: answers you know are supported, answers that invent a figure or a policy, and answers that cite the right source but draw the wrong conclusion. Record the scores for each group, then choose the threshold from that data rather than from a default. Keep the set after go-live so you can re-test when the model, the prompt or the retriever changes.
Confirm that the scorer receives the same context the application LLM used to write the answer. If the rail is wired to a different chunk list, a different ordering, or a truncated context, the score measures something other than the answer your users see. Trace one request end to end in a test environment and compare the context passed to the rail with the context in the generation prompt. Also confirm with Cleanlab the languages the scorer supports and the maximum input length for questions, context and answers, since long RAG contexts are a common reason for silent truncation or rejected calls.
Get the current terms, usage limits, data handling commitments and service levels from Cleanlab in writing before you commit. These were not supplied for this page, so do not assume them from marketing material or from the open-source NeMo Guardrails documentation. Agree internally who owns threshold changes, who approves a change after an incident, and who reviews the audit log of blocked and passed answers. Those decisions decide whether the score stays a reliable control or drifts into an unexplained setting.
Limits to check in your environment before rollout
The Cleanlab rail depends on several moving parts: the NeMo Guardrails version, the Python runtime, a hosted API outside your network, and the other output rails in your configuration. Each card below names one limit to confirm in your own environment before the rail reaches production traffic.
Integration version support
Confirm that the NeMo Guardrails version you run includes the Cleanlab integration and that its configuration keys match the documentation for that version. Integrations can change between releases, so a sample that works on one version may fail silently on another. Pin the version in your build and test the rail after every upgrade. Ask the Cleanlab team which API version your account uses.
- Current release
- 0.25.0
Python and library compatibility
NeMo Guardrails 0.25.0 requires Python 3.11, 3.12 or 3.13. Check that your base image, CI runners and any shared virtual environments use one of these versions, and that the Cleanlab client library installs cleanly alongside your other dependencies. Mismatched Python versions are a common cause of failed container builds for teams that copy samples from older repositories.
- Supported Python
- 3.11 to 3.13
Hosted API rate limits and latency
The Cleanlab score is computed by a hosted API, so every output rail call adds a network round trip and counts against your account limits. Ask Cleanlab for the current rate limits, request quotas and latency expectations for your region and plan. Load test with your expected peak concurrency, and decide what happens when the API is slow or unavailable, whether the answer is blocked, passed or sent for review.
Score calibration for your domain
A trustworthiness score is a general estimate and may not be calibrated for your documents, terminology or risk tolerance. A threshold that looks sensible on public content can block too many correct answers in a specialized domain, or pass unsupported ones. Build a labeled sample from your own questions and answers, measure false blocks and false passes at several thresholds, and document the chosen value with its evidence.
Interaction with other output rails
Output rails run in sequence, and a block from one rail changes what reaches the next. Confirm the order of the Cleanlab rail relative to self-check, content safety and PII masking, and check whether a masked answer is still scored against the original evidence. Test combined behavior with the same prompts you use for single rails, so you can see which rail produced each block in your logs.
Code samples and LLMRails deprecation
NeMo Guardrails 0.25.0 deprecates the LLMRails class in favor of Guardrails, with removal planned no earlier than 0.27.0. Many published samples and blog posts still construct LLMRails, so code copied into your service may break later or already emit warnings. Use the 0.25 migration guide to update initialization code before you wire in the Cleanlab rail, and add a deprecation check to your review checklist.
NeMo Guardrails docsQuestions buyers ask about Cleanlab scores in NeMo Guardrails
What does it cost to add a Cleanlab trustworthiness score to NeMo Guardrails?
The cost comes from four places: internal engineering time, the validation data you assemble, Cleanlab's fees for its service, and the infrastructure that runs your application and any self-hosted checks. NeMo Guardrails itself is licensed under Apache 2.0, so the library has no license fee. Cleanlab's pricing and terms are not published in the sources behind this page, so ask Cleanlab for a written quote covering API volume, usage tiers and any support or enterprise terms. Validation data and threshold testing are one-time work, while API fees, hosting and threshold reviews recur. A DeployOpen quote is built from a written scope, so the figure you receive will depend on which of these components you need.
How long does validating a Cleanlab threshold take?
Validation length is set by how many representative answers you must label, how many failure modes you need to cover, and how many review rounds your risk owners require. Wiring the rail into a test configuration is usually the shortest step. Choosing a threshold takes longer because you must compare scores against answers that a human has judged correct or unsupported, then check the trade-off between blocked good answers and passed bad ones. No duration is supplied for this work, so ask for a timeline tied to your dataset size and sign-off process in any proposal you receive.
What must our team provide before a Cleanlab rail can be validated?
Expect to supply the following before work starts:
- Representative RAG questions and the documents or chunks your assistant retrieves for them
- Labeled examples of acceptable and unacceptable answers, reviewed by a subject-matter owner
- Credentials and a written data-processing position for Cleanlab's API, if you use the hosted service
- Network approvals for outbound calls from the NeMo Guardrails host, or a decision to host the check yourself
- A named owner who accepts the threshold and who reviews changes to it
If any of these are missing, validation tends to stall at the threshold decision.
Can an internal team set up Cleanlab scoring without outside help?
Yes, a team with Python experience and access to a NeMo Guardrails configuration can add an output rail and run tests on its own. The harder parts are building a labeled evaluation set, documenting why the threshold was chosen, and proving that the rail behaves the same after upgrades. Teams that lack evaluation experience or that must produce evidence for an assessor often bring in a partner for those steps. DeployOpen plans, implements, tests and documents self-hosted platforms in your own infrastructure, so an engagement can cover some steps and leave others with your team. Agree on the split in writing before work starts.
Does the hosted Cleanlab API fit a regulated network, or should we self-host the check?
The hosted API sends the question, retrieved context and generated answer to Cleanlab's servers, so it must pass your data classification, vendor risk and data residency reviews before use. Where that transfer is not acceptable, the alternative is a self-hosted check that keeps the text inside your infrastructure. The NeMo Guardrails library includes self-check, fact-checking and hallucination detection rails that run in your environment, and NeMo Guardrails can run as a server image you build and operate. Confirm with Cleanlab which data it retains and whether a self-hosted option exists for your use case, and document the decision before deployment.
What changes when NeMo Guardrails or Cleanlab releases a new version?
A NeMo Guardrails upgrade can change configuration handling, Python APIs and server behavior, so pin the version you tested and retest the rail after each upgrade. The current release is 0.25.0, published on 19 November 2026, and it requires Python 3.11, 3.12 or 3.13. Version 0.25.0 also deprecates the LLMRails class in favor of Guardrails, with removal planned no earlier than 0.27.0. Cleanlab changes to its API or score behavior can shift results without a change on your side, so track its release notes, rerun your labeled test set and revisit the threshold whenever either component changes.
Does a Cleanlab score guarantee that an answer is correct?
No, a trustworthiness score is a signal that helps decide whether an answer should be returned, blocked or flagged, and it does not prove the answer is true. Its usefulness depends on the threshold you set and on how well your test set matches real traffic. Expect some good answers to be blocked and some weak answers to pass. Keep human review for high-impact responses, log the score with each decision so auditors can see how it was applied, and treat the rail as one control within a wider grounding and testing program.
How DeployOpen works on this
DeployOpen scopes Cleanlab trustworthiness scores in NeMo Guardrails as a fixed-scope piece of work agreed in writing before it starts. The work covers the output rail, the threshold decision, the data path to Cleanlab's API or a self-hosted alternative, and the evidence your team needs to review the result.
How we scope
- Written scope names the RAG application, the answer path the output rail will check, and the data categories involved.
- Scope records whether Cleanlab's hosted API, a self-hosted option or both are in play for your environment.
- Scope sets the threshold decision process, including who approves the value and how it is recorded before go-live.
How we build
- Build adds the Cleanlab trustworthiness output rail to your NeMo Guardrails configuration in a test environment you control.
- Test cases cover answers that should pass, answers that should be blocked and borderline answers near the threshold.
- Build documents every outbound data flow so your security team can review what leaves your network and why.
How we hand over
- Handover includes the configuration files, threshold rationale, data flow diagram and test results for your records.
- Runbook explains how to change the threshold, rotate API credentials and respond when the rail blocks answers.
- Knowledge transfer sessions walk your engineers through configuration, logs and the rollback path.
How we support
- Ongoing support, upgrades and continuous testing are available as a retainer after handover.
- Retainer work can include retesting the rail when NeMo Guardrails or the Cleanlab client library changes.
- Ask any partner to confirm current Cleanlab API terms, data retention and availability for your region before you sign.

