Improving machine learning iteration speed with faster application build and packaging
Meta cut ML engineers' build and packaging overhead by double-digit percentages by tackling build non-determinism, pruning dependencies, and replacing monolithic XAR executables with an incremental Content Addressable Filesystem (CAF). Non-determinism from compilers and build rules is mitigated inside the Remote Execution service that Buck2 sends nearly all build actions to, so stable warm revisions can reuse cached outputs. CAF describes each executable as a flat manifest of content digests, skips uploads already in CAS, and fetches only missing content via per-host CAS daemons that share data peer-to-peer over Owl. Btrfs compression and copy-on-write keep on-disk size close to XAR while sharing files across executables. Planned next steps are lazy on-demand fetching (LazyCAF) and putting all ML engineers on uniform revisions to raise cache hit rates.
Related posts
- Large-scale distributed builds with Microsoft Build Accelerator
Engineering@Microsoft easyNoviceMicrosoft's BuildXL distributes and caches builds for its largest codebases. Runtime file access monitoring fails the build whenever a process reads unpredicted inputs or writes conflicting outputs, which makes incremental builds trustworthy enough to ship from. Its key caching change is a two-phase cache lookup: the fingerprint combines statically predicted inputs with dynamically observed ones, such as the subset of headers a C++ compiler actually reads. This avoids both over-approximated inputs and hand-maintained dependency annotations. Together with CloudBuild, it cut builds that took over 24 hours down to minutes, at the scale of millions of process invocations.
- Optimizing Our E2E Pipeline
Slack Engineering mediumAdeptSlack cut redundant frontend builds in its monorepo E2E pipeline by using `git diff` three-dot notation against `main` to detect whether a PR touches frontend code, and when it doesn't, serving a recent production frontend build from S3 through an internal CDN instead of rebuilding. The check and artifact lookup take under 3 seconds across 100,000+ tracked files. Frontend build frequency dropped 60%, average build time fell from ~5 to ~2 minutes (from ~10 minutes at the start of the year, counting an earlier Webpack upgrade), several terabytes of monthly S3 storage were saved, and E2E test flakiness reached its lowest measured level.
- Build faster with Buck2: Our open source build system
Meta Engineering mediumAdeptBuck2 is Meta's from-scratch rewrite of Buck, open sourced with a Rust core and all language rules written in Starlark, and it completes builds about twice as fast as Buck1 internally. Its speed comes from a single incremental dependency graph held by a persistent daemon instead of separate target/action graph phases, plus Bazel-compatible remote execution and integration with virtual file systems via Watchman and Sapling. New rule primitives make complex patterns safe and efficient: dynamic_output lets rules run tools like ocamldep and wire dependencies from their output, and transitive-sets (tsets) avoid O(n²) memory for C++ link closures. The open source release is nearly identical to Meta's internal version and is aimed mainly at moderately sized multi-language projects.
- 5 Things you didn’t know about Buck2
Meta Engineering easyNoviceBuck2, Meta's open-source successor to the Buck build system, completes builds roughly 2x faster than Buck1 in internal tests. Its core is written in Rust, chosen over Java, Haskell and Go for performance, memory control without GC over large graphs, and safe concurrency, while rules are written in Starlark. With remote execution it can skip downloading intermediate outputs by tracking only their hashes. It uses 11 distinct path types for type safety, keeps all language knowledge out of the core in a replaceable Starlark prelude, and offers BXL for querying the build graph and defining new actions, for example to generate IDE projects.
- Build better software to build software better
Slack Engineering mediumAdeptSlack cut the 60-minute build pipeline for Quip and Slack Canvas's backend by applying classic software engineering principles (hermetic, idempotent, granular units of work and clean separation of concerns) before adopting Bazel. A dependency edge from the built Python backend into the TypeScript frontend build zeroed the cache hit rate and cost about 35 minutes per build. The team untangled build code from application code, rewrote orchestration in Starlark, cut Python build scripts down to the standard library only, and used a Rust diffing tool to verify the new artifacts matched the old ones. The core lesson is that Bazel's caching and parallelism only pay off once the build graph is acyclic, well-defined and finely granular.