Communitygithub.com

mle-workflow

生产级机器学习工程工作流,涵盖数据契约、可复现训练、模型评估、部署、监控和回滚。在构建、审查或加固超越一次性笔记的ML系统时使用。

mle-workflow 是什么?

此技能为将模型工作转化为生产级ML系统提供了一套完整的工作流,强调数据契约、可复现训练、可量化的质量门禁、可部署的制品以及可操作的监控。它适用于规划或审查生产ML功能(如排名、推荐、分类器、嵌入、时序预测)、将笔记本代码转换为训练/评估/推理流水线,以及设计模型发布标准、评估、实验追踪和回滚路径。该技能不强制使用固定的架构,而是根据项目需求选择相关模块,并可与现有软件工程工作流(如产品能力、代码审查、测试、部署、监控)无缝集成。通过使用迭代契约和决策脑回路,该技能帮助团队聚焦于具体业务决策、犯错误成本以及可逆的下一步,从而避免在不明确的目标或过度的MLOps工具上浪费时间。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/affaan-m/ECC/tree/main/skills/mle-workflow

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

机器学习工程工作流

使用此技能,将模型工作转化为一个具有明确数据契约、可重复训练、可测量质量门禁、可部署制品和可操作监控的生产级ML系统。

何时激活

  • 规划或审查一个生产ML特性、模型刷新、排名系统、推荐器、分类器、嵌入工作流或预测管线时
  • 将笔记本代码转换为可重用的训练、评估、批量推理或在线推理管线时
  • 设计模型升级标准、离线/在线评估、实验追踪或回滚路径时
  • 调试由数据漂移、标签泄漏、过时特征、制品不匹配或不一致的训练和服务逻辑引起的故障时
  • 添加模型监控、金丝雀发布、影子流量或部署后质量检查时

范围校准

仅使用适合您当前系统的部分。该技能适用于排名、搜索、推荐、分类器、预测、嵌入、大语言模型工作流、异常检测和批量分析,但它不应迫使所有系统都采用一种架构。

  • 不要假设每个模型都有监督标签、在线服务、特征存储、PyTorch、GPU、人工审核、A/B测试或实时反馈。
  • 当一份数据契约、基线、评估脚本和回滚说明就足以让变更可审查时,不要添加沉重的MLOps工具。
  • 当项目缺少标签、延迟结果、切片定义、生产流量或监控所有权时,要明确说明假设。
  • 将示例视为可互换的脚手架。将指标、服务模式、数据存储和发布机制替换为项目本地的等价物。

相关技能

  • python-patterns 和 python-testing 用于Python实现和pytest覆盖率
  • pytorch-patterns 用于深度学习模型、数据加载器、设备处理和训练循环
  • eval-harness 和 ai-regression-testing 用于升级门禁和代理辅助的回归检查
  • database-migrations、postgres-patterns 和 clickhouse-io 用于数据存储和分析表面
  • deployment-patterns、docker-patterns 和 security-review 用于服务、密钥、容器和生产加固

复用SWE表面

不要将机器学习工程与软件工程分开对待。大多数ECC SWE工作流直接适用于ML系统,而且通常具有更严格的故障模式:

推荐的 minimal --with capability:machine-learning 安装使得核心代理表面与该技能同时可用。对于仅技能或代理受限的环境,在目标支持代理的情况下,将 skill:mle-workflow 与 agent:mle-reviewer 配对。

