AI Food Recipe Optimization System

We design and deploy artificial intelligence systems: from prototype to production-ready solutions. Our team combines expertise in machine learning, data engineering and MLOps to make AI work not in the lab, but in real business.
Showing 1 of 1 servicesAll 1566 services
AI Food Recipe Optimization System
Medium
~2-4 weeks
FAQ
AI Development Areas
AI Solution Development Stages
Latest works
  • image_website-b2b-advance_0.png
    B2B ADVANCE company website development
    1212
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1161
  • image_websites_belfingroup_462_0.webp
    Website development for BELFINGROUP
    852
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1041
  • image_logo-advance_0.png
    B2B Advance company logo design
    561
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    822

AI-based system for optimizing food product formulations

Developing food recipes is a multi-criteria task: taste, texture, shelf life, nutrient composition, cost, and technological feasibility must all be met simultaneously. AI accelerates this process by 3-5 times compared to laboratory testing.

Surrogate models of recipe properties

Prediction of organoleptic properties:

Taste, smell, and texture cannot be calculated analytically—they must be measured experimentally. A surrogate ML model predicts organoleptic properties based on composition:

import pandas as pd
import numpy as np
from sklearn.gaussian_process import GaussianProcessRegressor
from sklearn.gaussian_process.kernels import Matern, WhiteKernel

class RecipeSurrogateModel:
    """
    Surrogate model органолептических свойств рецептуры.
    Обучается на экспериментальных данных дегустаций.
    """

    def __init__(self, sensory_attributes):
        """sensory_attributes: ['sweetness', 'saltiness', 'texture', 'color', ...]"""
        self.attributes = sensory_attributes
        self.models = {}

        for attr in sensory_attributes:
            kernel = Matern(length_scale=1.0, nu=2.5) + WhiteKernel(noise_level=0.1)
            self.models[attr] = GaussianProcessRegressor(
                kernel=kernel,
                n_restarts_optimizer=10,
                normalize_y=True,
                random_state=42
            )

    def fit(self, ingredient_compositions, sensory_scores):
        """
        ingredient_compositions: (n_recipes, n_ingredients) — доли ингредиентов
        sensory_scores: (n_recipes, n_attributes) — оценки дегустаторов 0–10
        """
        for i, attr in enumerate(self.attributes):
            self.models[attr].fit(ingredient_compositions, sensory_scores[:, i])
        return self

    def predict_with_uncertainty(self, composition):
        """
        Предсказание свойств новой рецептуры с оценкой неопределённости.
        Высокая неопределённость → приоритет для лабораторного теста.
        """
        X = np.array(composition).reshape(1, -1)
        predictions = {}
        for attr, model in self.models.items():
            mean, std = model.predict(X, return_std=True)
            predictions[attr] = {'mean': float(mean[0]), 'std': float(std[0])}
        return predictions

Optimization of composition

Multi-objective Optimization:

Three competing goals: cost is minimal, nutrient profile is optimal, organoleptic properties are maximal:

from scipy.optimize import minimize, LinearConstraint
import numpy as np

def optimize_recipe(
    surrogate_model,
    ingredient_costs,        # руб/кг каждого ингредиента
    nutrient_targets,        # {'protein_pct': (min, max), 'fat_pct': ...}
    sensory_targets,         # {'sweetness': min_value, 'texture': min_value}
    ingredient_limits,       # (min_pct, max_pct) для каждого ингредиента
    w_cost=0.4, w_sensory=0.6
):
    """
    Поиск рецептуры, минимизирующей стоимость при соблюдении
    нутриентных и органолептических требований.
    """
    n_ingr = len(ingredient_costs)

    def objective(x):
        cost = np.dot(x, ingredient_costs)  # стоимость
        sensory = surrogate_model.predict_with_uncertainty(x)
        # Штраф за несоответствие органолептическим требованиям
        sensory_penalty = sum(
            max(0, target - sensory[attr]['mean']) ** 2
            for attr, target in sensory_targets.items()
        )
        return w_cost * cost + w_sensory * sensory_penalty * 10

    # Ограничения
    constraints = [
        {'type': 'eq', 'fun': lambda x: np.sum(x) - 1.0},  # сумма = 100%
    ]
    for attr, (min_val, max_val) in nutrient_targets.items():
        # Добавить нутриентные ограничения (через композиционные таблицы)
        pass

    bounds = ingredient_limits
    x0 = np.array([0.5 / n_ingr] * n_ingr)  # равномерный старт

    result = minimize(objective, x0, method='SLSQP',
                     bounds=bounds, constraints=constraints)
    return result.x, result.fun

Bayesian Optimization for Iterative Development

Active experiment:

Instead of brute force, choose the next experiment wisely: 1. Initial DoE: 20–30 recipes using Simplex-Centroid design 2. Train the GP surrogate 3. Expected Improvement selects the most informative next point 4. Lab testing → update the surrogate 5. Converge in 50–100 iterations (vs. 200–500 with random search)

Directional Variation:

The developer sets the direction for optimization with the words: - “Make it sweeter without increasing sugar” → replace some of the sugar with stevia/erythritol - “Reduce fat content while maintaining a creamy texture” → functional starches - LLM offers alternative ingredients → GP surrogate evaluates the effect

Stability and shelf life

Expiration date forecast:

Kinetic spoilage models (Arrhenius): rates of chemical reactions at different temperatures: - Fat oxidation (TBARS, peroxide value) → prediction for different storage conditions - Microbiological spoilage: growth models (Baranyi, Modified Gompertz) - ML corrections for specific formulation

Accelerated testing:

Q10 law: at +10°C the reaction rate doubles: - Storage at 45°C × 3 weeks ≈ storage at 25°C × 6 months - ML model for converting accelerated data into real shelf life

Development time: 3–5 months for a recipe optimization system with GP surrogate, Bayesian Optimization and shelf life forecast.