Learning Objectives
By the end of this chapter, you will be able to:
- Select an LLM choice (size and architecture) based on a set of quantitative evaluation metrics, including authoring Databricks custom Scorers for agents and LLMs.
- Select key metrics to monitor for a specific LLM deployment scenario and incorporate SME feedback to improve agent performance.
- Evaluate agent performance using MLflow scoring and tracing.
- Use inference logging to assess deployed RAG application performance.
- Use Databricks features to control LLM costs.
- Use inference tables and Agent Monitoring to track a live LLM endpoint.
- Identify evaluation judges that require ground truth.
- Use AI Gateway (Inference Tables, Usage Tables, and rate limiting) to track an LLM or agent deployed via Agent Framework.
Executive Summary
- Model selection on Databricks is a constrained optimization across a quality vector (correctness, faithfulness, relevance), a cost vector (input and output tokens times rate), and a latency vector (P50, P95, P99 end-to-end), reported in an
mlflow.genai.evaluaterun on a stable evaluation set, with Databricks custom Scorers expressing any metric the built-in judges do not cover. - Monitoring is not a copy of evaluation. Evaluation runs against a curated set with known answers, while monitoring runs against live traffic without known answers, so judge selection at monitoring time is restricted to reference-free judges, and SME feedback in the Review App is the only reliable mechanism to assign ground truth after the fact.
- MLflow Tracing instruments every span (retriever, re-ranker, tool call, LLM call) and is the substrate that both
mlflow.genai.evaluateand Agent Monitoring read, so a chain that is not traced is a chain that cannot be scored. - Inference Tables, Usage Tables, and rate limiting are AI Gateway primitives that apply at the endpoint boundary; together with Agent Monitoring on the inference table they convert a live endpoint into a queryable Delta dataset of every request, response, token count, latency, and policy decision.
Assumptions
- The reader has built and deployed a Mosaic AI Agent Framework chain through Chapters 4 and 5, registered it to Unity Catalog under the
databricks-ucregistry URI, and exposed it through a Mosaic AI Model Serving endpoint with AI Gateway attached. - All evaluation, monitoring, and AI Gateway features are available in the workspace tier the reader has provisioned. Where a feature is offered through more than one entry point (UI, REST, SDK), code samples favor the Python SDK to match exam style.
- The terms
evaluation phase,monitoring phase,Agent Monitoring,MLflow Prompt Registry,evaluation set,Mosaic AI Agent Evaluation,faithfulness judge,correctness judge, andrelevance judgeare used as defined in Chapters 2 and 3 and are not redefined here.
