Chapter 10: Flavor Embeddings

“A map is not the territory it represents, but, if correct, it has a similar structure to the territory, which accounts for its usefulness.” — Alfred Korzybski, Science and Sanity (1933)


RUNNING EXAMPLE — CHEF WATSON’S PROPOSAL

It is a Tuesday menu-development session at a forty-seat bistro, and the sous-chef, Dev, has been feeding the kitchen’s recipe archive into a flavor-pairing model for a week. He has a dish that is almost there — a chilled stone-fruit and cured-pork plate, prosciutto draped over white peaches — but the chef says it reads “one-note,” too softly sweet, with nothing to argue against the fat. Dev types the constraint into the engine: keep peach, keep pork, find a third ingredient that the embedding places “off-diagonal” — far in compound space, near in pairing space. The model returns a ranked list. Near the top, above the basil and the burrata he expected, sits a suggestion that makes him laugh out loud: blue cheese. Not a garnish — a structural partner.

He almost deletes it. Peach and Roquefort is not in the archive; it is not in his training. But the engine has a reason, and the reason is geometric: the model has learned a vector for “the move that rescues soft sweetness,” abstracted from a thousand recipes where honey met Stilton and fig met Gorgonzola, and it has transported that vector onto peach. Dev plates a test. The first bite is a revelation — the funk and salt of the cheese give the peach an edge, the way a cellist’s drone gives a melody somewhere to stand. The second test, with a different blue, is inedible: the cheese is too aggressive, the peach disappears, the plate collapses into ammonia and sugar. Same vector, same arithmetic, opposite verdict.

The engine proposed a direction. Dev had to find the magnitude, the brand, the ripeness, the quantity — and to know, by tasting, when the direction was right and the dose was wrong. This chapter is about what such an engine knows, how it learned it from databases of compounds and corpora of recipes, and exactly where its knowledge ends and the cook’s begins.


When the Map Learns Itself

The previous nine chapters posited a flavor space $\mathcal{F}$ and derived its structure from biology: receptors as linear functionals, the olfactory manifold, the metric of perception, the operators of seasoning. Throughout, we assumed coordinates we could name — sweet, umami, bright, deep. This chapter asks a sharper question. Suppose we do not name the axes. Suppose we hand a machine a large enough record of what humans actually cook and eat, and let it infer the coordinates from co-occurrence statistics alone. What geometry falls out?

The answer, established repeatedly since the early 2010s, is that the geometry falls out almost exactly as the perceptual theory predicts — and it falls out by the same machinery that produces word embeddings in natural language. This is not a loose analogy. A recipe is a sentence whose words are ingredients; a cuisine is a corpus; the distributional hypothesis of linguistics — “you shall know a word by the company it keeps” (Firth, 1957) — becomes, in the kitchen, you shall know an ingredient by the dishes it keeps. When you run the same algorithms, you get the same kind of object: a dense, low-dimensional vector per ingredient, in which distance encodes culinary similarity and direction encodes culinary relationship.

[Empirical.] The convergence is the central empirical fact of this chapter. Two completely independent routes to $\mathcal{F}$ — the bottom-up chemical route (catalogue every volatile compound in every food, as in Chapter 2’s binding-affinity matrix) and the top-down behavioral route (catalogue every recipe humans write) — produce embeddings that agree on the gross structure of flavor space. Cuisines separate. Substitutes cluster. The same handful of dimensions carry most of the variance. When two measurement procedures with nothing in common recover the same low-dimensional structure, that structure is not an artifact of either procedure. It is a property of the thing being measured. The geometry was always real; the embeddings merely make it computable.

But this chapter is also where we must be most careful, because computability seduces. An embedding is a projection of flavor, learned from a record of flavor, and both the projection and the record discard exactly the information — concentration, matrix, temporal unfolding — that Chef Watson’s second blue cheese exploited to fail. The closing sections draw that boundary precisely.

10.1 FlavorDB, FooDB, and the Compound Corpora

Before an ingredient can be a vector, something must vectorize it. There are two raw materials, corresponding to the two routes above, and they live in different databases.

The chemical route begins with compound databases. FooDB (the Food Database, hosted at the University of Alberta) catalogues on the order of $70{,}000$ compounds across roughly $1{,}000$ foods, linking each food to its constituents — macronutrients, micronutrients, and, crucially for us, the volatile and non-volatile flavor molecules. FlavorDB (Garg et al., 2018, Nucleic Acids Research) is purpose-built for our problem: it associates more than $25{,}000$ flavor compounds with their natural sources and, where known, their sensory descriptors and the receptors they engage. VCF (Volatile Compounds in Food) and the GoodScents and Flavornet databases supplement these with sensory and threshold annotations.

