Skip to content

Programmer’s one more line of code may save you a little bit

Programmer’s one more line of code may save you a little bit


Editor’s Note: The story was published in Chinese on the WeChat account for Qianhei Technology. The story gives us an in-depth understanding of how JD is reshaping the industry through its supply chain capabilities, and features interviews with two scientists from Here’s the logic behind JD’s supply chain development.

JD’s 618 Grand Promotion wrapped up with a new record transaction volume of over RMB 343.8 billion yuan (US$53.14 Billion) during the 18-day sale (Jun. 1-18). Consumers are now enjoying fresh new products purchased during the promotion, delivered quickly by JD’s couriers from JD’s warehouses.

Where do the products in JD’s warehouses come from? The brand partner. The brand partner’s products are made in factories, which manufactured the items from raw materials offered by suppliers. The whole process has an official name: Supply Chain.

What is Supply Chain?

At, there is a group of people in a mysterious department called “Y,” who are specifically responsible for studying the smoothness and efficiency of the supply chain.

Their job is to ensure that goods don’t become over-stocked, while also ensuring that goods are never under-stocked—with the overall goal of guaranteeing the fastest delivery of goods to consumers.

Xiaolong Xia is a supply chain expert and a member of the Y department. He worked at P&G after graduating from college, and then joined Amazon, before finally bringing his years of working experience and expertise in the area of supply chain to

Xia thinks about “Inventory turnover rate” all day long. Inventory turnover rate refers to the average time that all goods are stocked in JD’s warehouse.

For example, JD’s inventory turnover rate in the first quarter of 2021 was 31.2 days, which means that all goods will be sold after an average of 31.2 days from the time they were sent to JD’s warehouse. The smaller the number, the shorter the time that goods occupy JD’s warehouse. The shorter the time, the less of JD’s capital will be used for warehousing. The ideal scenario would be to achieve a turnover rate of 0.

“For those of us working on supply chain, we simply want to predict two numbers for the future: ‘supply’ and ‘demand,’” said Xia.

“Therefore, what we’re looking for is ‘stable supply and demand.’ The more stable the better, as it will be easier for us to predict the stock.”

However, the disappointing fact is that it’s difficult to stabilize both supply and demand in the real world. In September 2020, pre-orders of the new iPhone totaled several million, resulting in an inventory shortage. Unfortunately, this kind of occurrence is not rare.

This problem requires experts to stir together “historical supply and demand data” and “current influencing factors” like alchemy, according to the supply chain characteristics of different commodities, with an aim to find the optimal rhythm of stocking and the optimal quantity of stocking each time. This is the focus of Xia’s department. 

Xia divided the daily commodities into four different scenarios, according to “stable supply and unstable demand” and “stable demand and unstable demand.”

“First, rice, flour and cooking oil belongs to the stable supply and stable demand category, which is easy to handle,” Xia explained. “Secondly, fashion and cosmetics belong to stable supply, but unstable demand. Third, for high-end 3C digital products, supply is also not stable. For example, it’s easy for new cell phones to be out of stock, so stocking up is necessary when there are goods. However, we cannot always stock up, as electronic products may occasionally suffer from price drops.”

Facing complicated situations between supply and demand, technology has played an important role in stabilizing both supply and demand. Hao Hu, who is Xia’s colleague and joined JD in 2014, has led the team to make sales forecasting systems, intelligent replenishment systems, and warehouse network optimization systems, among other areas of focus. So far, the intelligent systems make more than 400,000 decisions every day, and more than half of the daily supply chain work is done by these “artificial brains”.

To cope with various scenarios between supply and demand, Hu led his team to create a generic model which can cover most of the scenarios. There are many types of parameters in the model, such as “average delivery time,” “delivery satisfaction rate,” “price impact factor,” “promotion impact factor,” “inventory loss factor,” “delivery time requirement” and more, according to Hu.

“Through letting the intelligent system learn the historical data of different categories, it can automatically modify the parameters and create a ‘supply chain model’ suitable for the specific commodity category. It will prompt the person in charge of the category on how much to stock, when to restock, how much to restock, and so on,” Hu added.