SWE 表面MLE 用途
product-capability / architecture-decision-records将模型工作转化为明确的产品契约,并记录不可逆的数据、模型和发布选择
repo-scan / codebase-onboarding / code-tour在引入并行ML栈之前,找到现有的训练、特征、服务、评估和监控路径
plan / feature-dev将模型变更作为包含数据、评估、服务和回滚阶段的产品能力来规划
tdd-workflow / python-testing在实现之前测试特征转换、拆分逻辑、指标计算、制品加载和推理模式
code-reviewer / mle-reviewer审查代码质量以及ML特有的泄漏、可复现性、升级和监控风险
build-fix / pr-test-analyzer诊断断裂的CI、不稳定的评估、缺失的fixture以及环境特定的模型或依赖失败
quality-gate / test-coverage要求对转换、指标、推理契约、升级门禁和回滚行为提供自动化证据
eval-harness / verification-loop将离线指标、切片检查、延迟预算和回滚演练转化为可重复的门禁
ai-regression-testing将每个生产bug保留为回归测试:缺失特征、过时标签、糟糕制品、模式漂移或服务不匹配
api-design / backend-patterns设计预测API、批处理作业、幂等再训练端点和响应信封
database-migrations / postgres-patterns / clickhouse-io版本化标签、特征快照、预测日志、实验指标和漂移分析
deployment-patterns / docker-patterns打包可复现的训练和服务镜像,包含健康检查、资源限制和回滚
canary-watch / dashboard-builder通过包含模型版本、切片、漂移、延迟、成本和延迟标签的仪表盘使发布健康可见
security-review / security-scan检查模型制品、笔记本、提示词、数据集和日志中是否包含密钥、PII、不安全的反序列化和供应链风险
e2e-testing / browser-qa / accessibility测试使用预测结果的关键产品流程,包括可解释性和回退UI状态
benchmark / performance-optimizer测量吞吐量、p95延迟、内存、GPU利用率和每次预测或再训练的成本
cost-aware-llm-pipeline / token-budget-advisor根据质量、延迟和预算路由LLM/嵌入工作负载,而不是默认使用最大的模型
documentation-lookup / search-first在编码前验证当前库在模型服务、特征存储、向量数据库和评估工具方面的行为
git-workflow / github-ops / opensource-pipeline将MLE变更打包以供审查,包含清晰的范围、排除生成的制品以及可复现的测试证据
strategic-compact / dmux-workflows将较长的ML工作拆分为并行轨道:数据契约、评估工具、服务路径、监控和文档

十个MLE任务模拟

在规划或审查MLE工作时,使用这些模拟作为覆盖检查。一个强大的MLE工作流应将每个任务减少为明确的契约、可重用的SWE表面、自动化证据和可审查的制品。

ID常见MLE任务简化的ECC路径必需输出覆盖的管线车道
MLE-01规划一个模糊的预测、排名、推荐器、分类器、嵌入或预测能力product-capability, plan, architecture-decision-records, mle-workflow迭代契约:命名、关注者、决策负责人、成功指标、不可接受的错误、假设、约束和首次实验产品契约、利益相关者损失、风险、发布
MLE-02定义指标目标、标签、数据源和错误预算repo-scan, database-reviewer, database-migrations, postgres-patterns, clickhouse-io数据和指标契约,包含实体粒度、标签时机、标签置信度、特征时机、时间点连接、拆分策略和数据集快照数据契约、指标设计、泄漏、可复现性
MLE-03在增加复杂性之前构建基线和评分路径tdd-workflow, python-testing, python-patterns, code-reviewer基线评分器,包含混淆矩阵、校准说明、延迟/成本估计、已知弱点以及评分形状和确定性的测试基线、评分、测试、服务一致性
MLE-04根据关于区分结果的假设生成特征python-patterns, pytorch-patterns, docker-patterns, deployment-patterns特征计划和转换模块,涵盖信号源、缺失值、异常值、相关性、泄漏检查以及训练/服务等价性特征管线、泄漏、训练、制品
MLE-05在权衡下调整阈值、配置和模型复杂度eval-harness, ai-regression-testing, quality-gate, test-coverage阈值/配置报告,比较精确率、召回率、F1、AUC、校准、组切片、延迟、成本、复杂度和可接受的错误类别评估、阈值、升级、回归
MLE-06运行错误分析并将错误转化为下一次实验eval-harness, ai-regression-testing, mle-reviewer, silent-failure-hunter错误聚类报告:假阳性、假阴性、模糊标签、过时特征、缺失信号和包含经验教训的bug追踪错误分析、bug追踪、迭代、回归
MLE-07打包模型制品用于批量或在线推理api-design, backend-patterns, security-review, security-scan带版本号的制品包,包含预处理、配置、依赖约束、模式验证、安全加载和PII安全的日志制品、安全、推理契约
MLE-08发布包含反馈捕获的在线服务或批量评分api-design, backend-patterns, e2e-testing, browser-qa, accessibility预测端点或批处理作业,包含响应信封、超时、批处理、回退、模型版本、置信度、反馈日志记录和产品流程测试服务、批量推理、回退、用户工作流
MLE-09使用影子流量、金丝雀、A/B测试或回滚发布模型canary-watch, dashboard-builder, verification-loop, performance-optimizer发布计划:命名流量拆分、仪表盘、p95延迟、成本、质量护栏、回滚制品和回滚触发器部署、金丝雀、回滚
MLE-10在发布后操作、调试和刷新生产模型silent-failure-hunter, dashboard-builder, mle-reviewer, doc-updater, github-ops观察账本和刷新计划,包含漂移检查、延迟标签健康、告警所有者、runbook更新、再训练标准和PR证据监控、事件响应、再训练