From any of these, an ingredient becomes a vector by the construction of Chapter 2. Let there be $M$ catalogued compounds. Each food $i$ is a binary or weighted vector $\mathbf{c}_i \in \mathbb{R}^M$, with $c_{i,k} = 1$ (or a concentration) if food $i$ contains compound $k$. This is the compound representation: high-dimensional ($M \sim 10^4$), sparse, and — this is the key property — constructed without reference to any recipe. It says what is chemically present, not what is culinarily done.

[Modeling Axiom.] The compound representation is the kitchen’s analogue of a one-hot or bag-of-features encoding in NLP: faithful but unembedded. Two foods are “similar” under it only if they literally share compounds, $\langle \mathbf{c}_i, \mathbf{c}_j \rangle$ large. It has no notion that two foods behave alike if they never share a molecule. The Ahn et al. flavor network of Chapter 4 lives here: it is precisely the graph whose edge weights are $\langle \mathbf{c}_i, \mathbf{c}_j \rangle$, the count of shared compounds. As a similarity structure it is excellent; as an embedding it is raw, because $10^4$ correlated, mostly-empty dimensions are not a navigable space. They are the chemical haystack Chapter 1 warned against. The work of the rest of this chapter is to compress them — or to bypass them entirely.

These databases are corpora in the literal information-retrieval sense, and they carry the biases of all corpora. They over-represent compounds that are cheap to assay by GC-MS (Appendix C) and Western, commercially important foods; they under-represent fermented, aged, and traditional preparations whose chemistry shifts continuously in time (Chapter 7). A model is only ever as wide as its corpus, a limitation we return to in §10.6.

10.2 Ingredient Embeddings: word2vec on the Recipe Corpus

The behavioral route ignores chemistry entirely and learns from what cooks do. Take a large recipe collection — the canonical one is the Recipe1M+ set (Marín et al., 2019) at over a million recipes, or the earlier Yummly and “What’s Cooking” corpora — and strip each recipe to its ingredient list. Now treat the list exactly as word2vec (Mikolov et al., 2013) treats a sentence.

The skip-gram objective is, verbatim, the linguistic one. For an ingredient $i$ appearing in a recipe, we learn a vector $\mathbf{v}_i$ that predicts the other ingredients $j$ in the same recipe:

$$ \mathcal{L} = -\sum_{(i,j)\,\in\,\text{co-occur}} \log \frac{\exp(\mathbf{v}_i \cdot \mathbf{v}_j)}{\sum_{k} \exp(\mathbf{v}_i \cdot \mathbf{v}_k)}. $$

The window is the recipe; there is no word order to speak of, so the model is effectively a continuous bag-of-ingredients. Trained on a few million recipes with an embedding dimension $d \approx 100$–$300$, this yields ingredient2vec (the name and the first systematic implementations are due to a cluster of 2017–2018 work, including Park et al.’s “KitcheNette” pairing model). Every ingredient — across, say, $6{,}000$ vocabulary items — becomes a dense vector in $\mathbb{R}^d$.

[Empirical.] What the embedding learns is striking precisely because nobody told it any chemistry. Nearest neighbors by cosine similarity are culinary substitutes: cilantro sits beside parsley and Thai basil; heavy cream beside crème fraîche and mascarpone; the chilies cluster by heat and region. None of these similarities was supplied; all were inferred from co-occurrence with shared partners. This is the distributional hypothesis vindicated in the kitchen: butter and olive oil are near not because they share fatty-acid profiles (they barely do) but because they keep the same company — both appear with garlic, onion, salt, flour. The recipe corpus has reconstructed the functional role of an ingredient, which is exactly the perceptual-plus-cultural quantity that chemistry alone (§10.1) misses.

Two embeddings, then, two notions of “near.” The compound embedding’s neighbors share molecules; the recipe embedding’s neighbors share uses. They overlap heavily — strawberry is near raspberry in both — but they diverge on the interesting cases, and the divergence is itself diagnostic. When two ingredients are near in recipe space but far in compound space, the corpus has discovered a complementary pairing (Chapter 4’s off-diagonal, East-Asian mode): partners that work by filling different dimensions rather than reinforcing the same ones. Chef Watson’s peach-and-blue-cheese suggestion lives exactly in this gap. We can now say what kind of object it is, geometrically.

10.3 Analogy Structure: Vector Arithmetic in the Kitchen

