Menu Close
A woman wearing a white shirt holds two glass jars, one with chickpeas and one with black rice. A jar of pine nuts sits on the wooden countertop.
Pantry staples can go rancid when exposed to oxygen. Daniel de la Hoz/Moment

Rancid food smells and tastes gross − AI tools may help scientists prevent that spoilage

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.

Rancidity and antioxidants

Food goes 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, aldehydes and fatty acids that give rancid foods a characteristic rank, strong and metallic scent. Repeatedly consuming rancid foods can threaten your health.

Fortunately, both nature and the food industry have an excellent shield against rancidity – antioxidants.

Foods turn rancid from a process called oxidation.

Antioxidants include a broad range of natural molecules, like vitamin C, and synthetic molecules capable of protecting your food from oxidation.

While there are a few ways antioxidants work, overall they can neutralize many of the processes that cause rancidity and preserve the flavors and nutritional value of your food for longer. Most often, customers don’t even know they are consuming added antioxidants, as 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, which are time-consuming, require specialized personnel and increase the food’s overall cost.

Exploring all possible combinations would require 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.

A use for AI

You’ve probably seen AI tools like ChatGPT in the news or 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.

AI tools have changed how many scientists conduct research.

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 each antioxidant. 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, like how certain molecules react with each other, we fine-tuned it by teaching it some more advanced chemistry. For this step, our team used a database of almost 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% 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.

Refining and enhancing

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 be able to assist 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.

The project is now exploring more effective ways to train the AI model and looking for ways to further improve its predictive capabilities.

Want to write?

Write an article and join a growing community of more than 182,600 academics and researchers from 4,945 institutions.

Register now