LangSmith Highlights: Evaluation

LangChain · Intermediate ·📰 AI News & Updates ·2y ago

Key Takeaways

Demonstrates evaluation features in LangSmith, including changing chain parts, updating tags, and comparing test runs

Full Transcript

okay so in this video we're going to show how you can do automatic evaluation in link Smith we just showed you how you can easily collect data sets in link Smith as a reminder these are inputs and outputs that someone has deemed as a good response so if your agent was given this question and it output output uh a response like this uh this would be considered a golden answer or a true reference data set and so we make it pretty easy for you to create test runs in links Smith this is really the only way that you're going to be able to gain confidence that you can put that application in production you have to observe over dozens of inputs how your agent performs and see if it meets your criteria bar on the quality side or accuracy side so we have a couple evaluators that you can borrow that are off the shelf uh like correctness you can test for things things like helpfulness or insensitivity and all that we're doing here is really building up some evaluators that we can copy into our linkchain code often evaluation though is pretty bespoke to your business and we give you space to create custom evaluation as well maybe it is that your output needs to be proper Json so you might want to test that it runs through a Json D serializer properly or maybe you want to test that it runs through a SQL ler properly but we really let you as your business Define exactly how you want to evaluate these runs and this is where often really hard work happens uh to test uh over you know thousands of examples and build that confidence so we can copy this code into linkchain which we'll do now and in this eval example that I have uh what's happening is we're we're using the same agent that we've used prior and we are going to evaluate it on a few criteria in this case the correctness and sensitivity and helpfulness we're going to use a higher level model in this case GPT 4 to do the grading so a lot of the automatic evaluation can be done with an llm grading the output and so people like to pick uh more cognitive llm to do the grading and gp4 is an excellent choice then you name uh reference uh data set uh in link Smith so this was the planetary successful data set that we've been working with and you're going to give it a name and because I am less creative uh I will just use the autop populated name that uh we are given here and I can run it and I can see I have something running already but I can just pause and rerun from the top okay so we're going to rerun this code and the other thing I wanted to point out is that I've added a tag and this is really important to keep track of what's what being run so in this case I'm using GPT 3.5 under the hood so I've noted that here now my runs my test runs will be tagged with GPT 3.5 often people will also tag the commit sha for the prompt and that way you know what prompt was running uh when you are testing a particular iteration of a prompt or an iteration of a chainer agent you'll have precise information of what you're what you're actually testing against so let's go ahead and and run these and we can see in lsmith there's a new test run that's uh happening now and these usually take a minute to run but we already see uh it's it's started and it's kicked off I'm going to actually use a run that I uh just ran to to walk through that's completed but we can quickly see that um in these runs we have uh some aggregate measures for the correctness so only 38% of these test runs came back correct zero were insensitive and only 63 were insensitive were 63% were helpful so I can click in and and really get much more information on on what's Happening so you can see uh these are the inputs that are in the data set and really this agent is just getting iterated over all of these inputs and uh it's getting compared the output of that agent compared to the reference data set output which is also tagged here was this response that the agent provided correct and we see a lot of times that it was not correct and so this is a comparative evaluation we'll click in and and show what that looks like so we you can see that given this input this agent responded the following but the reference output uh said you know the response was something different and we could see that you know in fact the uh score for correctness here was was Zero it wasn't helpful um but it wasn't insensitive at least but if we wanted to click in and see how these evaluators are actually doing the evaluation we can see it's really just another EV it's another llm run and so if I click into this helpfulness run and I dig into the actual prompt that's being used you can see that it has uh some prompt around you know giving this submission and describing what a helpfulness is is this submission meet your criteria for helpful and it replies why why meaning yes it was helpful and that just gets reported really easily on that particular run so that way we know that this run was was helpful um but this makes adding evaluation uh a lot easier and just to of double click on a few few more runs to show it in action you know not all evaluation criteria is comparative in nature certainly correctness is and in this example example um we did get that the answer was correct and you can see just eyeballing it the output that this agent gave compared to the true answer the reference output both got 10 so it's automatically grated as correct um even though uh you know these are pretty semantically different responses and maybe the um the the distance uh of these two embeddings might not be that close uh you did get the correct response and so this all gets added uh to your test runs and you can get these aggregate measures around helpfulness uh and sensitivity and accuracy because those were the measures that I asked you grade on and one of the things that I really like about the test runs in link Smith is I can iterate and tweak my chainer agent and continue to run it so in this run it's now completed in the background uh remember this tag was GPT 3.5 uh we could see that it ran and it was helpful 88% of the time it was not insensitive and it was accurate 100% of the time by this by this measure and if I compare these two test runs I can even get a much deeper view of you know where did they differ so if I want to filter around a run where uh it was maybe not correct so a contextual accuracy of Zero by removing this one I can see how this agent performed when it was incorrect versus this agent using a different underlying model did get the answer correct and I can just read right across get given this input given this reference output these two versions of my agent as I tweaked the underlying model they had different responses and I can comb through as a reviewer to see exactly how they differed and in some sometimes you'll see that the um you know llm grading wasn't wasn't accurate these are two pretty similar texts but when we scored via the llm we got a in said it was zero here so it wasn't accurate even though it said it was accurate in in this case you're not always going to get um perfect responses by the llms but I'm able to really narrow down the number of uh rows that I need to look at when I'm comparing between two different test Rons uh and and seeing how as I iterate and change my my chainer agent whether it be a different underlying model or a different retrieval strategy or a different prompt I can pairwise see uh how uh the responses change