迭代契约

在接触模型代码之前,将工作压缩成一个可审查的制品。它应该足够简短,能放入PR描述,并且足够精确,让其他工程师能够质疑其中的权衡。

目标:
关注者:
决策负责人:
模型改变的用户或系统行为:
成功指标:
护栏指标:
错误预算:
不可接受的错误:
可接受的错误:
假设:
约束:
标签和数据快照:
基线:
候选信号:
阈值或配置计划:
评估切片:
已知风险:
下一次实验:
回退或回滚:

这个契约是MLE中强力SWE设计说明的等价物。它让团队避免优化一个没有人信任的指标,避免添加不能解决实际错误模式的特征,或是在没有回滚的情况下发布复杂性。

决策脑回路

当任务含糊不清、影响重大或指标繁重时,使用这个循环:

  1. 从决策开始,而不是模型。命名改变下游行为的动作。
  2. 命名谁关心以及为什么。不同的利益相关者为假阳性、假阴性、延迟、计算开销、不透明性或错失的机会付出不同的成本。
  3. 将模糊性转化为假设。询问什么信号能区分结果,什么证据能反驳它,以及什么简单的基线应该难以击败。
  4. 在发明定制系统之前,研究现有成果或邻近的已知问题。
  5. 用 (概率, 置信度) x (成本, 严重性, 重要性, 影响) 对选择进行评分。
  6. 考虑对抗行为、激励、选择性披露、分布偏移和反馈循环。
  7. 首选能减少最重要错误的最简单变更。简单不是懒惰;它是减少重大失误同时保持迭代速度的一种方式。
  8. 捕捉决策、证据、反驳论点和下一步可逆步骤。

指标与错误经济学

根据失败成本选择指标,而非习惯:

  • 尽早使用混淆矩阵,以便团队讨论具体的假阳性和假阴性,而不是抽象准确率。
  • 当不正确阳性决策的成本占主导地位时,偏好精确率。
  • 当漏检阳性的成本占主导地位时,偏好召回率。
  • 仅当精确率/召回率权衡真正平衡且可解释时,才使用F1。
  • 当排序质量比单一阈值更重要时,使用AUC或排序指标。
  • 将延迟、吞吐量、内存和成本作为一等指标进行追踪,因为它们决定了可行的模型复杂度。
  • 在庆祝离线提升之前,与基线和当前生产模型进行比较。
  • 将现实世界的反馈信号视为带有偏差、滞后和覆盖缺口的延迟标签;未经分析,不要将其视为事实真相。

每个指标选择都应说明它降低了哪种错误的成本,使哪种错误更可能发生,以及谁承担该成本。

数据与特征假设

特征应源于一种分离理论:

  • 文本、分类字段、数值历史、图关系、新近性、频率和聚合值都是候选信号家族,而非自动特征。
  • 对于每个特征家族,说明它为什么应该能分离结果,以及它如何可能泄漏未来信息。
  • 对于嘈杂标签,考虑裁决、标签置信度、软目标或置信度加权。
  • 对于类别不平衡,比较加权损失、重采样、阈值移动和校准的决策规则。
  • 对于缺失值,决定缺失是否具有信息量、是否可插补,或者是否应弃权。
  • 对于异常值,决定是裁剪、分桶、调查还是将其保留为罕见但重要的信号。
  • 对于相关特征,检查它们是冗余的、不稳定的,还是作为不可用未来状态的代理。

在错误分析表明基线失败于一个额外信号或容量合理能够修复的原因之前,不要增加模型复杂度。

错误分析循环

在每次基线运行、训练运行、阈值变更或配置变更之后:

  1. 将错误分解为假阳性、假阴性、弃权、低置信度案例和系统故障。
  2. 按共同特征对错误进行聚类:语言、实体类型、来源、时间、地理位置、设备、稀疏性、新近性、特征新鲜度、标签来源或模型版本。
  3. 将模型错误与数据错误分开

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

accessibility

Design, implement, and audit inclusive digital products using WCAG 2.2 Level AA. Use when building or auditing UI that must meet WCAG 2.2 Level AA, or when reviewing a change for keyboard, contrast, or screen-reader support.

affaan-m/content-engine

Create platform-native content systems for X, LinkedIn, TikTok, YouTube, newsletters, and repurposed multi-platform campaigns. Use when the user wants social posts, threads, scripts, content calendars, or one source asset adapted cleanly across platforms.