The property that made word2vec famous was not similarity but analogy: the discovery that the vector arithmetic $\mathbf{v}_{\text{king}} - \mathbf{v}_{\text{man}} + \mathbf{v}_{\text{woman}}$ lands near $\mathbf{v}_{\text{queen}}$. Relationships are encoded as displacements, and the same displacement recurs across many pairs, so that subtraction isolates a relation and addition transports it.

Ingredient embeddings inherit this, and it is the formal heart of Chef Watson’s proposal. Consider the analogy that soy sauce is to Japanese cuisine as fish sauce is to Thai:

$$ \mathbf{v}_{\text{soy sauce}} - \mathbf{v}_{\text{Japanese}} + \mathbf{v}_{\text{Thai}} \;\approx\; \mathbf{v}_{\text{fish sauce}}. $$

Read it as: “the salty-umami fermented backbone of Japanese cuisine, transported to Thai cuisine, is fish sauce.” For this to hold, the embedding must have learned a consistent displacement vector — call it $\mathbf{r}_{\text{umami-base}}$ — that points from a cuisine’s coordinate toward its characteristic fermented seasoning, and the same displacement must apply across cuisines. Empirically, on embeddings trained over multi-cuisine corpora, analogies of this family resolve well above chance: garam masala is to Indian as five-spice is to Chinese; mozzarella is to Italian as queso fresco is to Mexican. The displacement $\mathbf{r}$ is the geometric form of a culinary role — “the melting fresh cheese,” “the bright finishing acid,” “the warming spice blend” — abstracted away from any particular ingredient.

[Modeling Axiom.] A culinary analogy is the claim that a relational displacement is approximately constant across a region of $\mathcal{F}$: for a role $r$ and ingredients filling it in contexts $A$ and $B$, $$ \mathbf{v}^{(A)}_r - \mathbf{v}_A \;\approx\; \mathbf{v}^{(B)}_r - \mathbf{v}_B. $$ This is precisely the parallel transport of Volume 4 (Geometric Economics, Chapter 8): a vector carried from one point of a manifold to another along the cuisine connection. Where the connection is flat — within a tradition, among well-attested ingredients — transport is faithful and the analogy holds. Where the manifold is curved, the transported vector “arrives rotated,” and the analogy degrades. Bad analogies are not noise; they are measurements of curvature in the pairing manifold of Chapter 5.

This is the operation Dev’s engine performed. It took the displacement “rescue soft sweetness with salty funk” — learned from honey-Stilton, fig-Gorgonzola, pear-Roquefort co-occurrences — and added it to $\mathbf{v}_{\text{peach}}$. The arithmetic returned a region of $\mathcal{F}$ occupied by blue cheeses. The model did not retrieve a memorized peach-and-Roquefort recipe; there was none. It transported a relation. The proposal was a geodesic step, not a lookup — the same distinction Chapter 1’s line cook embodied, now performed in silico.

CHEF WATSON’S PROPOSAL, REVISITED — THE ARITHMETIC ON THE PLATE

We can now write Dev’s suggestion exactly. Let $\mathbf{r}_{\text{funk-foil}} = \frac{1}{N}\sum (\mathbf{v}_{\text{blue}} - \mathbf{v}_{\text{sweet partner}})$ averaged over the corpus’s sweet-and-blue pairings. The engine computed $\mathbf{v}_{\text{peach}} + \mathbf{r}_{\text{funk-foil}}$ and read off the nearest ingredients; blue cheese topped the list because peach sits, in recipe space, where figs and pears sit — near in role, the off-diagonal neighbors of §10.2. The first plate succeeded because the transport was faithful: peach’s region of $\mathcal{F}$ is locally flat with respect to figs and pears, so the rescue vector arrived un-rotated. The second plate failed for a reason the embedding could not see at all. The model’s $\mathbf{v}_{\text{blue cheese}}$ is a single point; it does not distinguish a mild young Bleu d’Auvergne from a wall of aged Roquefort. Concentration, the very thing §10.6 will indict, lived in the dose Dev chose, not in the vector the engine knew. The direction was a theorem. The magnitude was a craft.

10.4 Flavor Compression: PCA-Matryoshka on Flavor Profiles

How many dimensions does $\mathcal{F}$ actually need? Chapter 1 argued, from biology, for “a few tens.” The embeddings let us answer empirically, and the answer matters both for theory and for practice: a flavor vector that fits in a handful of numbers is one a cook, a database, or a sensor can actually use.

