AI Takes on Expiration Dates

  • by By Carlos Garcia and Lucas de Brito Ayres as seen in The Atlantic magazine
  • 22-Oct-2023 12:00

The fight against food waste is getting high-tech.


Have you ever bitten into a nut or a piece of chocolate expecting a smooth, rich taste only to encounter an unexpected and unpleasant chalky or sour flavor? That taste is rancidity in action, and it affects pretty much every product in your pantry. Now artificial intelligence can help scientists tackle this issue more precisely and efficiently.

We’re a group of chemists who study ways to extend the life of food products, including those that go rancid. We recently published a study describing the advantages of AI tools to help keep oil and fat samples fresh for longer. Because oils and fats are common components in many food types, including chips, chocolate, and nuts, the outcomes of the study could be broadly applied and even affect other areas, including cosmetics and pharmaceuticals. [Click on the link above to view the abstract.]

Food can go rancid when it’s exposed to the air for a while—a process called oxidation. In fact, many common ingredients, but especially lipids, which are fats and oils, react with oxygen. The presence of heat or UV light can accelerate the process.

Oxidation leads to the formation of smaller molecules, such as ketones and aldehydes, that give rancid foods a characteristic rank scent. Repeatedly consuming rancid foods can threaten your health.

Fortunately, both nature and the food industry have an excellent shield against rancidity: antioxidants. Antioxidants include a broad range of natural molecules, such as vitamin C, and synthetic molecules capable of protecting your food from oxidation.

While there are a few ways antioxidants work, overall they can neutralize some of the processes that cause rancidity and preserve the flavors and nutritional value of your food for longer. Many customers don’t even know they are consuming added antioxidants, because food manufacturers typically add them in small amounts during preparation.

But you can’t just sprinkle some vitamin C on your food and expect to see a preservative effect. Researchers have to carefully choose a specific set of antioxidants and precisely calculate the amount of each.

Combining antioxidants does not always strengthen their effect. In fact, there are cases in which using the wrong antioxidants, or mixing them with the wrong ratios, can decrease their protective effect—that’s called “antagonism.” Finding out which combinations work for which types of food requires many experiments that are time-consuming, require specialized personnel, and increase the food’s overall cost.

Exploring all possible combinations would necessitate an enormous amount of time and resources, so researchers are stuck with a few mixtures that provide only some level of protection against rancidity. Here’s where AI comes into play.

You’ve probably seen AI tools such as ChatGPT in the news or have played around with them yourself. These types of systems can take in big sets of data and identify patterns, then generate an output that could be useful to the user.

As chemists, we wanted to teach an AI tool how to look for new combinations of antioxidants. For this, we selected a type of AI capable of working with textual representations, which are written codes describing the chemical structure of antioxidants. First, we fed our AI a list of about a million chemical reactions and taught the program some simple chemistry concepts, like how to identify important features of molecules.

Once the machine could recognize general chemical patterns, such as how certain molecules react with one another, we fine-tuned it by teaching it some more advanced chemistry. For this step, our team used a database of roughly 1,100 mixtures previously described in the research literature.

At this point, the AI could predict the effect of combining any set of two or three antioxidants in under a second. Its prediction aligned with the effect described in the literature 90 percent of the time.

But these predictions didn’t quite align with the experiments our team performed in the lab. In fact, we found that our AI was able to correctly predict only a few of the oxidation experiments we performed with real lard, which shows the complexities of transferring results from a computer to the lab.

Luckily, AI models aren’t static tools with predefined yes-and-no pathways. They’re dynamic learners, so our research team can continue feeding the model new data until it sharpens its predictive capabilities and can accurately predict the effect of each antioxidant combination. The more data the model gets, the more accurate it becomes, much like how humans grow through learning.

We found that adding about 200 examples from the lab enabled the AI to learn enough chemistry to predict the outcomes of the experiments performed by our team, with only a slight difference between the predicted and the real value.

A model like ours may one day be able to aid scientists developing better ways to preserve food by coming up with the best antioxidant combinations for the specific foods they’re working with—kind of like having a very clever assistant.


Carlos D. Garcia is a professor of chemistry at Clemson University.

Lucas de Brito Ayres is a PhD student in chemistry at Clemson University.