---
title: "Lazy is the new fast: How Lazy Imports and Cinder accelerate machine learning at Meta"
description: "Meta rolled out the Cinder Python runtime with Lazy Imports, which transparently defers all imports until first use, across ML frameworks and Jupyter kernels."
url: "https://swe.quest/articles/lazy-is-the-new-fast-how-lazy-imports-and-cinder-accelerate-machine-learning-at-1dca895716af1470"
canonical: "https://engineering.fb.com/2024/01/18/developer-tools/lazy-imports-cinder-machine-learning-meta/"
source: "Meta Engineering"
published: "2024-01-18"
difficulty: "easy"
kind: "Case study"
reading_minutes: 5
tags: ["python","runtimes","performance","machine-learning","developer-productivity"]
---

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

A post on [Meta Engineering](https://swe.quest/sources/meta.md), published 2024-01-18, 5 min read, Case study. Original: [https://engineering.fb.com/2024/01/18/developer-tools/lazy-imports-cinder-machine-learning-meta/](https://engineering.fb.com/2024/01/18/developer-tools/lazy-imports-cinder-machine-learning-meta/)

## Summary

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.

Written by swe.quest, not by the author.

**Difficulty:** Easy: no special background needed; explains what something is and why it matters

## Topics

- [Python](https://swe.quest/tags/python.md) (Languages)
- [Runtimes & VMs](https://swe.quest/tags/runtimes.md) (Compilers & runtimes)
- [Performance engineering](https://swe.quest/tags/performance.md) (Reliability & operations)
- [Machine learning](https://swe.quest/tags/machine-learning.md) (AI & ML)
- [Developer productivity](https://swe.quest/tags/developer-productivity.md) (Engineering practices)

## Prerequisites

- Python import system ([easy posts on Python](https://swe.quest/tags/python.md?difficulty=easy))

## Keywords

Cinder, Lazy Imports, PyTorch, Jupyter, importlib, time to first batch

## Related posts

- [Meta contributes new features to Python 3.12](https://swe.quest/articles/meta-contributes-new-features-to-python-3-12-9b216e044692b29d.md): Meta Engineering · 2023-10-05 · Medium · 6 min read · Python, Runtimes & VMs, Performance engineering, Compilers, Open source
  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.
- [AI Lab: The secrets to keeping machine learning engineers moving fast](https://swe.quest/articles/ai-lab-the-secrets-to-keeping-machine-learning-engineers-moving-fast-ecc26a27b1339111.md): Meta Engineering · 2024-07-16 · Medium · 6 min read · ML platforms, Performance engineering, Testing, Developer productivity, Python
  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.
- [Serverless Jupyter Notebooks at Meta](https://swe.quest/articles/serverless-jupyter-notebooks-at-meta-852eae361d8319c8.md): Meta Engineering · 2024-06-10 · Medium · 4 min read · WebAssembly, Python, Developer tools, Browsers
  Meta's Bento notebook platform now runs "lite" workloads directly in the browser using Pyodide on WebAssembly, skipping the slow remote-compute reservation step.
- [Introducing ModuleLens: Zooming into PyTorch Modules for Human and Agentic Engineering](https://swe.quest/articles/introducing-modulelens-zooming-into-pytorch-modules-for-human-and-agentic-8767bb31b4979135.md): Pinterest Engineering · 2026-10-19 · Hard · 5 min read · ML platforms, Python, Developer productivity, AI agents, Recommendations & ranking
  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.
- [What the interns have wrought, special jumbo 2026 edition](https://swe.quest/articles/what-the-interns-have-wrought-special-jumbo-2026-edition-ccd1ba7feb2b1087.md): Jane Street Tech Blog · 2026-09-30 · Easy · 8 min read · Engineering culture, Machine learning, Linux, Performance engineering
  Jane Street's 2026 interns shipped projects across ML research, software engineering, Linux engineering, IT, trading desk operations and strategy.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
