← All AI Engineer talks

AI Engineer Summit 2023

Trust, but Verify

Shreya Rajpal· Founder, Guardrails AI19:41

Read the talk

Trust, but Verify: Put a Validation Boundary Around LLM Outputs

A prototype can look reliable until someone else uses it. Application-specific checks and corrective retries give model outputs a clearer path into dependable software.

From a talk by Shreya Rajpal

Before you start: Familiarity with model API calls and retrieval-augmented generation will help; the Python example uses callable functions and a bounded retry loop.

The prototype works—until someone else tries it

Why does an AI application work for its builder, then fail when someone else tests it? That is the practical problem behind Shreya Rajpal’s trust-but-verify approach. Introducing herself as co-founder and CEO of Guardrails AI, Rajpal brings experience leading machine learning infrastructure at Predibase, working across self-driving systems, and researching classical AI and deep learning.

The excitement is easy to understand: AutoGPT expanded expectations for autonomous applications, while new tools appeared in mental health, sales, and software engineering. Rajpal’s search-interest graph shows a peak around ChatGPT’s release. But rapid adoption does not necessarily produce lasting use. Drawing on Sequoia’s Generative AI’s Act Two, she contrasts fast adoption with weaker month-one mobile-app retention among AI-first applications than traditional incumbents.

Slide pairing a Path to 100 Million Users chart with one-month retention bars grouped into incumbents and AI-first companies.
“The reality”: adoption speed and one-month retention for consumer applications.

The engineering symptom is a gap between a convincing prototype and reliable behavior outside the developer’s own tests. Rajpal attributes that gap to the nondeterministic behavior of machine learning systems: a successful response during development does not establish a dependable contract for future responses.

0:150:35
Suggest correction

This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.

0:15 · section reference included

Variable outputs become compounding errors

Consider a database query asking how much a particular user spent last month. With the same underlying data and a correctly specified query, the answer represents the stored records. This is a question of correctness relative to the data, separate from uptime or availability. That predictable relationship lets one software component consume another component’s output.

A model API offers a different relationship. Repeating the same question can produce different responses, and downstream components may depend on whichever response arrives. Once those outputs feed further decisions, errors can compound. The failures include hallucinated content, incorrect structure, and vulnerability to prompt injection. In the prompt-centered development approach Rajpal describes, developers try to control these behaviors through English instructions, without an independent enforcement mechanism.

Human-facing interfaces can absorb some of this uncertainty. A developer can ignore a bad GitHub Copilot suggestion; a ChatGPT user can explain what is wrong and ask again. Applications where correctness is critical cannot always depend on that human repair loop. The goal is to retain a model’s flexibility while adding explicit checks before its output becomes an application decision.

2:503:00
Suggest correction

This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.

2:50 · section reference included

Insert verification before consumption

Rajpal introduces a proposal she attributes to Alex Graveley: check a generation against constraints, then, on a violation, return both the generated content and the broken rule to the model and ask it to regenerate. Guardrails provides an open-source framework around this pattern. Instead of sending a model’s raw response straight back to the application, route it through a verification suite.

The suite reflects the application’s risks. A healthcare chatbot and a code generator need different checks, even if both call the same model.

  • Sensitive information: detect personally identifiable information or protected health information.
  • Language and commercial policy: check profanity and competitor references. Rajpal’s example is a McDonald’s chatbot that should not recommend Burger King as the best burger in town.
  • Executable code: check whether generated code works within the target environment.
  • Source grounding: check whether a summary or free-form response is supported by the material the application treats as authoritative.

These are independent constraints, assembled into a suite appropriate to the product.

Release an output only after the required checks pass. If a check fails, feedback can help the model correct itself: identify what went wrong, request another response, and validate again. That correction is a possibility, not an assurance. Each retry also consumes latency, tokens, and money, so the application needs a budget for the loop.

Side-by-side standard and Guardrails flows show prompt, LLM API, and raw output; Guardrails adds verification checks, a pass exit, and a failed-validation path back to reconstruct the prompt.
Guardrails adds verification and a failed-validation loop around LLM output.
5:506:03
Suggest correction

This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.

5:50 · section reference included

Separate the check from the failure policy

