Guardrail (AI)

A guardrail is a predefined rule or filter around an AI tool that blocks or redirects unsafe or unreliable inputs and outputs, for example to human review.

Status
Published, version 1.0.0
Last reviewed
10 Nov 2026, by Dr Darrin Baines
Report a problem
Tell us if something is wrong or out of date

Concept Architecture

Guardrail (AI) in Evidence Synthesis and Economic Modelling

In AI work, a guardrail is a control, usually placed outside the model itself, that decides what happens when an input or an output falls outside agreed limits. For a health economist or HTA analyst the term covers both the safety filters that come with commercial chat tools and the plainer rules a review team writes for itself, such as treating a failed API call as an inclusion rather than an exclusion. NICE ECD20 (2026), the NICE framework on AI methods for evidence, lists guardrails with prompts and parameter settings among the configuration choices that can affect the quality and cost of large language model output. In evidence work the costly AI errors are usually quiet ones, such as a relevant trial dropped at screening, and a well-placed rule can stop them before anyone relies on the result, though it does not replace the validation and human oversight that ECD20 asks for.

How a guardrail differs from the model it guards

Dong and colleagues describe a guardrail as an algorithm that takes the inputs or outputs of a language model and decides whether, and how, to act on them so as to reduce risk. They group guardrails with post-hoc methods that treat the model as a black box, used alongside training-time methods such as reinforcement learning from human feedback.

Rebedea and colleagues, who built the NeMo Guardrails toolkit, distinguish embedded rails, built into a model during alignment and hard for users to change at run time, from programmable rails, which the developer writes, which work whatever model is underneath and which are interpretable, being written in a modelling language called Colang and applied by a run-time engine that sits as a proxy between the user and the model. They advise that programmable rails complement embedded ones and should not be used alone for safety. For an evidence team the difference matters, since a programmable rule can be documented, tested and reported, whereas the training of a commercial model is outside the team's control.

A guardrail can be a fixed rule or a model in its own right. A fixed rule might check that a response is one of a short list of allowed values, or that an extracted proportion lies between 0 and 1. A learned guardrail is a classifier, for example Llama Guard, a model that Inan and colleagues tuned to classify prompts and responses against an adjustable taxonomy of safety risks.

Where guardrails sit in an AI workflow

The position of a guardrail decides which errors it can catch. The table gives the main positions, each with an example from evidence synthesis or economic evaluation.

PositionWhat it checksExample in evidence work
InputWhat reaches the modelBlocking identifiable patient data or confidential prices before a request leaves the organisation
ScopeWhat the model may draw onRestricting a screening model to the protocol and the abstract, with external retrieval switched off
Output formatWhether the response is usableAccepting only include, exclude or unsure codes and treating anything else as unsure
Output contentWhether the response is plausibleRejecting an extracted probability above 1
Failure handlingWhat happens when the system breaksTreating a time-out or malformed response as an inclusion
EscalationWhen a person must decideSending non-English abstracts or model disagreement for human review

Guardrails in ECD20 for screening and extraction

Several controls in NICE ECD20 (2026) work as guardrails in this sense, although the framework does not attach the word to each one. They are most detailed for title and abstract screening in a systematic review, where the main risk is a relevant study wrongly excluded.

For failure handling, ECD20 asks that systems calling a model through an API be set up so that a model or API failure leads either to inclusion of the record or to human review, and never to an automatic exclusion. Its suggested scope controls include prompt-level safeguards that add caution, such as including any abstract not written in English and telling the model to use only the protocol and the record supplied, and it suggests switching off, or limiting, web search and other tools when the answer should come only from the documents given. It also advises that a cautious persona written into the prompt should be kept brief and validated, because such wording can change model performance.

ECD20 also gives an example prompt that fixes the output format, limiting the answer to a single character for include, exclude or unsure, and, for automation or semi-automation, it describes turning a model likelihood score into a decision with a pre-defined, validated threshold, while warning that in support use such scores should not set a cut-off for exclusion. For escalation, it asks developers who find poorer performance in a subgroup, such as non-randomised studies or abstracts in other languages, to set deterministic flags so that those records go to human experts.

In data extraction, ECD20 suggests that asking the model to return each answer in a fixed layout may make extraction steadier and cut errors of format. A schema that fixes the type of each field is an output-format guardrail.

Guardrails around economic models and technical documents

In its interim position for health economic evaluation, NICE ECD20 (2026) allows AI only as a support tool with a human closely in the loop, not for semi-automation or full automation. Its examples are model code drafted by AI that an analyst checks before running it, and suggested parameter values that an analyst weighs before any of them enters the model. In workflow terms this is a structural guardrail, because no AI output reaches the health economic model without a person. Plausibility rules can sit on the human side of that path, flagging for instance a transition probability outside 0 to 1, a negative unit cost or a utility value above that of full health. Such rules overlap with the technical checks used in model validation, and they catch only values that break a rule, so a wrong value that looks plausible passes.