The efficiency of the industrial supply chain will eventually be reflected in the price of commodities, which is highly relevant to every consumer, according to Hu. In China, the average social supply chain cost is 18%, which means that if a consumer spends RMB 100 yuan to buy two boxes of Durex, the consumer will contribute about RMB 18 yuan for the supply chain. This percentage is far more than that in Europe and the United States. However, the cost supply chain within JD accounts for just 8%, which is far lower than the world’s average level.

Supply Chain Data Integration

Supply chain is a “chain” with many individual parts, with each part cooperating to drive efficiency. Within JD’s own loop, the chain is transparent, intelligent and efficient. But when it comes to suppliers, JD knows nothing about how their goods are produced, which warehouse they are placed in, how many goods are in each warehouse, and from where they are delivered to JD after orders are placed.

For example, JD’s Beijing warehouses would like to order 100 units of air conditioners from brand A. The brand only has units in their warehouse in Beijing, and the remaining 50 units need to be shipped from their warehouse in Shijiazhuang. So the brand sends 50 units from Beijing, and 50 units from Shijiazhuang. However, within a few days, 3 consumers from Shijiazhuang order air conditioners from JD, and the products end up being delivered to them from JD’s Beijing warehouses, instead of from the warehouses closest to them in Shijiazhuang. These kinds of flaws in the process cause unnecessary logistics cost, and an increase of inventory turnover days.

Data integration is the key way to ensure that JD and suppliers are organized enough to work on the same level. However, it’s not easy to promote data integration between JD and suppliers, as many suppliers are still using Excel to manually manage the data of its supply chain, and suppliers which have digital systems to manage data are also reluctant to share their business data with a third party.

Since the outbreak of COVID-19 in China in 2020, consumers’ demands have changed dramatically, said Xia.

The pandemic drove many companies to open up their data to JD, in order to adjust their production and precisely fulfill consumer demands in a timely manner during the pandemic.

For example, Midea and Hisense integrated their production data with JD in 2020. As a result, they are now able to arrange production in advance according to JD’s “real-time sales data” and “future sales forecast.” JD will also be able to better adjust its preorders according to the manufacturer’s stock information.

“Technically speaking, we are actually stacking the data from two nets to calculate the results, so that although the requirements to our technical capabilities are higher, the results obtained are naturally better than calculating only one net,” said Hu.

“The pandemic may ultimately push the digital transformation of traditional enterprises 1-3 years ahead,” said Lei Xu, CEO of JD Retail.

Data integration is only the very beginning. For those companies that still use Excel to manage their production and supply chain, there is still a long way to go to make their supply chain smarter.

“The biggest enemy of artificial intelligence is Excel,” said Hu.

Opening up JD’s supply chain capabilities is a way to help those companies that are still in the initial production stages.

Empowering the Merchants

The relationship between JD and its merchants has transcended far beyond a distributor and suppliers, as JD has taken a step further to help merchants revamp their own supply chain system to be more digitally smart. This requires JD to think and act in a way that considers the perspectives of their merchant partners, working out solutions to tackle some outstanding pain points.

There are two main things that JD is capable of doing in particular. First, JD can help merchants to improve their sales predictions in different channels. No matter where the products are sold, online or offline, JD’s AI-driven sales prediction system can analyze their historical product distribution data, and figure out the most likely sales trends for all channels in the coming months.

Although the prediction might not be 100% accurate, as long as the provided data is detailed enough, the prediction can serve as reliable guidance for merchants to make their future production plan, greatly relieving the inventory pressure that often exists as a result of groundless planning.

Optimizing a nationwide warehouse network for merchants is the second thing at which JD excels. Based on its more than 10 years of experience in parcel distribution and warehouse deployment across the country, JD developed a warehouse optimization system for merchants to advise them on where they should build or rent cost-effective warehouses.

Data is key to delivering accurate system results. But if people do not feed the system with good data, the outcome will be useless. As a popular saying goes in the AI research circle: “Garbage in, garbage out.”

Xia recalled a “bad case” that is relevant to this point. A few years ago, Xia’s team noticed that a category manager for a company selling computer mouse products always hoarded more stock than the replenishing amount suggested by the prediction system. So they went to ask the manager for the reason, and he answered, “If I buy more, the supplier will offer a bigger discount, so it’s a better deal.”

At that time, such a bargain was a “never heard of” for the system. So the team quickly taught the system the “buy more get better discount” logic, and made the system smarter in replenishment planning.

Similar to this mouse category manager, many people in charge of channels or procurement lacked trust in the system at the beginning. To build their trust and understanding of the system, JD’s team spent a great amount of time and efforts to learn their concerns, in order to help them view the system as a real teammate that helps to enhance their work efficiency.

“It takes time to reach a point of integration between humans and the system. There’s no shortcut but relentless communications, fine-tuning and building acceptance,” Xia said. “Some merchants have a very quick learning curve, and they even hold competitions to encourage their workers to use the supply chain system, which gives them an advantage in the market competition.”

Expanding Innovations

Another effective way to speed up goods flow is to produce popular or brand-new products that people love to buy.

There are millions of people shopping on every day. Through the big data generated from these shopping behaviors, JD is able to have a broad and clear observation of customers’ preferences. By sharing these shopping insights with upstream manufacturers, they can produce more tailor-made products for more targeted consumers.

This process is called the C2M (Customer-to-Manufacturer) model through which JD can work closely with brand partners to offer more marketable products, thus increasing sales and reducing inventory turnover days.

For example, by studying consumers’ shopping trends and comments on kitchenware products, JD realized that tea eggs had become a trending food, and many people were looking for some kind of cooking tool for easy tea egg boiling. The platform shared this insight with a partner brand of kitchen utensils, which then used the insights to make a well-designed “smart tea egg boiler” that can set a timer and automatically add tea into the pot to cook perfect tea eggs. The boiler was introduced to the market during the tea egg boom, how could it not be a hot-selling product?

Meanwhile, it is also worth mentioning that the more sub-categorized the products are, the fewer users they will have. For instance, olive oil is a sub-category of vegetable oil, so its demand and buyers will be smaller than its parent category.

To manufacturers, less demand means smaller production scale and higher cost. So factories must adjust their manufacturing techniques to adapt to the lower-volume customized production mode.

Hu noted that the book category fits the C2M model particularly well. If the printing machines can be equipped with more intelligent systems, they can be quite flexible in ink-printing tens of thousands of different books in one go.

In the most ideal situation for the C2M model, consumers will make the orders first, and then the factories will start to produce according to the demand. Thus, there will be no overstock, and the inventory turnover days can be infinitely closer to zero.

Another innovation that Xia’s team has been exploring in recent years is to optimize the inventory networks by pooling together all the inventories from JD and merchants to create a holistic view of a product’s whereabouts and fulfillment plans.

Imagine a scenario in which after you order a bottle of mineral water online, JD’s open and connected inventory system checks through the inventories of JD, the brand’s, connected convenience stores and water stations to locate the nearest spot for the delivery of the water as quickly as possible.

Such a network superposition will surely create exponential value for time efficiency and cost reduction, but also raises the requirement for system performance and algorithms.

“As more and more data and algorithms are combined, the system will become much smarter,” Hu said. He believes that super automation presents a promising future, he said.

“In the past, the man-machine cooperation was to have machines do the work and humans do the coordination. But the intelligent technology will challenge the current mode to have machines to do both the work and coordination,” he added.

As long as the intelligent system is extensive enough that it can connect to the whole process of product management, ranging from procurement to fulfillment, machines will keep learning and evolving to eventually enter a “fully autopilot” mode in supply chain management.

When the intelligent systems are dense enough, they are connected and overlap with each other to become a ubiquitously automated network on the planet. For people working in this field, it is unimaginable that the prediction and coordination work of such a network would continue to be administered by human beings, just like we cannot imagine any scenario today in which soldiers would ride horses to fight a war.

This is exactly the era we are living in. (