Streamlining Machine Learning Pipelines at Amazon Prime Video with Metaflow

This is a summary of the original
Amazon Prime Video
blog. You may access their original article
here.
400%

 Increase in Project Capacity: Went from managing 1 project to 5 projects simultaneously.

67%

Reduction in Overhead: Avoided hiring 2-3 engineers for infrastructure management.

5x

 Faster Deployment: Increased velocity in building, training, and deploying ML models.

Name
Amazon Prime Video
Deployment Type
Metaflow Open Source
Founded
2005
Location
Seattle, WA
Industry
Entertainment and Digital Media
Original Article
ML Models
No items found.

Amazon Prime Video is a leading global streaming service that provides a vast library of content to millions of users worldwide. As part of Amazon’s expansive digital ecosystem, Prime Video competes directly with other streaming giants like Netflix, focusing heavily on personalized user experiences.

Nissan Pow, a seasoned machine learning engineer at Amazon Prime Video, brings years of expertise in AI and ML to the table. Nissan's journey into machine learning began with a deep fascination for its potential during his academic tenure at McGill University, leading him to apply these skills in the high-stakes environment of digital streaming.

Challenges Faced: The Need for Robust Machine Learning Pipelines

When Nissan joined Prime Video over four years ago, he quickly realized the limitations of the existing infrastructure. The lack of a centralized infrastructure team meant that individual teams were creating their own ad-hoc solutions for machine learning pipelines. This approach led to significant inefficiencies, particularly in the transition from research to production.

"We had a lot of manual processes. The research environment was different from the production environment, leading to a lot of friction when we tried to move models into production," Nissan recalled. This disparity often resulted in delays, as models built in research notebooks had to be re-engineered for production, a process that could take weeks or even months.

Nissan’s team also faced challenges with Sagemaker, Amazon’s native machine learning platform. Although Sagemaker provided a comprehensive environment for ML tasks, it lacked the flexibility needed to meet Prime Video’s specific needs. The research-to-production gap remained significant, and the team needed a solution that could bridge this divide without adding unnecessary complexity.

The Search for a Solution: Why Metaflow?

Recognizing the inefficiencies, Nissan began exploring potential solutions, leading him to Metaflow, Netflix’s open-source framework designed to streamline the building and management of ML projects. "I did some Googling, looked at what Netflix was using, and came across Metaflow," Nissan shared. The decision to explore Metaflow stemmed from its reputation for being user-friendly, well-documented, and battle-tested in production environments.

The primary requirements Nissan had in mind were clear:

  1. Ergonomics: The solution needed to be easy to use, minimizing the time between ideation and production.
  2. Environment Equivalence: The ability to seamlessly transition from local development to production without significant rework.
  3. Infrastructure Agnosticism: The flexibility to work across different backend environments without locking into a single provider or platform.

Metaflow’s ability to abstract the underlying infrastructure while allowing data scientists to maintain control over their code was a key selling point. "Metaflow allows you to live in code, keep your code completely intact, and interact with the infrastructure, even change tooling or deployment options without changing any of your code," Nissan explained.

Implementing Metaflow: Bridging the Gap

Once the decision was made to adopt Metaflow, the implementation process began. Nissan's team found the onboarding experience straightforward, with Metaflow’s native Python support enabling a smooth transition. The simplicity of setting up workflows, combined with the ability to run them both locally and in production, significantly reduced the friction the team had previously encountered.

One of the standout features for Nissan was Metaflow’s support for local development. "Local development is a first-class citizen in Metaflow," he noted, emphasizing how this capability made debugging and scaling up much more manageable. The ability to write a workflow once and then execute it across different environments, from local machines to cloud infrastructure, was a game-changer.

However, implementing Metaflow was not without its challenges. The team had to build certain capabilities internally, particularly around CI/CD processes, which Metaflow did not fully support at the time. "Metaflow is very focused on the research side of things," Nissan pointed out. To address this, his team developed additional tools to manage model deployment, monitoring, and rollback processes, ensuring that their models could be safely and efficiently moved from development to production.

Transforming the Machine Learning Workflow

The adoption of Metaflow at Amazon Prime Video has led to substantial improvements in the machine learning pipeline, particularly in terms of development speed and operational efficiency. With Metaflow, the team could now focus more on experimentation and less on the logistical hurdles of moving models into production.

"We’ve definitely seen a reduction in lead time for certain types of experiments," Nissan confirmed. While some complex experiments still required significant effort, the overall process became more streamlined, allowing for quicker iteration and deployment. The ability to easily modify configurations, track results, and scale resources as needed has empowered the team to explore more sophisticated models and techniques without being bogged down by infrastructure concerns.

The environment equivalence provided by Metaflow has also bridged the gap between research and production, ensuring that models behave consistently across different stages of the pipeline. This consistency has been crucial in maintaining the quality and reliability of the recommendations provided to Prime Video’s users.

Moreover, the internal abstraction layer that Nissan’s team built on top of Metaflow has added a layer of security and flexibility. By decoupling the dependency on Metaflow, the team has mitigated potential risks associated with relying on a single technology, ensuring they can pivot if necessary.

Metaflow's Impact at Amazon Prime Video

The integration of Metaflow into Amazon Prime Video's machine learning pipeline has been a significant success, enabling faster, more reliable deployment of personalized content recommendations to millions of users. The flexibility and ergonomics provided by Metaflow have empowered Nissan's team to innovate more rapidly, experiment more freely, and maintain high standards of quality and reliability in their models.

Key Successes:

  • Improved Experimentation Speed: Faster transition from research to production, particularly for less complex experiments.
  • Seamless Scaling: Ability to scale models from local development to cloud environments without significant rework.
  • Enhanced Flexibility: Infrastructure-agnostic approach allows the team to adapt to new technologies and avoid vendor lock-in.

Looking forward, Nissan and his team at Prime Video are optimistic about the potential for further improvements. As Metaflow continues to evolve, particularly with the support of the Outerbounds team, they anticipate even greater efficiencies and capabilities in their machine learning workflows. The ongoing collaboration between Amazon and the broader Metaflow community ensures that Prime Video will remain at the forefront of personalized content delivery, leveraging cutting-edge technology to enhance user experiences around the globe.

No items found.

Start building today

Join our office hours for a live demo! Whether you're curious about Outerbounds or have specific questions - nothing is off limits.


We can't wait to meet you soon! Keep an eye out for a confirmation email with the deets.
Oops! Something went wrong while submitting the form.