Evaluation Primitives | LangSmith Evaluations - Part 2

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

Key Takeaways

The video discusses the core primitives of LangSmith evaluations, including runs, traces, projects, data sets, and evaluators, to help developers accelerate their development process and make informed decisions when working with LLMs.

Full Transcript

hi this is Lance lanching this is our second video on Lang Smith evaluation I'm going to walk through kind the core Primitives or the basic components of lsmith to give you a sense of how to kind of build up your understanding from scratch so in the pirate video we talked about kind of landscape evaluations and the things you a want to do in terms of these four categories building data sets implementing evaluators um and then applying evals and of course specifying a task you care about so let's let's actually kind of build this up let's say have an LM app like have a task and rag is a very popular use case there is an index you do retrieval and then you do generation based on this the retrieve documents to produce an answer so it's question in answer out now the single unit of work for each of these steps we call a run so in this particular case there's two runs here one is question to documents and then documents to answer so it's indexing or retrieval and generation those are the two core steps so to speak SLE units will work runs can be tagged they can you can have feedback to runs you can have metadata to runs which we're going to talk about later now runs are rolled up into traces so traces just collection of runs um and for example in this particular case the rag app Trace would have the two runs the Run for the retrieval step the Run for the generation step that's kind of it and then a project is just a collection of traces for given app so let's say I had this rag app it was in production somewhere a bunch of users used basically used it um that all those traces would this be logged to that particular project so that's really it so kind of again I have an app it's a rag app it has two steps each step is a run the app going from you know input to Output is a trace that Trace contains the two runs and every time I run that app all those traces get rolled into into a project that's kind of it so those are the kind key key components of like of kind of the task component or the app component of this four you know these four pieces that we've been talking about now data sets here we kind of talked about the flavors of data set you might want manually curated from logs or synthetic but really at the core data sets are pretty simple they just have an input and optionally an output um so in the case like if you're doing a rag app you might have a data set with question answer pairs in that case there is an input and an output each of the pairs typically doesn't have to be is just like a for example a dict or a key value pair like question um your question answer your answer um now that's an example and the data set is just a collection of examples and as I just mentioned a lot of times the input outputs are just like key values you know so in the case of rag question answer you know key value pairs for my input and my output um there are other types of data sets that are interesting though chat and Ln in particular these are a little bit more relevant if you kind of want to do things like fine-tuning in which the data set requires a particular format like for for example chatter Ln format for a lot of applications we'll talk about key value is is completely fine and again your data set composed of examples each example just has an input and optionally an output that's really um and now evaluator so what's happening here we we kind of talk through a few different flavors here there's different kinds of Judges you can chw so like LM as a judge heuristic judges like function the human judge and then different modes like comparison comparing two different traces for example two different Generations um reference free so like there's no ground truth you give an llm judge a bunch of General criteria um or if Human been judge General criteria and then of course you can also provide ground truth so are kind of like the things you can think about in terms of evaluation now here's a very important piece where these all come together so like what's the information flow when you run an evaluation what's the evalu really doing so again our data sets composed of examples each example is an input and an output when you run an evaluation you take that input and you Plum it into your application so let's thing about a rag app for example the input's a question we Plum that into our rag chain we get some output answer that's that that's what you see on that bottom uh kind of in red now also you have your ground truth answer as an output in your data set that also gets plunged through to the evaluator so the evaluator which is kind of very intuitive has access to a grou answer in the case of this rag toy example and the Ln answer your rag chain answer and then it's doing some judging at the two now this is where there's a lot of different interesting options here you can build a custom evaluator like we talked about you can also use a bunch of off-the-shelf lsmith evaluators to do the grading so in this particular case we have an answer from you know our LM we have a ground truth answer and we want to use a built-in evaluator we can use one of the evaluators that are label Centric so they are like tuned or or designed to do uh comparison between like an Ln output and a groud truth output and we'll talk about the various options later but I just want to give you a flavor of really what's happening here is you have your data set of examples you're passing the you know the expected in this particular case example to your judge um you have your app which is receiving input from your data set it's producing its own output so now you have an output from your app you have the ground truth output you pass them to a judge a judge make a decision and outputs effectively a some kind of score that's really it that's the big picture for how to think about the information flow when doing evaluations and that's really it you know for like the core Primitives this is the key thing to understand and once you understand this everything else is kind of is pretty easy um so we're going to be talking about a little bit more detail and and show some code examples in the next video thank you

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 video introduces the primary components of LangSmith evaluation, including tracing (along with metadata, feedback, tags), datasets, and evaluators. Documentation: https://docs.smith.langchain.com/tracing/concepts
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

The video introduces the core primitives of LangSmith evaluations, including runs, traces, projects, data sets, and evaluators, to help developers work with LLMs. It explains how these components fit together to enable effective evaluation and decision-making. By understanding these primitives, developers can accelerate their development process and make informed decisions when working with LLMs.

Key Takeaways
  1. Define a task and identify the relevant LLM application
  2. Break down the application into runs and traces
  3. Create a project to collect and organize traces
  4. Design and implement a data set with input and output examples
  5. Choose an evaluator and configure it to compare outputs
💡 The core primitives of LangSmith evaluations provide a structured process for working with LLMs, enabling developers to make informed decisions and accelerate their development process.

Related Reads

📰
The AI Crash Test: adversarial LLM testing you can audit in the Network tab
Learn to test LLMs with adversarial examples using a browser tool, ensuring model robustness and security
Dev.to · Erik Hill
📰
[Day 17] I analyzed 33,469 of my own AI conversations to audit how I actually use AI
Analyze your AI conversations to understand how you use AI and identify areas for improvement
Dev.to · PEPPERCORN
📰
Active players looked real until we asked which sessions counted
Learn how to build a web game with LLM integration, specifically Codenames AI, and understand the challenges of defining active player sessions
Dev.to · Michael Truong
📰
Building Multimodal SuperAgents: Integrating Speech, OCR, and Translation with iFly-Skills
Learn to build multimodal SuperAgents that integrate speech, OCR, and translation using iFly-Skills, enabling AI to interact with the physical world
Dev.to AI
Up next
5 Levels of AI Agents - From Simple LLM Calls to Multi-Agent Systems
Dave Ebbelaar (LLM Eng)
Watch →