Using machine learning for virtual-machine placement in the cloud

In tests, a new way to allocate virtual machines across servers outperforms baselines by 10%.

In the cloud, load balancing, or distributing tasks evenly across servers, is essential to providing reliable service. It prevents individual servers from getting overloaded, which degrades their performance.

The simplest way to prevent server overloads is to cap the number of tasks assigned to each server. But this may result in inefficient resource use, as tasks can vary greatly in their computational demands. The ideal approach to load-balancing would allocate tasks to the minimum number of servers required to prevent overloads.

Last week, at the Conference on Machine Learning and Systems (MLSys), we presented a new algorithm for optimizing task distribution, called FirePlace. FirePlace is built around a decision-tree machine learning model, which we train using simulations based on historical data.

Server-Animation-v3.gif
Deciding how to allocate virtual machines (VMs) to cloud servers is a difficult challenge, as the VMs' resource consumption (represented here by the size of the VMs) varies over time. FirePlace combines simulation and machine learning to address that challenge.
Credit: Glynis Condon

In experiments, we found that FirePlace outperformed both more-complex models, such as long-short-term-memory models and reinforcement learning models, and simpler baselines that have proved effective in practice, such as the power-of-two algorithm.

Firecracker placement

The name FirePlace comes from the Firecracker virtual machine (VM), which is used by Amazon Web Services’ (AWS) Lambda service. Lambda provides function execution as a service, sparing customers from provisioning infrastructure themselves and lowering their costs, since they are billed for function execution duration.

In cloud computing, virtual machines enable secure execution of customer code by moderating that code’s access to server operating systems. Traditionally, a cloud computing service might allot one VM to each application running on its servers. Firecracker, however, allots a separate VM to each function.

Firecracker VMs are secure and lightweight and can be packed densely into servers. Their small size gives them efficiency advantages, but it also makes them less predictable: the resource consumption of a large program is easier to estimate than the resource consumption of a single program function. Optimizing the placement of Firecracker VMs required a new approach to load balancing; hence FirePlace.

FirePlace uses a decision tree model that takes as input the resource consumption status of multiple servers in the fleet; to ensure that the model can deliver a decision within milliseconds, those servers are randomly sampled. The model’s output is the assignment of a new VM to one of the input servers.

Training by simulation

To train the model, we use historical data about real Firecracker VMs’ resource consumption, represented as time series. During training, when the model is presented with a new VM to place, each of the currently allocated VMs is at a particular step in its time series. We run a simulation to compute those VMs’ future resource consumption, and on that basis, we can optimize the placement of the new VM. The optimized placement then becomes the training label for the current input. 

In our experiments, our baseline was the surprisingly effective power-of-two algorithm, which is widely used in cloud computing. It randomly picks two servers as potential recipients for a new VM, then selects the least loaded of the two. 

We also compared our approach to one that used neural networks — a long-short-term-memory network (LSTM) and a temporal convolutional network (TCN) — that were trained to predict the future resource consumption of a given VM, based on its resource consumption up to that time.

Finally, we also compared our system to one that used reinforcement learning to learn optimal placement of a VM, given its previous decisions about VM placement. The learned model performed well for smaller datasets, but as we increase the number of VMs for placement, the complexity of the problem increases, and reinforcement learning models fail to converge to a competitive solution.

We evaluated these approaches according to how many servers they needed to serve a given load, given a fixed limit on server overloads; the lower the number of servers, the better. FirePlace improved upon the power-of-two baseline algorithm by 10%. The LSTM and TCN approaches were too inaccurate to be competitive.

Lambda has begun to introduce the FirePlace approach in production, where in future it can provide real-world validation of our experimental results.

Research areas

Related content

US, NY, New York
Are you a scientist interested in pushing the state of the art in machine learning and recommendation systems? Are you interested in working on novel ideas that can positively impact millions of customers? Do you wish you had access to large datasets and tremendous computational resources? Answer yes to any of these questions and you will be a great fit for our team at Amazon. As an Applied Scientist in our team, you will be responsible for the research, design, and development of new AI technologies for Personalization. You will adopt or invent new machine learning and analytical techniques in the realm of recommendations and large language models. You will collaborate with scientists, engineers, and product partners locally and abroad. Your work will include inventing, experimenting with, and launching new features, products and systems. Key job responsibilities - Using Amazon’s large-scale computing resources, you will ask research questions about customer behavior, build state-of-the-art models to optimize the shopping experience, and run these models directly on the retail website. - Develop AI solutions for Recommendation systems using Deep learning, LLMs, Reinforcement Learning, distillation, and Optimization methods; - Work closely with engineers and product managers to design, implement and launch AI solutions end-to-end; - Design and conduct offline and online (A/B) experiments to evaluate proposed solutions based on in-depth data analyses; - Effectively communicate technical and non-technical ideas with teammates and stakeholders; - Stay up-to-date with advancements and the latest modeling techniques in the field; - Publish your research findings in top conferences and journals. About the team Our team is part of Amazon’s Personalization organization, a high-performing group that leverages Amazon’s expertise in machine learning, big data, distributed systems, and user experience design to deliver the best shopping experiences for our customers. We run global experiments and our work has revolutionized e-commerce with features such as "Keep shopping for ...", “Customers who bought this item also bought”, and “Frequently bought together”.
US, WA, Seattle
Interested in modeling and understanding customer behavior through machine learning, artificial intelligence, and data mining over TB scale data with huge business impact on millions of customers? Join our team of Scientists developing models to model customer behavior and optimize the customer experience with Amazon Prime. This includes understanding who our customers are, long-term value of the Prime membership program, and creating the right personalized framework for content and subscription optimization. As an AI/ML expert, you will partner directly with product owners to intake, build, and directly apply your modeling solutions. There are numerous scientific and technical challenges you will get to tackle in this role, such as optimizing/fine-tuning GenAI/LLM solutions for Prime personalization, building GenAI foundation models, global scalability of models, combinatorial optimization, cold start problem, accelerated experimentation, short/long term goals modeling, and multi-step optimization leading to reinforcement learning of the customer journey. We employ techniques from GenAI/LLMs, supervised/semi-supervised learning, deep learning, transformer architectures, using outcomes from causal Econometric modeling, and Reinforcement learning. As the central science team within Prime, our expertise gets routinely called upon to weigh in on a variety of topics. We also emphasize the need and value of scientific research and have developed a strong publication and patent record (internally/externally) which you will be a part of. You will also utilize and be exposed to the latest in ML technologies and infrastructure: AWS technologies (EMR/Spark, Sagemaker, DynamoDB, S3, ClaudeCode), various AI/ML algorithms and techniques (Deep Learning, GenAI/LLMs, transformers, supervised/unsupervised/semi-supervised/reinforcement learning), and statistical modeling techniques. - Stay abreast of current literature in the field and advance/build novel science solutions leveraging SoTA solutions. - Build and develop AI/ML models and supporting infrastructure at TB scale, in coordination with software engineering teams. - Leverage Deep Learning and GenAI solutions for building foundation models and personalized optimization solution. - Develop offline policy estimation tools and integrate with measurement systems/econometric models. - Establish scalable, efficient, automated processes for large scale data analyses, science development, science validation and model implementation. - Analyze and extract relevant information from large amounts of Amazon’s historical business data to help automate and optimize key processes. - Work closely with the business to understand their problem space, identify the opportunities and formulate the problems. - Use AI/machine learning, data mining, statistical techniques and others to create actionable, meaningful, and scalable solutions for the business problems. - Design, develop and evaluate highly innovative models and statistical approaches to understand and predict customer behavior and to solve business problems. Key job responsibilities - Stay abreast of current literature in the field and advance/build novel science solutions leveraging SoTA solutions. - Build and develop AI/ML models and supporting infrastructure at TB scale, in coordination with software engineering teams. - Leverage Deep Learning and GenAI solutions for building foundation models and personalized optimization solution. - Develop offline policy estimation tools and integrate with measurement systems/econometric models. - Establish scalable, efficient, automated processes for large scale data analyses, science development, science validation and model implementation. - Analyze and extract relevant information from large amounts of Amazon’s historical business data to help automate and optimize key processes. - Work closely with the business to understand their problem space, identify the opportunities and formulate the problems. - Use AI/machine learning, data mining, statistical techniques and others to create actionable, meaningful, and scalable solutions for the business problems. - Design, develop and evaluate highly innovative models and statistical approaches to understand and predict customer behavior and to solve business problems.
US, WA, Seattle
Innovators wanted! Are you an entrepreneur? A builder? A dreamer? This role is part of an Amazon Special Projects team that takes the company’s Think Big leadership principle to the limits. We focus on creating entirely new products and services with a goal of positively impacting the lives of our customers. No industries or subject areas are out of bounds. If you’re interested in innovating at scale to address big challenges in the world, this is the team for you. Here at Amazon, we embrace our differences. We are committed to furthering our culture of inclusion. We have thirteen employee-led affinity groups, reaching 40,000 employees in over 190 chapters globally. We are constantly learning through programs that are local, regional, and global. Amazon’s culture of inclusion is reinforced within our 16 Leadership Principles, which remind team members to seek diverse perspectives, learn and be curious, and earn trust. As a Applied Scientist at the intersection of machine learning and the life sciences, you will participate in developing exciting products for customers. Our team rewards curiosity while maintaining a laser-focus in bringing products to market. Competitive candidates are responsive, flexible, and able to succeed within an open, collaborative, entrepreneurial, startup-like environment. At the forefront of both academic and applied research in this product area, you have the opportunity to work together with a diverse and talented team of scientists, engineers, and product managers and collaborate with others teams.
IN, KA, Bengaluru
Amazon Ads delivers advertising experiences across Amazon's owned-and-operated properties and third-party networks, reaching hundreds of millions of customers worldwide. Within Amazon Ads, Advertising Trust is the science-first organization responsible for ensuring every ad shown to customers meets Amazon's content policies — at massive scale, across all ad formats and global marketplaces. The Ads Trust Science team builds the ML systems that automate content moderation decisions: multimodal classification, retrieval-based labeling, LLM reasoning, and agentic self-improvement architectures. This requires inventing new approaches at the intersection of computer vision, NLP, information retrieval, and generative AI. We are seeking an Applied Science Manager to lead a team of applied scientists building next-generation content moderation intelligence. You will own the science roadmap for one of the highest-impact automation programs in Amazon Advertising, defining how multimodal content understanding, retrieval-first classification, and LLM-based reasoning combine into a production system that serves global advertising at scale. Key job responsibilities * Lead a team of applied scientists working across multimodal ML (vision-language models, video understanding), large-scale retrieval systems (embedding-based similarity and deduplication), and generative AI (LLM-based policy reasoning, knowledge distillation, agentic architectures, reinforcement learning). * Define the science strategy for ads trust. * Own end-to-end delivery of ML solutions: problem formulation, offline experimentation, online A/B testing, and production deployment. Your models directly move automation and defect metrics reported to senior leadership. * Build and grow scientists — hire, mentor, and develop team members. Raise the science bar through structured review processes and a publication culture within Amazon. * Partner with engineering, product, and operations teams to translate science investments into measurable automation improvements. Influence roadmaps across dependent teams. * Communicate science strategy and results to senior leadership through narratives, technical deep-dives, and roadmap documents.
US, WA, Seattle
Stores Economics and Science (SEAS) is an interdisciplinary science and engineering team in Amazon's Stores organization with a peak-jumping mission: we apply expertise in science and engineering to move from local to global optima in methods, models, and software. We pursue this mission by leveraging frontier science; collaborating with partner teams; and learning from the tools, experience, and perspective of others. We scale by solving problems, first in the small to prove concepts, and then in the large by building scalable solutions. We also help other teams within Amazon scale by hiring and developing the best and embedding them in other business units. In 2026, we are focused on economics and science in areas related to (1) lowering cost-to-serve, (2) optimizing selection, and (3) emerging machine learning. We also have some ongoing and highly-leveraged collaborations that help partner teams inside Amazon short-circuit months of R&D or otherwise look around corners. We are looking for an Applied Scientist to build and deliver state-of-the-art science and engineering solutions to improve our Stores business. In this role, you will work in a team of scientists and engineers with backgrounds in machine learning, NLP, IR, statistics, and economics to identify bottlenecks in our business, conceive new ideas to overcome those challenges, and deploy scientific solutions in partnership with product teams. Your responsibilities include developing and maintaining the scientific models, benchmarks, and services. Graduate education or hands-on experience in machine learning, optimization, causal inference, Bayesian statistics, deep learning, or other quantitative scientific fields is a big plus. To be successful in this role, you should be a quick learner and comfortable with a high degree of ambiguity. Key job responsibilities The successful candidate will lead large-scale science initiatives from research to production and translate complex business problems into mathematical frameworks. They will design and implement large-scale algorithms for complex supply chain and marketplace problems, and design incentive-compatible mechanisms for marketplace challenges. The ideal candidate will have a strong publication record in top-tier conferences/journals (INFORMS, EC, WINE, ICML, NeurIPS, etc.) and experience coordinating cross-functional projects. Hands-on experience building science solutions to mechanism design problems (e.g., optimal auction design, welfare maximization under constraints, incentive compatible coordination), with expertise in statistical learning and algorithm development. Leadership responsibilities include influencing technical strategy and roadmaps for complex initiatives, influencing senior stakeholders and shaping technical direction, and fostering team growth.
IN, KA, Bengaluru
We are embarking on a multi-year journey to improve the shopping experience for customers globally. Amazon Search team creates customer-focused search solutions and technologies that make shopping delightful and effortless for our customers. Our goal is to understand what customers are looking for in whatever language happens to be their choice at the moment and help them find what they need in Amazon's vast catalog of billions of products — starting from the very first keystroke. As Amazon expands to new interfaces, we are faced with the unique challenge of maintaining the bar on Search Results Quality and Search Autocomplete. We are looking for a Applied Scientist II to work on improving search on Amazon using NLP, ML, and DL technology. As an Applied Scientist, you will lead our efforts in query understanding, semantic matching, and ranking. You will build systems that anticipate search query intent and surface the right results. As part of this role, you will develop high precision, high recall, and low latency solutions for search. Your solutions should work for all languages that Amazon supports and will be used in all Amazon locales world-wide. You will develop scalable science and engineering solutions that work successfully in production. Key job responsibilities As an Applied Scientist on the team, you will lead science innovation to improve the customer search experience through higher-quality search results. You will: - Develop and deploy ML models to produce relevant search results. - Design and train semantic matching models (bi-encoders, cross-encoders, and distillation from large foundation models) for ranking and relevance. - Develop reinforcement learning and reward-modeling approaches to continuously improve search results quality. - Train multi-objective ranking and scoring systems that balance suggestion diversity, specificity, and relevance. - Design and implement scalable model architectures optimized for strict latency constraints, including knowledge distillation, quantization, and efficient inference strategies for production deployment. - Lead end-to-end science projects from problem formulation through production launch, collaborating closely with engineers and scientists within and outside the team to deliver customer-facing impact.
IN, KA, Bengaluru
We are embarking on a multi-year journey to improve the shopping experience for customers globally. Amazon Search team creates customer-focused search solutions and technologies that make shopping delightful and effortless for our customers. Our goal is to understand what customers are looking for in whatever language happens to be their choice at the moment and help them find what they need in Amazon's vast catalog of billions of products — starting from the very first keystroke. As Amazon expands to new interfaces, we are faced with the unique challenge of maintaining the bar on Search Results Quality and Search Autocomplete. We are looking for a Applied Scientist II to work on improving search on Amazon using NLP, ML, and DL technology. As an Applied Scientist, you will lead our efforts in query understanding, semantic matching, and ranking. You will build systems that anticipate search query intent and surface the right results. As part of this role, you will develop high precision, high recall, and low latency solutions for search. Your solutions should work for all languages that Amazon supports and will be used in all Amazon locales world-wide. You will develop scalable science and engineering solutions that work successfully in production. Key job responsibilities As an Applied Scientist on the team, you will lead science innovation to improve the customer search experience through higher-quality search results. You will: - Develop and deploy ML models to produce relevant search results. - Design and train semantic matching models (bi-encoders, cross-encoders, and distillation from large foundation models) for ranking and relevance. - Develop reinforcement learning and reward-modeling approaches to continuously improve search results quality. - Train multi-objective ranking and scoring systems that balance suggestion diversity, specificity, and relevance. - Design and implement scalable model architectures optimized for strict latency constraints, including knowledge distillation, quantization, and efficient inference strategies for production deployment. - Lead end-to-end science projects from problem formulation through production launch, collaborating closely with engineers and scientists within and outside the team to deliver customer-facing impact.
IN, KA, Bengaluru
We are embarking on a multi-year journey to improve the shopping experience for customers globally. Amazon Search team creates customer-focused search solutions and technologies that make shopping delightful and effortless for our customers. Our goal is to understand what customers are looking for in whatever language happens to be their choice at the moment and help them find what they need in Amazon's vast catalog of billions of products — starting from the very first keystroke. As Amazon expands to new interfaces, we are faced with the unique challenge of maintaining the bar on Search Results Quality and Search Autocomplete. We are looking for a Applied Scientist II to work on improving search on Amazon using NLP, ML, and DL technology. As an Applied Scientist, you will lead our efforts in query understanding, semantic matching, and ranking. You will build systems that anticipate search query intent and surface the right results. As part of this role, you will develop high precision, high recall, and low latency solutions for search. Your solutions should work for all languages that Amazon supports and will be used in all Amazon locales world-wide. You will develop scalable science and engineering solutions that work successfully in production. Key job responsibilities As an Applied Scientist on the team, you will lead science innovation to improve the customer search experience through higher-quality search results. You will: - Develop and deploy ML models to produce relevant search results. - Design and train semantic matching models (bi-encoders, cross-encoders, and distillation from large foundation models) for ranking and relevance. - Develop reinforcement learning and reward-modeling approaches to continuously improve search results quality. - Train multi-objective ranking and scoring systems that balance suggestion diversity, specificity, and relevance. - Design and implement scalable model architectures optimized for strict latency constraints, including knowledge distillation, quantization, and efficient inference strategies for production deployment. - Lead end-to-end science projects from problem formulation through production launch, collaborating closely with engineers and scientists within and outside the team to deliver customer-facing impact.
US, NY, New York
We are seeking a Robotics/AI Motor Control Scientist to develop cutting-edge machine learning algorithms for motor control systems in robots. In this role, you will focus on creating and optimizing intelligent motor control strategies to enable robots to perform complex, whole-body tasks. Your contributions will be essential in advancing robotics by enabling fluid, reliable, and safe interactions between robots and their environments. Key job responsibilities - Develop controllers that leverage reinforcement learning, imitation learning, or other advanced AI techniques to achieve natural, robust, and adaptive motor behaviors - Collaborate with multi-disciplinary teams to integrate motor control systems with robotic hardware, ensuring alignment with real-world constraints such as actuator dynamics and energy efficiency - Use simulation and real-world testing to refine and validate control algorithms - Stay updated on advancements in robotics, AI, and control systems to apply advanced techniques to robotic motion challenges - Lead technical projects from conception through production deployment - Mentor junior scientists and engineers - Bridge research initiatives with practical engineering implementation About the team Fauna Robotics, an Amazon company, is building capable, safe, and genuinely delightful robots for everyday life. Our goal is simple: make robots people actually want to live and interact with in everyday human spaces. We believe that future won’t arrive until building for robotics becomes far more accessible. Today, too much effort is spent reinventing the fundamentals. We’re changing that by developing tightly integrated hardware and software systems that make it faster, safer, and more intuitive to create real-world robotic products. Our work spans the full stack: mechanical design, control systems, dynamic modeling, and intelligent software. The focus is not just functionality, but experience. We’re building robots that feel responsive, expressive, and genuinely useful. At Fauna, you’ll work at the frontier of this space, helping define how robots move, manipulate, and interact with people in natural environments. It’s an opportunity to solve hard problems across hardware and software with a team focused on making robotics accessible and joyful to build. If you care about making robotics real for everyone and building systems that are as delightful as they are capable, we’re interested in hearing from you. an opportunity to solve hard problems across hardware and software with a team focused on making robotics accessible and joyful to build. If you care about making robotics real for everyone and building systems that are as delightful as they are capable, we’re interested in hearing from you.
GB, MLN, Edinburgh
Do you want to make a real difference to real people's lives? Want to design and build fair and explainable systems which automate recruitment processes across Amazon? Come and be part of a team that develops new machine learning (ML) technologies, which help Amazon scale for its customers by recruiting diverse teams. Join our Recommendations team within Intelligent Talent Acquisition (ITA) where you’ll build machine learning products that transform how job seekers find opportunities and recruiters discover talent. You’ll develop sophisticated recommendation systems powering both Amazon Jobs and internal hiring platforms, operating at global scale to match the right people with the right positions. Using techniques including representation learning, reinforcement learning, and probabilistic modeling, your work will directly improve efficiency for recruiters and help candidates find their ideal roles. This position offers the chance to solve complex problems with significant impact by creating systems that make Amazon’s entire hiring ecosystem more effective while collaborating with scientists across the organization. Key job responsibilities - Design and implement machine learning models that power recommendation systems for job seekers and recruiters, ensuring high performance, scalability, and reliability at global scale. Our ideal candidate has a strong scientific foundation and experience of statistical analysis and model building and has a passion for fairness and explainability in ML systems. - Collaborate with engineers, scientists, and product managers to define requirements, create solutions, and deliver products that improve the hiring experience. - Participate in the full software development lifecycle including scoping, design, coding, testing, documentation, deployment, and maintenance of recommendation systems and ML models. - Solve complex ML problems using optimal data structures and algorithms, making thoughtful trade-offs between efficiency and maintainability. - Stay current with scientific literature and develop novel approaches that address business challenges in talent acquisition. You will have the opportunity to provide feedback on scientific work across the organization helping the entire Intelligent Talent Acquisition organization improve. A day in the life You might spend the morning reviewing a colleague’s code for a new recommendation algorithm feature, then collaborate with product managers to refine requirements for an upcoming enhancement. After lunch, you’ll dive into model development, analyzing performance metrics from recent A/B tests and implementing improvements to the job-seeker recommendation pipeline. Throughout the day, you’ll participate in scientific discussions with peers across the organization, providing valuable feedback while continuing to refine your expertise. About the team The Recommendations team is a hybrid group of software engineers and applied scientists located in Edinburgh. We build tools that match people to jobs and jobs to people, optimizing experiences for both recruiters and candidates. Our work directly impacts Amazon’s ability to find and hire exceptional talent globally. The team maintains a collaborative environment with regular knowledge sharing and mentorship opportunities. We work closely with our product teams to understand business needs and develop innovative scientific solutions that improve hiring outcomes across both industry and student requisitions worldwide.