Take either representation — the $M\sim 10^4$-dimensional compound profiles of §10.1 or the $d\sim 300$-dimensional ingredient2vec of §10.2 — and apply principal component analysis. Center the data, diagonalize the covariance $\Sigma = \frac{1}{N}\sum_i (\mathbf{f}_i - \bar{\mathbf{f}})(\mathbf{f}_i - \bar{\mathbf{f}})^\top$, and inspect the eigenvalue spectrum. The spectrum falls off steeply. [Empirical.] Across both FlavorDB compound profiles and recipe-trained embeddings, on the order of $10$–$15$ principal components recover the large majority of the variance, and the leading components are interpretable: PC1 typically separates sweet-fruit-floral from savory-meaty-roasted (the great divide of the dessert/savory axis), PC2 separates fresh-green-herbal from fermented-aged-pungent, and lower components pick out the sulfurous (allium/brassica), the citrus-terpene, and the spice-phenolic directions. These are the receptor-grounded axes of Chapter 2, rediscovered as the eigenvectors of culinary variance — the second convergence of the chapter.

The practical refinement is the Matryoshka structure (after Matryoshka Representation Learning, Kusupati et al., 2022, here applied to flavor). An ordinary PCA truncation forces you to choose $k$ in advance. A Matryoshka embedding instead nests the dimensions, so that every prefix of the vector is itself a usable embedding: the first $8$ coordinates give a coarse flavor sketch, the first $32$ a working profile, the full $256$ the fine grain. Formally, the representation is trained (or, for PCA, ordered) so that for any truncation length $\ell$, the prefix $\mathbf{f}_{1:\ell}$ minimizes reconstruction error among $\ell$-dimensional representations — exactly the optimality PCA gives, but made adaptive. One vector serves the index that needs speed and the pairing engine that needs precision.

[Modeling Axiom.] Flavor admits a nested low-dimensional code: there is an ordering of perceptual axes such that truncating to the first $\ell$ minimizes the expected perceptual distortion among all $\ell$-dimensional codes, and the marginal value of axis $\ell+1$ falls monotonically. This is the embedding-era restatement of Chapter 1’s dimensionality claim, and it is what licenses the entire enterprise: if flavor genuinely needed all $10^4$ chemical dimensions, no Matryoshka prefix would suffice and Henning’s project (Chapter 1.5) would have been right to fail. That a $12$-dimensional prefix predicts pairing nearly as well as the full vector is the quantitative form of “the scalars were always insufficient, but the manifold is mercifully small.”

10.5 IBM Chef Watson and the Computational Pairing Engine

The most ambitious public deployment of these ideas was IBM’s Chef Watson (Cognitive Cooking), developed around 2013–2015 with the Institute of Culinary Education and documented in Varshney et al. (2013, IBM Tech. Report) and the resulting cookbook Cognitive Cooking with Chef Watson (2015). It is the canonical case study — a real engine that proposed real, sometimes startling, sometimes failed dishes — and it instantiates almost every construction above.

Watson’s architecture had three components, each geometric. First, a representation: ingredients encoded by their FlavorDB-style compound profiles (§10.1), the chemical route. Second, a pairing score: the food-pairing hypothesis of Chapter 4 made operational, scoring candidate combinations by shared-compound overlap — cosine-similarity in compound space — favoring high-overlap (Western, on-diagonal) or, on demand, deliberately low-overlap (surprising, off-diagonal) sets. Third, and most distinctively, a novelty/pleasantness model: a learned hedonic function (Chapter 5’s $H$) estimating whether a combination would be perceived as good, trained on human ratings, so that the engine could optimize surprise subject to staying near the hedonic manifold. Its signature outputs — Belgian bacon pudding, Austrian chocolate burrito, a Swiss-Thai asparagus quiche — were generated by searching for points that were far from the cuisine’s center of mass yet still inside the pleasant region: maximal novelty at fixed hedonic feasibility. This is, formally, constrained optimization on $\mathcal{F}$, and the dishes that worked worked because the constraint held.

[Empirical.] The successes were real and the failures were instructive, and both are reported in the project’s own materials and subsequent reviews. Watson genuinely produced novel, palatable combinations that working chefs adopted — its strength was ideation, surfacing off-diagonal partners (Chapter 4.3) that a chef’s training had foreclosed. Its weaknesses were equally systematic, and they are the weaknesses of every compound-route engine: it knew presence, not proportion; it scored ingredients, not preparations; it had no model of texture, temperature, or the sequence of operations (Chapter 8’s non-commuting products). It could tell you that pork pairs with chocolate by shared pyrazines; it could not tell you how much, in what form, or that searing-then-braising and braising-then-searing reach different points. The human collaborator supplied all of that. The division of labor was exactly Dev’s: the engine proposed directions in $\mathcal{F}$; the chef supplied magnitudes, transformations, and the verdict of the tongue.

