Distributed ML Model Hosting with Dynamic Caching and Routing

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Loading machine learning models on-the-fly in hosted environments is not feasible due to high latency and memory constraints, making it inefficient to cache all models, especially in systems with a large number of models where only a few receive traffic.

Innovation Solution

Implementing an auto-scaling, distributed hosting system that caches a subset of machine learning models in RAM and uses a least frequently used caching strategy for disk storage, allowing for efficient routing of models based on demand and dynamically adding hosts to ensure resource optimization and reduced latency.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Quantity of substance

If machine learning models are loaded on-the-fly from disk in response to user requests, then memory resources are conserved, but service latency increases significantly

Engineering Contradiction:
Improvememory resourcesVSAvoidservice latency
Core Design Contradiction:
Quantity of substanceVSLoss of time

Solution Approach 1:

The system pre-loads machine learning models into memory before they are requested by users. Model loading occurs proactively based on prediction algorithms that anticipate which models will be needed, rather than waiting for actual requests. This preliminary action ensures models are ready in memory when needed, eliminating latency while avoiding the waste of keeping all models permanently loaded.

Inventive Principle:
Principle #10Preliminary action

2Loss of time

If all machine learning models are cached in memory, then service latency is reduced, but memory consumption becomes prohibitively high

Engineering Contradiction:
Improveservice latencyVSAvoidmemory consumption
Core Design Contradiction:
Loss of timeVSQuantity of substance

Solution Approach 1:

Instead of caching all possible models in memory (excessive action), the system caches only a subset of models that are predicted to be needed soon (partial action). The prediction algorithm determines which models to load based on usage patterns and requirements, loading just enough models to maintain low latency without consuming excessive memory resources.

Inventive Principle:
Principle #16Partial or excessive action

Solution Approach 2:

The model caching strategy is dynamic rather than static. The system continuously monitors model usage patterns, request rates, and memory availability, adjusting which models are cached in real-time. Models are loaded into memory when predicted to be needed and evicted when no longer required, creating a dynamic balance between latency performance and memory consumption.

Inventive Principle:
Principle #15Dynamics

3Quantity of substance

If a fixed number of hosts are used for model hosting, then infrastructure cost is reduced, but the system cannot handle variable traffic demands

Engineering Contradiction:
Improveinfrastructure resourcesVSAvoidtraffic handling capability
Core Design Contradiction:
Quantity of substanceVSAdaptability or versatility

Solution Approach 1:

The hosting infrastructure dynamically scales the number of hosts based on actual traffic demands and model loading requirements. When traffic increases or memory pressure mounts, the system automatically provisions additional hosts. When traffic decreases, hosts are de-provisioned to reduce costs. This dynamic adaptation allows the system to handle variable traffic demands efficiently without over-provisioning infrastructure.

Inventive Principle:
Principle #15Dynamics

Data Source

PatentUS11436524B2Hosting machine learning models
Publication Date: 2022.09.06 AMAZON TECH INC
  • US11436524B2 patent drawing
  • US11436524B2 patent drawing
  • US11436524B2 patent drawing

AI summary

Techniques for hosting machine learning models are described. In some instances, a method of receiving a request to perform an inference using a particular machine learning model; determining a group of hosts to route the request to, the group of hosts to host a plurality of machine learning models including the particular machine learning model; determining a path to the determined group of hosts; determining a particular host of the group of hosts to perform an analysis of the request based on the determined path, the particular host having the particular machine learning model in memory; routing the request to the particular host of the group of hosts; performing inference on the request using the particular host; and providing a result of the inference to a requester is performed.