For technical documents, ECD20 recommends limiting AI summarisation in low-complexity review tasks to documents written by the user or within the user's own organisation, rather than by third parties such as a submitting company, a scope guardrail set by policy.

ECD20 also reminds users that they remain responsible for data protection and confidentiality when they use AI, and an input filter that blocks patient-level data before it reaches an external service is one practical way to meet that duty within wider data governance.

Retrieved text creates a separate risk. Greshake and colleagues showed that instructions planted in data a model is likely to retrieve, such as a web page, can manipulate how an application built on the model behaves, a problem they called indirect prompt injection, and in 2023 they reported that effective mitigations were lacking. The finding matters for retrieval-augmented generation and any tool that reads full texts.

Worked example with a fail-safe screening rule

All numbers in this example are illustrative. A team uses a large language model through an API to screen 1,000 records for a review that will feed a cost-effectiveness model, and 50 of the records are truly relevant. The prompt asks for a single code meaning include, exclude or unsure. The API fails on 20 records, 1 of them relevant. Of the 980 records processed, the model codes 220 as include (41 relevant), 60 as unsure (6 relevant) and 700 as exclude (2 relevant). In design A the parser treats anything other than an include code as an exclusion. In design B two guardrails apply, so a failure and an unsure code both send the record to a human reviewer, who is assumed to judge correctly.

FNR=FNTP+FN\mathrm{FNR} = \frac{FN}{TP + FN}

where FNR\mathrm{FNR} is the false negative rate of the screening process, FNFN is the number of relevant records excluded, and TPTP is the number of relevant records retained.

1. Check the totals. Records sum to 20 + 220 + 60 + 700 = 1,000, and relevant records sum to 1 + 41 + 6 + 2 = 50.

2. Design A without guardrails. The relevant failure, the relevant unsure records and the wrong exclusions are all lost, so FN = 1 + 6 + 2 = 9 and TP = 41. With TP + FN = 50, the false negative rate is 9 / 50 = 0.18, so the process keeps 82% of relevant records.

3. Design B with guardrails. The relevant failure and the 6 relevant unsure records reach a person and are kept, so TP = 41 + 6 + 1 = 48 and FN = 2. With TP + FN = 50 again, the false negative rate is 2 / 50 = 0.04, so the process keeps 96% of relevant records.

4. Count the extra human work. A person screens the 220 retained records in design A and 220 + 60 + 20 = 300 records in design B. Design B adds 80 records and recovers 9 − 2 = 7 relevant records, so 80 / 7 = 11.4 records are screened by hand for each one recovered.

5. Interpretation. The two guardrails recover 7 of the 9 lost studies at modest cost, which matters if one of them is a large trial that would shift the pooled effect and the incremental cost-effectiveness ratio built on it. The 2 remaining false negatives are wrong exclusion codes that neither rule in design B can catch, so the residual risk still depends on validating the tool and, in semi-automation, on an independent human screener.

What guardrails cost and where they fail

Guardrails add cost and delay. Rebedea and colleagues report that the chained prompting in their run-time took about 3 times the latency and cost of a normal call. In their moderation test on 200 prompts, half harmful and half helpful, gpt-3.5-turbo with both input and output rails blocked close to 99% of harmful prompts, against 93% without the rails, while also blocking 2% of helpful ones, against none without the rails. A strict rule in a screening tool shows the same trade-off, passing more records to people in return for fewer lost studies.

Dong and colleagues note that the difficulty often lies in setting the requirements, since they differ by context and can conflict, and they argue for building guardrails with the discipline used for safety-critical software.

A vendor safety filter that blocks harmful topics will not catch a wrong hazard ratio, so the guardrails an HTA team needs are usually ones it writes itself. Prompt-level instructions only ask the model to comply, so a check in code after the model gives firmer enforcement. A guardrail that escalates a record helps only if the person who receives it looks independently, the concern described under Automation Bias.

Boundaries with nearby ideas

A guardrail defines when a person is called in, while Human-in-the-Loop, Human-on-the-Loop and Human-at-the-Helm describe the kind of human oversight that follows. Hallucination (AI) and AI Failure Mode name the errors that guardrails try to catch, and Prompt Engineering is where prompt-level safeguards are written. Fine-Tuning changes the weights of a model, so safety behaviour trained into the model itself is an embedded rail, while a separately tuned classifier such as Llama Guard works as an external guardrail. ECD20 does not yet cover agentic AI, and an AI agent that calls tools on its own raises the further question of which actions a guardrail should allow.

