Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Meta Engineering 5 min read Case study easyNovice

Lazy is the new fast: How Lazy Imports and Cinder accelerate machine learning at Meta

Meta rolled out the Cinder Python runtime with Lazy Imports, which transparently defers all imports until first use, across ML frameworks and Jupyter kernels. The change cut time to first batch (TTFB) by up to 40 percent and Jupyter kernel startup by 20 percent. Unlike importlib's LazyLoader, it needs no hand-picked lazy imports and removes the need for TYPE_CHECKING guards. Libraries such as PyTorch, NumPy, SciPy and Numba broke because they depend on import side effects and ordering, so Meta enables lazy imports only during startup and preparation and turns them off before the first batch.

Related posts

  • Meta contributes new features to Python 3.12

    Meta Engineering mediumAdept

    Meta upstreamed several features into CPython 3.12, many derived from its Cinder runtime: immortal objects (PEP 683) that skip reference counting to cut copy-on-write memory in forked Instagram workers, the @typing.override decorator (PEP 698), and inlined comprehensions (PEP 709) running up to 2x faster. Other changes include opt-in eager asyncio tasks that resolve immediately-available results without event-loop scheduling, a LOAD_SUPER_ATTR opcode that avoids allocating super objects, and new async_tree and comprehension benchmarks in pyperformance. New runtime hooks, including vectorcall entrypoints, dict/type/function/code watchers, and a thread-safe perf-map API, let third-party JITs like CinderX plug into CPython.

  • AI Lab: The secrets to keeping machine learning engineers moving fast

    Meta Engineering mediumAdept

    Meta's AI Lab is a pre-production framework that continuously runs shrunk, often CPU-only versions of common ML training workflows as A/B tests to measure time to first batch (TTFB), the delay from job submission to the first training batch. It catches regressions before release and lets infra owners validate improvements in under an hour. During the Cinder Python runtime rollout, it helped engineers double their TTFB gains, reaching up to 40%, for example by fixing memoization that triggered expensive repr() calls. It also caught an unrelated blocking-logging regression and attributed it to the specific change. To scale, it runs cheap tests on code changes and broader tests with bisect-style attribution on releases, flagging changes via t-tests, confirmation runs and ROC-tuned thresholds that cap false positives.

  • Serverless Jupyter Notebooks at Meta

    Meta Engineering mediumAdept

    Meta's Bento notebook platform now runs "lite" workloads directly in the browser using Pyodide on WebAssembly, skipping the slow remote-compute reservation step. A kernel bridge lets the Pyodide kernel speak the Jupyter protocol like server kernels, a web worker keeps expensive kernel operations off the main thread, and middleware intercepts cell magics (%%sql, %%googlesheet, %%graphql, %%dataframe) in JavaScript and injects their results into the Python kernel. Uploads are handed off to async Tupperware jobs. The main limitation is that internal libraries not ported to Wasm are unavailable. Planned work includes auto-detecting lite workloads and falling back to server kernels when needed.

  • Introducing ModuleLens: Zooming into PyTorch Modules for Human and Agentic Engineering

    Pinterest Engineering hardMaster

    ModuleLens lets Pinterest ML engineers capture any PyTorch module from a sharded multi-GPU recommendation model and rebuild it locally within seconds, replacing full-model initialization with a "module-first" workflow. A ModuleTracer uses forward hooks to record inputs, outputs, state_dicts and runtime metadata. It captures __init__ arguments by patching Python's __import__ and stops tracing after a single post-warmup training step, logging only shapes for large tensors and deduplicating shared ones. Captured modules are versioned in a Weights & Biases Registry, indexed by a hash of model and module name, and consumed through a Jupyter extension, an IPython CLI, and Agent Skills for LLM agents. Internal uses include a training bottleneck analyzer, an LLM-driven GPU kernel generator, and scaling-law ROI tooling.

  • What the interns have wrought, special jumbo 2026 edition

    Jane Street Tech Blog easyNovice

    Jane Street's 2026 interns shipped projects across ML research, software engineering, Linux engineering, IT, trading desk operations and strategy. Highlights include an activation checkpointing scheme that beats PyTorch's by greedily recomputing the nodes with the cheapest recompute cost per byte freed in the torch.compile dynamo graph, and a dense topic index for tip recovery in the Aria messaging framework that cut CPU use by 30%. Other projects include an OCaml-native FUSE server for the Depot object store reaching 1.3 GiB/s, and a kernel log reporter that falls back to pstore when disk and network fail. Research work covered diffusion models of market data and reducing memorization in LLMs, and an OxCaml SPMD DSL targets CPU SIMD instructions.

The quest for software engineering knowledge.

Look:
Layout: