Finding the right amount of packaging to ship an item can be challenging — and at Amazon, an ever-changing catalogue of hundreds of millions of products makes it an ongoing challenge. In addition, Amazon’s scale also means it is impossible to solve this challenge using manual inspection to choose packaging for each and every item. For the same reason, general packaging rules and run-of-the-mill logic just won’t cut it. What’s required is a cutting-edge-smart automated mechanism that can adapt on the fly to changing circumstances.
Fortunately, machine learning approaches — particularly deep learning — thrive on big data and massive scale, and a pioneering combination of natural language processing and computer vision is enabling Amazon to hone in on using the right amount of packaging. These tools have helped Amazon drive change over the past six years, reducing per-shipment packaging weight by 36% and eliminating more than a million tonnes of packaging, equivalent to more than 2 billion shipping boxes.
“When I started at Amazon in 2017, we had a lot of physical testing of products going on, but not a scalable mechanism that could assess hundreds of millions of products to identify the optimal packaging type for each product,” says research science manager Matthew Bales. Bales, who is also a physicist, heads up Machine Learning within Amazon’s Customer Packaging Experience team.
“Statistical tests were the first piece, but they are essentially only useful when products have already been shipped in more than one package type. We wanted the capability to predict how a product would fare in a less-protective, lighter, and more sustainable package type. And once you're in that predictive space, you need machine learning,” Bales explains.
The power of customer feedback
To make a prediction about whether a given product could be safely shipped in a particular package type, Bales and his colleagues built a ML model based largely on the text-based data that customers find on the Amazon Store — the item name, description, price, package dimensions, and so on.
Customer feedback is paramount, it powers all of our statistical testing.
The model was trained on millions of examples of products successfully delivered in various packaging types, and on examples of products that arrived damaged in given packaging types. Amazon has access to almost real-time feedback when a product is not sufficiently protected by its packaging, because customers report it via the Online Returns Centre and other forms of feedback, including product reviews.
“Customer feedback is paramount,” says Bales. “It powers all of our statistical testing.”
The model learned that certain keywords were particularly important when making packaging decisions. For example, keywords that indicated that a padded mailer would not be the right packaging included “ceramic”, “grocery”, “mug” and “glass”. These products were better shipped in a box. Keywords that suggested mailers were the right choice included “multipack” and “bag.” Those indicated the product might already have some form of protective packaging.
“The portion of the model that's learning from the Amazon Store has learned really well what the product is, and about its dimensions,” says Bales.
It’s an important step in the journey, but automatically learning what a product is represents only half the battle. Equally important is how the vendor packaged the product before sending it to a fulfilment centre. For example, a ceramic mug may be packaged in clear plastic bag, or in a sturdy box.
To identify product packaging at scale, computer vision needed to be deployed. The ML team already knew that the product images on the Amazon Store weren’t helpful when selecting packaging. For example, a multipack of LED bulbs might be illustrated by a picture of a single, unpacked bulb, suggesting it is fragile, yet the multipack is, in fact, safely packaged by the vendor and doesn’t require additional packaging. It is best shipped in its own container.
Bales’s team addressed this challenge by using Amazon’s own image data. When products are delivered to fulfilment centres, many are sent via conveyor belt through special computer-vision tunnels equipped with cameras that capture images of the products from multiple angles. These tunnels are used for many things, including ascertaining product dimensions and spotting defects.
Prasanth Meiyappan, an Amazon applied scientist, expanded the training of the team’s ML model to include these standardised product images in addition to the text classifiers from the catalogue — a multimodal approach.
Our model detects the packaging edges to determine shape, identifies a perforation, a bag around the product, or light shining through a glass bottle.
“Our model detects the packaging edges to determine shape, identifies a perforation, a bag around the product, or light shining through a glass bottle.” Meiyappan explains. But to some extent, how the model makes its judgement about what it detects in images is hard for a human to discern, because the product features identified and weighted by the model tend to be complex.
“The important thing,” Bales notes, “is that the packaging decisions generated by the model are empirically accurate.”
Incorporating both text-based and visual data improved the ML model’s performance by as much as 30%, compared with using text-based data alone. Bales and Meiyappan have produced a position paper describing their work.
“When the model is certain of the best package type for a given product, we allow it to auto-certify it for that pack type,” says Bales. “When the model is less certain, it flags a product and its packaging for testing by a human.” The technology is currently being applied to product lines across North America and Europe, automatically reducing waste at a growing scale.
“It’s a triple win,” says Bales. “Reduced waste, increased customer satisfaction, and lower costs.”
To arrive at this triple win, though, the team also had to take on a thorny challenge encountered frequently in the ML domain: class imbalance. In a nutshell, the problem is this: if you want an ML model to learn effectively, you ideally provide it with as many examples of failures as successes, so it can learn to differentiate effectively between the two.
The data used to train the model had many millions of examples of product/package pairings, yet depending on the package type, as little as 1% of those examples were for packages that turned out to be unsuitable in some way for the product within.
The machine learning literature to do with packaging is pretty sparse. Not many people deal with the kind of datasets we are dealing with in the packaging domain.
“Prior to implementing ML, we’ve shipped some product in envelopes and mailers for some time,” says Bales. “So, we had loads of examples of things that were good in mailers, but didn't have a lot of examples of things that were bad in mailers. ML models have problems with this kind of overwhelming imbalance.”
“The machine learning literature to do with packaging is pretty sparse,” Meiyappan says. “Not many people deal with the kind of datasets we are dealing with in the packaging domain. How effective a technique is in dealing with dataset imbalance is both domain and dataset specific.”
Thus the team’s approach to the class imbalance problem was primarily experimental. And of the six approaches they applied — four data based, two algorithm based — the clear winner produced a marked improvement in model accuracy. That was a data-based approach called two-phase learning with random under sampling which focuses the model on the minority class in the first phase of training and then on all of the data in the second.
“In our position paper we share that knowledge with the ML community,” says Bales, “so that anyone who encounters a similar problem might choose to try this approach for themselves, to see if it also works in their problem space.”
The team said they are eager to expand the use of this tool by training the model to understand all Amazon’s customers languages while also incorporating the unique aspects of fulfilment in each country.
While Amazon scientists continue to research other ways to utilise machine learning to eliminate waste, the company is also working to reduce packaging waste throughout the e-commerce supply chain. Amazon is, for example, increasingly incentivising its vendors to create optimised e-commerce packaging for themselves that saves space and materials without compromising product protection.
The company’s Shipment Zero goal is to deliver 50% of shipments with net-zero carbon by 2030, which from a packaging perspective means shipping products without added Amazon packaging or in carbon-neutral packaging. This is part of the Amazon’s wider Climate Pledge — a commitment to reach net-zero carbon by 2040, a decade earlier than the 2050 emissions target of the Paris Agreement.
Find out more about sustainability at Amazon.