Table of Contents
Fetching ...

Losses that Cook: Topological Optimal Transport for Structured Recipe Generation

Mattia Ottoborgo, Daniele Rege Cambrin, Paolo Garza

TL;DR

This work tackles the gap between fluent text generation and executable recipe construction by introducing a topological loss that treats ingredient lists as embedding-space point clouds and minimizes a Sinkhorn divergence between predicted and true ingredient structures. By combining this topological objective with standard cross-entropy (and Dice in some configurations), the authors demonstrate substantial improvements in recipe-specific metrics such as Ingredient Recall and Quantity Precision, as well as improved procedural coherence, without increasing model size or inference cost. Empirical results on a pasta/rice/sandwich subset of RECIPE-NLG show that the Topological loss yields the most consistent gains across factual and procedural dimensions, while a mixed Topo+Dice objective offers the best overall balance and strong human preferences (Topo+Dice preferred in 62% of cases). The approach highlights the value of geometry-aware training signals for structured generation tasks and suggests avenues to extend to broader cuisines and safety-aware validations in practical deployments.

Abstract

Cooking recipes are complex procedures that require not only a fluent and factual text, but also accurate timing, temperature, and procedural coherence, as well as the correct composition of ingredients. Standard training procedures are primarily based on cross-entropy and focus solely on fluency. Building on RECIPE-NLG, we investigate the use of several composite objectives and present a new topological loss that represents ingredient lists as point clouds in embedding space, minimizing the divergence between predicted and gold ingredients. Using both standard NLG metrics and recipe-specific metrics, we find that our loss significantly improves ingredient- and action-level metrics. Meanwhile, the Dice loss excels in time/temperature precision, and the mixed loss yields competitive trade-offs with synergistic gains in quantity and time. A human preference analysis supports our finding, showing our model is preferred in 62% of the cases.

Losses that Cook: Topological Optimal Transport for Structured Recipe Generation

TL;DR

This work tackles the gap between fluent text generation and executable recipe construction by introducing a topological loss that treats ingredient lists as embedding-space point clouds and minimizes a Sinkhorn divergence between predicted and true ingredient structures. By combining this topological objective with standard cross-entropy (and Dice in some configurations), the authors demonstrate substantial improvements in recipe-specific metrics such as Ingredient Recall and Quantity Precision, as well as improved procedural coherence, without increasing model size or inference cost. Empirical results on a pasta/rice/sandwich subset of RECIPE-NLG show that the Topological loss yields the most consistent gains across factual and procedural dimensions, while a mixed Topo+Dice objective offers the best overall balance and strong human preferences (Topo+Dice preferred in 62% of cases). The approach highlights the value of geometry-aware training signals for structured generation tasks and suggests avenues to extend to broader cuisines and safety-aware validations in practical deployments.

Abstract

Cooking recipes are complex procedures that require not only a fluent and factual text, but also accurate timing, temperature, and procedural coherence, as well as the correct composition of ingredients. Standard training procedures are primarily based on cross-entropy and focus solely on fluency. Building on RECIPE-NLG, we investigate the use of several composite objectives and present a new topological loss that represents ingredient lists as point clouds in embedding space, minimizing the divergence between predicted and gold ingredients. Using both standard NLG metrics and recipe-specific metrics, we find that our loss significantly improves ingredient- and action-level metrics. Meanwhile, the Dice loss excels in time/temperature precision, and the mixed loss yields competitive trade-offs with synergistic gains in quantity and time. A human preference analysis supports our finding, showing our model is preferred in 62% of the cases.
Paper Structure (48 sections, 1 equation, 2 figures, 5 tables)

This paper contains 48 sections, 1 equation, 2 figures, 5 tables.

Figures (2)

  • Figure 1: Soft embeddings generation from the predicted token probabilities p and the model embeddings matrix E as a weighted average
  • Figure 2: The loss aligns the ground truth (black) and predicted (blue) token in embedding space. Shared tokens like "flour" (black dots with blue halos) have zero transport cost. The loss minimizes the transport distance for divergent tokens, penalizing semantic shifts (e.g., "salt" $\to$ "pepper") and structural deviations (e.g., "egg" $\to$ "eggs")