affaan-m/ECC

Multi-platform content distribution across X, LinkedIn, Threads, and Bluesky. Adapts content per platform using content-engine patterns. Never posts identical content cross-platform. Use when the user wants to distribute content across social platforms.

affaan-m/fal-ai-media

Unified media generation via fal.ai MCP — image, video, and audio. Covers text-to-image (Nano Banana), text/image-to-video (Seedance, Kling, Veo 3), text-to-speech (CSM-1B), and video-to-audio (ThinkSound). Use when the user wants to generate images, videos, or audio with AI.

affaan-m/manim-video

日本語翻訳:このファイルは manim-video 用の日本語翻訳が必要です

affaan-m/remotion-video-creation

Remotion のベストプラクティス - React で動画を作成する。3D、アニメーション、音声、字幕、チャート、トランジションなどをカバーするドメイン固有の29のルール。

affaan-m/video-editing

AI-assisted video editing workflows for cutting, structuring, and augmenting real footage. Covers the full pipeline from raw capture through FFmpeg, Remotion, ElevenLabs, fal.ai, and final polish in Descript or CapCut. Use when the user wants to edit video, cut footage, create vlogs, or build video content.

agent-architecture-audit

Full-stack diagnostic for agent and LLM applications. Audits the 12-layer agent stack for wrapper regression, memory pollution, tool discipline failures, hidden repair loops, and rendering corruption. Produces severity-ranked findings with code-first fixes. Essential for developers building agent applications, autonomous loops, or any LLM-powered feature. Use when an agent or LLM feature misbehaves and the failing layer is unknown, or before shipping an agent stack.

agent-eval

Head-to-head comparison of coding agents (Claude Code, Aider, Codex, etc.) on custom tasks with pass rate, cost, time, and consistency metrics. Use when choosing between coding agents, or when a change to an agent setup needs measured pass rate, cost, and time rather than an impression.

agent-harness-construction

Design and optimize AI agent action spaces, tool definitions, and observation formatting for higher completion rates. Use when defining or revising an agent

agentic-engineering

Operate as an agentic engineer using eval-first execution, decomposition, and cost-aware model routing. Use when planning or executing engineering work that agents will carry out end to end.

agentic-os

Build persistent multi-agent operating systems on Claude Code. Covers kernel architecture, specialist agents, slash commands, file-based memory, scheduled automation, and state management without external databases. Use when building a persistent multi-agent system on Claude Code with its own memory, commands, and scheduling.

agent-introspection-debugging

Structured self-debugging workflow for AI agent failures using capture, diagnosis, contained recovery, and introspection reports. Use when an agent run fails and you need a reproducible diagnosis instead of a retry.

agent-payment-x402

Add x402 payment execution to AI agents with per-task budgets, spending controls, and non-custodial wallets. Supports Base through agentwallet-sdk and X Layer through OKX Payments / OKX Agent Payments Protocol. Use when an agent must pay for something itself and needs per-task budgets, spending controls, and a non-custodial wallet.

agent-self-evaluation

Use after completing any non-trivial task. The agent self-rates its output on 5 axes — accuracy, completeness, clarity, actionability, conciseness — with concrete evidence per criterion. Produces a structured 1-5 scorecard with specific improvement suggestions.

agent-sort

Build an evidence-backed ECC install plan for a specific repo by sorting skills, commands, rules, hooks, and extras into DAILY vs LIBRARY buckets using parallel repo-aware review passes. Use when ECC should be trimmed to what a project actually needs instead of loading the full bundle.

ai-first-engineering

Engineering operating model for teams where AI agents generate a large share of implementation output. Use when setting team process, review gates, or ownership rules for a codebase largely written by agents.

ai-regression-testing

Regression testing strategies for AI-assisted development. Sandbox-mode API testing without database dependencies, automated bug-check workflows, and patterns to catch AI blind spots where the same model writes and reviews code. Use when adding regression coverage to AI-assisted code, or when the same model both wrote and reviewed a change.

android-clean-architecture

Clean Architecture patterns for Android and Kotlin Multiplatform projects — module structure, dependency rules, UseCases, Repositories, and data layer patterns. Use when structuring modules, layers, or data flow in an Android or KMP project.

angular-developer

Generates Angular code and provides architectural guidance. Trigger when creating projects, components, or services, or for best practices on reactivity (signals, linkedSignal, resource), forms, dependency injection, routing, SSR, accessibility (ARIA), animations, styling (component styles, Tailwind CSS), testing, or CLI tooling.

相关技能