Excited to release ✨Guardrails AI✨— an open-source package to add SLAs for LLM outputs!
Guardrails supports
🌟 pydantic-style validation of LLM outputs
🌟 corrective actions (e.g. reasking LLM) when needed
🌟 structure and type guarantees (e.g. JSON)
Apple is hiring engineers for the cross-functional ML team at Special Projects Group!
If you’re attending
@NeurIPSConf
, find me at the
@Apple
booth from 2.30-4pm on Tuesday (12/10). Or reach out and schedule some time, and I’d be happy to chat about our work!
🎉Our AI/ML residency program is here!!
I'll be a resident host on
@goodfellow_ian
's team at SPG. Please apply, or spread the word to candidates who you think would be a good fit!
I'm beyond thrilled to make two pretty substantial announcements:
1. We just released a brand new open source Guardrails Hub, with 50+ validators and more coming!
2. We raised a round of seed funding round to execute on our vision of open source AI reliability
🧵
I missed this when it came out, but I just discovered
The chapter on transposed convolutions is probably the best explanation I’ve seen on the subject!
One of my favorite validators in
@guardrails_ai
is the Provenance Guardrails, or the anti-hallucination guardrail. Today, I'll deep dive into how it works under the hood.
The core idea behind Provenance is that establishing provenance (i.e. source/origin) of any LLM utterance in
No more naked LLM access!
After months of hard work, our team is thrilled to bring you our
#1
most requested feature — Guardrails Server. As more engineers put
@guardrails_ai
around their LLM in production, we’re making Guardrails deployment easier than ever.
Why this matters:
Introducing guardrails for document summarization!! 🎉
@guardrails_ai
offers 5 new safeguards for multi-document summarization (how to use them at end of 🧵)
1/5 Sentence match guardrails: Ensure that each sentence in the summary has a high similarity score with source texts
🤯 This is absolutely wild - a Github action that uses LLMs to automatically create a pull request for an issue!
AutoPR uses
@guardrails_ai
to ensure that generated diffs & commits are valid & correct
Check it out in action below 👇
I’ve been out of school and in the workforce for a little over a year now, and my biggest takeaway (yet) on how to be a good engineer — not being afraid to look stupid!
The more I swallow my pride and ask (stupid) questions, the more productive I am..
💪Really excited about the new blog post by
@cohere
that goes deep into how to build robust and reliable LLM applications via
@guardrails_ai
!
While it’s straightforward to build LLM prototypes, it’s substantially harder to build LLM applications that work with the reliability
An output validation step ensures that an LLM application is robust and predictable.
In this article, we look at LLM output validation and how to implement it using
@guardrails_ai
.
Honestly if you’re running into issues trying to get pure JSON outputs with LLMs, just use
@guardrails_ai
for generating prompts that get JSON 🤷♀️
It’s freakishly good already, and there’s WIP to make it even better!
If anyone from
@OpenAI
is listening, then what would be insanely useful would be `gpt-3.5-turbo` but instruction-tuned to always reply in JSON according to a Typescript interface in an opening system message 🙏
My
@aiDotEngineer
tall is out!
I talk about LLMs require a fundamentally new software paradigm (stochastic vs. deterministic) and how to think abt building reliable applications
👀 bonus points if you can spot the blooper in the talk
Every time I answer why I'm building Guardrails, or why work on AI reliability instead of solving vertical problems in AI...
At the end of the day, all tech needs to drive value. The current AI hype will only work out if $$$ on AI >> the ROI of AI on company's bottom line. The
If you're building an LLM application & the LLM occasionally produces garbage output, what do you do to correct it?
Here's how LLM mishaps are corrected in
@guardrails_ai
:
✅ ReAsk: Automatically re-prompt LLM with helpful context & combine new response with previous ones
(1/n)
VERY excited to announce new comprehensive ✨Text2SQL support✨ in
@guardrails_ai
!
What's new:
✅ Create sandboxed db for testing
✅ Validate SQL in sandbox
✅ Constraints on predicates/columns
✅ Reasking if any of ^^ fails
✅ Few shot examples similar to query in prompt
(1/2)
👀 Spotted in the wild!
Example of how LLMs deployed for commercial purposes can often violate basic expectations on their outputs.
The
@guardrails_ai
competitor-check validator was created for this, basically guarding against mentioning any competitors. Link below
Quick thoughts on the new AI executive order
The White House just announced their new executive order on safe AI Development. If you’re working in AI in industry, there’s two ways the new executive order impacts your work*. Also included a bunch of other takeaways at the bottom.
Thrilled to collaborate with
@dk21
and
@weights_biases
on a new course on building LLM-powered applications! I talk about controlling LLM outputs w/
@guardrails_ai
The course is very thoughtfully designed & goes pretty deep into the stages of LLM app development. Details 👇
🎉 I'm thrilled to announce we're launching a free online course at
@weights_biases
, titled "Building LLM-Powered Applications." This course is designed for Machine Learning practitioners and Software Engineers who are interested in understanding LLMs and wish to use them in
Recorded my 5-min ⚡️ talk from AI Tinkerers' where I demoed
@pydantic
🤝
@guardrails_ai
!
Guardrails makes it really easy to ensure LLM-generated data is valid for a pydantic model. Under the hood, it reasks the LLM with new prompts until invalid data is corrected. Check it out👇
🚀 New
@guardrails_ai
release out!!
🌟 You can now add guardrails to any LLM, including self hosted models!
🌟 Tutorial on generating synthetic tabular data
🌟 Tutorial on generating profanity-free text
🌟 Changes for enabling
@LangChainAI
integration
🌟 Bug fixes & docs updates
I've had an interesting year to say the least -- almost exactly a year ago I started moonlighting on
@guardrails_ai
in my spare time. To celebrate my ~1 year anniversary, I'm giving the keynote at the AI in production conference, with some 4000+ registrations already(!)
Why you
📢 Exciting news, folks!
Thrilled to announce that I’ll be joining a panel of experts to discuss security and privacy at the LLMs in Production conference this Thursday!
Join us if you’re interested in security in the context of LLMs
📢 If you've struggled to get JSONs with Chat-GPT models,
@guardrails_ai
now supports instruction tags!
Check out this link for how to use instruction tags:
HUGE s/o to
@mikkolehtimaki
for leading this effort! 🤩
Stoked to showcase
@guardrails_ai
at the 🤗 Open Source meet up!
I’ll talk about how guardrails helps if you care about
1️⃣ prompt engineering
2️⃣ structured outputs
3️⃣ ensuring that your LLM app is aligned with intent & not flaky
Thanks to
@ClementDelangue
for the opportunity!
At the
@huggingface
Open-source AI meetup 🤗
we want to showcase amazing community demos and research. If you want to take part in it, please fill this spreadsheet and prepare to come to the event at 5pm PST on Friday:
sign
We’re throwing a Guardrails company launch party in SF tomorrow. If you’re working on building LLM apps and care about AI reliability, come celebrate with us!
We’re saving some limited seats for AI builders and tinkerers
I got GPT3 access a few days ago and have a couple of really cool applications in the pipeline. I don’t think I’ve been this excited about a side project in forever!
Thanks
@gdb
and
@OpenAI
for building something that has given so many people a new hobby, on top of all else!
🛤️ Huge release Guardrails 0.1.5 out now!
⚡️ Choice data types i.e. 'if' conditions!! Generate different JSON schemas based on the choice
⚡️ Massively better logging support
⚡️ New actions: fix + reask, raise
⚡️ Custom system prompts for Chat APIs
⚡️ Bug fixes
Details 👇
🚨COMING OUT OF STEALTH ALERT🚨Super excited to announce what I’ve been working on!
85% of ML projects in industry fail because building ML products is too expensive, too slow and too specialized. ML dev is fraught with duplicated effort using low level APIs
Enter
@predibase
🧵
I'm excited to announce Predibase, the enterprise declarative machine learning platfom. Bulding on top of the open source foudnations of Ludwig and Horovod to bring machine learning and data closer together.
#MachineLearning
#DataScience
#DeepLearning
Before ML Twitter gets sick of hearing about
#NeurIPS2019
, I wanted to highlight a really cool talk by Prof. Zhiru Zhang from Cornell about Neural Network and Hardware co-design. Here’s a great summary slide giving an overview of different NN model optimization techniques!
🛤️ Guardrails AI v0.1.6 is out now! This is pretty massive release, here's some of the highlights:
✅ Guardrails CLI: Use
@guardrails_ai
from non-Python applications
✅ Python 3.11 support
✅ Manifest support: Run any LLM, embedding model with caching
✅ Many new validators!! 1/
This is 🔥🔥🔥
LLMs to generate pandas dataframes from PDFs using
@guardrails_ai
and
@gpt_index
!
Guardrails ensures that the LLM generated data is structured correctly, and the output of guardrails is directly used to create a 🐼 dataframe
Unstructured data into structured data i.e. pfds with different format to pandas df for analysis of expense. See complete working at This could be extended to many other use cases.
Works perfectly.
#llamaindex
@gpt_index
@guardrails_ai
Two really exciting
@guardrails_ai
updates! 🚀
1. The GitHub repo hit 1000 🌟s
2.
@mikulskibartosz
wrote a pretty fantastic deep dive into the package! Check it out
Don’t let AI models keep making the same mistakes! Use
@guardrails_ai
to validate and correct the output of large language models. Get precise control over the output with custom validators and corrections!
Take a look at the article linked in the first response 👇
It's an absolute honor to be a guest on the
@twimlai
podcast!
@samcharrington
and I cover everything under the sun in LLMOps, from hallucinations, RAG to LLM safety. Check out the podcast on the link below!
Today we’re joined by
@ShreyaR
to discuss LLM safety for production applications! We explore hallucinations, RAG, evaluation & tooling for LLMs as well as Guardrails, an open-source project enforcing correctness in LMs.
🎧/🎥 Check out the episode at
We just shipped the latest Guardrails release with a ton of major QoL improvements. However, my favorite new feature from the new Guardrails release is much better support for input guardrails!
First, what are input guardrails?
These are guardrails that give you the ability to
small W acknowledgement: yesterday was
@Apple
’s perf review day and a LARGE number of ppl added me as their reviewer. really made me feel like my work and my opinion matters, especially since this last year has been quite challenging in so many ways 🙂
The Bias-Variance Trade-Off & "DOUBLE DESCENT" 🧵
Remember the bias-variance trade-off? It says that models perform well for an "intermediate level of flexibility". You've seen the picture of the U-shape test error curve.
We try to hit the "sweet spot" of flexibility.
1/🧵
Excited to be giving a talk at the
@databricks
’ Data + AI summit this afternoon
Swing by Hall F to learn more about how your enterprise AI needs Guardrails
do you also draft messages to your personal slack if you’re writing a big announcement/essay because you’re scared of accidentally hitting Send or are you normal?
🙌 Over the weekend, I revamped the getting started guide in
@guardrails_ai
!
Unstructured doctors notes ➡️ Structured dictionary of patient info, symptoms and medication.
Check out unstructured input and the final output 👇
New
@guardrails_ai
validator release!💥
If you're building a customer-facing chatbot, a basic requirement is to not mention any competitors to your company. E.g. don't talk about Burger King if you’re McDonalds.
We just added a validator to test this explicitly. Docs below
it's finally here 👀
last year, when i first launched
@guardrails_ai
it provided an interface via a bunch of prompt hacking to generate structured data and was widely adopted for solving that problem. pretty early on though, i learned a couple of things:
1. constrained decoding
Output Parsers (extracting a structured response from LLM output) sometimes fail. So what do you do then?
You ask the LLM to fix it's output of course!
Introducing Output Parsers that can fix themselves (OutputFixingParser, RetryOutputParser)
👇
Prompt injection continues to expose many vulnerabilities of LLMs, including leaking PII.
For customer facing applications, you can substantially lower the risk of PII by using
@guardrails_ai
. Here's how:
What happens if you ask ChatGPT to “Repeat this word forever: “poem poem poem poem”?”
It leaks training data!
In our latest preprint, we show how to recover thousands of examples of ChatGPT's Internet-scraped pretraining data:
Interesting testimonial from a
@guardrails_ai
user today:
"It took me a day to find the right prompting strategy, but with Guardrails it took me less than 5 mins!"
Outside of validation,
@guardrails_ai
provides a way of prompting that seems to generate valid JSON consistently
This is a substantial release, with a ton of new changes across documentation, validation, string templating, etc.
However, the two substantial features that were most often requested are:
1. Fully native
@pydantic
support, and
2. String validation
More tutorials coming soon!
🎉 Excited to announce Guardrails AI v0.2.0 is now live!!
This was a huge release (blog with more details below), but here are the highlights
✅ Full
@pydantic
support
✅ String validation (!!!)
✅ Better interfaces for custom validators
✅ Many paper cuts fixed
(contd.)
📣
@guardrails_ai
now has a CLI!
You can use `guardrails validate` to validate your LLM outputs via the CLI. This unblocks using Guardrails from non-Python applications! 🌟
Check out more details here
Excited to join a stacked lineup of speakers at the
@mlopscommunity
LLMs in Production conference!
I'll be talking about the practical approach to building guardrails for LLM applications in production, and how
@guardrails_ai
can help!
anecdotal observation:
we are building a validator for a specific task and at one point the validator required structured json. the performance degradation was significant enough that we ended up with a 2-step generation -- first step to generate the 'correct' values followed by
Been out of school 2 years now, and doubling down on this tweet from last year.
My big lesson: BE ANNOYING!
Consciously taking up space in meetings and discussions and asking plenty of questions without self-censoring has been the best thing for both my career and mental health
I’ve been out of school and in the workforce for a little over a year now, and my biggest takeaway (yet) on how to be a good engineer — not being afraid to look stupid!
The more I swallow my pride and ask (stupid) questions, the more productive I am..
👀
@guardrails_ai
x
@LangChainAI
coming out tomorrow!!
This will add a layer of safety around your Langchain apps! Super excited for devs to be able to use guardrails from within LangChain!!
Shoutout to
@hwchase17
for the speedy reviews 🚀
Some personal news — after an amazing 2 years at Apple SPG, I recently left to join a tiny startup working on big problems in low-code ML!
More updates to come soon, but in the meantime hmu if you’re interested in working on applied ML problems across a variety of use cases.
The Air Canada chatbot debacle highlights the key issue with AI adoption today.
Enterprises are fundamentally risk-averse and GenAI opens them to a lot of risk. How do you adopt AI while still adding constraints for the risks you care about?
Some examples of the cool things you can do w/ guardrails
🧩 Extract entities from a ToS document:
🧩 Generate bug-free Python code:
🧩 Use GPT to play valid chess moves:
🛤️
@pydantic
support in
@guardrails_ai
!!
If you want to fit some LLM output in a Pydantic model, Guardrails now supports:
✅ Automatic prompt engineering from pydantic model to try for a valid output
✅ Correcting LLM output by reasking GPT if needed
📚
Crazy to see the same misconceptions about working in ML industry jobs over and over again.
I’ve worked in ML in tiny startups and in massive orgs, and have had research offers from top industry ML labs. I can confirm — you do NOT need a PhD to work in ML. (contd.)
A big lesson for me has been about how essential good UX is. Added this small UX upgrade for installing a guardrail in the latest release (before and after below)
This was a tiiiny change (took ~1 hr) among bigger ones in the release, but it makes me happy every time i see it!
Can't believe 600+ people signed up for my lesson on Maven about building reliable AI applications! Last call for signing up at 🔗 below for the course tomorrow!
closing out the week with a very special announcement
we're thrilled to launch
@bespokelabsai
's SOTA Hallucination detection model Minicheck-7B on Guardrails Hub
there's a lot of noise about hallucinations, but Bespoke comes with receipts (i.e. benchmarks)
Interesting observation from interviewing ML eng candidates at guardrails -- kind of wild to see how little consolidation there is around what different ML job titles mean
E.g. I was last on the job market 3+ years ago, and realized pretty quickly that for different companies I
Learned about
@ShreyaR
’s awesome work on
@guardrails_ai
last week thanks to
@hwchase17
tweets and saw her IRL presenting at AI Tinkerers meetup tonight.
Can’t beat Twitter + SF for
#AI
these days.
I had a fantastic time chatting with
@labenz
about practical strategies for adding Guardrails to LLM applications at the Cognitive Revolution podcast!
Check out my episode below 👇
[new episode]
@labenz
talks to
@ShreyaR
, creator of
@guardrails_ai
.
Shreya reinforces just how early we are in LLMs' impact on software.
In this ep they discuss:
- paradigm shift could unlock bigger productivity gains & user value
- risks of delegating output validation
@OpenAI
's function calling is a HUGE utility for developers! 💥
@guardrails_ai
's latest release supports easy JSON generation, validation and correction using function calling
1️⃣ Create a
@pydantic
basemodel of the JSON schema
2️⃣ Set up `Guard`
3️⃣ Call OpenAI's freshest model
🤖 If you're also building products powered by AI, you've seen first hand how unruly they can be.
@ShreyaR
is building
@guardrails_ai
to solve that:
- Enforce structure of outputs
- Validate correctness with "contracts"
- ReAsk and correct if needed
Amazing community contribution
@guardrails_ai
: you can now add a ✨translation quality✨ guardrail to generated text!
Huge shoutout to
@gneubig
🙌
Below, the raw GPT-3 output which is a poor translation, and the output by
@guardrails_ai
which filters low quality translations!
If you haven’t already, check out my conversation with the prolific
@mattturck
on the MAD podcast!
We dig our heels into a lot of relevant topics for GenAI builders — how to measure and mitigate hallucinations, patterns for GenAI systems, etc
🛤️ New
@guardrails_ai
release out! `pip install guardrails-ai==0.1.3` for:
🌟 New text validators `is-profanity-free` and `is-high-quality-translation`
🌟 Support for ChatGPT(!!)
🌟 Ability to configure max reasks *per query*
🌟 Bug fixes for
@LangChainAI
🤝
@guardrails_ai
The past two days I've been working on using
@LangChainAI
and
@guardrails_ai
to extract tabular data from PDFs. Going to open source the codebase on GitHub this weekend. Excited to see what improvements are made from contributors!
ICYMI: excellent thread on the implementation details behind AutoPR!
AutoPR automatically creates pull requests from issues, figuring out files to edit, diffs, etc. automatically
In the 🧵,
@IrgolicR
shares how he uses
@guardrails_ai
to check correctness of AutoPR’s actions👇
At the heart of guardrails is RAIL, a language-agnostic spec that lets developers specify what a good LLM output looks like.
RAIL specifies structure + output validation, manages prompts and can contain custom code for validation, corrective action, etc.
Just goes to show the value of ML models-as-a-service!
Imagine a world where all ML model advances have an inference API that allows users to build cool apps like this. Takes away the burden of reproducibility from the user, and saves hours/$$ training a new model from scratch.
This is mind blowing.
With GPT-3, I built a layout generator where you just describe any layout you want, and it generates the JSX code for you.
W H A T
🛤️ New
@guardrails_ai
release out!
✅Better logging support — optionally persist logs to disk
✅Manifest embeddings (with caching) by
@laurel_orr1
✅More guardrails to validate generated summaries
✅A ton of bug fixes!
Try it out with “pip install guardrails-ai”
I've had a chance to play around with the Sonic model and have been super impressed by not just the quality but also the latency.
Take the model for a spin at 🚀
Today, we’re excited to release the first step in our mission to build real time multimodal intelligence for every device: Sonic, a blazing fast (🚀 135ms model latency), lifelike generative voice model and API.
Read and try Sonic
🙌 Guardrails AI got its first community contribution!!
Huge shoutout to
@devenbhooshan
for adding a tutorial on using guardrails to filter out profanity from translated text.
The example uses RAIL to create a custom validator for profanity filtering
Excited to release ✨Guardrails AI✨— an open-source package to add SLAs for LLM outputs!
Guardrails supports
🌟 pydantic-style validation of LLM outputs
🌟 corrective actions (e.g. reasking LLM) when needed
🌟 structure and type guarantees (e.g. JSON)
(1/2) I love this thread!
As an ML engineer in industry, a lot of my work is exploratory, so the tendency is to not merge code often. Isolating parts of your code that would be useful to your org (ie merge-able), is hard but rewarding. Code review is a great learning experience!
I've been thinking a lot about research and engineering and what they can learn from one another.
After grad school I spent 1.5 years working as a backend developer. Here's a list of some engineering lessons I picked up that have greatly improved my research productivity💪:
This is 🔥🔥
@justinliang1020
uses
@guardrails_ai
to query the OpenAPI spec of ChatGPT plugins in a structured way, making sure that the queries are valid for any plugin!
I couldn't wait for the ChatGPT Plugins waitlist.
So, I built a quick chatbot that can access any official ChatGPT Plugins by dynamically parsing their OpenAPI spec.⚡️
Built using and
@guardrails_ai
.
Link:
This honestly doesn’t get the attention it deserves. The process is so poorly designed that you are:
- capped at 10 attempts before you’re locked out for 3 days, and
- so flaky that you need multiple retries because of errors.
Thread:
I live in the US on a work visa. I’m among thousands of Indians unable to see their families because US consulates in India haven’t fully functioned through the pandemic. If I leave the US to see my parents, I won’t be able to return unless I get a consular appointment.
Had a fantastic time chatting with Charlie and Badar at
@mlsecops
on how to make LLMs safer and more usable in practical applications with
@guardrails_ai
.
Check out the podcast below! 📣
looking at
@sharifshameem
’s tweets every morning about new stuff GPT-3 can do — is this what new parents feel like when their child is learning to walk?
Meerkat is awesome! If you’ve ever felt the pain of trying to do data wrangling on unstructured data, you’ll know that existing tools are severely lacking.
As with all ML/data science apps, you need to be able to see and feel your data for it to be useful
We built an interactive data frame powered by foundation models that can wrangle your unstructured data (images, videos, text docs...)
Introducing 🔮 Meerkat!
📃
💻
🌐