Design Once, Deploy at Scale: Building a Template-Driven ML Ecosystem
本文为原文前 6,000 字符的节选翻译,完整内容请查看原文。
Design Once, Deploy at Scale: Building a Template-Driven ML Ecosystem
By Anirudh Agrawal, Djordje Gligorijevic, Yao Xuan, Peggy Yao, Jiang Liu, John Martabano Landy, Rahul Suresh As ML ecosystems grow to a large number of production models, the bottleneck is no longer inventing new techniques to improve these models, but rather shipping them reliably and efficiently across a fragmented model space, creating a rising tide that lifts all the boats.
随着机器学习生态系统发展出大量生产模型,瓶颈不再是发明改进这些模型的新技术,而是在碎片化的模型空间中可靠且高效地部署它们,从而实现“水涨船高”的整体提升。
At Meta, we built a template-driven approach that standardizes model design into a small set of reusable and composable building blocks, turning model iteration from a per-model problem into a shared systems problem. Over the last two years, this approach reduced per-model engineering time by 92%, shipped 5000+ technique-model combinations, improved offline model quality by 0.63% on average at neutral serving capacity, and delivered 0.86% cumulative online lift covering 70% of models by count.
在 Meta,我们构建了一种模板驱动的方法,将模型设计标准化为一组可重用且可组合的构建块,将模型迭代从“每个模型单独处理”的问题转变为“共享系统”的问题。在过去两年中,该方法使每个模型的工程时间减少了 92%,部署了 5000 多种技术与模型的组合,在服务容量不变的情况下,离线模型质量平均提高了 0.63%,并为 70% 的模型带来了 0.86% 的累计在线提升。
This work is fully detailed in our paper, “Design Once, Deploy at Scale: Template-Driven ML Development for Large Model Ecosystems.” Meta’s ads ranking systems process billions of daily requests across a diverse array of products and optimization goals, served by a large number of production models. At that scale, the main challenge in improving user relevance and advertiser value has shifted from inventing new techniques to propagating them.
这项工作在我们的论文《一次设计,规模化部署:大型模型生态系统的模板驱动机器学习开发》中有详细介绍。Meta 的广告排名系统每天处理数十亿次请求,涵盖多种产品和优化目标,并由大量生产模型提供支持。在这种规模下,提高用户相关性和广告商价值的主要挑战已从发明新技术转向了如何推广这些技术。
Every high-impact idea needs to reach every model it applies to, and adapting it one model at a time does not scale with the fleet. Fragmentation compounds quickly in large-scale ML systems. A new architecture lands on one model, but bringing it to every corner of the ecosystem may take years. A platform migration works for one family of models, but breaks on a long tail of specialized configurations. A tuning insight improves one model, but says little about the next one because the underlying setup is too different. Over time, propagation becomes more difficult than the innovation itself.
每一个高影响力的想法都需要触达其适用的所有模型,而逐个模型进行适配无法满足大规模系统的需求。碎片化在大型机器学习系统中会迅速加剧。一种新架构可能在一个模型上落地,但要将其推广到生态系统的每个角落可能需要数年时间。平台迁移可能适用于一个模型系列,但在处理长尾的特殊配置时却会失败。一个调优见解可能改进了一个模型,但对下一个模型却毫无参考价值,因为底层的设置差异太大。久而久之,推广变得比创新本身更困难。
Meta’s ads ranking ecosystem ran into this exact problem. As the number of production models grew with the diversity of ads optimization objectives, so did the diversity of architectures, features, training settings, serving constraints, and platform-specific logic. That diversity gave teams flexibility, but it also created three systemic problems: high engineering cost to ship new ideas broadly, high reliability cost from an explosion of corner cases, and low predictability when trying to estimate the ecosystem-wide impact of a change.
Meta 的广告排名生态系统就遇到了这个问题。随着生产模型数量的增加以及广告优化目标的多样化,架构、特征、训练设置、服务约束和平台特定逻辑的多样性也随之增加。这种多样性赋予了团队灵活性,但也带来了三个系统性问题:广泛部署新想法的工程成本高昂,因极端情况激增导致的可靠性成本高昂,以及在评估变更对整个生态系统的影响时缺乏可预测性。
The deeper issue is that fragmentation creates an unfavorable scaling law for engineering itself. If each idea must be evaluated and adapted per model, the work grows linearly with the number of models. That is manageable early on, but becomes a serious bottleneck when you have a large number of models. Fragmentation also weakens automation. AutoML and optimization systems work best in a structured space, but when every model has a different shape, the highest-potential techniques reach only a subset of models.
更深层次的问题在于,碎片化为工程本身创造了一种不利的扩展规律。如果每个想法都必须针对每个模型进行评估和适配,工作量就会随着模型数量的增加而线性增长。这在早期尚可管理,但当模型数量庞大时,就会成为严重的瓶颈。碎片化也削弱了自动化。自动机器学习(AutoML)和优化系统在结构化空间中表现最佳,但当每个模型的形态各异时,最具潜力的技术只能触达一小部分模型。
Our answer was not to add another layer of automation on top of this complexity. Instead, we started by reducing the complexity itself. We did this by introducing Standard Model Templates (SMT), an approach that standardizes model design into a curated set of reusable templates. Figure 1: Before SMT, each technique was tuned by hand on each model, and the combinations to try grew exponentially. With SMT, multi-model optimization tunes techniques once across representative models, and the ones that generalize go into the next template version.
我们的解决方案不是在这些复杂性之上再增加一层自动化,而是从降低复杂性本身入手。我们引入了标准模型模板(SMT),这是一种将模型设计标准化为一组精选的可重用模板的方法。图 1:在 SMT 之前,每项技术都需要在每个模型上手动调优,尝试的组合呈指数级增长。有了 SMT,多模型优化可以在代表性模型上对技术进行一次性调优,而那些具有通用性的技术会被纳入下一个模板版本。
A Template-Driven Foundation A template is an opinionated, minimal model setup built from shared components such as architecture choices, feature logic, training settings, and serving configs. Instead of maintaining every production model as a largely independent design, we group similar models around a smaller number of standard templates. Model-specific logic still exists where necessary, but the common parts are explicitly represented and shared.
模板驱动的基础:模板是一种基于共享组件(如架构选择、特征逻辑、训练设置和服务配置)构建的、具有特定倾向的最小化模型设置。我们不再将每个生产模型维护为基本独立的设计,而是将相似的模型归类到少数几个标准模板中。模型特定的逻辑在必要时依然存在,但公共部分被显式地表示并共享。
In practice, we use a small set of templates that cover major ranking and retrieval patterns across different model sizes. These templates package reusable components for feature selection, feature interaction, model parallelism, training configuration, and hardware-aware serving. This changes the operating model in an important way. Instead of evaluating a new idea independently on every model, we can evaluate it on a much smaller set of representative templates and then propagate it to the model groups that use them. In other words, we shift from per-model iteration to template-level iteration.
在实践中,我们使用少量模板来覆盖不同模型规模下的主要排名和检索模式。这些模板封装了用于特征选择、特征交互、模型并行、训练配置和硬件感知服务的可重用组件。这在很大程度上改变了运营模式。我们不再在每个模型上独立评估一个新想法,而是在一小组代表性模板上进行评估,然后将其推广到使用这些模板的模型组。换句话说,我们将迭代方式从“每个模型”转向了“模板级别”。
That gives us three main advantages. Reduced propagation complexity: A shared template lets one implementation serve many downstream models, which lowers the cost of shipping new ideas at scale. Improved reliability: When there are fewer unique model setups, it becomes practical to build stronger validation, better guardrails, and more transferable debugging workflows. Problems such as training instability or serving regressions become easier to reason about because they occur within a shared template structure rather than an unbounded configuration space. Improved predictability: When models in a group share a common template, performance on representative models becomes a much better signal for the rest of the group. That makes ecosystem-wide planning more grounded and less assumption-driven.
这为我们带来了三个主要优势。降低推广复杂性:共享模板使一种实现可以服务于多个下游模型,从而降低了大规模部署新想法的成本。提高可靠性:当独特的模型设置减少时,构建更强的验证、更好的护栏和更具可移植性的调试工作流变得切实可行。训练不稳定或服务回归等问题变得更容易分析,因为它们发生在共享的模板结构内,而不是无限的配置空间中。提高可预测性:当一组模型共享一个通用模板时,代表性模型上的性能表现能为该组中的其他模型提供更好的信号。这使得整个生态系统的规划更加扎实,减少了对假设的依赖。
Over time, this template-driven approach became more than a standardization effort. It became the foundation for a broader ML development system. Figure 2: The SMT development loop (left) and the layered architecture inside each template (right). Techniques are tuned once across representative models, added to a new template version, and rolled out to every model built on it. SMTs: From Standardization to Scalable Technique Transfer The shift to SMTs unlocked a more ambitious capability — the ability to optimize the entire ecosystem as a single, cohesive unit. Rather than managing a fleet of in
随着时间的推移,这种模板驱动的方法不仅仅是一项标准化工作,它成为了更广泛的机器学习开发系统的基础。图 2:SMT 开发循环(左)和每个模板内部的分层架构(右)。技术在代表性模型上进行一次性调优,添加到新的模板版本中,并推广到基于该模板构建的每个模型。SMT:从标准化到可扩展的技术迁移。向 SMT 的转变解锁了一项更宏大的能力——即能够将整个生态系统作为一个统一的整体进行优化,而不是管理一堆……