Skip to content

Formulation Studio — read a whole recipe before you pour - #183

Merged
rvnminers-A-and-N merged 1 commit into
mainfrom
feat/formulation-studio
Jul 18, 2026
Merged

rvnminers-A-and-N merged 1 commit into
mainfrom
feat/formulation-studio

Conversation

@rvnminers-A-and-N

Copy link
Copy Markdown
Collaborator

The "before you pour" bench read

A bench chemist works with formulations — many ingredients at ppm — not single molecules. The Formulation Studio plugs in the whole recipe and predicts what it will come out like, so runs get spent where they count.

What it does

  • Blended note-profile — aggregates each ingredient's predicted aroma, weighted by odor impact (OAV where thresholds are loaded, else mass × volatility), into the profile the blend reads as, naming the driving ingredient under each note.
  • Overpowering-component flag — "too heavy in one item," computed from the blend weights so it works in both the quantitative (OAV) and directional (volatility) bases.
  • Target + gap analysis — set the notes you're aiming for; get what's short (with food-safe, GRAS-preferred carriers to add) and what's over/unrequested (what to ease back).
  • Documented-hazard screen — reuses the curated precursor/process hazard rules on the full formulation.
  • Honest data-gates, in the UI — directional today; calibrated intensity and suppression/synergy (a learned mixture model) unlock with the customer's odor-threshold / panel data. Missing-note carriers with no clean public source are labelled data-gated rather than faked.

Engine

  • New POST /api/formulation composes the existing RF taste/aroma heads + analyze_balance (OAV) + check_mixture + palette_match.
  • Note weighting, aggregation, and the gap/overpower logic are deterministic chemistry math over the ML predictions — reliable, explainable, auditable (the right posture for a safety-adjacent bench tool).

Performance

  • Memoized predict_aroma and _resolve.
  • Pinned the RF heads to n_jobs=1 — single-sample predict_proba was spending ~150 ms/call spawning a joblib thread pool (~3.8 s → ~1.2 s per 24-head aroma read); speeds the whole app.
  • Local name→SMILES index (from master_enrichment.parquet + the suggest CSV) so library molecules resolve offline; only unknown names hit PubChem.
  • Background pre-warm of the demo molecules at startup, so the starter formulas are instant.

Verified live with Playwright (three starter formulas, profile bars, overpowering flag, gap analysis, hazard path) and regression-checked /api/predict + /api/mixture.

Plug in a formulation (ingredients + ppm) and get the blended note-profile,
the overpowering-component flag, a documented-hazard screen, and — against a
target — a gap analysis with food-safe add/cut suggestions.

- /api/formulation aggregates each ingredient's predicted aroma weighted by
  odor impact (OAV where thresholds are loaded, else mass x volatility) into
  the profile the blend reads as, naming the driving ingredient per note.
- Overpowering-component flag derived from the blend weights, so it works in
  both the quantitative (OAV) and directional (volatility) bases.
- Target gap analysis: short/over notes, with GRAS-preferred named carriers
  to add or ease back.
- Honest data-gates surfaced in the UI: directional today; calibrated
  intensity and suppression/synergy unlock with odor-threshold / panel data.

Performance: memoize predict_aroma and _resolve; pin the RF heads to
n_jobs=1 (single-sample predict was spending ~150 ms/call on joblib thread
spawn, ~3.8s -> ~1.2s per aroma read); local name->SMILES index so library
molecules resolve offline; background pre-warm of the demo molecules.

Signed-off-by: Austin L. <86896075+rvnminers-A-and-N@users.noreply.github.com>
@rvnminers-A-and-N
rvnminers-A-and-N merged commit b5e5f9e into main Jul 18, 2026
3 checks passed
@rvnminers-A-and-N
rvnminers-A-and-N deleted the feat/formulation-studio branch July 18, 2026 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant