databricks-mlflow-evaluation
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseMLflow 3 GenAI Evaluation
MLflow 3 GenAI 评估
Scope vs upstream mlflow/skills
mlflow/skills与上游mlflow/skills
的范围对比
mlflow/skillsThe OSS repo ships and related skills (, , , ) that cover the generic MLflow GenAI evaluation workflow — , scorers/judges, datasets, tracing setup, and the 5-step evaluation loop.
mlflow/skillsagent-evaluationinstrumenting-with-mlflow-tracinganalyze-mlflow-traceretrieving-mlflow-tracesquerying-mlflow-metricsmlflow.genai.evaluate()This skill layers Databricks-specific patterns on top of that workflow rather than restating it. Use this skill when you need any of:
- Unity Catalog trace ingestion — production traces written into UC tables, log-based monitoring ().
patterns-trace-ingestion.md - MemAlign judge alignment via UC SME labeling sessions — aligning custom judges against domain-expert feedback collected in Databricks ().
patterns-judge-alignment.md - GEPA loop — Databricks' automated prompt-optimization driver running on a UC dataset (
optimize_prompts()).patterns-prompt-optimization.md - Databricks-flavored scorer/dataset patterns — UC-table-backed datasets, tagging traces in the Databricks UI for inclusion (,
patterns-datasets.md).patterns-scorers.md
For everything else — generic calls, scorer authoring patterns, dataset creation outside Databricks, MLflow tracing setup that isn't UC-table-bound — the upstream skill is the canonical source and is kept current by the MLflow team.
mlflow.genai.evaluate()mlflow/skills/agent-evaluation开源(OSS)仓库提供了及相关技能(、、、),涵盖通用的MLflow GenAI评估工作流——包括、评分器/评审模型(scorers/judges)、数据集、追踪设置以及五步评估循环。
mlflow/skillsagent-evaluationinstrumenting-with-mlflow-tracinganalyze-mlflow-traceretrieving-mlflow-tracesquerying-mlflow-metricsmlflow.genai.evaluate()本技能在上述工作流基础上叠加了Databricks专属模式,而非重复通用内容。当你需要以下任意功能时,使用本技能:
- Unity Catalog追踪数据摄入——将生产环境追踪数据写入UC表,实现基于日志的监控()。
patterns-trace-ingestion.md - 通过UC领域专家(SME)标注会话实现MemAlign评审模型对齐——针对在Databricks收集的领域专家反馈,对齐自定义评审模型()。
patterns-judge-alignment.md - GEPA循环——运行Databricks的自动提示词优化驱动程序,基于UC数据集执行优化(
optimize_prompts())。patterns-prompt-optimization.md - Databricks风格的评分器/数据集模式——基于UC表的数据集、在Databricks UI中标记追踪数据以纳入数据集(、
patterns-datasets.md)。patterns-scorers.md
对于其他场景——通用调用、评分器编写模式、Databricks外的数据集创建、非UC表绑定的MLflow追踪设置——上游技能是权威来源,由MLflow团队持续维护更新。
mlflow.genai.evaluate()mlflow/skills/agent-evaluationBefore Writing Any Code
编写代码前的准备
- Read GOTCHAS.md - 15+ common mistakes that cause failures
- Read CRITICAL-interfaces.md - Exact API signatures and data schemas
- 阅读GOTCHAS.md——包含15+种导致失败的常见错误
- 阅读CRITICAL-interfaces.md——明确API签名和数据 schema
End-to-End Workflows
端到端工作流
Follow these workflows based on your goal. Each step indicates which reference files to read.
根据你的目标选择以下工作流,每个步骤标注了需参考的文件。
Workflow 1: First-Time Evaluation Setup
工作流1:首次评估设置
For users new to MLflow GenAI evaluation or setting up evaluation for a new agent.
| Step | Action | Reference Files |
|---|---|---|
| 1 | Understand what to evaluate | |
| 2 | Learn API patterns | |
| 3 | Build initial dataset | |
| 4 | Choose/create scorers | |
| 5 | Run evaluation | |
适用于初次接触MLflow GenAI评估,或为新代理设置评估的用户。
| 步骤 | 操作 | 参考文件 |
|---|---|---|
| 1 | 明确评估对象 | |
| 2 | 学习API模式 | |
| 3 | 构建初始数据集 | |
| 4 | 选择/创建评分器 | |
| 5 | 运行评估 | |
Workflow 2: Production Trace -> Evaluation Dataset
工作流2:生产追踪数据 → 评估数据集
For building evaluation datasets from production traces.
| Step | Action | Reference Files |
|---|---|---|
| 1 | Search and filter traces | |
| 2 | Analyze trace quality | |
| 3 | Tag traces for inclusion | |
| 4 | Build dataset from traces | |
| 5 | Add expectations/ground truth | |
适用于从生产环境追踪数据构建评估数据集。
| 步骤 | 操作 | 参考文件 |
|---|---|---|
| 1 | 搜索并过滤追踪数据 | |
| 2 | 分析追踪数据质量 | |
| 3 | 标记需纳入的追踪数据 | |
| 4 | 从追踪数据构建数据集 | |
| 5 | 添加预期结果/基准事实 | |
Workflow 3: Performance Optimization
工作流3:性能优化
For debugging slow or expensive agent execution.
| Step | Action | Reference Files |
|---|---|---|
| 1 | Profile latency by span | |
| 2 | Analyze token usage | |
| 3 | Detect context issues | |
| 4 | Apply optimizations | |
| 5 | Re-evaluate to measure impact | |
适用于调试执行缓慢或成本高昂的代理。
| 步骤 | 操作 | 参考文件 |
|---|---|---|
| 1 | 按跨度分析延迟 | |
| 2 | 分析令牌使用情况 | |
| 3 | 检测上下文问题 | |
| 4 | 应用优化方案 | |
| 5 | 重新评估以衡量优化效果 | |
Workflow 4: Regression Detection
工作流4:回归检测
For comparing agent versions and finding regressions.
| Step | Action | Reference Files |
|---|---|---|
| 1 | Establish baseline | |
| 2 | Run current version | |
| 3 | Compare metrics | |
| 4 | Analyze failing traces | |
| 5 | Debug specific failures | |
适用于对比代理版本并发现回归问题。
| 步骤 | 操作 | 参考文件 |
|---|---|---|
| 1 | 建立基准线 | |
| 2 | 运行当前版本 | |
| 3 | 对比指标 | |
| 4 | 分析失败的追踪数据 | |
| 5 | 调试特定失败案例 | |
Workflow 5: Custom Scorer Development
工作流5:自定义评分器开发
For creating project-specific evaluation metrics.
| Step | Action | Reference Files |
|---|---|---|
| 1 | Understand scorer interface | |
| 2 | Choose scorer pattern | |
| 3 | For multi-agent scorers | |
| 4 | Test with evaluation | |
适用于创建项目专属的评估指标。
| 步骤 | 操作 | 参考文件 |
|---|---|---|
| 1 | 理解评分器接口 | |
| 2 | 选择评分器模式 | |
| 3 | 多代理评分器相关 | |
| 4 | 通过评估测试评分器 | |
Workflow 6: Unity Catalog Trace Ingestion & Production Monitoring
工作流6:Unity Catalog追踪数据摄入与生产监控
For storing traces in Unity Catalog, instrumenting applications, and enabling continuous production monitoring.
| Step | Action | Reference Files |
|---|---|---|
| 1 | Link UC schema to experiment | |
| 2 | Set trace destination | |
| 3 | Instrument your application | |
| 4 | Configure trace sources (Apps/Serving/OTEL) | |
| 5 | Enable production monitoring | |
| 6 | Query and analyze UC traces | |
适用于将追踪数据存储到Unity Catalog、为应用添加埋点、启用持续生产监控。
| 步骤 | 操作 | 参考文件 |
|---|---|---|
| 1 | 将UC schema关联到实验 | |
| 2 | 设置追踪数据目标 | |
| 3 | 为应用添加埋点 | |
| 4 | 配置追踪数据源(应用/服务/OTEL) | |
| 5 | 启用生产监控 | |
| 6 | 查询并分析UC追踪数据 | |
Workflow 7: Judge Alignment with MemAlign
工作流7:借助MemAlign对齐评审模型
For aligning an LLM judge to match domain expert preferences. A well-aligned judge improves every downstream use: evaluation accuracy, production monitoring signal, and prompt optimization quality. This workflow is valuable on its own, independent of prompt optimization.
| Step | Action | Reference Files |
|---|---|---|
| 1 | Design base judge with | |
| 2 | Run evaluate(), tag successful traces | |
| 3 | Build UC dataset + create SME labeling session | |
| 4 | Align judge with MemAlign after labeling completes | |
| 5 | Register aligned judge to experiment | |
| 6 | Re-evaluate with aligned judge (baseline) | |
适用于让LLM评审模型匹配领域专家偏好。对齐良好的评审模型可提升所有下游场景的效果:评估准确性、生产监控信号质量、提示词优化效果。本工作流可独立于提示词优化使用,自身具备很高价值。
| 步骤 | 操作 | 参考文件 |
|---|---|---|
| 1 | 使用 | |
| 2 | 运行evaluate(),标记成功的追踪数据 | |
| 3 | 构建UC数据集 + 创建领域专家标注会话 | |
| 4 | 标注完成后通过MemAlign对齐评审模型 | |
| 5 | 将对齐后的评审模型注册到实验 | |
| 6 | 使用对齐后的评审模型重新评估(建立基准) | |
Workflow 8: Automated Prompt Optimization with GEPA
工作流8:借助GEPA实现自动提示词优化
For automatically improving a registered system prompt using . Works with any scorer, but paired with an aligned judge (Workflow 7) gives the most domain-accurate signal. For the full end-to-end loop combining alignment and optimization, see Journey 10.
optimize_prompts()user-journeys.md| Step | Action | Reference Files |
|---|---|---|
| 1 | Build optimization dataset (inputs + expectations) | |
| 2 | Run optimize_prompts() with GEPA + scorer | |
| 3 | Register new version, promote conditionally | |
适用于使用自动优化已注册的系统提示词。可搭配任意评分器使用,但与对齐后的评审模型(工作流7)结合时,能获得最贴合领域的准确信号。如需结合对齐与优化的完整端到端循环,请查看的旅程10。
optimize_prompts()user-journeys.md| 步骤 | 操作 | 参考文件 |
|---|---|---|
| 1 | 构建优化数据集(输入+预期结果) | |
| 2 | 使用GEPA + 评分器运行optimize_prompts() | |
| 3 | 注册新版本,按需推广 | |
Reference Files Quick Lookup
参考文件速查
| Reference | Purpose | When to Read |
|---|---|---|
| Common mistakes | Always read first before writing code |
| API signatures, schemas | When writing any evaluation code |
| Running evals, comparing | When executing evaluations |
| Custom scorer creation | When built-in scorers aren't enough |
| Dataset building | When preparing evaluation data |
| Trace debugging | When analyzing agent behavior |
| Token/latency fixes | When agent is slow or expensive |
| UC trace setup, monitoring | When setting up trace storage or production monitoring |
| MemAlign judge alignment, labeling sessions, SME feedback | When aligning judges to domain expert preferences |
| GEPA optimization: build dataset, optimize_prompts(), promote | When running automated prompt improvement |
| High-level workflows, full domain-expert optimization loop | When starting a new evaluation project or running the full align + optimize cycle |
| 参考文件 | 用途 | 阅读时机 |
|---|---|---|
| 常见错误汇总 | 编写代码前务必阅读 |
| API签名、schema | 编写任何评估代码时 |
| 运行评估、对比结果 | 执行评估任务时 |
| 创建自定义评分器 | 内置评分器无法满足需求时 |
| 构建数据集 | 准备评估数据时 |
| 追踪数据调试 | 分析代理行为时 |
| 令牌/延迟优化 | 代理执行缓慢或成本过高时 |
| UC追踪设置、监控 | 设置追踪数据存储或生产监控时 |
| MemAlign评审模型对齐、标注会话、领域专家反馈 | 让评审模型匹配领域专家偏好时 |
| GEPA优化:构建数据集、optimize_prompts()、版本推广 | 运行自动提示词优化时 |
| 高阶工作流、完整领域专家优化循环 | 启动新评估项目或运行完整对齐+优化循环时 |
Critical API Facts
关键API要点
- Use: (NOT
mlflow.genai.evaluate())mlflow.evaluate() - Data format: (nested structure required)
{"inputs": {"query": "..."}} - predict_fn: Receives (not a dict)
**unpacked kwargs - MemAlign: Scorer-agnostic (works with any -- float, bool, categorical); token-heavy on the embedding model so set
feedback_value_typeexplicitlyembedding_model - Label schema name matching: The label schema in the labeling session MUST match the judge
nameused innameforevaluate()to pair scoresalign() - Aligned judge scores: May be lower than unaligned judge scores -- this is expected and means the judge is now more accurate, not that the agent regressed
- GEPA optimization dataset: Must have both AND
inputsper record (different from eval dataset)expectations - Episodic memory: Lazily loaded -- results won't show episodic memory on print until the judge is first used
get_scorer() - optimize_prompts: Requires MLflow >= 3.5.0
See for complete list.
GOTCHAS.md- 使用: (而非
mlflow.genai.evaluate())mlflow.evaluate() - 数据格式: (必须使用嵌套结构)
{"inputs": {"query": "..."}} - predict_fn: 接收(而非字典)
**unpacked kwargs - MemAlign: 与评分器无关(支持任意——浮点数、布尔值、分类值);嵌入模型令牌消耗较大,请显式设置
feedback_value_typeembedding_model - 标签schema名称匹配: 标注会话中的标签schema必须与
name中使用的评审模型evaluate()一致,才能让name匹配评分结果align() - 对齐后评审模型的评分: 可能低于未对齐评审模型的评分——这是正常现象,说明评审模型现在更准确,而非代理性能退化
- GEPA优化数据集: 每条记录必须同时包含和
inputs(与评估数据集不同)expectations - 情景记忆: 延迟加载——的结果在打印时不会显示情景记忆,直到评审模型首次被使用
get_scorer() - optimize_prompts: 需要MLflow >= 3.5.0
完整列表请查看。
GOTCHAS.mdRelated Skills
相关技能
- databricks-docs - General Databricks documentation reference
- databricks-model-serving - Deploying models and agents to serving endpoints
- databricks-agent-bricks - Building agents that can be evaluated with this skill
- databricks-python-sdk - SDK patterns used alongside MLflow APIs
- databricks-unity-catalog - Unity Catalog tables for managed evaluation datasets
- databricks-docs - Databricks通用文档参考
- databricks-model-serving - 将模型和代理部署到服务端点
- databricks-agent-bricks - 构建可通过本技能评估的代理
- databricks-python-sdk - 与MLflow API搭配使用的SDK模式
- databricks-unity-catalog - 用于托管评估数据集的Unity Catalog表",