Original Description

See how to: -Change part of a chain -Update tags -Compare test runs -Create an evaluation run -Do custom evaluations -Auto-evaluate a prompt run Log in or sign up for LangSmith (BETA): https://smith.langchain.com/
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from LangChain · LangChain · 29 of 60

1 Chat With Your Documents Using LangChain + JavaScript
Chat With Your Documents Using LangChain + JavaScript
LangChain
2 LangChain SQL Webinar
LangChain SQL Webinar
LangChain
3 LangChain "OpenAI functions" Webinar
LangChain "OpenAI functions" Webinar
LangChain
4 LangSmith Launch
LangSmith Launch
LangChain
5 LangChain x Pinecone: Supercharging Llama-2 with RAG
LangChain x Pinecone: Supercharging Llama-2 with RAG
LangChain
6 LangChain Expression Language
LangChain Expression Language
LangChain
7 Building LLM applications with LangChain with Lance
Building LLM applications with LangChain with Lance
LangChain
8 Benchmarking Question/Answering Over CSV Data
Benchmarking Question/Answering Over CSV Data
LangChain
9 LangChain "RAG Evaluation" Webinar
LangChain "RAG Evaluation" Webinar
LangChain
10 Fine-tuning in Your Voice Webinar
Fine-tuning in Your Voice Webinar
LangChain
11 Tabular Data Retrieval
Tabular Data Retrieval
LangChain
12 Building an LLM Application with Audio by AssemblyAI
Building an LLM Application with Audio by AssemblyAI
LangChain
13 Superagent Deepdive Webinar
Superagent Deepdive Webinar
LangChain
14 Lessons from Deploying LLMs with LangSmith
Lessons from Deploying LLMs with LangSmith
LangChain
15 Shortwave Assistant Deepdive Webinar
Shortwave Assistant Deepdive Webinar
LangChain
16 Cognitive Architectures for Language Agents
Cognitive Architectures for Language Agents
LangChain
17 Effectively Building with LLMs in the Browser with Jacob
Effectively Building with LLMs in the Browser with Jacob
LangChain
18 Data Privacy for LLMs
Data Privacy for LLMs
LangChain
19 "Theory of Mind" Webinar with Plastic Labs
"Theory of Mind" Webinar with Plastic Labs
LangChain
20 LangChain Templates
LangChain Templates
LangChain
21 Using Natural Language to Query Postgres with Jacob
Using Natural Language to Query Postgres with Jacob
LangChain
22 Building a Research Assistant from Scratch
Building a Research Assistant from Scratch
LangChain
23 Benchmarking RAG over LangChain Docs
Benchmarking RAG over LangChain Docs
LangChain
24 Skeleton-of-Thought: Building a New Template from Scratch
Skeleton-of-Thought: Building a New Template from Scratch
LangChain
25 Benchmarking Methods for Semi-Structured RAG
Benchmarking Methods for Semi-Structured RAG
LangChain
26 LangSmith Highlights: Getting Started
LangSmith Highlights: Getting Started
LangChain
27 LangSmith Highlights: Debugging
LangSmith Highlights: Debugging
LangChain
28 LangSmith Highlights: Datasets
LangSmith Highlights: Datasets
LangChain
LangSmith Highlights: Evaluation
LangSmith Highlights: Evaluation
LangChain
30 LangSmith Highlights: Human Annotation
LangSmith Highlights: Human Annotation
LangChain
31 LangSmith Highlights: Monitoring
LangSmith Highlights: Monitoring
LangChain
32 LangSmith Highlights: Hub
LangSmith Highlights: Hub
LangChain
33 SQL Research Assistant
SQL Research Assistant
LangChain
34 Getting Started with Multi-Modal LLMs
Getting Started with Multi-Modal LLMs
LangChain
35 Build a Full Stack RAG App With TypeScript
Build a Full Stack RAG App With TypeScript
LangChain
36 Auto-Prompt Builder (with Hosted LangServe)
Auto-Prompt Builder (with Hosted LangServe)
LangChain
37 LangChain v0.1.0 Launch: Introduction
LangChain v0.1.0 Launch: Introduction
LangChain
38 LangChain v0.1.0 Launch: Observability
LangChain v0.1.0 Launch: Observability
LangChain
39 LangChain v0.1.0 Launch: Integrations
LangChain v0.1.0 Launch: Integrations
LangChain
40 LangChain v0.1.0 Launch: Composability
LangChain v0.1.0 Launch: Composability
LangChain
41 LangChain v0.1.0 Launch: Streaming
LangChain v0.1.0 Launch: Streaming
LangChain
42 LangChain v0.1.0 Launch: Output Parsing
LangChain v0.1.0 Launch: Output Parsing
LangChain
43 LangChain v0.1.0 Launch: Retrieval
LangChain v0.1.0 Launch: Retrieval
LangChain
44 LangChain v0.1.0 Launch: Agents
LangChain v0.1.0 Launch: Agents
LangChain
45 Build and Deploy a RAG app with Pinecone Serverless
Build and Deploy a RAG app with Pinecone Serverless
LangChain
46 Hosted LangServe + LangChain Templates
Hosted LangServe + LangChain Templates
LangChain
47 LangGraph: Intro
LangGraph: Intro
LangChain
48 LangGraph: Agent Executor
LangGraph: Agent Executor
LangChain
49 LangGraph: Chat Agent Executor
LangGraph: Chat Agent Executor
LangChain
50 LangGraph: Human-in-the-Loop
LangGraph: Human-in-the-Loop
LangChain
51 LangGraph: Dynamically Returning a Tool Output Directly
LangGraph: Dynamically Returning a Tool Output Directly
LangChain
52 LangGraph: Respond in a Specific Format
LangGraph: Respond in a Specific Format
LangChain
53 LangGraph: Managing Agent Steps
LangGraph: Managing Agent Steps
LangChain
54 LangGraph: Force-Calling a Tool
LangGraph: Force-Calling a Tool
LangChain
55 LangGraph: Multi-Agent Workflows
LangGraph: Multi-Agent Workflows
LangChain
56 Streaming Events: Introducing a new `stream_events` method
Streaming Events: Introducing a new `stream_events` method
LangChain
57 Building a web RAG chatbot: using LangChain, Exa (prev. Metaphor), LangSmith, and Hosted Langserve
Building a web RAG chatbot: using LangChain, Exa (prev. Metaphor), LangSmith, and Hosted Langserve
LangChain
58 OpenGPTs
OpenGPTs
LangChain
59 Open Source RAG with Nomic's New Embedding Model (and ChromaDB and Ollama)
Open Source RAG with Nomic's New Embedding Model (and ChromaDB and Ollama)
LangChain
60 LangGraph: Persistence
LangGraph: Persistence
LangChain

Related Reads

📰
Reflection inks $1B compute deal with Nebius
Learn about Reflection's $1B compute deal with Nebius and its implications for AI and cloud computing
TechCrunch AI
📰
You’ve Been Working for Google for Years — And You Never Got Paid
Discover how your daily interactions with Google have been training their AI without your knowledge or compensation
Medium · AI
📰
You’ve Been Working for Google for Years — And You Never Got Paid
Discover how your everyday interactions with Google may be training their AI without your knowledge or compensation
Medium · Machine Learning
📰
From Career Confusion to Career Clarity: Building Supernova AI with Google Gemini
Learn how to build a career path using AI tools like Google Gemini and Supernova AI to gain clarity on skills and certifications
Dev.to · Suchitra Satapathy
Up next
Get Paid $85,000 to Learn AI (Claude Corps Fellowship Explained)
Zero To G
Watch →