Sources

  • Dong Y, Mu R, Jin G, Qi Y, Hu J, Zhao X, Meng J, Ruan W, Huang X. Building guardrails for large language models. Proceedings of the 41st International Conference on Machine Learning. PMLR 235. 2024. https://arxiv.org/abs/2402.01822
  • Greshake K, Abdelnabi S, Mishra S, Endres C, Holz T, Fritz M. Not what you've signed up for: compromising real-world LLM-integrated applications with indirect prompt injection. arXiv 2302.12173. 2023. https://arxiv.org/abs/2302.12173
  • Inan H, Upasani K, Chi J, Rungta R, Iyer K, Mao Y, Tontchev M, Hu Q, Fuller B, Testuggine D, Khabsa M. Llama Guard: LLM-based input-output safeguard for human-AI conversations. arXiv 2312.06674. 2023. https://arxiv.org/abs/2312.06674
  • National Institute for Health and Care Excellence. AI methods for evidence framework (ECD20). Published 9 November 2026. Introduction, principles, evidence synthesis, health economic evaluation and technical documents chapters, and Appendix A. https://www.nice.org.uk/corporate/ecd20
  • Rebedea T, Dinu R, Sreedhar M, Parisien C, Cohen J. NeMo Guardrails: a toolkit for controllable and safe LLM applications with programmable rails. Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing, System Demonstrations. 2023. https://arxiv.org/abs/2310.10501

Frequently Asked Questions (6)

  • What is guardrail in AI?

    A guardrail is a predefined rule or filter around an AI tool that blocks or redirects unsafe or unreliable inputs and outputs, for example to human review.

    Source: Dong et al. 2024

  • How does NICE ECD20 apply AI guardrails to title and abstract screening for a systematic review?

    NICE ECD20 (2026) does not attach the word guardrail to each screening control, although several of its recommendations act as guardrails in that sense. Systems that call a model through an API should be set up so that a model or API failure leads to inclusion of the record or to human review, and never to automatic exclusion. Prompt-level safeguards can add caution, for example by including any abstract not written in English. Where a tool performs worse in a subgroup, such as non-randomised studies, developers should set deterministic flags that send those records to human experts.

    Source: NICE ECD20 (2026)

  • How can an AI guardrail protect a health economic model when AI helps with model building under NICE ECD20?

    In its interim position for health economic evaluation, NICE ECD20 (2026) allows AI only as a support tool with a human closely in the loop, and rules out semi-automation and full automation. Its examples are model code drafted by AI that an analyst checks before running it, and suggested parameter values that an analyst weighs before any of them enters the model. This works as a structural guardrail, because no AI output reaches the model without a person. Plausibility rules can sit on the human side of that path, flagging for instance a transition probability outside 0 to 1 or a negative unit cost, although a wrong value that looks plausible will still pass.

    Source: NICE ECD20 (2026)

  • How do embedded and programmable AI guardrails differ?

    Rebedea and colleagues, who built the NeMo Guardrails toolkit, separate embedded rails, which are built into a model during alignment and hard for users to change at run time, from programmable rails, which a developer writes and which work whatever model sits underneath. The rails are written in a modelling language called Colang and applied by a run-time engine that sits between the user and the model, so a reader can inspect what they do. The authors advise that programmable rails complement embedded ones and should not be relied on alone for safety. For an evidence team, a programmable rule can be documented and tested, whereas the training of a commercial model lies outside the team's control.

    Source: Rebedea et al. 2023

  • What are the common limits of an AI guardrail in health technology assessment work?

    A vendor safety filter that blocks harmful topics will not catch a wrong hazard ratio, so the guardrails an HTA team needs are usually rules it writes for itself. A prompt-level instruction only asks the model to comply, and a check in code after the model gives firmer enforcement. Dong and colleagues note that setting the requirements is often where the difficulty lies, because requirements differ by context and can conflict, and they argue for building guardrails with the discipline used for safety-critical software. A guardrail that escalates a record to a person helps only if that person reviews it independently.

    Source: Dong et al. 2024

  • Why does indirect prompt injection matter for an AI guardrail in an evidence review tool?

    Greshake and colleagues showed that instructions planted in data a model is likely to retrieve, such as a web page, can manipulate how an application built on the model behaves, and they called this indirect prompt injection. In 2023 they reported that effective mitigations were still lacking. The finding matters for retrieval-augmented generation and for any evidence review tool that reads full texts, since such tools take in material that no one on the review team wrote. Guardrails for these tools therefore need to treat retrieved text as untrusted input, as well as checking what the user types.

    Source: Greshake et al. 2023

Trust Record

Verified by Dr Darrin Baines

British health economist

Professional identity: darrinbaines.org

Verification date: 10 Nov 2026

Content version: 1.0.0

Canonical Identity

Term code
HS-HP-DH-086

Stable URI · Machine-readable · Resolvable · CC BY 4.0

This article is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0).

Author: Dr Darrin Baines · Publisher: Intelligent Parameters Ltd · Identifier: https://healtheconomics.wiki/concept/guardrail-ai