A guard packages the requirements around a model call. In the talk’s API, guards can be constructed from XML-style RAIL specifications, Pydantic models with structure and validation criteria, or string-based definitions. Prompt and model information can also be supplied during initialization. At runtime, the guard surrounds the LLM callable and validates material entering or leaving it. These are the historical interfaces discussed in the recording; current package examples use a different API surface.

When an output is invalid, the next step depends on the failed constraint and its configured policy.

PolicyResponse to failure
Re-askRequest a corrected generation
FilterRemove offending content
FixApply a programmatic correction
FallbackUse another system
RefrainDecline to answer
No-opRecord the failure without corrective action

Validation and enforcement are separate decisions. A no-op can preserve the check result and failure reason while allowing execution to continue. It therefore does not implement the strict release gate described above. An application that requires rejection must configure failure handling accordingly.

The framework handles more than calling individual validators. It supports custom checks, supplies a catalog of common validators, and orchestrates verification to manage its latency cost. It also compiles validation requirements into the prompt, communicating the desired constraints before generation while retaining the checks afterward.

9:109:21
Suggest correction

This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.

9:10 · section reference included

Context is not a compliance check

Why not use a better prompt or a fine-tuned model? Prompt engineering can communicate requirements, and retrieval-augmented generation, or RAG, can inject relevant context. Neither operation checks that the resulting response actually follows the instructions or uses the supplied material. Providing evidence and verifying adherence are different operations.

Rajpal reports that five runs of the same LLM-evaluator experiment, with no parameter changes and temperature zero, produced different benchmark numbers. She does not identify the model, benchmark, or magnitude of variation. The observation reinforces the need to examine actual outputs rather than treating a fixed prompt and sampling configuration as a guarantee of compliance.

11:4311:53
Suggest correction

This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.

11:43 · section reference included

Training and model updates add operational work

Controlling behavior through model training introduces another set of costs. Rajpal connects this to her earlier work simplifying machine learning infrastructure: assembling a dataset, experimenting with hyperparameters, training, and serving remain substantial work even with better tooling.

A commercial model API shifts those responsibilities to a provider, but it can also limit the application developer’s control over model-version changes. Rajpal describes prompts that had worked previously losing effectiveness after an underlying model changed. Requirements encoded only in prompts are consequently exposed to changes in how a model interprets them.

12:4813:01
Suggest correction

This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.

12:48 · section reference included

Choose a checker that fits the constraint

There is no single implementation that makes every guardrail reliable. When possible, ground the check in an external system. For generated code, that can mean a runtime containing application-specific data. In text-to-SQL, a sandbox with the database and schema can supply concrete feedback for a corrective retry. Rajpal reports that coupling this SQL sandbox with re-asking substantially improved query correctness, without supplying a numerical result. A runtime check provides evidence about the query’s behavior; successful execution alone does not establish that it answers the intended business question.

Other constraints call for smaller mechanisms:

  • Rules-based heuristics: for interest-rate extraction from a document whose rates use percentage signs, check for that expected notation. The rule is useful because it encodes a property of the source format.
  • Traditional machine learning: use a targeted model for a narrow classification problem.
  • High-precision deep learning classifiers: check for categories such as toxicity, harmful advice, or misleading content. Rajpal favors smaller classifiers where suitable instead of invoking an LLM for every constraint.
  • LLM self-reflection: ask a model to assess an output when the task calls for that form of judgment.

The choice follows the evidence needed to evaluate the constraint, rather than defaulting to the largest available model.

Guardrails branches to grounding via external systems, rules-based heuristics, traditional ML methods, high precision DL classifiers, and LLM self reflection.
Five approaches to implementing guardrails.
13:4914:03
Suggest correction

This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.

13:49 · section reference included

Define correctness for a help-center chatbot

The concrete application is a chatbot answering questions over an organization’s help-center articles. Its requirements combine factual support with product policy: responses should not hallucinate, swear at customers, or mention competitors. A single general judgment of whether an answer is good would obscure these separate failure modes.

Provenance asks where a generated claim came from. After retrieving help-center context, the application should be able to trace the response back to supporting material within that context. This checks support against the supplied sources; it does not establish universal truth or repair an incorrect source article.

