WhoBuilt

Trust, but Verify

Nov 25, 2023· 20 min· 4.8K views·Watch on YouTube

Speaker

Shreya Rajpal, co-founder and CEO of Guardrails AI, presents “Trust, but Verify” at an AI Engineer event, explaining how to verify generative AI outputs before using them in applications.

Why generative AI apps fail after prototyping

Rajpal notes the rapid growth of AI applications, but says AI-first companies had lower one-month retention than traditional software companies in the data she cites. She attributes unreliable behavior to machine learning’s nondeterminism: the same prompt can produce different answers, and errors can compound when systems depend on earlier outputs.

Verify outputs before trusting them

Rajpal says flexible LLMs need correctness checks for high-value applications, where users cannot simply ignore an incorrect answer. Her proposed pattern sends every model output through a verification suite tailored to the application, checking risks such as sensitive information, profanity, competitor mentions, executable code, and whether text is grounded in a trusted source.

Use checks and recovery policies

Guardrails AI lets developers define checks using specifications such as XML or RAIL, Pydantic models, or strings, then wraps the LLM call at runtime. When an output fails, developers can re-ask the model, filter or programmatically fix the result, use a fallback, refrain from answering, or log the failure without taking action.

Choose validators suited to the risk

Rajpal argues that prompt engineering and retrieval-augmented generation do not guarantee compliance, citing an experiment that returned different benchmark numbers across five identical runs at zero temperature. She recommends choosing checks for the problem: ground code generation in a runtime or database sandbox, use rules for simple formats, and use smaller classifiers for tasks such as toxicity detection.

Correct a hallucinated answer with provenance checks

Rajpal demonstrates a health-center chatbot that must avoid hallucinations, profanity, and competitor mentions. A provenance validator checks whether each answer is supported by the provided source; in her password-help example, it detects a made-up setting and prompts the model to correct its response using the context.

Takeaways

  • Treat each LLM response as unverified until it passes checks tied to your application’s risks.
  • Set a latency and token budget for retries, and define a fallback or refusal when checks still fail.
  • Use deterministic rules or smaller classifiers for constraints they can check reliably.
  • For generated code or SQL, validate against the actual runtime, database, or schema when possible.
  • Track model and prompt changes because commercial model updates can affect previously working validations.

Mentioned in this talk

Search inside this talk

What was claimed 7

Related talks