This is the honest assessment, and it is neither hype nor dismissal. A pairing engine is a map-reader, and a superb one — it sees regions of $\mathcal{F}$ that habit hides. But it reads the map, and the map, as the next section insists, is not the territory.

10.6 Limitations: The Map Is Not the Territory

Every construction in this chapter encodes an ingredient as a single fixed vector. That single vector is the source of the engines’ power and the locus of every failure. Three discarded quantities — the same three that ruin Dev’s second plate — define the boundary of the embedding program.

Concentration. The vector $\mathbf{v}_{\text{garlic}}$ does not know whether garlic appears as a whispered note or a punishing wall. But perception is dose-dependent and nonlinear (Chapter 3’s Weber–Fechner metric): the same compound is a delight at threshold and a defect an order of magnitude above it. A binary “contains compound $k$” representation cannot represent this at all, and even a concentration-weighted one assumes a fixed dose per ingredient, collapsing the very axis along which a cook works. [Empirical.] Trimethylamine is pleasant at trace and rotten at excess; the embedding assigns one point to both. Chef Watson’s two blue cheeses differed only in concentration and aggressiveness — chemically the same vector, perceptually opposite — and no fixed-vector model can separate them.

Matrix effects. A compound’s perceptibility depends on what surrounds it. Fat sequesters volatiles and releases them slowly (Chapter 6’s diffusion operator); salt suppresses bitterness and amplifies umami (Chapter 1’s non-orthogonal basis); viscosity and protein binding gate what ever reaches the receptor. The flavor of a compound in isolation — which is what the database records — is not its flavor in the dish. The embedding’s addition $\mathbf{v}_1 + \mathbf{v}_2$ assumes superposition; the matrix makes the true combination nonlinear, curving the space in exactly the way Chapter 4.6 described as synergy and antagonism. The engine adds vectors; the mouth integrates a coupled system.

Temporal dynamics. Most fundamentally, the embedding is a point and flavor is a curve $\mathbf{f}(\tau)$ (Chapter 1.4, Chapter 14.1). Top notes, middle, base; the bloom and the finish; the way a sauce that is balanced on first taste turns cloying by the third bite. A fixed vector is the time-average of a trajectory, and the average discards the shape. No current embedding represents the order in which a flavor reveals itself, and order is much of what a great dish is.

[Modeling Axiom.] An ingredient embedding is the image of a food under a lossy projection $\Pi: \mathcal{T} \to \mathcal{F}_{\text{emb}}$ that quotients out concentration, matrix context, and time. Two foods with identical embeddings can taste utterly different; the fibers of $\Pi$ — the equivalence classes the projection collapses — are where the cook’s expertise lives. This is the gastronomic instance of the Scalar Irrecoverability result of Volume 4 (Geometric Economics, Chapter 6): once the projection has discarded a dimension, no operation on the projected vector recovers it. The embedding is not wrong. It is incomplete in a precise, characterizable, and irreversible way, and knowing the shape of what it discarded is what separates using the tool from being fooled by it.

The map-territory gap is not a defect to be patched but a structural feature to be respected. The embedding answers the questions it can answer — which directions, which neighbors, which surprising-but-feasible partners — superbly. The questions it cannot answer — how much, in what form, in what order, against what background — are not failures of this particular model but consequences of the projection itself, and they are precisely the questions that constitute craft. Connecting to Volume 6, Geometric Cognition: the cook’s tongue performs the inverse problem the embedding cannot, integrating the full coupled, concentration-dependent, time-evolving system in real time, which is why the human adjudicator never becomes optional.

Toward the Constraint Space

This chapter completed Part IV’s first movement: it showed that the flavor space posited from biology in Part I can be learned from data, by the same embedding mathematics that powers natural language, and that the learned geometry agrees with the perceptual one on every structural point — clustering, analogy, dimensionality. It also drew the program’s boundary with care, locating the three irreducible losses — concentration, matrix, time — that keep the cook in the loop and that Chapter 14 will take up as open problems.

We have, until now, treated “good” as a single hedonic manifold (Chapter 5). But eating answers to a second geometry entirely: the body’s nutritional requirements, a convex region of constraints indifferent to pleasure. Chapter 11 brings these two spaces into contact, asking when a point can lie simultaneously near the hedonic manifold and inside the nutritional feasible set — why junk food is a sharp local optimum that satisfies one and starves the other, and whether the geometric diet can find the points that honor both. The embedding gave us the map of flavor. The next chapter overlays the map of need.