Rajpal names embedding similarity, natural-language-inference classifiers, and LLM self-reflection as techniques used for provenance checks. Embedding similarity looks for related source material, while inference and model-based judgments can assess the relationship between that material and the generated response. The guard configuration selects provenance, profanity, and competitor-reference validators, then wraps the LLM call with the resulting guard.

15:4816:09
Suggest correction

This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.

15:48 · section reference included

Repair an unsupported password-change answer

A customer asks how to change their password. The RAG application constructs a prompt using retrieved material, but the model invents the location of the password setting. The answer may sound plausible while still failing to describe the actual application.

The correction proceeds through a specific sequence:

  1. The provenance check identifies the unsupported portion of the answer.
  2. Guardrails constructs a re-ask prompt containing the failed response, the relevant context, and an explanation of the unsupported content.
  3. The model generates a revised response.
  4. The verification suite checks that response again before the application releases it.

In Rajpal’s toy example, the revised answer passes verification. The key transition is from an unchecked candidate to a checked response, with corrective generation between them—not an assumption that a second answer must be right.

The following Python function expresses that control flow for the same password question. The caller supplies the retrieved help-center context, a model callable, and a verifier that returns concrete violation messages. It keeps a failed candidate out of the return path and stops when its retry budget is exhausted.

python

from collections.abc import Callable


def answer_password_question(
    context: str,
    generate: Callable[[str], str],
    verify: Callable[[str, str], list[str]],
    max_reasks: int = 1,
) -> str:
    if max_reasks < 0:
        raise ValueError("max_reasks must be nonnegative")

    question = "How do I change my password on your application?"
    base_prompt = (
        f"Help-center context:\n{context}\n\n"
        f"Question: {question}\n"
        "Answer using the context. Do not use profanity "
        "or mention competitors."
    )
    prompt = base_prompt

    for attempt in range(max_reasks + 1):
        candidate = generate(prompt)
        violations = verify(candidate, context)
        if not violations:
            return candidate

        if attempt < max_reasks:
            feedback = "\n".join(f"- {item}" for item in violations)
            prompt = (
                f"{base_prompt}\n\n"
                f"Previous response:\n{candidate}\n\n"
                f"Failed checks:\n{feedback}\n\n"
                "Correct the response to satisfy these checks."
            )

    raise ValueError("No response passed verification")

The verifier remains the consequential component: the loop can enforce its decisions, but it cannot make an inadequate provenance check more accurate.

17:4617:58
Suggest correction

This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.

17:46 · section reference included

Make application policy executable

The same pattern extends beyond help-center grounding. Validators can enforce restrictions on financial or healthcare advice, check generated code, detect requests for private information, and address competitor mentions, profanity, or prompt injection. Each requirement needs an appropriate check and a deliberate response to failure.

Guardrails packages four responsibilities around those requirements: custom validation, orchestration of verification and re-prompting, a catalog of reusable validators, and compilation of requirements into prompts. That division lets the application communicate what it wants before generation and decide what it will accept afterward.

Summary slide with four green checkmarks listing custom validators, prompting to verification to re-prompting, commonly used validators, and a specification language for communicating requirements to an LLM.
Guardrails’ recap: custom validators, verification orchestration, a validator library, and a specification language.

For implementation, Rajpal points to the repository under its historical name, ShreyaR/guardrails, which now redirects to guardrails-ai/guardrails, and to the project website and documentation. The practical work begins with specifying the conditions under which an output is acceptable—and what the application should do when those conditions fail.

18:4419:02
Suggest correction

This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.

18:44 · section reference included

Resources

From the talk

Updates since the talk

