Eval Comparisons | LangSmith Evaluations - Part 7

LangChain · Beginner ·🧠 Large Language Models ·2y ago

Key Takeaways

The video demonstrates LangSmith Evaluations for comparing and evaluating different LLMs, including MStrA 7B and GPT-3.5 Turbo, using tools like Alama, CoQA evaluator, and LangSmith Evaluations, with a focus on AB testing and custom evaluation datasets.

Full Transcript

hi this is L Lang chain this is the seventh video in our Langs Smith evaluation series um so our first video gave kind of a context as to why EV vals are interesting and important the second video talk about Lang Smith Primitives our third video showed how to create manually curated data sets we built one based upon this datab bras blog post um the fourth one showed how to build data set from user logs so if You' have an app in production you want to kind of capture user questions and create a data set from them you can very easily do that we talked through that um we then talked about various judges for data sets so different types of valuators we should how to build use a built in Lang chain evaluator um for question answering we applied that to our data data set um and we just talked through custom evaluator so again we've kind of showed this this flow diagram and go to go to those videos if you want to kind of Deep dive into those topics now we're going to have a little bit of fun so this is where you know you kind of get into like very real world use cases and and needs you often want to do comparisons so let's ask a really practical question how does mistra 7 be running locally on my laptop compared to gp35 turbo on this little challenge we've set up again remember we've four question eval set on this data bre blog post p and open L undo versus uh gbd 35 turbo so just a little note here I'm using Alama for this um just you can download it going to uh uh ama.com you can do Alama P mstr to get the model and you can kind of follow instructions here um so here's my setup I'm going to create a new function that does the same thing that we already were doing with open AI but here I'm going using MW this is running locally on my laptop so again it just I can answer ask and answer questions about the particular blog post so I answered I just asked a question and here we go so you know the answer is streaming out very good and it's obviously slower than open AI exactly what we would expect but we really care out here is I want to know about quality how does it actually compare on this little challenge I built for myself so what are we actually doing uh here we a developer curated data set of four examples on this data bricks block post um I'm using LM as a judge again remember the built-in coot QA evaluator I'm using um and I ground truth answers for every question I'm doing an AB test between gbd 35 turbo and mraw running locally on my laptop so that's the setup um and it's pretty easy so remember we've already built or defined this data set dbrx we've already used this to evaluator coqa so that doesn't change at all all that changes is I'm just passing in this new function now now let's go back and look at that function it looks exactly like our old one a few little twists I'm using ol instead of open AI that's really get same output object answer you addict with an answer that's it simple we just saw it work here so what I can do is kick off the SE valve this will take a little bit cuz it's running locally I have an M2 Mac uh with 32 gigs by the way so that kind of gives you some sense I've heard a lot of people having good results using Mr all 7B on on Far smaller machines though so it's a really nice open model to work with if you want and you can see it's still churning it's streaming its answers out here it's actually done so it didn't take that long it ran against my four questions now here's where it can get really interesting let's go over to my data set now I can see here that there's three runs so this is our initial run uh experiment you can think of with open AI this is that second one to do with a custom evaluator we're not interested in that that was just kind of a quick more unit test that wasn't a proper kind of LM based evaluation and now here's our latest one so here's where the gets really interesting I can click on um this and this so my mraw run my open eye run and I can click this compare thing that opens up this compare mode and you already see some nice statistics here so what I can see is the average score so the first run which was up in AI indeed does quite a bit better in terms of score latency as exactly we would expect M draw slower by quite a bit um and here's a latency dis and so forth so you get some immediate statistics about the two runs now here's where I've done a lot of work in the past and you know this is kind of the Crux of AB testing that's extremely useful um that's why it's very helps to do this inside Lang is all kind have captured for you managing this all yourself is can be quite painful here's my first question here's a reference output here is the output returned by mraw here's the output returned by open AI so I can actually look at those in detail I can like kind of zoom in look at the answers and like hey they they look very similar here that's really cool and you can see my greater also assesses them both as correct and again we talked about you can actually click on the evaluator run for each case to see why but they look good now here's where it gets a little interesting it looks like my mistr running locally is is did not receive a correct grade um and I did so let's actually look at what was the question what is the context window of the drb ex Dro model okay so it's 32k token right what did mrra think uh cont is oo 2048 so that is definitely wrong and we would have to investigate as to why Mr believed that to be the case it could be you know there could be many different reasons why I failed for that one but indeed our grader is correctly grading that as as a as a wrong response for fun we can actually dig in and look at uh that particular grading trace and we can see why stud's answer is incorrect the student States at the context window is 2048 um the Contex says clearly 32k there you go so the grer is doing the same thing and we can kind of go through each one so this is like a toy example but it shows you a very important useful concept of comparative AB testing so like you might want to compare different prompts different llms and this is a very nice way to do that you can see it's extremely simple we've just supplied our data set name um so we're of course run against the same data set where you know typically I like to apply different experimental prefix to to enumerate the different experiments and running so that's easy you can also capture that in metadata by the way so that's another way to kind of differentiate your experiments um and I'm using the same grader of course and I'm just modifying the my function which in this case was just hey swapping out mistol uh swapp swapping in mistol for for opening I so again this just shows you how to use this compare mode and limith to do ab testing really nicely um in this particular case we're comparing mrra versus open AI we can look at you know kind of overall run statistics as well as granular answer wise differences we can inspect the greater as shown here we can look at the runs as shown here so this gives you a very flexible General place to do ab testing uh across different parameters in this casat I use different uh different llms um and I've used this all the time for lots of different kind of projects and it is indeed quite useful it's very nice to have this all kind of managed in one place for you um so we're going to be kind of diving into some uh deeper themes after this this is kind of the final video of our like kind of introductory Concepts so if we kind of Zoom all the way back out what did we talk through we just talked through man building your M Cur data set in this case running Elm as a judge against the ground Truth for AB testing so we kind of went through that we also had talks through um you know same setup but basic just simple unit test using custom evaluators we talked through um yep we talked through yeah different data set creation yeah we talked through here we go Len is a judge with ground truth um so for like you know uh just just you know Len is greater evaluation um but no AB test so in that case you're just looking at like a single a single model and evaluating it using LM as as a judge um we talked about the information flow for valuation we've talk about different ways to build data sets from user logs from manual curation and that's really it this gives you kind of like the groundwork you need to do a lot of different things building custom evaluators and AB testing is frankly covers a huge surface area of use cases uh and we're going to do some deep Dives following this so stay tuned for for additional videos thanks