Read the complete timestamped transcript
  1. 0:00

    [on-hold music] Hey, everyone.

  2. 0:15

    Thank you for coming. I am Shreya Rajpal. I am the, uh-- I'm one of the co-founders and the CEO of Guardrails AI. Uh, and today, we are going to be talking about trust but verify, which is a new programming paradigms that we need as we're entering GenAI native, uh, application development.

  3. 0:35

    Uh, before we get started, a little bit about me. Uh, uh, as I mentioned, I'm currently, uh, [REDACTED:username] Guardrails AI. In the past, I've spent about a decade or so working in machine learning.

  4. 0:45

    Uh, previously, I was the machine learning infrastructure lead [REDACTED:username] Predibase, which is, uh, an infrastructure, uh, machine learning infrastructure company. I spent, uh, a number of years in the self-driving car space working across the stack of self-driving.

  5. 0:58

    Uh, and before that, did research in classical AI and deep learning.

  6. 1:05

    Awesome. So we're seeing this massive explosion o-- in, uh, AI applications over the last year. Uh, there's a lot of excitement and, you know, that is also why so many of you guys are here attending this.

  7. 1:16

    Um, we have folks from AutoGPT, uh, which, you know, really took the world by storm and opened up the possibility and all of our minds with, like, what AI can do.

  8. 1:26

    Uh, we've seen, like, a lot of really awesome applications in mental illness, uh, sales, uh, even like software engineering.

  9. 1:34

    Uh, this is a relevant graph. This is basically search interest for artificial intelligence over time. Uh, and you can really see that peak, uh around where, uh, ChatGPT came out.

  10. 1:48

    Uh, but if you think about, like, where a lot of the reality is or a lot of where the value lies today, uh, even though generative AI applications have seen fastest adoption compared to a lot of these other consumer applications, uh, their retention right now tends to be lower.

  11. 2:05

    Um, so these, these are some graphs I, you know, uh, borrowed from this really fantastic article by Sequoia. And you can really see that retention for AI first companies versus the one-month retention, you know, for, uh, for non-AI first traditional software companies.

  12. 2:22

    So why is this the case? Um, a common symptom, uh, that a lot of people experience as they're working with generative AI applications is, uh, my app worked while prototyping, but it failed, you know, the moment I tried shipping it out or even the moment like someone else tried te-testing this.

  13. 2:39

    It just behaved very unreliably. Um, but the root cause of this symptom is that machine learning is fundamentally non-deterministic.

  14. 2:50

    Um, for those of you, um, you know, we're gonna, like, dig deeper into what that really means. So I'm guessing that a lot of you here have worked with traditional software systems before.

  15. 3:00

    So if you think about, like, a database and querying a database, uh, to get a question about how much was, you know, the spend of X user over the last month.

  16. 3:10

    Every single time you hit that database API, you are going to get what is the correct response, right? And correct really means like representative of whatever your true data actually is.

  17. 3:23

    So this is completely irrespective of like uptime, um, you know, um, uh, and availability, et cetera.

  18. 3:30

    This fundamental property allows you to really build these, like, really complex software systems which, like, power our world today. Um, but if you think about, like, machine learning model APIs, this is not really the case.

  19. 3:44

    Because of, you know, fundamental like, um, stochasticity that is, like, part of machine learning systems. Um, for a lot of you that have worked with generative AI systems and LLMs in the past, you'll see that even if you ask the same question across, like, multiple times in a row, you're going to end up seeing, like, different responses.

  20. 4:04

    And the-- because of this, being able to build these, like, really complex systems, uh, that talk to each other, that rely on previous outputs, et cetera, becomes harder because you have this issue of, you know, like, compounding errors that really kind of explodes.

  21. 4:22

    Um, this is just, you know, like, diving deeper into the problem a little bit. A lot of, like, common issues, uh, as you work with these problems. Hallucinations, that's a very buzzwordy, uh, thing that a lot of us here are familiar with.

  22. 4:33

    But there's a lot of other issues like correct structure, uh, you know, their vulnerability to prompt injections. Um, and all of this is exacerbated by the fact that unlike all other previous generations of programming, the only tool that is really available to you is English, right?

  23. 4:51

    It's just the prompt that you can really work with.

  24. 4:55

    So, um, we end up in this scenario right now and in the current, like, time that we're in, where use of LLMs is limited wherever correctness is really critical, right?

  25. 5:07

    Um, I love GitHub Copilot. It's on my badge as my favorite tool. Uh, but if GitHub Copilot is wrong, you just kind of like ignore it and move on.

  26. 5:16

    Uh, same as like ChatGPT. The chat interface is really, really great because it's iterative and you can give it feedback and, you know. Uh, if it's incorrect, you can tell it, like, why it's incorrect, and it can, you know, maybe give you something that's more, uh-- that's more appropriate.

  27. 5:29

    Um, but this is not the use case for a lot of, like, really high value critical applications. And so how do we add correctness guarantees to LLMs, uh, while still retaining their, like, flexible nature, uh, you know, that really, uh, uh, allows them to adapt so well to so many tasks?

  28. 5:50

    Um, so I'm gonna add this, like, quick quote here by Alex Gravely, who is, uh, the creator of GitHub Copilot. It's a very simple idea, which is that, uh, "Add a constraint checker to check for valid generation.

  29. 6:03

    Um, on in-- on violation, inject what was generate-- what was generated and the rule violation and regenerate." Um, so once again, we're trying to think about, like, how programming paradigms change as we are working with this fundamentally non-deterministic technology.

  30. 6:17

    So this is something that, you know, wasn't, uh, needed for the longest time because we were working with, like, deterministic systems, but becomes very relevant now

  31. 6:26

    Um, so interestingly, this tweet was actually pretty recent. Uh, but Guardrails AI, the open source framework that implements this and kind of like f- builds a framework around this strategy has existed, um, for a little while longer, uh, from the beginning of this month-- uh, from the beginning of this year.

  32. 6:44

    Um, so Guardrails acts as a safety firewall around your LLMs, and this kind of fundamentally introduces, uh, a novel paradigm that once again wasn't as necessary in the previous generations of software development.

  33. 6:59

    So this is what a lot of the software development like architectures for applications that you might build, you know, uh, may look like wherein you have like some application, and then in that application, you have a prompt that gets sent to an LLM, and then you end up getting like some output or some response back.

  34. 7:17

    Um, this is the new paradigm that we propose, um, and that Guardrails kind of like, uh, implements as a framework wherein every output that you get back passes through a verification suite.

  35. 7:30

    And that verification suite looks [REDACTED:username] all of the functional areas of, uh, you know, inconsistencies or risks that you are really sensitive to as an application builder, which may be very, very different from, you know, um, if you're building a code generation application whereas if you're building like a healthcare chatbot, right?

  36. 7:48

    Uh, so maybe like containing PII or PHI, like sensitive information might be something you wanna check against or profanity, uh, filtering that out. If you're building a commercial application, you might really care about the fact that there's no mention of any competitors.

  37. 8:03

    Like if you're, uh, building a McDonald's chatbot, like nobody should be able to get your chatbot to say that Burger King's the best burger in town. Um, making sure that any code that you generate is executable within your environment, uh, as well as, you know, summarization or free-form text generation is true and grounded in the source that

  38. 8:22

    you know to be, you know, correct and not just hallucinated from the model. So each of these ends up being an independent check that runs as part of this like comprehensive verification suite that allows you to build trust in the models and the, uh, ML applications that you're building.

  39. 8:39

    Uh, so the paradigm that we propose is that only use, um, large language model outputs if your verification suite passes. On failure, you can really hook into this very powerful, uh, capability that LLMs unleash, which is, you know, their ability to like self-heal.

  40. 8:56

    Uh, which is that if you tell them why they're wrong, they can often correct themselves, and you can kind of go through this loop again if you have the, you know, latency budget or the-- even the dollar budget or the token budget to implement this.

  41. 9:10

    Um, I'm gonna like go over this very briefly, but under the hood how Guardrails does this, um, is that it allows you to create what we call guards, uh, from, you know, different inputs.

  42. 9:21

    So you can use like either a declarative model spec, uh, such as like, um, uh, you know, like XML or Rail. You can use Pydantic models that implement like specific validation criteria and structure, or you can use string implementation.

  43. 9:36

    Uh, you can create a guard from all of these components. If you want, you can add information about, you know, your prompt as well as the LLMs you wanna use.

  44. 9:44

    Um, and then you create this [REDACTED:username] initialization, but [REDACTED:username] runtime, this guard will basically surround your LLM callable and then make sure that everything that you're sending in or getting out of the LLM is valid and correct for you, right?

  45. 9:59

    Um, so for example, uh, if your output is valid, you end up sending the output back to your application. But if it's invalid, uh, you go through this loop of, uh, looking [REDACTED:username] which constraint is violated or which check is violated.

  46. 10:13

    And then if on violation, uh, you have a set of these policies including like re-asking, which we touched on earlier, uh, filtering or fixing, which is programmatically trying to correct outputs, uh, falling back on some other system, uh, so refraining from answering or, you know, just no op where you don't actively take an o- action, but you

  47. 10:35

    log and store what the outputs of those checks or verification was and like why, uh, that particular check failed. And then you only do this like on-- uh, you only return the output once you know you can trust whatever came out of the LLM.

  48. 10:52

    Um, so within this framework, what Guardrails AI does is it's a fully open source library, um, that allows you to, A, create custom validators. Uh, it orchestrates the whole va-validation and verification process for you, uh, to make sure that, you know, you're not taking on this like, uh, really kind of like often latency-intensive task of doing validation

  49. 11:13

    and make sure that it's done as efficiently as possible. Um, it's a library and a catalog of many, many commonly used validators across a bunch of use cases. Uh, and it's a specification language that allows you to compile your requirements into a prompt so that like whatever specific, uh, validators you wanna use are automatically turned into a

  50. 11:34

    prompt so that you know that, you know, those requirements are also being compu-- uh, communicated to the LLM.

  51. 11:43

    All right. So a common question, why do I need this? Why can't I just use prompt engineering or, you know, a better fine-tuned model?

  52. 11:53

    Um, so okay. So for some reason my, um, rendering here is weird. Um, but controlling the outputs with prompts, uh, including using retrieval augmented generation, which basically injects specific context into your prompt, uh, doesn't act as a guarantee, right?

  53. 12:10

    Um, LLMs are stochastic. Even if you do all the prompt engineering in the world, there's nothing guaranteeing that those instructions will be followed. Um, we actually did this as an experiment for an unrelated thing where we used LLMs as evaluators.

  54. 12:24

    Um, we ran the exact same experiment five different times, changing like absolutely zero parameters with zero temperature and saw like different numbers across our benchmark, which is, you know, really fascinating and wouldn't really fly in like previous generations of machine learning.

  55. 12:40

    Um, and then second, prompts don't offer any guarantees. LLMs don't, you know, uh, always follow instructions.

  56. 12:48

    Uh, the alternative is also like controlling, uh, the outputs with models. Uh, so first of all, it is very expensive and time-consuming to train a model. Uh, in my past life, this was basically what I've done my whole life.

  57. 13:01

    Uh, and I was so frustrated with this whole process as I joined a startup, uh, where my job was to make this, you know, this process easier like as a function.

  58. 13:10

    Uh, but it still requires like, you know, compiling a lot of dataset which is expensive, uh, training a model over a bunch of hyperparameters, um, and then serving it.

  59. 13:19

    Um, and then if you are, if you aren't doing that and you're using like an LLM that's hidden behind a commercial API, uh, you typically don't have any control over model version updates.

  60. 13:30

    Um, so I've kind of seen this where, you know, I, I mentioned like validations get compiled into prompts. So I've kind of like observed where commercial models will get updated under the hood.

  61. 13:41

    Uh, and so prompts that might have worked for you in the past will stop working, uh, just over time.

  62. 13:49

    Uh, so how do these guardrails work under the hood, right? Uh, there's no like one-stop sh- uh, one-stop shop solution for h- for a guardrail here. It really depends on the type of problem that you're, you're solving.

  63. 14:03

    Um, so a very reliable way, if possible, uh, for, for implementing a guardrail is to ground it in an external system. So let's say you're working in a code generation app.

  64. 14:14

    Uh, a really good way to generate more reliable code is to actually hook up the output of the LLM into a runtime that basically contains application-specific data. So we, um, tried it for a lot of text-to-SQL applications, which is something that is supported as a first-class citizen in, in Guardrails.

  65. 14:32

    Uh, and we found that this re-asking framework where you hook it up to, you know, a sandbox that contains your ta- database and your schema, um, really substantially improved the correctness of the SQL queries that you got.

  66. 14:45

    You can also use, uh, rule-based heuristics. Uh, so really looking into like, okay, if I'm, let's say, trying to extract, uh, an interest rate from a really long document, I, I always must know that interest rates, you know, end with like, uh, percentage signs, and so that can be a clue that I must always be retrieving.

  67. 15:03

    Uh, you can try to use like traditional machine learning methods or high-precision deep learning classifiers. Uh, so really you don't need the full power of an LLM to solve, you know, really basic constraints.

  68. 15:14

    So, uh, trying to find like, is there, uh, some type of toxicity in this output? Uh, does some type of output contain, you know, uh, advice that is harmful for my users or is misleading my users in some way?

  69. 15:27

    Uh, you don't need, um... My favorite analogy to use is you don't need like a jackhammer to crack open a walnut. So if possible, you know, some of the guardrails should use like smaller classifiers that are much more reliable and deterministic, um, uh, a- instead of, you know, using LLMs.

  70. 15:43

    And then finally, you can also use LLM self-reflection.

  71. 15:48

    Um, all right, so we're gonna walk through this example of how this works in practice, uh, for building a chatbot, uh, where you wanna generate correct responses always. Um, so let's say you're an organization that has certain help center articles, and you wanna make sure that, um, you always generate, you know, y- you-- your users can ask

  72. 16:09

    questions over those help center articles in a chatbot, and you always generate like correct responses, where correctness means no hallucinations, uh, not using any foul language, so don't swear [REDACTED:username] your customers, um, and never mention any competitors.

  73. 16:27

    Now, how do you really prevent hallucinations? Like that's a very fundamental question, right? Um, provenance guardrails. Uh, provenance guardrails essentially mean that every LLM utterance should have some, some leaning in a source of truth, right?

  74. 16:44

    Especially if you're building like retrieval-augmented generation applications. Uh, you make the assumption that, okay, I gave it this context. I hope it's using the context. What you wanna make sure is that every output that is generated, you're able to pinpoint to where in the context, uh, you know, your response kind of came from.

  75. 17:02

    So this is one of the guardrails that, you know, is-- exists in our catalog of guardrails. Um, under the hood, there's a few different techniques that we employ. Uh, we use embedding similarity.

  76. 17:12

    Uh, we also have like classifiers that are built on traditional NLI, like Natural language inference models, uh, and we use LLM self-reflection.

  77. 17:22

    Um, this is a very brief, uh, um, you know, snippet of like how to configure a guard, uh, when you can essentially like select from this catalog which guardrails you wanna use.

  78. 17:32

    So we've, we've used provenance, profanity, no references to peer or competitor institutions. Uh, and then you essentially wrap your, uh, LLM call with, you know, the guard that you've created.

  79. 17:46

    Uh, so very briefly, let's say you get some question which is like, "How do I change my password on your application?" Um, you have like some prompt that you know is constructed from your retrieval-augmented generation application.

  80. 17:58

    Um, but because LLMs are very, very prone to hallucinating, there's like-- it hallucinates where the setting exists for you in your, uh, you know, uh, in, in the response.

  81. 18:08

    Uh, when this passes through your verification suite, the provenance guardrail will essentially spike and will cause, uh, the LLM to, you know, like go through this like re-asking loop, where a re-ask prompt will automatically be constructed for you via guardrails, which will like pinpoint which part is hallucinated, uh, give it the context again and ask it to

  82. 18:28

    correct itself. Uh, and then finally, the re-ask output, uh, you know, it tends to be more correct. And so we can kind of see here in this toy example, uh, that the output is, you know, corrected for you.

  83. 18:39

    And finally, verification passes, and you can send this back to the output.

  84. 18:44

    Uh, very briefly, more examples of validators that you can, uh, create or that exist. Uh, never giving any financial or healthcare advice, making sure that any code that you generate is usable, never asking any private questions from your customers or mentioning competitors, um, no profanity, prompt injection, et cetera.

  85. 19:02

    Um, and then just to summarize what Guardrails does for you, custom validations, uh, orchestration of verification, uh, a catalog of commonly used guardrails, as well as automatic prompt compilation from your verification checks.

  86. 19:16

    Uh, to follow along, you can look [REDACTED:username] the GitHub project, which is [REDACTED:username] [REDACTED:username]. Uh, our website with our documentation is guardrailsai.com. Uh, or you can follow me or the p- project on Twitter, uh, and that's for my LinkedIn.

  87. 19:30

    Awesome. Thank you so much, everyone. [audience applauding] [upbeat music]