Original Description

With the rapid pace of AI, developers are often faced with a paradox of choice: how to choose the right prompt, how to trade-off LLM quality vs cost? Evaluations can accelerate development with structured process for making these decisions. But, we've heard that it is challenging to get started. So, we are launching a series of short videos focused on explaining how to perform evaluations using LangSmith. This introduces how to use the LangSmith UI to compare (e.g., different prompts, LLMs, etc) across a dataset. Documentation: https://docs.smith.langchain.com/user_guide#comparison-view Code: https://github.com/langchain-ai/langsmith-cookbook/blob/main/introduction/langsmith_introduction.ipynb
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from LangChain · LangChain · 0 of 60

← Previous Next →
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
29 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

This video teaches how to use LangSmith Evaluations to compare and evaluate different LLMs, including MStrA 7B and GPT-3.5 Turbo, using AB testing and custom evaluation datasets. It covers the importance of evaluation in LLM development and provides practical steps for implementing evaluations.

Key Takeaways
  1. Create a new function using MStrA 7B for local evaluation
  2. Run the function against a custom dataset
  3. Compare the results to GPT-3.5 Turbo using an AB test
  4. Run MRAW and Open AI on the same dataset
  5. Compare the results using the compare mode in LangSmith Evaluations
  6. Inspect the grader's assessment of the answers and reference output
  7. Capture metadata for different experiments and runs
💡 AB testing and custom evaluation datasets are crucial for comparing and evaluating different LLMs, and tools like LangSmith Evaluations can simplify and accelerate this process.

Related Reads

📰
The Token Ledger Digest – 2026-07-19
Learn about the latest price reductions for MoonshotAI's Kimi models and how they can impact your large-scale code or reasoning workloads
Dev.to AI
📰
A Developer's Quick-Start Guide to Claude AI
Get started with Claude AI quickly using a developer's setup checklist and learn how to harness its features
Dev.to AI
📰
GPT-5.6 closes a 30-year gap in convex optimization. https://old.reddit.com/r/math/comments/1uxj3cy/after_openais_cdc_proof_anno
GPT-5.6 achieves a breakthrough in convex optimization, closing a 30-year gap, and its implications are significant for AI and math communities
Dev.to AI
📰
Full-Text Search Artık Yeterli Olmadığında: Vektörler, LLM’ler ve Hybrid Search
Learn how to improve search results using vectors, LLMs, and hybrid search for more accurate and relevant outcomes
Medium · LLM
Up next
5 Levels of AI Agents - From Simple LLM Calls to Multi-Agent Systems
Dave Ebbelaar (LLM Eng)
Watch →